Skip to content

feature: configurable ip address#1555

Merged
jpdillingham merged 6 commits into
slskd:ipfrom
x0vi:feature/configurable-ip-address
Dec 10, 2025
Merged

feature: configurable ip address#1555
jpdillingham merged 6 commits into
slskd:ipfrom
x0vi:feature/configurable-ip-address

Conversation

@x0vi

@x0vi x0vi commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

(Based on the issue #1083 )
This adds configurable IP address binding for HTTP/HTTPS listeners to support IPv6 and custom network interfaces for example.

Comment thread config/slskd.example.yml
# - ^.{1,2}$
# web:
# port: 5030
# listen_ip_address: 0.0.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# listen_ip_address: 0.0.0.0
# ip_address: 0.0.0.0

keeping things consistent with the soulseek config; there's no listen_ prefix for the port so there shouldn't be one for the IP either. i can merge to an intermediate branch and take care of this.

@jpdillingham

Copy link
Copy Markdown
Member

I will pick this up and get it merged in a bit. Some notes for myself:

The current logic uses IPAddress.Any, which is strictly an ipv4 address under the hood. This should be IPAddress.IPv6Any, or the current options.Listen() call should be changed to options.ListenAnyIP() which appears to be the better of the two options:

    /// <summary>
    /// Listens on all IPs using IPv6 [::], or IPv4 0.0.0.0 if IPv6 is not supported.
    /// </summary>
    public void ListenAnyIP(int port, Action<ListenOptions> configure)
    {
        ArgumentNullException.ThrowIfNull(configure);

        var listenOptions = new AnyIPListenOptions(port);
        ApplyEndpointDefaults(listenOptions);
        configure(listenOptions);
        CodeBackedListenOptions.Add(listenOptions);
    }

If a user wanted to listen on just localhost the guidance would be to supply the proper loopback address for their system (::1 or 127.0.0.1), which should be reasonable if a user has a strong opinion about this.

The logic in the kestrel config is then:

If the user has specified any value for ip_address, use options.Listen(<provided ip4/6 address>), otherwise use options.ListenAny()

The only uncovered use case would be instances where the user wanted to listen on multiple, specific addresses but not 'any', in which case another code/config change would be needed. When CIDRs can be supplied for API keys or the relay, they can be supplied as a comma separated list. I suppose this option should have that ability as well.

The option will need a custom validator that iterates over the supplied addresses to make sure they are valid.

@jpdillingham jpdillingham changed the base branch from master to ip December 10, 2025 01:08
@jpdillingham jpdillingham merged commit c06e61b into slskd:ip Dec 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants