txthinking / brook

A cross-platform programmable network tool
https://brook.app
GNU General Public License v3.0
14.5k stars 2.39k forks source link

支持 多网卡 搭建socks5吗? #1266

Closed photkey closed 1 year ago

photkey commented 1 year ago

比方电脑有4个网卡:eth0,eth1,eth2,eth3,能不能搭建4个socks5,每个socks5都走不同的网卡?

txthinking commented 1 year ago

支持

参见这个

https://github.com/txthinking/brook/issues/1204

还有这个

GLOBAL OPTIONS:
   --pprof value                     go http pprof listen addr, such as :6060
   --log value                       Enable log. A valid value is file path or 'console'. If you want to debug SOCKS5 lib, set env SOCKS5_DEBUG=true
   --tag value [ --tag value ]       Tag can be used to the process, will be append into log, such as: 'key1:value1'
   --dialWithDNS value               When a domain name needs to be resolved, use the specified DNS. Such as 8.8.8.8:53 or https://dns.google/dns-query?address=8.8.8.8%3A443, the address is required. Note that for client-side commands, this does not affect the client passing the domain address to the server
   --dialWithDNSPrefer value         This is used with the dialWithDNS parameter. Prefer A record or AAAA record. Value is A or AAAA
   --dialWithIP4 value               When the current machine establishes a network connection to the outside IPv4, both TCP and UDP, it is used to specify the IPv4 used
   --dialWithIP6 value               When the current machine establishes a network connection to the outside IPv6, both TCP and UDP, it is used to specify the IPv6 used
   --dialWithNIC value               When the current machine establishes a network connection to the outside, both TCP and UDP, it is used to specify the NIC used
   --dialWithSocks5 value            When the current machine establishes a network connection to the outside, both TCP and UDP, with your socks5 proxy, such as 127.0.0.1:1081
   --dialWithSocks5Username value    If there is
   --dialWithSocks5Password value    If there is
   --dialWithSocks5TCPTimeout value  time (s) (default: 0)
   --dialWithSocks5UDPTimeout value  time (s) (default: 60)
   --prometheus value                prometheus http listen addr, such as :7070. If it is transmitted on the public network, it is recommended to use it with nico
   --prometheusPath value            prometheus http path, such as /xxx. If it is transmitted on the public network, a hard-to-guess value is recommended
   --help, -h                        show help (default: false)
   --version, -v                     print the version (default: false)
photkey commented 1 year ago

1204 也是我问的……哈哈

这次我就抱着试试看的想法,随口一问的,基本没抱希望,因为网上找的资料 貌似是大佬的样子 说目前没有软件支持这个需求。没想到还真支持! @txthinking NIC指的是网卡吗?

txthinking commented 1 year ago

😄 没注意到用户名

对。NIC 网卡名。 可以用 --listen ip1:1080, 可以用 --dialWithIP4,--dialWithIP6,--dialWithNIC,--dialWithSocks5

比如 入和出 都用 eth0 网卡的话,入 --listen ip1:1080 的 ip1 可以从 eth0 上的 ip 里选一个,出 可以 --dialWithNIC eth0,出 也可以 --dialWithIP4/--dialWithIP6 ip2,ip2 可以从 eth0 上的 ip 里选一个

photkey commented 1 year ago

brook太强了,每次都能给我惊喜!大佬还每次都有问必答,太感人了!敬礼!