Remove dependence on network.Connection.Scope

This commit is contained in:
Daniel
2021-04-16 17:44:01 +02:00
parent a879d2715a
commit 4c5461a788
3 changed files with 9 additions and 9 deletions

View File

@@ -650,12 +650,12 @@ func (conn *Connection) SetInspectorData(new map[uint8]interface{}) {
// String returns a string representation of conn.
func (conn *Connection) String() string {
switch conn.Scope {
case IncomingHost, IncomingLAN, IncomingInternet, IncomingInvalid:
switch {
case conn.Inbound:
return fmt.Sprintf("%s <- %s", conn.process, conn.Entity.IP)
case PeerHost, PeerLAN, PeerInternet, PeerInvalid:
return fmt.Sprintf("%s -> %s", conn.process, conn.Entity.IP)
default:
case conn.Entity.Domain != "":
return fmt.Sprintf("%s to %s (%s)", conn.process, conn.Entity.Domain, conn.Entity.IP)
default:
return fmt.Sprintf("%s -> %s", conn.process, conn.Entity.IP)
}
}

View File

@@ -55,7 +55,7 @@ func SaveOpenDNSRequest(conn *Connection) {
openDNSRequestsLock.Lock()
defer openDNSRequestsLock.Unlock()
key := getDNSRequestCacheKey(conn.process.Pid, conn.Scope)
key := getDNSRequestCacheKey(conn.process.Pid, conn.Entity.Domain)
if existingConn, ok := openDNSRequests[key]; ok {
existingConn.Lock()
defer existingConn.Unlock()