core

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InterfaceType_name = map[int32]string{
		0: "UNSPECIFIED_INTERFACE_TYPE",
		1: "KERNEL_LINUX",
		2: "KERNEL_OPENBSD",
		3: "KERNEL_FREEBSD",
		4: "KERNEL_WINDOWS",
		5: "USERSPACE",
	}
	InterfaceType_value = map[string]int32{
		"UNSPECIFIED_INTERFACE_TYPE": 0,
		"KERNEL_LINUX":               1,
		"KERNEL_OPENBSD":             2,
		"KERNEL_FREEBSD":             3,
		"KERNEL_WINDOWS":             4,
		"USERSPACE":                  5,
	}
)

Enum value maps for InterfaceType.

View Source
var (
	PeerState_name = map[int32]string{
		0: "NEW",
		1: "CONNECTING",
		2: "CONNECTED",
		3: "FAILED",
		4: "CLOSED",
	}
	PeerState_value = map[string]int32{
		"NEW":        0,
		"CONNECTING": 1,
		"CONNECTED":  2,
		"FAILED":     3,
		"CLOSED":     4,
	}
)

Enum value maps for PeerState.

View Source
var (
	ReachabilityType_name = map[int32]string{
		0: "UNSPECIFIED_REACHABILITY_TYPE",
		1: "NONE",
		2: "DIRECT",
		3: "RELAYED",
		4: "RELAYED_BIDIR",
		5: "ROUTED",
	}
	ReachabilityType_value = map[string]int32{
		"UNSPECIFIED_REACHABILITY_TYPE": 0,
		"NONE":                          1,
		"DIRECT":                        2,
		"RELAYED":                       3,
		"RELAYED_BIDIR":                 4,
		"ROUTED":                        5,
	}
)

Enum value maps for ReachabilityType.

View Source
var File_core_interface_proto protoreflect.FileDescriptor
View Source
var File_core_net_proto protoreflect.FileDescriptor
View Source
var File_core_peer_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type IPAddress

type IPAddress struct {
	Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

func Address

func Address(i net.IP) *IPAddress

func (*IPAddress) Address

func (i *IPAddress) Address() net.IP

func (*IPAddress) Descriptor deprecated

func (*IPAddress) Descriptor() ([]byte, []int)

Deprecated: Use IPAddress.ProtoReflect.Descriptor instead.

func (*IPAddress) GetAddr

func (x *IPAddress) GetAddr() []byte

func (*IPAddress) ProtoMessage

func (*IPAddress) ProtoMessage()

func (*IPAddress) ProtoReflect

func (x *IPAddress) ProtoReflect() protoreflect.Message

func (*IPAddress) Reset

func (x *IPAddress) Reset()

func (*IPAddress) String

func (x *IPAddress) String() string

type IPPrefix

type IPPrefix struct {
	Addr   []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	Pfxlen uint32 `protobuf:"varint,2,opt,name=pfxlen,proto3" json:"pfxlen,omitempty"`
	// contains filtered or unexported fields
}

func Prefix

func Prefix(i net.IPNet) *IPPrefix

func (*IPPrefix) Descriptor deprecated

func (*IPPrefix) Descriptor() ([]byte, []int)

Deprecated: Use IPPrefix.ProtoReflect.Descriptor instead.

func (*IPPrefix) GetAddr

func (x *IPPrefix) GetAddr() []byte

func (*IPPrefix) GetPfxlen

func (x *IPPrefix) GetPfxlen() uint32

func (*IPPrefix) Prefix

func (i *IPPrefix) Prefix() *net.IPNet

func (*IPPrefix) ProtoMessage

func (*IPPrefix) ProtoMessage()

func (*IPPrefix) ProtoReflect

func (x *IPPrefix) ProtoReflect() protoreflect.Message

func (*IPPrefix) Reset

func (x *IPPrefix) Reset()

func (*IPPrefix) String

func (x *IPPrefix) String() string

type Interface

type Interface struct {
	Name              string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type              InterfaceType     `protobuf:"varint,2,opt,name=type,proto3,enum=cunicu.core.InterfaceType" json:"type,omitempty"`
	PublicKey         []byte            `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	PrivateKey        []byte            `protobuf:"bytes,4,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
	ListenPort        uint32            `protobuf:"varint,5,opt,name=listen_port,json=listenPort,proto3" json:"listen_port,omitempty"`
	FirewallMark      uint32            `protobuf:"varint,6,opt,name=firewall_mark,json=firewallMark,proto3" json:"firewall_mark,omitempty"`
	Peers             []*Peer           `protobuf:"bytes,7,rep,name=peers,proto3" json:"peers,omitempty"`
	Ice               *epdisc.Interface `protobuf:"bytes,8,opt,name=ice,proto3" json:"ice,omitempty"`
	Ifindex           uint32            `protobuf:"varint,9,opt,name=ifindex,proto3" json:"ifindex,omitempty"`
	Mtu               uint32            `protobuf:"varint,10,opt,name=mtu,proto3" json:"mtu,omitempty"`
	LastSyncTimestamp *proto.Timestamp  `protobuf:"bytes,11,opt,name=last_sync_timestamp,json=lastSyncTimestamp,proto3" json:"last_sync_timestamp,omitempty"`
	// contains filtered or unexported fields
}

A WireGuard interface See: https://pkg.go.dev/golang.zx2c4.com/wireguard/wgctrl/wgtypes#Device

func (*Interface) Descriptor deprecated

func (*Interface) Descriptor() ([]byte, []int)

Deprecated: Use Interface.ProtoReflect.Descriptor instead.

func (*Interface) Device

func (i *Interface) Device() *wg.Interface

func (*Interface) Dump

func (i *Interface) Dump(wr io.Writer, level log.Level) error

Dump writes a human readable version of the interface status to the supplied writer. The format resembles the one used by wg(8).

func (*Interface) GetFirewallMark

func (x *Interface) GetFirewallMark() uint32

func (*Interface) GetIce

func (x *Interface) GetIce() *epdisc.Interface

func (*Interface) GetIfindex

func (x *Interface) GetIfindex() uint32

func (*Interface) GetLastSyncTimestamp

func (x *Interface) GetLastSyncTimestamp() *proto.Timestamp

func (*Interface) GetListenPort

func (x *Interface) GetListenPort() uint32

func (*Interface) GetMtu

func (x *Interface) GetMtu() uint32

func (*Interface) GetName

func (x *Interface) GetName() string

func (*Interface) GetPeers

func (x *Interface) GetPeers() []*Peer

func (*Interface) GetPrivateKey

func (x *Interface) GetPrivateKey() []byte

func (*Interface) GetPublicKey

func (x *Interface) GetPublicKey() []byte

func (*Interface) GetType

func (x *Interface) GetType() InterfaceType

func (*Interface) ProtoMessage

func (*Interface) ProtoMessage()

func (*Interface) ProtoReflect

func (x *Interface) ProtoReflect() protoreflect.Message

func (*Interface) Redact

func (i *Interface) Redact() *Interface

Redact redacts any sensitive information from the interface status such as private keys

func (*Interface) Reset

func (x *Interface) Reset()

func (*Interface) String

func (x *Interface) String() string

type InterfaceType

type InterfaceType int32

Type of the WireGuard interface implementation

const (
	InterfaceType_UNSPECIFIED_INTERFACE_TYPE InterfaceType = 0
	InterfaceType_KERNEL_LINUX               InterfaceType = 1
	InterfaceType_KERNEL_OPENBSD             InterfaceType = 2
	InterfaceType_KERNEL_FREEBSD             InterfaceType = 3
	InterfaceType_KERNEL_WINDOWS             InterfaceType = 4
	InterfaceType_USERSPACE                  InterfaceType = 5
)

func (InterfaceType) Descriptor

func (InterfaceType) Enum

func (x InterfaceType) Enum() *InterfaceType

func (InterfaceType) EnumDescriptor deprecated

func (InterfaceType) EnumDescriptor() ([]byte, []int)

Deprecated: Use InterfaceType.Descriptor instead.

func (InterfaceType) Number

func (InterfaceType) String

func (x InterfaceType) String() string

func (InterfaceType) Type

type Peer

type Peer struct {

	// A human readable name describing the peer
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The operating state of the peer
	State PeerState `protobuf:"varint,2,opt,name=state,proto3,enum=cunicu.core.PeerState" json:"state,omitempty"`
	// The reachability of the peer
	Reachability ReachabilityType `protobuf:"varint,3,opt,name=reachability,proto3,enum=cunicu.core.ReachabilityType" json:"reachability,omitempty"`
	// Public WireGuard X25519 key
	PublicKey    []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	PresharedKey []byte `protobuf:"bytes,5,opt,name=preshared_key,json=presharedKey,proto3" json:"preshared_key,omitempty"`
	// List of allowed IPs
	AllowedIps                  []string `protobuf:"bytes,6,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
	PersistentKeepaliveInterval uint32   `` /* 145-byte string literal not displayed */
	// Timestamps
	LastHandshakeTimestamp *proto.Timestamp `` /* 129-byte string literal not displayed */
	LastReceiveTimestamp   *proto.Timestamp `protobuf:"bytes,9,opt,name=last_receive_timestamp,json=lastReceiveTimestamp,proto3" json:"last_receive_timestamp,omitempty"`
	LastTransmitTimestamp  *proto.Timestamp `` /* 127-byte string literal not displayed */
	// Trafic counters
	TransmitBytes int64 `protobuf:"varint,11,opt,name=transmit_bytes,json=transmitBytes,proto3" json:"transmit_bytes,omitempty"`
	ReceiveBytes  int64 `protobuf:"varint,12,opt,name=receive_bytes,json=receiveBytes,proto3" json:"receive_bytes,omitempty"`
	// WireGuard endpoint address
	Endpoint string `protobuf:"bytes,13,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// WireGuard protocol version
	ProtocolVersion uint32       `protobuf:"varint,14,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	Ice             *epdisc.Peer `protobuf:"bytes,15,opt,name=ice,proto3" json:"ice,omitempty"`
	// contains filtered or unexported fields
}

func (*Peer) Descriptor deprecated

func (*Peer) Descriptor() ([]byte, []int)

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) Dump

func (p *Peer) Dump(wr io.Writer, level log.Level) error

func (*Peer) GetAllowedIps

func (x *Peer) GetAllowedIps() []string

func (*Peer) GetEndpoint

func (x *Peer) GetEndpoint() string

func (*Peer) GetIce

func (x *Peer) GetIce() *epdisc.Peer

func (*Peer) GetLastHandshakeTimestamp

func (x *Peer) GetLastHandshakeTimestamp() *proto.Timestamp

func (*Peer) GetLastReceiveTimestamp

func (x *Peer) GetLastReceiveTimestamp() *proto.Timestamp

func (*Peer) GetLastTransmitTimestamp

func (x *Peer) GetLastTransmitTimestamp() *proto.Timestamp

func (*Peer) GetName

func (x *Peer) GetName() string

func (*Peer) GetPersistentKeepaliveInterval

func (x *Peer) GetPersistentKeepaliveInterval() uint32

func (*Peer) GetPresharedKey

func (x *Peer) GetPresharedKey() []byte

func (*Peer) GetProtocolVersion

func (x *Peer) GetProtocolVersion() uint32

func (*Peer) GetPublicKey

func (x *Peer) GetPublicKey() []byte

func (*Peer) GetReachability

func (x *Peer) GetReachability() ReachabilityType

func (*Peer) GetReceiveBytes

func (x *Peer) GetReceiveBytes() int64

func (*Peer) GetState

func (x *Peer) GetState() PeerState

func (*Peer) GetTransmitBytes

func (x *Peer) GetTransmitBytes() int64

func (*Peer) Peer

func (p *Peer) Peer() wgtypes.Peer

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

func (x *Peer) ProtoReflect() protoreflect.Message

func (*Peer) Redact

func (p *Peer) Redact() *Peer

Redact redacts any sensitive information from the peer status such as the preshared key

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type PeerState

type PeerState int32
const (
	PeerState_NEW        PeerState = 0 // Peer has been created
	PeerState_CONNECTING PeerState = 1 // Peer is connecting
	PeerState_CONNECTED  PeerState = 2 // Connection to remote has been established
	PeerState_FAILED     PeerState = 3 // Connection to remote has failed
	PeerState_CLOSED     PeerState = 4 // Peer has been closed
)

func (PeerState) Color

func (s PeerState) Color() string

func (PeerState) Descriptor

func (PeerState) Descriptor() protoreflect.EnumDescriptor

func (PeerState) Enum

func (x PeerState) Enum() *PeerState

func (PeerState) EnumDescriptor deprecated

func (PeerState) EnumDescriptor() ([]byte, []int)

Deprecated: Use PeerState.Descriptor instead.

func (*PeerState) MarshalText

func (s *PeerState) MarshalText() ([]byte, error)

func (PeerState) Number

func (x PeerState) Number() protoreflect.EnumNumber

func (PeerState) String

func (x PeerState) String() string

func (PeerState) Type

type ReachabilityType

type ReachabilityType int32
const (
	ReachabilityType_UNSPECIFIED_REACHABILITY_TYPE ReachabilityType = 0
	ReachabilityType_NONE                          ReachabilityType = 1
	ReachabilityType_DIRECT                        ReachabilityType = 2
	ReachabilityType_RELAYED                       ReachabilityType = 3
	ReachabilityType_RELAYED_BIDIR                 ReachabilityType = 4
	ReachabilityType_ROUTED                        ReachabilityType = 5
)

func (ReachabilityType) Descriptor

func (ReachabilityType) Enum

func (ReachabilityType) EnumDescriptor deprecated

func (ReachabilityType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ReachabilityType.Descriptor instead.

func (ReachabilityType) Number

func (ReachabilityType) String

func (x ReachabilityType) String() string

func (ReachabilityType) Type

Jump to

Keyboard shortcuts

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