mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Ignore interfaces that are not up
This commit is contained in:
		
							parent
							
								
									6844b9df51
								
							
						
					
					
						commit
						b7f2f8b55c
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -138,6 +138,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) {
 | 
			
		|||
		var conn net.Conn
 | 
			
		||||
		var err error
 | 
			
		||||
		if socksaddr != nil {
 | 
			
		||||
			if sintf != "" {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			var dialer proxy.Dialer
 | 
			
		||||
			dialer, err = proxy.SOCKS5("tcp", *socksaddr, nil, proxy.Direct)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			@ -159,6 +162,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) {
 | 
			
		|||
			if sintf != "" {
 | 
			
		||||
				ief, err := net.InterfaceByName(sintf)
 | 
			
		||||
				if err == nil {
 | 
			
		||||
					if ief.Flags & net.FlagUp == 0 {
 | 
			
		||||
				    return
 | 
			
		||||
					}
 | 
			
		||||
					addrs, err := ief.Addrs()
 | 
			
		||||
					if err == nil {
 | 
			
		||||
						dst, err := net.ResolveTCPAddr("tcp", saddr)
 | 
			
		||||
| 
						 | 
				
			
			@ -175,10 +181,10 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) {
 | 
			
		|||
									IP:   src,
 | 
			
		||||
									Port: 0,
 | 
			
		||||
								}
 | 
			
		||||
								break
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						if dialer.LocalAddr == nil {
 | 
			
		||||
							iface.core.log.Println("No valid source address found for interface", sintf)
 | 
			
		||||
							return
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue