models

package
v0.0.0-...-3f2847d Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyKey = wgtypes.Key{}
)

Functions

This section is empty.

Types

type Device

type Device struct {

	// WireGuard device name. Usually it is network interface name
	Name string `json:"name"`

	// WireGuard device listen port.
	ListenPort int32 `json:"listen_port"`

	// WireGuard device public key encoded by base64.
	PublicKey string `json:"public_key"`

	// WireGuard device firewall mark.
	FirewallMark int32 `json:"firewall_mark"`

	// IPv4 or IPv6 addresses in CIDR notation
	Networks []string `json:"networks"`

	// WireGuard device's peers count
	PeersCount int32 `json:"peers_count"`

	// WireGuard device's peers total receive bytes
	TotalReceiveBytes int64 `json:"total_receive_bytes"`

	// WireGuard device's peers total transmit bytes
	TotalTransmitBytes int64 `json:"total_transmit_bytes"`
}

Device - Information about wireguard device.

func NewDevice

func NewDevice(device *wgtypes.Device) Device

type DeviceCreateOrUpdateRequest

type DeviceCreateOrUpdateRequest struct {

	// WireGuard device name. Usually it is network interface name
	Name *string `json:"name,omitempty"`

	// WireGuard device listen port.
	ListenPort *int32 `json:"listen_port,omitempty"`

	// WireGuard device private key encoded by base64.
	PrivateKey *string `json:"private_key,omitempty"`

	// WireGuard device firewall mark.
	FirewallMark *int32 `json:"firewall_mark,omitempty"`

	// IPv4 or IPv6 addresses in CIDR notation
	Networks *[]string `json:"networks,omitempty"`
}

DeviceCreateOrUpdateRequest - Device params that might be used due to creation or updation process

func (*DeviceCreateOrUpdateRequest) Apply

type DeviceOptions

type DeviceOptions struct {

	// Device's allowed ips, it might be any of IPv4 or IPv6 addresses in CIDR notation. It might be owervrite in peer and device config.
	AllowedIps []string `json:"allowed_ips"`

	// Interface's DNS servers.
	DnsServers []string `json:"dns_servers"`

	// Device host, it might be domain name or IPv4/IPv6 address. It is used for external/internal connection
	Host string `json:"host"`
}

DeviceOptions - Device options

func NewDeviceOptions

func NewDeviceOptions(options storage.StoreDeviceOptions) DeviceOptions

type DeviceOptionsUpdateRequest

type DeviceOptionsUpdateRequest struct {

	// Device's allowed ips, it might be any of IPv4 or IPv6 addresses in CIDR notation. It might be owervrite in peer and device config.
	AllowedIps *[]string `json:"allowed_ips,omitempty"`

	// Interface's DNS servers.
	DnsServers *[]string `json:"dns_servers,omitempty"`

	// Device host, it might be domain name or IPv4/IPv6 address. It is used for external/internal connection
	Host *string `json:"host,omitempty"`
}

DeviceOptionsUpdateRequest - Device options

func (*DeviceOptionsUpdateRequest) Apply

type Error

type Error struct {

	// Error code
	Code string `json:"code"`

	// Error's short description
	Message string `json:"message"`

	// Error's detail description
	Detail string `json:"detail,omitempty"`
}

type HelloWorld

type HelloWorld struct {
	Message string `json:"message"`
}

HelloWorld is a sample data structure to make sure each endpoint return something.

type Peer

type Peer struct {

	// Base64 encoded public key
	PublicKey string `json:"public_key"`

	// URL safe base64 encoded public key. It is usefull to use in peers api endpoint.
	UrlSafePublicKey string `json:"url_safe_public_key"`

	// Base64 encoded preshared key
	PresharedKey string `json:"preshared_key,omitempty"`

	// Peer's allowed ips, it might be any of IPv4 or IPv6 addresses in CIDR notation
	AllowedIps []string `json:"allowed_ips"`

	// Peer's last handshake time formated in RFC3339
	LastHandshakeTime time.Time `json:"last_handshake_time"`

	// Peer's persistend keepalive interval in
	PersistentKeepaliveInterval string `json:"persistent_keepalive_interval"`

	// Peer's endpoint in host:port format
	Endpoint string `json:"endpoint"`

	// Peer's receive bytes
	ReceiveBytes int64 `json:"receive_bytes"`

	// Peer's transmit bytes
	TransmitBytes int64 `json:"transmit_bytes"`
}

Peer - Information about wireguard peer.

func NewPeer

func NewPeer(peer wgtypes.Peer) Peer

type PeerCreateOrUpdateRequest

type PeerCreateOrUpdateRequest struct {

	// Base64 encoded private key. If present it will be stored in persistent storage.
	PrivateKey *string `json:"private_key,omitempty"`

	// Base64 encoded public key
	PublicKey *string `json:"public_key,omitempty"`

	// Base64 encoded preshared key
	PresharedKey *string `json:"preshared_key,omitempty"`

	// Peer's allowed ips, it might be any of IPv4 or IPv6 addresses in CIDR notation
	AllowedIps *[]string `json:"allowed_ips,omitempty"`

	// Peer's persistend keepalive interval. Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".
	PersistentKeepaliveInterval string `json:"persistent_keepalive_interval,omitempty"`

	// Peer's endpoint in host:port format
	Endpoint string `json:"endpoint,omitempty"`
}

PeerCreateOrUpdateRequest - Peer params that might be used due to creation or updation process

func (*PeerCreateOrUpdateRequest) Apply

Jump to

Keyboard shortcuts

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