mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Add notes on isSessionAllowed checks
This commit is contained in:
		
							parent
							
								
									e229ad6e2b
								
							
						
					
					
						commit
						f545060e89
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -219,6 +219,7 @@ func (ss *sessions) getByTheirSubnet(snet *address.Subnet) (*sessionInfo, bool)
 | 
				
			||||||
// includse initializing session info to sane defaults (e.g. lowest supported
 | 
					// includse initializing session info to sane defaults (e.g. lowest supported
 | 
				
			||||||
// MTU).
 | 
					// MTU).
 | 
				
			||||||
func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
 | 
					func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
 | 
				
			||||||
 | 
						// TODO: this check definitely needs to be moved
 | 
				
			||||||
	if !ss.isSessionAllowed(theirPermKey, true) {
 | 
						if !ss.isSessionAllowed(theirPermKey, true) {
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -393,6 +394,7 @@ func (ss *sessions) handlePing(ping *sessionPing) {
 | 
				
			||||||
	// Get the corresponding session (or create a new session)
 | 
						// Get the corresponding session (or create a new session)
 | 
				
			||||||
	sinfo, isIn := ss.getByTheirPerm(&ping.SendPermPub)
 | 
						sinfo, isIn := ss.getByTheirPerm(&ping.SendPermPub)
 | 
				
			||||||
	// Check if the session is allowed
 | 
						// Check if the session is allowed
 | 
				
			||||||
 | 
						// TODO: this check may need to be moved
 | 
				
			||||||
	if !isIn && !ss.isSessionAllowed(&ping.SendPermPub, false) {
 | 
						if !isIn && !ss.isSessionAllowed(&ping.SendPermPub, false) {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue