wg

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeviceType_name = map[int32]string{
		0: "UNKNOWN",
		1: "LINUX_KERNEL",
		2: "OPENBSD_KERNET",
		3: "FREEBSD_KERNEL",
		4: "WINDOWS_KERNEL",
		5: "USERSPACE",
	}
	DeviceType_value = map[string]int32{
		"UNKNOWN":        0,
		"LINUX_KERNEL":   1,
		"OPENBSD_KERNET": 2,
		"FREEBSD_KERNEL": 3,
		"WINDOWS_KERNEL": 4,
		"USERSPACE":      5,
	}
)

Enum value maps for DeviceType.

View Source
var File_wgtypes_proto protoreflect.FileDescriptor
View Source
var WireGuard_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "WireGuard",
	HandlerType: (*WireGuardServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ConfigureDevice",
			Handler:    _WireGuard_ConfigureDevice_Handler,
		},
		{
			MethodName: "Devices",
			Handler:    _WireGuard_Devices_Handler,
		},
		{
			MethodName: "Device",
			Handler:    _WireGuard_Device_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "node.proto",
}

WireGuard_ServiceDesc is the grpc.ServiceDesc for WireGuard service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterWireGuardServer

func RegisterWireGuardServer(s grpc.ServiceRegistrar, srv WireGuardServer)

Types

type Config

type Config struct {

	// PrivateKey specifies a private key configuration, if not nil.
	//
	// A non-nil, zero-value Key will clear the private key.
	PrivateKey []byte `protobuf:"bytes,1,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
	// ListenPort specifies a device's listening port, if not nil.
	ListenPort int32 `protobuf:"varint,2,opt,name=listen_port,json=listenPort,proto3" json:"listen_port,omitempty"`
	// FirewallMark specifies a device's firewall mark, if not nil.
	//
	// If non-nil and set to 0, the firewall mark will be cleared.
	FirewallMark int32 `protobuf:"varint,3,opt,name=firewall_mark,json=firewallMark,proto3" json:"firewall_mark,omitempty"`
	// ReplacePeers specifies if the Peers in this configuration should replace
	// the existing peer list, instead of appending them to the existing list.
	ReplacePeers bool `protobuf:"varint,4,opt,name=replace_peers,json=replacePeers,proto3" json:"replace_peers,omitempty"`
	// Peers specifies a list of peer configurations to apply to a device.
	Peers []*PeerConfig `protobuf:"bytes,5,rep,name=peers,proto3" json:"peers,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetFirewallMark

func (x *Config) GetFirewallMark() int32

func (*Config) GetListenPort

func (x *Config) GetListenPort() int32

func (*Config) GetPeers

func (x *Config) GetPeers() []*PeerConfig

func (*Config) GetPrivateKey

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

func (*Config) GetReplacePeers

func (x *Config) GetReplacePeers() bool

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type ConfigureDeviceRequest

type ConfigureDeviceRequest struct {
	Name   string  `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Config *Config `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

func (*ConfigureDeviceRequest) Descriptor deprecated

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

Deprecated: Use ConfigureDeviceRequest.ProtoReflect.Descriptor instead.

func (*ConfigureDeviceRequest) GetConfig

func (x *ConfigureDeviceRequest) GetConfig() *Config

func (*ConfigureDeviceRequest) GetName

func (x *ConfigureDeviceRequest) GetName() string

func (*ConfigureDeviceRequest) ProtoMessage

func (*ConfigureDeviceRequest) ProtoMessage()

func (*ConfigureDeviceRequest) ProtoReflect

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

func (*ConfigureDeviceRequest) Reset

func (x *ConfigureDeviceRequest) Reset()

func (*ConfigureDeviceRequest) String

func (x *ConfigureDeviceRequest) String() string

type ConfigureDeviceResponse

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

func (*ConfigureDeviceResponse) Descriptor deprecated

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

Deprecated: Use ConfigureDeviceResponse.ProtoReflect.Descriptor instead.

func (*ConfigureDeviceResponse) ProtoMessage

func (*ConfigureDeviceResponse) ProtoMessage()

func (*ConfigureDeviceResponse) ProtoReflect

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

func (*ConfigureDeviceResponse) Reset

func (x *ConfigureDeviceResponse) Reset()

func (*ConfigureDeviceResponse) String

func (x *ConfigureDeviceResponse) String() string

type Device

type Device struct {

	// Name is the name of the device.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Type specifies the underlying implementation of the device.
	Type DeviceType `protobuf:"varint,2,opt,name=type,proto3,enum=wgtypes.DeviceType" json:"type,omitempty"`
	// PrivateKey specifies a private key configuration, if not nil.
	//
	// A non-nil, zero-value Key will clear the private key.
	PrivateKey []byte `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
	// PublicKey is the device's public key, computed from its PrivateKey.
	PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// ListenPort specifies a device's listening port, if not nil.
	ListenPort int32 `protobuf:"varint,5,opt,name=listen_port,json=listenPort,proto3" json:"listen_port,omitempty"`
	// FirewallMark specifies a device's firewall mark, if not nil.
	//
	// If non-nil and set to 0, the firewall mark will be cleared.
	FirewallMark int32 `protobuf:"varint,6,opt,name=firewall_mark,json=firewallMark,proto3" json:"firewall_mark,omitempty"`
	// Peers specifies a list of peer configurations to apply to a device.
	Peers []*Peer `protobuf:"bytes,7,rep,name=peers,proto3" json:"peers,omitempty"`
	// contains filtered or unexported fields
}

func (*Device) Descriptor deprecated

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

Deprecated: Use Device.ProtoReflect.Descriptor instead.

func (*Device) GetFirewallMark

func (x *Device) GetFirewallMark() int32

func (*Device) GetListenPort

func (x *Device) GetListenPort() int32

func (*Device) GetName

func (x *Device) GetName() string

func (*Device) GetPeers

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

func (*Device) GetPrivateKey

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

func (*Device) GetPublicKey

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

func (*Device) GetType

func (x *Device) GetType() DeviceType

func (*Device) ProtoMessage

func (*Device) ProtoMessage()

func (*Device) ProtoReflect

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

func (*Device) Reset

func (x *Device) Reset()

func (*Device) String

func (x *Device) String() string

type DeviceRequest

type DeviceRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceRequest) Descriptor deprecated

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

Deprecated: Use DeviceRequest.ProtoReflect.Descriptor instead.

func (*DeviceRequest) GetName

func (x *DeviceRequest) GetName() string

func (*DeviceRequest) ProtoMessage

func (*DeviceRequest) ProtoMessage()

func (*DeviceRequest) ProtoReflect

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

func (*DeviceRequest) Reset

func (x *DeviceRequest) Reset()

func (*DeviceRequest) String

func (x *DeviceRequest) String() string

type DeviceResponse

type DeviceResponse struct {
	Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceResponse) Descriptor deprecated

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

Deprecated: Use DeviceResponse.ProtoReflect.Descriptor instead.

func (*DeviceResponse) GetDevice

func (x *DeviceResponse) GetDevice() *Device

func (*DeviceResponse) ProtoMessage

func (*DeviceResponse) ProtoMessage()

func (*DeviceResponse) ProtoReflect

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

func (*DeviceResponse) Reset

func (x *DeviceResponse) Reset()

func (*DeviceResponse) String

func (x *DeviceResponse) String() string

type DeviceType

type DeviceType int32
const (
	DeviceType_UNKNOWN        DeviceType = 0
	DeviceType_LINUX_KERNEL   DeviceType = 1
	DeviceType_OPENBSD_KERNET DeviceType = 2
	DeviceType_FREEBSD_KERNEL DeviceType = 3
	DeviceType_WINDOWS_KERNEL DeviceType = 4
	DeviceType_USERSPACE      DeviceType = 5
)

func (DeviceType) Descriptor

func (DeviceType) Descriptor() protoreflect.EnumDescriptor

func (DeviceType) Enum

func (x DeviceType) Enum() *DeviceType

func (DeviceType) EnumDescriptor deprecated

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

Deprecated: Use DeviceType.Descriptor instead.

func (DeviceType) Number

func (x DeviceType) Number() protoreflect.EnumNumber

func (DeviceType) String

func (x DeviceType) String() string

func (DeviceType) Type

type DevicesRequest

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

func (*DevicesRequest) Descriptor deprecated

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

Deprecated: Use DevicesRequest.ProtoReflect.Descriptor instead.

func (*DevicesRequest) ProtoMessage

func (*DevicesRequest) ProtoMessage()

func (*DevicesRequest) ProtoReflect

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

func (*DevicesRequest) Reset

func (x *DevicesRequest) Reset()

func (*DevicesRequest) String

func (x *DevicesRequest) String() string

type DevicesResponse

type DevicesResponse struct {
	Devices []*Device `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"`
	// contains filtered or unexported fields
}

func (*DevicesResponse) Descriptor deprecated

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

Deprecated: Use DevicesResponse.ProtoReflect.Descriptor instead.

func (*DevicesResponse) GetDevices

func (x *DevicesResponse) GetDevices() []*Device

func (*DevicesResponse) ProtoMessage

func (*DevicesResponse) ProtoMessage()

func (*DevicesResponse) ProtoReflect

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

func (*DevicesResponse) Reset

func (x *DevicesResponse) Reset()

func (*DevicesResponse) String

func (x *DevicesResponse) String() string

type IPNet

type IPNet struct {
	Ip     []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	IpMask []byte `protobuf:"bytes,2,opt,name=ip_mask,json=ipMask,proto3" json:"ip_mask,omitempty"`
	// contains filtered or unexported fields
}

func (*IPNet) Descriptor deprecated

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

Deprecated: Use IPNet.ProtoReflect.Descriptor instead.

func (*IPNet) GetIp

func (x *IPNet) GetIp() []byte

func (*IPNet) GetIpMask

func (x *IPNet) GetIpMask() []byte

func (*IPNet) ProtoMessage

func (*IPNet) ProtoMessage()

func (*IPNet) ProtoReflect

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

func (*IPNet) Reset

func (x *IPNet) Reset()

func (*IPNet) String

func (x *IPNet) String() string

type Peer

type Peer struct {

	// PublicKey is the public key of a peer, computed from its private key.
	//
	// PublicKey is always present in a Peer.
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// PresharedKey is an  preshared key which may be used as an
	// additional layer of security for peer communications.
	//
	// A zero-value Key means no preshared key is configured.
	PresharedKey []byte `protobuf:"bytes,2,opt,name=preshared_key,json=presharedKey,proto3" json:"preshared_key,omitempty"`
	// Endpoint is the most recent source address used for communication by
	// this Peer.
	Endpoint *UDPAddr `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// PersistentKeepaliveInterval specifies how often an "empty" packet is sent
	// to a peer to keep a connection alive.
	//
	// A value of 0 indicates that persistent keepalives are disabled.
	PersistentKeepaliveInterval *durationpb.Duration `` /* 144-byte string literal not displayed */
	// LastHandshakeTime indicates the most recent time a handshake was performed
	// with this peer.
	//
	// A zero-value time.Time indicates that no handshake has taken place with
	// this peer.
	LastHandshakeTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_handshake_time,json=lastHandshakeTime,proto3" json:"last_handshake_time,omitempty"`
	// ReceiveBytes indicates the number of bytes received from this peer.
	RecievedBytes int64 `protobuf:"varint,6,opt,name=recieved_bytes,json=recievedBytes,proto3" json:"recieved_bytes,omitempty"`
	// TransmitBytes indicates the number of bytes transmitted to this peer.
	TransmitBytes int64 `protobuf:"varint,7,opt,name=transmit_bytes,json=transmitBytes,proto3" json:"transmit_bytes,omitempty"`
	// AllowedIPs specifies which IPv4 and IPv6 addresses this peer is allowed
	// to communicate on.
	//
	// 0.0.0.0/0 indicates that all IPv4 addresses are allowed, and ::/0
	// indicates that all IPv6 addresses are allowed.
	AllowedIps []*IPNet `protobuf:"bytes,8,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
	// ProtocolVersion specifies which version of the WireGuard protocol is used
	// for this Peer.
	//
	// A value of 0 indicates that the most recent protocol version will be used.
	ProtocolVersion int32 `protobuf:"varint,9,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	// contains filtered or unexported fields
}

Peer is a WireGuard peer to a Device.

func (*Peer) Descriptor deprecated

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

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetAllowedIps

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

func (*Peer) GetEndpoint

func (x *Peer) GetEndpoint() *UDPAddr

func (*Peer) GetLastHandshakeTime

func (x *Peer) GetLastHandshakeTime() *timestamppb.Timestamp

func (*Peer) GetPersistentKeepaliveInterval

func (x *Peer) GetPersistentKeepaliveInterval() *durationpb.Duration

func (*Peer) GetPresharedKey

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

func (*Peer) GetProtocolVersion

func (x *Peer) GetProtocolVersion() int32

func (*Peer) GetPublicKey

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

func (*Peer) GetRecievedBytes

func (x *Peer) GetRecievedBytes() int64

func (*Peer) GetTransmitBytes

func (x *Peer) GetTransmitBytes() int64

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

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

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type PeerConfig

type PeerConfig struct {

	// PublicKey specifies the public key of this peer.  PublicKey is a
	// mandatory field for all PeerConfigs.
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// Remove specifies if the peer with this public key should be removed
	// from a device's peer list.
	Remove bool `protobuf:"varint,2,opt,name=remove,proto3" json:"remove,omitempty"`
	// UpdateOnly specifies that an operation will only occur on this peer
	// if the peer already exists as part of the interface.
	UpdateOnly bool `protobuf:"varint,3,opt,name=update_only,json=updateOnly,proto3" json:"update_only,omitempty"`
	// PresharedKey specifies a peer's preshared key configuration, if not nil.
	//
	// A non-nil, zero-value Key will clear the preshared key.
	PresharedKey []byte `protobuf:"bytes,4,opt,name=preshared_key,json=presharedKey,proto3" json:"preshared_key,omitempty"`
	// Endpoint specifies the endpoint of this peer entry, if not nil.
	Endpoint *UDPAddr `protobuf:"bytes,5,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// PersistentKeepaliveInterval specifies the persistent keepalive interval
	// for this peer, if not nil.
	//
	// A non-nil value of 0 will clear the persistent keepalive interval.
	PersistentKeepaliveInterval *durationpb.Duration `` /* 144-byte string literal not displayed */
	// ReplaceAllowedIPs specifies if the allowed IPs specified in this peer
	// configuration should replace any existing ones, instead of appending them
	// to the allowed IPs list.
	ReplaceAllowedIps bool `protobuf:"varint,7,opt,name=replace_allowed_ips,json=replaceAllowedIps,proto3" json:"replace_allowed_ips,omitempty"`
	// AllowedIPs specifies a list of allowed IP addresses in CIDR notation
	// for this peer.
	AllowedIps []*IPNet `protobuf:"bytes,8,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
	// contains filtered or unexported fields
}

PeerConfig is a WireGuard device peer configuration.

func (*PeerConfig) Descriptor deprecated

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

Deprecated: Use PeerConfig.ProtoReflect.Descriptor instead.

func (*PeerConfig) GetAllowedIps

func (x *PeerConfig) GetAllowedIps() []*IPNet

func (*PeerConfig) GetEndpoint

func (x *PeerConfig) GetEndpoint() *UDPAddr

func (*PeerConfig) GetPersistentKeepaliveInterval

func (x *PeerConfig) GetPersistentKeepaliveInterval() *durationpb.Duration

func (*PeerConfig) GetPresharedKey

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

func (*PeerConfig) GetPublicKey

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

func (*PeerConfig) GetRemove

func (x *PeerConfig) GetRemove() bool

func (*PeerConfig) GetReplaceAllowedIps

func (x *PeerConfig) GetReplaceAllowedIps() bool

func (*PeerConfig) GetUpdateOnly

func (x *PeerConfig) GetUpdateOnly() bool

func (*PeerConfig) ProtoMessage

func (*PeerConfig) ProtoMessage()

func (*PeerConfig) ProtoReflect

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

func (*PeerConfig) Reset

func (x *PeerConfig) Reset()

func (*PeerConfig) String

func (x *PeerConfig) String() string

type UDPAddr

type UDPAddr struct {
	Ip   []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	Port int32  `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	Zone string `protobuf:"bytes,3,opt,name=zone,proto3" json:"zone,omitempty"`
	// contains filtered or unexported fields
}

func (*UDPAddr) Descriptor deprecated

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

Deprecated: Use UDPAddr.ProtoReflect.Descriptor instead.

func (*UDPAddr) GetIp

func (x *UDPAddr) GetIp() []byte

func (*UDPAddr) GetPort

func (x *UDPAddr) GetPort() int32

func (*UDPAddr) GetZone

func (x *UDPAddr) GetZone() string

func (*UDPAddr) ProtoMessage

func (*UDPAddr) ProtoMessage()

func (*UDPAddr) ProtoReflect

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

func (*UDPAddr) Reset

func (x *UDPAddr) Reset()

func (*UDPAddr) String

func (x *UDPAddr) String() string

type UnimplementedWireGuardServer

type UnimplementedWireGuardServer struct {
}

UnimplementedWireGuardServer must be embedded to have forward compatible implementations.

func (UnimplementedWireGuardServer) ConfigureDevice

func (UnimplementedWireGuardServer) Device

func (UnimplementedWireGuardServer) Devices

type UnsafeWireGuardServer

type UnsafeWireGuardServer interface {
	// contains filtered or unexported methods
}

UnsafeWireGuardServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WireGuardServer will result in compilation errors.

type WireGuardClient

type WireGuardClient interface {
	ConfigureDevice(ctx context.Context, in *ConfigureDeviceRequest, opts ...grpc.CallOption) (*ConfigureDeviceResponse, error)
	Devices(ctx context.Context, in *DevicesRequest, opts ...grpc.CallOption) (*DevicesResponse, error)
	Device(ctx context.Context, in *DeviceRequest, opts ...grpc.CallOption) (*DeviceResponse, error)
}

WireGuardClient is the client API for WireGuard service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewWireGuardClient

func NewWireGuardClient(cc grpc.ClientConnInterface) WireGuardClient

type WireGuardServer

type WireGuardServer interface {
	ConfigureDevice(context.Context, *ConfigureDeviceRequest) (*ConfigureDeviceResponse, error)
	Devices(context.Context, *DevicesRequest) (*DevicesResponse, error)
	Device(context.Context, *DeviceRequest) (*DeviceResponse, error)
	// contains filtered or unexported methods
}

WireGuardServer is the server API for WireGuard service. All implementations must embed UnimplementedWireGuardServer for forward compatibility

Jump to

Keyboard shortcuts

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