Create interface for socket info structs, fix caching bug
From PR Review https://github.com/safing/portmaster/pull/72
This commit is contained in:
@@ -29,3 +29,35 @@ type Address struct {
|
||||
IP net.IP
|
||||
Port uint16
|
||||
}
|
||||
|
||||
// Info is a generic interface to both ConnectionInfo and BindInfo.
|
||||
type Info interface {
|
||||
GetPID() int
|
||||
SetPID(int)
|
||||
GetUID() int
|
||||
GetInode() int
|
||||
}
|
||||
|
||||
// GetPID returns the PID.
|
||||
func (i *ConnectionInfo) GetPID() int { return i.PID }
|
||||
|
||||
// SetPID sets the PID to the given value.
|
||||
func (i *ConnectionInfo) SetPID(pid int) { i.PID = pid }
|
||||
|
||||
// GetUID returns the UID.
|
||||
func (i *ConnectionInfo) GetUID() int { return i.UID }
|
||||
|
||||
// GetInode returns the Inode.
|
||||
func (i *ConnectionInfo) GetInode() int { return i.Inode }
|
||||
|
||||
// GetPID returns the PID.
|
||||
func (i *BindInfo) GetPID() int { return i.PID }
|
||||
|
||||
// SetPID sets the PID to the given value.
|
||||
func (i *BindInfo) SetPID(pid int) { i.PID = pid }
|
||||
|
||||
// GetUID returns the UID.
|
||||
func (i *BindInfo) GetUID() int { return i.UID }
|
||||
|
||||
// GetInode returns the Inode.
|
||||
func (i *BindInfo) GetInode() int { return i.Inode }
|
||||
|
||||
Reference in New Issue
Block a user