5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 09:55:39 +00:00

Add notes on isSessionAllowed checks

This commit is contained in:
Neil Alexander 2019-06-13 23:37:53 +01:00
parent e229ad6e2b
commit f545060e89
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -219,6 +219,7 @@ func (ss *sessions) getByTheirSubnet(snet *address.Subnet) (*sessionInfo, bool)
// includse initializing session info to sane defaults (e.g. lowest supported
// MTU).
func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
// TODO: this check definitely needs to be moved
if !ss.isSessionAllowed(theirPermKey, true) {
return nil
}
@ -393,6 +394,7 @@ func (ss *sessions) handlePing(ping *sessionPing) {
// Get the corresponding session (or create a new session)
sinfo, isIn := ss.getByTheirPerm(&ping.SendPermPub)
// Check if the session is allowed
// TODO: this check may need to be moved
if !isIn && !ss.isSessionAllowed(&ping.SendPermPub, false) {
return
}