mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Stop tunnels if they are not needed anymore due to verdict change
This commit is contained in:
parent
f63df67d23
commit
e00131e937
2 changed files with 9 additions and 0 deletions
|
@ -163,6 +163,14 @@ func resetAllConnectionVerdicts() {
|
||||||
// Apply privacy filter and check tunneling.
|
// Apply privacy filter and check tunneling.
|
||||||
filterConnection(ctx, conn, nil)
|
filterConnection(ctx, conn, nil)
|
||||||
|
|
||||||
|
// Stop existing SPN tunnel if not needed anymore.
|
||||||
|
if conn.Verdict.Active != network.VerdictRerouteToTunnel && conn.TunnelContext != nil {
|
||||||
|
err := conn.TunnelContext.StopTunnel()
|
||||||
|
if err != nil {
|
||||||
|
log.Debugf("filter: failed to stopped unneeded tunnel: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save if verdict changed.
|
// Save if verdict changed.
|
||||||
if conn.Verdict.Firewall != previousVerdict {
|
if conn.Verdict.Firewall != previousVerdict {
|
||||||
conn.Save()
|
conn.Save()
|
||||||
|
|
|
@ -162,6 +162,7 @@ type Connection struct { //nolint:maligned // TODO: fix alignment
|
||||||
// connection is using.
|
// connection is using.
|
||||||
TunnelContext interface {
|
TunnelContext interface {
|
||||||
GetExitNodeID() string
|
GetExitNodeID() string
|
||||||
|
StopTunnel() error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal is set to true if the connection is attributed as an
|
// Internal is set to true if the connection is attributed as an
|
||||||
|
|
Loading…
Add table
Reference in a new issue