portmaster: github.com/safing/portmaster/network Index | Files | Directories

package network

import "github.com/safing/portmaster/network"

Index

Package Files

clean.go communication.go database.go link.go module.go self.go status.go unknown.go

Constants

const (
    Inbound  = true
    Outbound = false
)

Packer Directions

const (
    IncomingHost     = "IH"
    IncomingLAN      = "IL"
    IncomingInternet = "II"
    IncomingInvalid  = "IX"
    PeerHost         = "PH"
    PeerLAN          = "PL"
    PeerInternet     = "PI"
    PeerInvalid      = "PX"
)

Non-Domain Connections

const (
    ReasonUnknownProcess = "unknown connection owner: process could not be found"
)

Static reasons

type Communication Uses

type Communication struct {
    record.Base
    sync.Mutex

    Domain    string
    Direction bool
    Intel     *intel.Intel

    Verdict Verdict
    Reason  string
    Inspect bool

    FirstLinkEstablished int64
    LastLinkEstablished  int64
    // contains filtered or unexported fields
}

Communication describes a logical connection between a process and a domain.

func GetCommunication Uses

func GetCommunication(pid int, domain string) (comm *Communication, ok bool)

GetCommunication fetches a connection object from the internal storage.

func GetCommunicationByDNSRequest Uses

func GetCommunicationByDNSRequest(ctx context.Context, ip net.IP, port uint16, fqdn string) (*Communication, error)

GetCommunicationByDNSRequest returns the matching communication from the internal storage.

func GetCommunicationByFirstPacket Uses

func GetCommunicationByFirstPacket(pkt packet.Packet) (*Communication, error)

GetCommunicationByFirstPacket returns the matching communication from the internal storage.

func GetOwnComm Uses

func GetOwnComm(pkt packet.Packet) (*Communication, error)

GetOwnComm returns the communication for the given packet, that originates from

func GetUnknownCommunication Uses

func GetUnknownCommunication(pkt packet.Packet) (*Communication, error)

GetUnknownCommunication returns the connection to a packet of unknown owner.

func (*Communication) Accept Uses

func (comm *Communication) Accept(reason string)

Accept accepts the communication and adds the given reason.

func (comm *Communication) AddLink(link *Link)

AddLink applies the Communication to the Link and sets timestamps.

func (*Communication) AddReason Uses

func (comm *Communication) AddReason(reason string)

AddReason adds a human readable string as to why a certain verdict was set in regard to this communication.

func (*Communication) Block Uses

func (comm *Communication) Block(reason string)

Block blocks the communication and adds the given reason.

func (*Communication) Delete Uses

func (comm *Communication) Delete()

Delete deletes a connection from the storage and propagates the change.

func (*Communication) Deny Uses

func (comm *Communication) Deny(reason string)

Deny blocks or drops the communication depending on the connection direction and adds the given reason.

func (*Communication) Drop Uses

func (comm *Communication) Drop(reason string)

Drop drops the communication and adds the given reason.

func (*Communication) GetVerdict Uses

func (comm *Communication) GetVerdict() Verdict

GetVerdict returns the current verdict.

func (*Communication) NeedsReevaluation Uses

func (comm *Communication) NeedsReevaluation() bool

NeedsReevaluation returns whether the decision on this communication should be re-evaluated.

func (*Communication) Process Uses

func (comm *Communication) Process() *process.Process

Process returns the process that owns the connection.

func (*Communication) ResetVerdict Uses

func (comm *Communication) ResetVerdict()

ResetVerdict resets the verdict to VerdictUndecided.

func (*Communication) SaveIfNeeded Uses

func (comm *Communication) SaveIfNeeded()

SaveIfNeeded saves the Connection if it is marked for saving when finished.

func (*Communication) SaveWhenFinished Uses

func (comm *Communication) SaveWhenFinished()

SaveWhenFinished marks the Connection for saving after all current actions are finished.

func (*Communication) SetReason Uses

func (comm *Communication) SetReason(reason string)

SetReason sets/replaces a human readable string as to why a certain verdict was set in regard to this communication.

func (*Communication) String Uses

func (comm *Communication) String() string

String returns a string representation of Communication.

func (*Communication) UpdateVerdict Uses

func (comm *Communication) UpdateVerdict(newVerdict Verdict)

UpdateVerdict sets a new verdict for this link, making sure it does not interfere with previous verdicts.

type FirewallHandler Uses

type FirewallHandler func(pkt packet.Packet, link *Link)

FirewallHandler defines the function signature for a firewall handle function

type Link struct {
    record.Base
    sync.Mutex

    ID  string

    Verdict          Verdict
    Reason           string
    Tunneled         bool
    VerdictPermanent bool
    Inspect          bool
    Started          int64
    Ended            int64
    RemoteAddress    string
    // contains filtered or unexported fields
}

Link describes a distinct physical connection (e.g. TCP connection) - like an instance - of a Connection.

func CreateLinkFromPacket Uses

func CreateLinkFromPacket(pkt packet.Packet) *Link

CreateLinkFromPacket creates a new Link based on Packet.

func GetLink(id string) (*Link, bool)

GetLink fetches a Link from the database from the default namespace for this object

func GetOrCreateLinkByPacket Uses

func GetOrCreateLinkByPacket(pkt packet.Packet) (*Link, bool)

GetOrCreateLinkByPacket returns the associated Link for a packet and a bool expressing if the Link was newly created

func (*Link) Accept Uses

func (link *Link) Accept(reason string)

Accept accepts the link and adds the given reason.

func (*Link) AddReason Uses

func (link *Link) AddReason(reason string)

AddReason adds a human readable string as to why a certain verdict was set in regard to this link

func (*Link) ApplyVerdict Uses

func (link *Link) ApplyVerdict(pkt packet.Packet)

ApplyVerdict appies the link verdict to a packet.

func (*Link) Block Uses

func (link *Link) Block(reason string)

Block blocks the link and adds the given reason.

func (*Link) Communication Uses

func (link *Link) Communication() *Communication

Communication returns the Communication the Link is part of

func (*Link) Delete Uses

func (link *Link) Delete()

Delete deletes a link from the storage and propagates the change.

func (*Link) Deny Uses

func (link *Link) Deny(reason string)

Deny blocks or drops the link depending on the connection direction and adds the given reason.

func (*Link) Drop Uses

func (link *Link) Drop(reason string)

Drop drops the link and adds the given reason.

func (*Link) FirewallHandlerIsSet Uses

func (link *Link) FirewallHandlerIsSet() bool

FirewallHandlerIsSet returns whether a firewall handler is set or not

func (*Link) GetActiveInspectors Uses

func (link *Link) GetActiveInspectors() []bool

GetActiveInspectors returns the list of active inspectors.

func (*Link) GetInspectorData Uses

func (link *Link) GetInspectorData() map[uint8]interface{}

GetInspectorData returns the list of inspector data.

func (*Link) GetVerdict Uses

func (link *Link) GetVerdict() Verdict

GetVerdict returns the current verdict.

func (*Link) HandlePacket Uses

func (link *Link) HandlePacket(pkt packet.Packet)

HandlePacket queues packet of Link for handling

func (*Link) RerouteToNameserver Uses

func (link *Link) RerouteToNameserver()

RerouteToNameserver reroutes the link to the portmaster nameserver.

func (*Link) RerouteToTunnel Uses

func (link *Link) RerouteToTunnel(reason string)

RerouteToTunnel reroutes the link to the tunnel entrypoint and adds the given reason for accepting the connection.

func (*Link) SaveIfNeeded Uses

func (link *Link) SaveIfNeeded()

SaveIfNeeded saves the Link if it is marked for saving when finished.

func (*Link) SaveWhenFinished Uses

func (link *Link) SaveWhenFinished()

SaveWhenFinished marks the Link for saving after all current actions are finished.

func (*Link) SetActiveInspectors Uses

func (link *Link) SetActiveInspectors(new []bool)

SetActiveInspectors sets the list of active inspectors.

func (*Link) SetFirewallHandler Uses

func (link *Link) SetFirewallHandler(handler FirewallHandler)

SetFirewallHandler sets the firewall handler for this link

func (*Link) SetInspectorData Uses

func (link *Link) SetInspectorData(new map[uint8]interface{})

SetInspectorData set the list of inspector data.

func (*Link) StopFirewallHandler Uses

func (link *Link) StopFirewallHandler()

StopFirewallHandler unsets the firewall handler

func (*Link) String Uses

func (link *Link) String() string

String returns a string representation of Link.

func (*Link) UpdateVerdict Uses

func (link *Link) UpdateVerdict(newVerdict Verdict)

UpdateVerdict sets a new verdict for this link, making sure it does not interfere with previous verdicts

type StorageInterface Uses

type StorageInterface struct {
    storage.InjectBase
}

StorageInterface provices a storage.Interface to the configuration manager.

func (*StorageInterface) Get Uses

func (s *StorageInterface) Get(key string) (record.Record, error)

Get returns a database record.

func (*StorageInterface) Query Uses

func (s *StorageInterface) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error)

Query returns a an iterator for the supplied query.

type Verdict Uses

type Verdict int8

Verdict describes the decision made about a connection or link.

const (
    // UNDECIDED is the default status of new connections
    VerdictUndecided           Verdict = 0
    VerdictUndeterminable      Verdict = 1
    VerdictAccept              Verdict = 2
    VerdictBlock               Verdict = 3
    VerdictDrop                Verdict = 4
    VerdictRerouteToNameserver Verdict = 5
    VerdictRerouteToTunnel     Verdict = 6
)

List of values a Status can have

func (Verdict) String Uses

func (v Verdict) String() string

Directories

PathSynopsis
environment
geoip
netutils
packet
reference

Package network imports 21 packages (graph) and is imported by 4 packages. Updated 2019-09-15. Refresh now. Tools for package owners.