mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Set SNI by default if the peering URI contains a DNS name
This commit is contained in:
		
							parent
							
								
									d8df9755f2
								
							
						
					
					
						commit
						f094cf34bf
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -99,6 +99,13 @@ func (l *links) call(u *url.URL, sintf string) error {
 | 
			
		|||
	case "tls":
 | 
			
		||||
		tcpOpts.upgrade = l.tcp.tls.forDialer
 | 
			
		||||
		tcpOpts.tlsSNI = u.Query().Get("sni")
 | 
			
		||||
		if tcpOpts.tlsSNI == "" {
 | 
			
		||||
			// SNI headers must contain hostnames and not IP addresses, so we must make sure
 | 
			
		||||
			// that we do not populate the SNI with an IP literal.
 | 
			
		||||
			if host, _, err := net.SplitHostPort(u.Host); err == nil && net.ParseIP(host) == nil {
 | 
			
		||||
				tcpOpts.tlsSNI = host
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		l.tcp.call(u.Host, tcpOpts, sintf)
 | 
			
		||||
	default:
 | 
			
		||||
		return errors.New("unknown call scheme: " + u.Scheme)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue