mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Update CKR
This commit is contained in:
		
							parent
							
								
									63936c11b5
								
							
						
					
					
						commit
						d16505e417
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -92,8 +92,7 @@ func (s *tunConn) _read(bs []byte) (err error) {
 | 
			
		|||
			// The destination address isn't in our CKR allowed range
 | 
			
		||||
			skip = true
 | 
			
		||||
		} else if key, err := s.tun.ckr.getPublicKeyForAddress(srcAddr, addrlen); err == nil {
 | 
			
		||||
			srcNodeID := crypto.GetNodeID(&key)
 | 
			
		||||
			if *s.conn.RemoteAddr().(*crypto.NodeID) == *srcNodeID {
 | 
			
		||||
			if *s.conn.RemoteAddr().(*crypto.BoxPubKey) == key {
 | 
			
		||||
				// This is the one allowed CKR case, where source and destination addresses are both good
 | 
			
		||||
			} else {
 | 
			
		||||
				// The CKR key associated with this address doesn't match the sender's NodeID
 | 
			
		||||
| 
						 | 
				
			
			@ -169,8 +168,7 @@ func (s *tunConn) _write(bs []byte) (err error) {
 | 
			
		|||
			// The source address isn't in our CKR allowed range
 | 
			
		||||
			skip = true
 | 
			
		||||
		} else if key, err := s.tun.ckr.getPublicKeyForAddress(dstAddr, addrlen); err == nil {
 | 
			
		||||
			dstNodeID := crypto.GetNodeID(&key)
 | 
			
		||||
			if *s.conn.RemoteAddr().(*crypto.NodeID) == *dstNodeID {
 | 
			
		||||
			if *s.conn.RemoteAddr().(*crypto.BoxPubKey) == key {
 | 
			
		||||
				// This is the one allowed CKR case, where source and destination addresses are both good
 | 
			
		||||
			} else {
 | 
			
		||||
				// The CKR key associated with this address doesn't match the sender's NodeID
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue