@@ -60,36 +60,36 @@ func Debug(debug bool) {
6060
6161// Options specifies user specific options
6262type Options struct {
63- IsSender bool
64- SharedSecret string
65- RoomName string
66- Debug bool
67- RelayAddress string
68- RelayAddress6 string
69- RelayPorts []string
70- RelayPassword string
71- Stdout bool
72- NoPrompt bool
73- NoMultiplexing bool
74- DisableLocal bool
75- OnlyLocal bool
76- IgnoreStdin bool
77- Ask bool
78- SendingText bool
79- NoCompress bool
80- IP string
81- Overwrite bool
82- Curve string
83- HashAlgorithm string
84- ThrottleUpload string
85- ZipFolder bool
86- TestFlag bool
87- GitIgnore bool
88- MulticastAddress string
89- ShowQrCode bool
90- Exclude []string
91- Quiet bool
92- DisableClipboard bool
63+ IsSender bool
64+ SharedSecret string
65+ RoomName string
66+ Debug bool
67+ RelayAddress string
68+ RelayAddress6 string
69+ RelayPorts []string
70+ RelayPassword string
71+ Stdout bool
72+ NoPrompt bool
73+ NoMultiplexing bool
74+ DisableLocal bool
75+ OnlyLocal bool
76+ IgnoreStdin bool
77+ Ask bool
78+ SendingText bool
79+ NoCompress bool
80+ IP string
81+ Overwrite bool
82+ Curve string
83+ HashAlgorithm string
84+ ThrottleUpload string
85+ ZipFolder bool
86+ TestFlag bool
87+ GitIgnore bool
88+ MulticastAddress string
89+ ShowQrCode bool
90+ Exclude []string
91+ Quiet bool
92+ DisableClipboard bool
9393 ExtendedClipboard bool
9494}
9595
@@ -1069,21 +1069,28 @@ func (c *Client) Receive() (err error) {
10691069 for _ , ip := range ips {
10701070 ipv4Addr , ipv4Net , errNet := net .ParseCIDR (fmt .Sprintf ("%s/24" , ip ))
10711071 log .Debugf ("ipv4Add4: %+v, ipv4Net: %+v, err: %+v" , ipv4Addr , ipv4Net , errNet )
1072- localIps , _ := utils .GetLocalIPs ()
1073- haveLocalIP := false
1074- for _ , localIP := range localIps {
1075- localIPparsed := net .ParseIP (localIP )
1076- log .Debugf ("localIP: %+v, localIPparsed: %+v" , localIP , localIPparsed )
1077- if ipv4Net .Contains (localIPparsed ) {
1078- haveLocalIP = true
1079- log .Debugf ("ip: %+v is a local IP" , ip )
1080- break
1081- }
1082- }
1083- if ! haveLocalIP {
1084- log .Debugf ("%s is not a local IP, skipping" , ip )
1085- continue
1086- }
1072+
1073+ // For peer-to-peer connectivity within a LAN, the sender and receiver don't need to be on the same subnet.
1074+ // Even with NAT routers in their respective local networks,
1075+ // a receiver behind NAT can establish direct access to the sender without requiring internet connectivity.
1076+ // Conversely, the local networks on the sender and receiver may overlap but not be connected.
1077+ // This often occurs with 192.168.0.0/30 and 192.168.1.0/30 subnets.
1078+
1079+ // localIps, _ := utils.GetLocalIPs()
1080+ // haveLocalIP := false
1081+ // for _, localIP := range localIps {
1082+ // localIPparsed := net.ParseIP(localIP)
1083+ // log.Debugf("localIP: %+v, localIPparsed: %+v", localIP, localIPparsed)
1084+ // if ipv4Net.Contains(localIPparsed) {
1085+ // haveLocalIP = true
1086+ // log.Debugf("ip: %+v is a local IP", ip)
1087+ // break
1088+ // }
1089+ // }
1090+ // if !haveLocalIP {
1091+ // log.Debugf("%s is not a local IP, skipping", ip)
1092+ // continue
1093+ // }
10871094
10881095 serverTry := net .JoinHostPort (ip , port )
10891096 conn , banner2 , externalIP , errConn := tcp .ConnectToTCPServer (serverTry , c .Options .RelayPassword , c .Options .RoomName , 500 * time .Millisecond )
0 commit comments