v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

Feat: add bind to device to Windows and Darwin

Open AkinoKaede opened this issue 3 years ago • 1 comments

I don't have any device to test if it works on Mac OS.

Windows IP_UNICAST_IF Gets or sets the outgoing interface for sending IPv4 traffic. This option does not change the default interface for receiving IPv4 traffic. This option is important for multihomed computers. The input value for setting this option is a 4-byte IPv4 address in network byte order. This DWORD parameter must be an interface index in network byte order. Any IP address in the 0.x.x.x block (first octet of 0) except IPv4 address 0.0.0.0 is treated as an interface index. An interface index is a 24-bit number, and the 0.0.0.0/8 IPv4 address block is not used (this range is reserved). The interface index can be used to specify the default interface for sending traffic for IPv4. The GetAdaptersAddresses function can be used to obtain the interface index information. If optval is zero , the default interface for sending traffic is set to unspecified. When getting this option, the optval returns the current default interface index for sending IPv4 traffic in host byte order.

https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options

AkinoKaede avatar Sep 11 '22 05:09 AkinoKaede

Codecov Report

Base: 38.89% // Head: 38.82% // Decreases project coverage by -0.06% :warning:

Coverage data is based on head (9a13236) compared to base (e29defc). Patch coverage: 30.61% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1972      +/-   ##
==========================================
- Coverage   38.89%   38.82%   -0.07%     
==========================================
  Files         613      616       +3     
  Lines       36180    36360     +180     
==========================================
+ Hits        14071    14118      +47     
- Misses      20554    20658     +104     
- Partials     1555     1584      +29     
Impacted Files Coverage Δ
app/dispatcher/default.go 29.41% <0.00%> (ø)
app/router/router.go 27.58% <0.00%> (ø)
common/cmdarg/arg.go 0.00% <ø> (ø)
main/commands/all/api/balancer_info.go 0.00% <0.00%> (ø)
proxy/shadowsocks/simplified/config.go 3.12% <0.00%> (ø)
transport/internet/sockopt_darwin.go 22.22% <0.00%> (-6.35%) :arrow_down:
transport/internet/sockopt_windows.go 23.52% <0.00%> (-4.38%) :arrow_down:
infra/conf/json/reader.go 82.29% <70.00%> (+1.33%) :arrow_up:
proxy/dokodemo/dokodemo.go 55.20% <100.00%> (ø)
app/router/command/errors.generated.go 0.00% <0.00%> (-100.00%) :arrow_down:
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 11 '22 06:09 codecov-commenter