shared

package
v0.0.0-...-c5c3ef8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2024 License: BSD-3-Clause Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EventUp      = "up"
	EventDown    = "down"
	EventStartup = "startup"
)

Variables

View Source
var (
	Version         = "dev"
	ProtocolVersion = 12
)
View Source
var DefaultMAC = net.HardwareAddr{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

Functions

func BoolIfString

func BoolIfString(val bool, trueval string) string

func BoolToEnabled

func BoolToEnabled(val bool) string

func BoolToString

func BoolToString(val bool, trueval string, falseval string) string

func ExecCmd

func ExecCmd(cmd string, arg ...string) error

func ExecCmdGetStdOut

func ExecCmdGetStdOut(cmd string, arg ...string) (string, error)

func GetPacketBufferSizeByMTU

func GetPacketBufferSizeByMTU(mtu int) int

func IPMaskGetNetMask

func IPMaskGetNetMask(mask net.IPMask) string

func IPNetGetNetMask

func IPNetGetNetMask(ipNet *net.IPNet) string

func LoadConfigFile

func LoadConfigFile(file string, out interface{}) error

func LoadConfigReader

func LoadConfigReader(reader io.Reader, out interface{}) error

func MakeLogger

func MakeLogger(logType string, prefix string) *log.Logger

func MakeSimpleCond

func MakeSimpleCond() *sync.Cond

func PrintVersion

func PrintVersion()

func TLSSetCipherAESPreference

func TLSSetCipherAESPreference(preferAES bool)

func TLSVersionNum

func TLSVersionNum(version string) uint16

func TLSVersionString

func TLSVersionString(version uint16) string

func UpdateLogger

func UpdateLogger(logger *log.Logger, logType string, prefix string)

Types

type EventConfig

type EventConfig struct {
	Up      []string `yaml:"up"`
	Down    []string `yaml:"down"`
	Startup []string `yaml:"startup"`
}

type EventConfigHolder

type EventConfigHolder struct {
	UpScript      []string
	DownScript    []string
	StartupScript []string
}

func (*EventConfigHolder) LoadEventConfig

func (c *EventConfigHolder) LoadEventConfig(config *EventConfig)

func (*EventConfigHolder) RunEventScript

func (c *EventConfigHolder) RunEventScript(op string, remoteNet string, iface string, args ...string) error

type VPNMode

type VPNMode int
const (
	VPNModeTUN VPNMode = iota
	VPNModeTAP
	VPNModeInvalid
)

func VPNModeFromString

func VPNModeFromString(mode string) VPNMode

func (VPNMode) ToString

func (m VPNMode) ToString() string

func (VPNMode) ToWaterDeviceType

func (m VPNMode) ToWaterDeviceType() water.DeviceType

type VPNNet

type VPNNet struct {
	// contains filtered or unexported fields
}

func ParseVPNNet

func ParseVPNNet(rNetStr string) (*VPNNet, error)

func (*VPNNet) Equals

func (r *VPNNet) Equals(other *VPNNet) bool

func (*VPNNet) GetClientSlots

func (r *VPNNet) GetClientSlots() uint64

func (*VPNNet) GetIPAt

func (r *VPNNet) GetIPAt(idx int) (net.IP, error)

func (*VPNNet) GetNetmask

func (r *VPNNet) GetNetmask() string

func (*VPNNet) GetRaw

func (r *VPNNet) GetRaw() string

func (*VPNNet) GetRawIP

func (r *VPNNet) GetRawIP() net.IP

func (*VPNNet) GetServerIP

func (r *VPNNet) GetServerIP() net.IP

func (*VPNNet) GetSize

func (r *VPNNet) GetSize() int

func (*VPNNet) GetSubnet

func (r *VPNNet) GetSubnet() *net.IPNet

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL