mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Add additional field to internal SQL model
This commit is contained in:
parent
15f85b5ae9
commit
d93c3f60ce
2 changed files with 12 additions and 0 deletions
|
@ -92,6 +92,13 @@ type (
|
||||||
Allowed *bool `sqlite:"allowed"`
|
Allowed *bool `sqlite:"allowed"`
|
||||||
ProfileRevision int `sqlite:"profile_revision"`
|
ProfileRevision int `sqlite:"profile_revision"`
|
||||||
ExitNode *string `sqlite:"exit_node"`
|
ExitNode *string `sqlite:"exit_node"`
|
||||||
|
|
||||||
|
// FIXME(ppacher): support "NOT" in search query to get rid of the following helper fields
|
||||||
|
SPNUsed bool `sqlite:"spn_used"` // could use "exit_node IS NOT NULL" or "exit IS NULL"
|
||||||
|
Active bool `sqlite:"active"` // could use "ended IS NOT NULL" or "ended IS NULL"
|
||||||
|
|
||||||
|
// FIXME(ppacher): we need to profile here for "suggestion" support. It would be better to keep a table of profiles in sqlite and use joins here
|
||||||
|
ProfileName string `sqlite:"profile_name"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ func convertConnection(conn *network.Connection) (*Conn, error) {
|
||||||
ProfileID: conn.ProcessContext.Source + "/" + conn.ProcessContext.Profile,
|
ProfileID: conn.ProcessContext.Source + "/" + conn.ProcessContext.Profile,
|
||||||
Path: conn.ProcessContext.BinaryPath,
|
Path: conn.ProcessContext.BinaryPath,
|
||||||
ProfileRevision: int(conn.ProfileRevisionCounter),
|
ProfileRevision: int(conn.ProfileRevisionCounter),
|
||||||
|
ProfileName: conn.ProcessContext.ProfileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch conn.Type {
|
switch conn.Type {
|
||||||
|
@ -200,6 +201,9 @@ func convertConnection(conn *network.Connection) (*Conn, error) {
|
||||||
if conn.Ended > 0 {
|
if conn.Ended > 0 {
|
||||||
ended := time.Unix(conn.Ended, 0)
|
ended := time.Unix(conn.Ended, 0)
|
||||||
c.Ended = &ended
|
c.Ended = &ended
|
||||||
|
c.Active = false
|
||||||
|
} else {
|
||||||
|
c.Active = true
|
||||||
}
|
}
|
||||||
|
|
||||||
extraData := map[string]interface{}{
|
extraData := map[string]interface{}{
|
||||||
|
@ -210,6 +214,7 @@ func convertConnection(conn *network.Connection) (*Conn, error) {
|
||||||
extraData["tunnel"] = conn.TunnelContext
|
extraData["tunnel"] = conn.TunnelContext
|
||||||
exitNode := conn.TunnelContext.GetExitNodeID()
|
exitNode := conn.TunnelContext.GetExitNodeID()
|
||||||
c.ExitNode = &exitNode
|
c.ExitNode = &exitNode
|
||||||
|
c.SPNUsed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if conn.DNSContext != nil {
|
if conn.DNSContext != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue