refactor to reduce repetition. iterate through local interfaces and cache them to compare against incoming connection requests.