mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Remove dependence on network.Connection.Scope
This commit is contained in:
parent
a879d2715a
commit
4c5461a788
3 changed files with 9 additions and 9 deletions
|
@ -106,10 +106,10 @@ func createPrompt(ctx context.Context, conn *network.Connection, pkt packet.Pack
|
||||||
switch {
|
switch {
|
||||||
case conn.Inbound, conn.Entity.Domain == "": // connection to/from IP
|
case conn.Inbound, conn.Entity.Domain == "": // connection to/from IP
|
||||||
nID = fmt.Sprintf(
|
nID = fmt.Sprintf(
|
||||||
"%s-%s-%s-%s",
|
"%s-%s-%v-%s",
|
||||||
promptIDPrefix,
|
promptIDPrefix,
|
||||||
localProfile.ID,
|
localProfile.ID,
|
||||||
conn.Scope,
|
conn.Inbound,
|
||||||
pkt.Info().RemoteIP(),
|
pkt.Info().RemoteIP(),
|
||||||
)
|
)
|
||||||
default: // connection to domain
|
default: // connection to domain
|
||||||
|
@ -117,7 +117,7 @@ func createPrompt(ctx context.Context, conn *network.Connection, pkt packet.Pack
|
||||||
"%s-%s-%s",
|
"%s-%s-%s",
|
||||||
promptIDPrefix,
|
promptIDPrefix,
|
||||||
localProfile.ID,
|
localProfile.ID,
|
||||||
conn.Scope,
|
conn.Entity.Domain,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,12 +650,12 @@ func (conn *Connection) SetInspectorData(new map[uint8]interface{}) {
|
||||||
|
|
||||||
// String returns a string representation of conn.
|
// String returns a string representation of conn.
|
||||||
func (conn *Connection) String() string {
|
func (conn *Connection) String() string {
|
||||||
switch conn.Scope {
|
switch {
|
||||||
case IncomingHost, IncomingLAN, IncomingInternet, IncomingInvalid:
|
case conn.Inbound:
|
||||||
return fmt.Sprintf("%s <- %s", conn.process, conn.Entity.IP)
|
return fmt.Sprintf("%s <- %s", conn.process, conn.Entity.IP)
|
||||||
case PeerHost, PeerLAN, PeerInternet, PeerInvalid:
|
case conn.Entity.Domain != "":
|
||||||
return fmt.Sprintf("%s -> %s", conn.process, conn.Entity.IP)
|
|
||||||
default:
|
|
||||||
return fmt.Sprintf("%s to %s (%s)", conn.process, conn.Entity.Domain, conn.Entity.IP)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ func SaveOpenDNSRequest(conn *Connection) {
|
||||||
openDNSRequestsLock.Lock()
|
openDNSRequestsLock.Lock()
|
||||||
defer openDNSRequestsLock.Unlock()
|
defer openDNSRequestsLock.Unlock()
|
||||||
|
|
||||||
key := getDNSRequestCacheKey(conn.process.Pid, conn.Scope)
|
key := getDNSRequestCacheKey(conn.process.Pid, conn.Entity.Domain)
|
||||||
if existingConn, ok := openDNSRequests[key]; ok {
|
if existingConn, ok := openDNSRequests[key]; ok {
|
||||||
existingConn.Lock()
|
existingConn.Lock()
|
||||||
defer existingConn.Unlock()
|
defer existingConn.Unlock()
|
||||||
|
|
Loading…
Add table
Reference in a new issue