From 08eb9b5443832850f0c18fe47457137b91fa83b3 Mon Sep 17 00:00:00 2001 From: Eric Wustrow Date: Wed, 3 Mar 2021 18:35:21 -0700 Subject: [PATCH] Change phantom_blocklist behavior (#75) * Still send phantom blocklisted IPs to registration API, but ignore them locally * updated comment Co-authored-by: Jack Wampler --- application/main.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/application/main.go b/application/main.go index b009e714..60c3a1be 100644 --- a/application/main.go +++ b/application/main.go @@ -238,6 +238,15 @@ func get_zmq_updates(connectAddr string, regManager *cj.RegistrationManager, con go tryShareRegistrationOverAPI(reg, conf.PreshareEndpoint) } + + if conf.IsBlocklistedPhantom(reg.DarkDecoy) { + // Note: Phantom blocklist is applied at this stage because the phantom may only be blocked on this + // station. We may want other stations to be informed about the registration, but prevent this station + // specifically from handling / interfering in any subsequent connection. See PR #75 + logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy) + continue + } + // validate the registration regManager.AddRegistration(reg) logger.Printf("Adding registration %v\n", reg.IDString()) @@ -328,14 +337,9 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *cj.RegistrationManager, co logger.Printf("Failed to create registration: %v", err) return nil, err } - if conf.IsBlocklistedPhantom(reg.DarkDecoy) { - logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy) - - } else { - // Received new registration, parse it and return - newRegs = append(newRegs, reg) - } + // Received new registration, parse it and return + newRegs = append(newRegs, reg) } if parsed.GetRegistrationPayload().GetV6Support() && conf.EnableIPv6 { @@ -344,12 +348,8 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *cj.RegistrationManager, co logger.Printf("Failed to create registration: %v", err) return nil, err } - if conf.IsBlocklistedPhantom(reg.DarkDecoy) { - logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy) - } else { - // add to list of new registrations to be processed. - newRegs = append(newRegs, reg) - } + // add to list of new registrations to be processed. + newRegs = append(newRegs, reg) } // log decoy connection and id string