Tunnel flag bugfix and refactoring

This commit is contained in:
Vladimir Stoilov
2022-09-06 17:56:06 +02:00
committed by Daniel
parent fdc8ef5698
commit edcb93bf5c
5 changed files with 88 additions and 159 deletions

View File

@@ -451,12 +451,6 @@ func GetAllIDs() []string {
return append(conns.keys(), dnsConns.keys()...)
}
// ClearConnections Clear all connections.
func ClearConnections() {
dnsConns = newConnectionStore()
conns = newConnectionStore()
}
// SetLocalIP sets the local IP address together with its network scope. The
// connection is not locked for this.
func (conn *Connection) SetLocalIP(ip net.IP) {
@@ -526,22 +520,6 @@ func (conn *Connection) Failed(reason, reasonOptionKey string) {
conn.FailedWithContext(reason, reasonOptionKey, nil)
}
// Reset resets all values of the connection.
func (conn *Connection) Reset(reason, reasonOptionKey string) {
conn.Verdict.Current = VerdictUndecided
conn.Verdict.Previous = VerdictUndecided
conn.Verdict.User = VerdictUndecided
conn.Reason.Msg = reason
conn.Reason.Context = nil
conn.Reason.OptionKey = ""
conn.Reason.Profile = ""
if reasonOptionKey != "" && conn.Process() != nil {
conn.Reason.OptionKey = reasonOptionKey
conn.Reason.Profile = conn.Process().Profile().GetProfileSource(conn.Reason.OptionKey)
}
}
// SetVerdict sets a new verdict for the connection, making sure it does not interfere with previous verdicts.
func (conn *Connection) SetVerdict(newVerdict Verdict, reason, reasonOptionKey string, reasonCtx interface{}) (ok bool) {
// if newVerdict >= conn.Verdict.Current {