Documentation
¶
Overview ¶
Package networkpolicy stores Solomon's network selection independently of OS configuration.
Index ¶
- func AllowedLocal(ip net.IP) bool
- func ApplyTailscaleStatus(rows []Interface, data []byte)
- func DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func InterfaceType(name string, local bool) string
- func LinuxInterfaceType(root, name string) string
- func PolicyPath() (string, error)
- func RunningInContainer(readFile func(string) ([]byte, error)) bool
- func Set(name string, enabled bool) error
- func SetDevice(name, address string, allowed bool) error
- func SetOutbound(name string) error
- func WrapDial(fallback func(context.Context, string, string) (net.Conn, error), ...) func(context.Context, string, string) (net.Conn, error)
- func WritePolicyFile(path string, p Policy) error
- type Interface
- type Link
- type LinkDevice
- type Policy
- type TailscaleInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowedLocal ¶
AllowedLocal checks the destination address accepted by the server.
func ApplyTailscaleStatus ¶
func InterfaceType ¶
func LinuxInterfaceType ¶
func PolicyPath ¶
func SetOutbound ¶ added in v2026.1121.0
func WrapDial ¶
func WrapDial(fallback func(context.Context, string, string) (net.Conn, error), timeout ...time.Duration) func(context.Context, string, string) (net.Conn, error)
WrapDial preserves the caller timeout and custom dial behavior when unrestricted.
func WritePolicyFile ¶
Types ¶
type Interface ¶
type Interface struct {
Tailscale *TailscaleInfo `json:"tailscale,omitempty"`
Type string `json:"type"`
DisplayLabel string `json:"display_name"`
Number int `json:"number"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Up bool `json:"up"`
Local bool `json:"local"`
Addresses []string `json:"addresses"`
}
func ListUnfiltered ¶
func VisibleInterfaces ¶
Filter the user-facing list only; hiding an interface must not alter routing or server access through Docker bridges.
func (Interface) DisplayName ¶
DisplayName keeps the actual interface name when its type cannot be established.
type Link ¶ added in v2026.1201.0
type Link struct {
Name string `json:"name"`
Label string `json:"label"`
Status string `json:"status"`
Devices []LinkDevice `json:"devices"`
}
type LinkDevice ¶ added in v2026.1201.0
type Policy ¶
type Policy struct {
AllowedDevices map[string]map[string]bool `json:"allowed_devices,omitempty"`
OutboundInterface string `json:"outbound_interface,omitempty"`
Disabled map[string]bool `json:"disabled"`
DisabledMagicDNS map[string]bool `json:"disabled_magic_dns,omitempty"`
}
func (Policy) AllowedHostname ¶
AllowedHostname controls Solomon access via the saved MagicDNS aliases.
type TailscaleInfo ¶
type TailscaleInfo struct {
MagicDNSEnabled bool `json:"magic_dns_enabled"`
MagicDNS string `json:"magic_dns,omitempty"`
Tailnet string `json:"tailnet,omitempty"`
DNSName string `json:"dns_name,omitempty"`
Account string `json:"account,omitempty"`
Tagged bool `json:"tagged,omitempty"`
// contains filtered or unexported fields
}