mirror of
https://github.com/safing/portmaster
synced 2025-09-10 06:14:41 +00:00
fix linter errors
This commit is contained in:
parent
4bd8412f71
commit
b4e2687884
2 changed files with 8 additions and 7 deletions
|
@ -264,7 +264,7 @@ func getConnectionByID(id string) (*network.Connection, error) {
|
||||||
return nil, errors.New("connection does not exist")
|
return nil, errors.New("connection does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
connection := connPtr.(*network.Connection)
|
connection := connPtr.(*network.Connection) //nolint:forcetypeassert // Can only be a *network.Connection.
|
||||||
return connection, nil
|
return connection, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ func initialHandler(conn *network.Connection, pkt packet.Packet) {
|
||||||
// Check if connection should be tunneled.
|
// Check if connection should be tunneled.
|
||||||
checkTunneling(pkt.Ctx(), conn, pkt)
|
checkTunneling(pkt.Ctx(), conn, pkt)
|
||||||
|
|
||||||
updateVerdictBasedOnPreviousState(conn, pkt)
|
updateVerdictBasedOnPreviousState(conn)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case conn.Inspecting:
|
case conn.Inspecting:
|
||||||
|
@ -581,14 +581,15 @@ func issueVerdict(conn *network.Connection, pkt packet.Packet, verdict network.V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateVerdictBasedOnPreviousState(conn *network.Connection, pkt packet.Packet) {
|
func updateVerdictBasedOnPreviousState(conn *network.Connection) {
|
||||||
// previously accepted or tunneled connections may need to be blocked
|
// previously accepted or tunneled connections may need to be blocked
|
||||||
if conn.Verdict.Current == network.VerdictAccept {
|
if conn.Verdict.Current == network.VerdictAccept {
|
||||||
if conn.Verdict.Previous == network.VerdictRerouteToTunnel && !conn.Tunneled {
|
switch {
|
||||||
|
case conn.Verdict.Previous == network.VerdictRerouteToTunnel && !conn.Tunneled:
|
||||||
conn.SetVerdictDirectly(network.VerdictBlock)
|
conn.SetVerdictDirectly(network.VerdictBlock)
|
||||||
} else if conn.Verdict.Previous == network.VerdictAccept && conn.Tunneled {
|
case conn.Verdict.Previous == network.VerdictAccept && conn.Tunneled:
|
||||||
conn.SetVerdictDirectly(network.VerdictBlock)
|
conn.SetVerdictDirectly(network.VerdictBlock)
|
||||||
} else if conn.Tunneled {
|
case conn.Tunneled:
|
||||||
conn.SetVerdictDirectly(network.VerdictRerouteToTunnel)
|
conn.SetVerdictDirectly(network.VerdictRerouteToTunnel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ func stop() error {
|
||||||
return StopNfqueueInterception()
|
return StopNfqueueInterception()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetAllConnections resets all connections so they are forced to go thought the firewall again
|
// ResetAllConnections resets all connections so they are forced to go thought the firewall again.
|
||||||
func ResetAllConnections() error {
|
func ResetAllConnections() error {
|
||||||
return nfq.DeleteAllMarkedConnection()
|
return nfq.DeleteAllMarkedConnection()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue