enfein / mieru

mieru is a socks5 / HTTP / HTTPS proxy to bypass censorship. 見える是一款 socks5 / HTTP / HTTPS 网络代理翻墙工具。
GNU General Public License v3.0
933 stars 122 forks source link

[Feature] Specify IP address on the server side #131

Closed yanecc closed 3 weeks ago

yanecc commented 3 weeks ago

Hope to bind to specific IP address(es) on the server side. Thank you.

enfein commented 3 weeks ago

The server usually don't know its public IP address and unable to bind to the IP address directly. The server is listening to wildcard address. What is your use case?

yanecc commented 3 weeks ago

The server usually don't know its public IP address and unable to bind to the IP address directly. The server is listening to wildcard address. What is your use case?

I hope to set IP address manually in the configuration file.

enfein commented 3 weeks ago

User don't need to specify this manually in the server configuration.

Think about the following case, your server can see the following interfaces:

lo: inet 127.0.0.1/8 scope host lo
ens4: inet 10.10.10.10/32 metric 100 scope global dynamic ens4

Your VPS provider gives you a public IP address 20.30.40.50, but this is not visible by your server.

Can you bind to 20.30.40.50? No, because this IP address is not known by your server.

Can you bind to 10.10.10.10? Yes, but this provides no more benefit than binding to *. The internal IP address 10.10.10.10 can also change, so why have this volatile value in the configuration?

yanecc commented 3 weeks ago

User don't need to specify this manually in the server configuration.

Think about the following case, your server can see the following interfaces:

lo: inet 127.0.0.1/8 scope host lo
ens4: inet 10.10.10.10/32 metric 100 scope global dynamic ens4

Your VPS provider gives you a public IP address 20.30.40.50, but this is not visible by your server.

Can you bind to 20.30.40.50? No, because this IP address is not known by your server.

Can you bind to 10.10.10.10? Yes, but this provides no more benefit than binding to *. The internal IP address 10.10.10.10 can also change, so why have this volatile value in the configuration?

But the server may have multiple public IP addresses, and users do not want to use all for proxy services. Moreover, we could still have listening to all ports as the default value, right?

enfein commented 3 weeks ago

But the server may have multiple public IP addresses, and users do not want to use all for proxy services.

It is common that the server has both public IPv4 and IPv6 addresses, but not common to has more than one public IPv4 address. You may think I only want address A to run the proxy, not address B. This is not feasible with most of the VPS providers, since the public IP address is controlled by their SDN, and it is not visible to the server itself. The most you can do is, if two public IP addresses are assigned as two different network interfaces in the server, you can choose which network interface to bind to. This depends on too much technical details of how VPC is implemented by the VPS provider. I don't suggest users to rely on that.

Moreover, we could still have listening to all ~ports~ IP addresses as the default value, right?

Listening to all IP addresses is the desired use case. At the moment I don't see a strong reason to listen to a particular IP address, also that is not feasible from most of VPS providers, it will just cause more confusions.