wghost

package module
v0.0.0-...-13113db Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

README

Wghost

Copyright (C) 2020 Mohlmann Solutions SRL; tim@mohlmann.solutions

Wghost is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Development

Protocol buffers

The wghost API server uses gRPC through protocol buffers generation. To regenerate the gRPC definitions, run:

protoc --go_out=plugins=grpc:. wghost.proto

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterWgServer

func RegisterWgServer(s *grpc.Server, srv WgServer)

Types

type ConfigSuccess

type ConfigSuccess struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ConfigSuccess) Descriptor

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

func (*ConfigSuccess) ProtoMessage

func (*ConfigSuccess) ProtoMessage()

func (*ConfigSuccess) Reset

func (m *ConfigSuccess) Reset()

func (*ConfigSuccess) String

func (m *ConfigSuccess) String() string

func (*ConfigSuccess) XXX_DiscardUnknown

func (m *ConfigSuccess) XXX_DiscardUnknown()

func (*ConfigSuccess) XXX_Marshal

func (m *ConfigSuccess) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfigSuccess) XXX_Merge

func (m *ConfigSuccess) XXX_Merge(src proto.Message)

func (*ConfigSuccess) XXX_Size

func (m *ConfigSuccess) XXX_Size() int

func (*ConfigSuccess) XXX_Unmarshal

func (m *ConfigSuccess) XXX_Unmarshal(b []byte) error

type Endpoint

type Endpoint struct {
	IP                   string   `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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Endpoint) Descriptor

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

func (*Endpoint) GetIP

func (m *Endpoint) GetIP() string

func (*Endpoint) GetPort

func (m *Endpoint) GetPort() int32

func (*Endpoint) GetZone

func (m *Endpoint) GetZone() string

func (*Endpoint) ProtoMessage

func (*Endpoint) ProtoMessage()

func (*Endpoint) Reset

func (m *Endpoint) Reset()

func (*Endpoint) String

func (m *Endpoint) String() string

func (*Endpoint) XXX_DiscardUnknown

func (m *Endpoint) XXX_DiscardUnknown()

func (*Endpoint) XXX_Marshal

func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Endpoint) XXX_Merge

func (m *Endpoint) XXX_Merge(src proto.Message)

func (*Endpoint) XXX_Size

func (m *Endpoint) XXX_Size() int

func (*Endpoint) XXX_Unmarshal

func (m *Endpoint) XXX_Unmarshal(b []byte) error

type Peer

type Peer struct {
	// PublicKey is the public key of a peer, computed from its private key.
	PublicKey string `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"`
	// PresharedKey is an optional preshared key which may be used as an
	// additional layer of security for peer communications.
	PresharedKey string `protobuf:"bytes,2,opt,name=PresharedKey,proto3" json:"PresharedKey,omitempty"`
	// Endpoint is the most recent source address used for communication by
	// this Peer.
	Endpoint *Endpoint `protobuf:"bytes,3,opt,name=Endpoint,proto3" json:"Endpoint,omitempty"`
	// 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 *timestamp.Timestamp `protobuf:"bytes,4,opt,name=LastHandshakeTime,proto3" json:"LastHandshakeTime,omitempty"`
	// ReceiveBytes indicates the number of bytes received from this peer.
	ReceiveBytes int64 `protobuf:"varint,5,opt,name=ReceiveBytes,proto3" json:"ReceiveBytes,omitempty"`
	// TransmitBytes indicates the number of bytes transmitted to this peer.
	TransmitBytes int64 `protobuf:"varint,6,opt,name=TransmitBytes,proto3" json:"TransmitBytes,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 []string `protobuf:"bytes,7,rep,name=AllowedIPs,proto3" json:"AllowedIPs,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,8,opt,name=ProtocolVersion,proto3" json:"ProtocolVersion,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Peer) Descriptor

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

func (*Peer) GetAllowedIPs

func (m *Peer) GetAllowedIPs() []string

func (*Peer) GetEndpoint

func (m *Peer) GetEndpoint() *Endpoint

func (*Peer) GetLastHandshakeTime

func (m *Peer) GetLastHandshakeTime() *timestamp.Timestamp

func (*Peer) GetPresharedKey

func (m *Peer) GetPresharedKey() string

func (*Peer) GetProtocolVersion

func (m *Peer) GetProtocolVersion() int32

func (*Peer) GetPublicKey

func (m *Peer) GetPublicKey() string

func (*Peer) GetReceiveBytes

func (m *Peer) GetReceiveBytes() int64

func (*Peer) GetTransmitBytes

func (m *Peer) GetTransmitBytes() int64

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) Reset

func (m *Peer) Reset()

func (*Peer) String

func (m *Peer) String() string

func (*Peer) XXX_DiscardUnknown

func (m *Peer) XXX_DiscardUnknown()

func (*Peer) XXX_Marshal

func (m *Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Peer) XXX_Merge

func (m *Peer) XXX_Merge(src proto.Message)

func (*Peer) XXX_Size

func (m *Peer) XXX_Size() int

func (*Peer) XXX_Unmarshal

func (m *Peer) XXX_Unmarshal(b []byte) error

type PeerConfig

type PeerConfig struct {
	// PublicKey is the public key of a peer, computed from its private key.
	PublicKey string `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"`
	// PresharedKey is an optional preshared key which may be used as an
	// additional layer of security for peer communications.
	PresharedKey string `protobuf:"bytes,2,opt,name=PresharedKey,proto3" json:"PresharedKey,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           []string `protobuf:"bytes,3,rep,name=AllowedIPs,proto3" json:"AllowedIPs,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerConfig) Descriptor

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

func (*PeerConfig) GetAllowedIPs

func (m *PeerConfig) GetAllowedIPs() []string

func (*PeerConfig) GetPresharedKey

func (m *PeerConfig) GetPresharedKey() string

func (*PeerConfig) GetPublicKey

func (m *PeerConfig) GetPublicKey() string

func (*PeerConfig) ProtoMessage

func (*PeerConfig) ProtoMessage()

func (*PeerConfig) Reset

func (m *PeerConfig) Reset()

func (*PeerConfig) String

func (m *PeerConfig) String() string

func (*PeerConfig) XXX_DiscardUnknown

func (m *PeerConfig) XXX_DiscardUnknown()

func (*PeerConfig) XXX_Marshal

func (m *PeerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerConfig) XXX_Merge

func (m *PeerConfig) XXX_Merge(src proto.Message)

func (*PeerConfig) XXX_Size

func (m *PeerConfig) XXX_Size() int

func (*PeerConfig) XXX_Unmarshal

func (m *PeerConfig) XXX_Unmarshal(b []byte) error

type PeerConfigList

type PeerConfigList struct {
	// 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,1,opt,name=ReplacePeers,proto3" json:"ReplacePeers,omitempty"`
	// Peers specifies a list of peer configurations to apply to a device.
	Peers                []*PeerConfig `protobuf:"bytes,2,rep,name=Peers,proto3" json:"Peers,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*PeerConfigList) Descriptor

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

func (*PeerConfigList) GetPeers

func (m *PeerConfigList) GetPeers() []*PeerConfig

func (*PeerConfigList) GetReplacePeers

func (m *PeerConfigList) GetReplacePeers() bool

func (*PeerConfigList) ProtoMessage

func (*PeerConfigList) ProtoMessage()

func (*PeerConfigList) Reset

func (m *PeerConfigList) Reset()

func (*PeerConfigList) String

func (m *PeerConfigList) String() string

func (*PeerConfigList) XXX_DiscardUnknown

func (m *PeerConfigList) XXX_DiscardUnknown()

func (*PeerConfigList) XXX_Marshal

func (m *PeerConfigList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerConfigList) XXX_Merge

func (m *PeerConfigList) XXX_Merge(src proto.Message)

func (*PeerConfigList) XXX_Size

func (m *PeerConfigList) XXX_Size() int

func (*PeerConfigList) XXX_Unmarshal

func (m *PeerConfigList) XXX_Unmarshal(b []byte) error

type PeerList

type PeerList struct {
	Peers                []*Peer  `protobuf:"bytes,1,rep,name=Peers,proto3" json:"Peers,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerList) Descriptor

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

func (*PeerList) GetPeers

func (m *PeerList) GetPeers() []*Peer

func (*PeerList) ProtoMessage

func (*PeerList) ProtoMessage()

func (*PeerList) Reset

func (m *PeerList) Reset()

func (*PeerList) String

func (m *PeerList) String() string

func (*PeerList) XXX_DiscardUnknown

func (m *PeerList) XXX_DiscardUnknown()

func (*PeerList) XXX_Marshal

func (m *PeerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerList) XXX_Merge

func (m *PeerList) XXX_Merge(src proto.Message)

func (*PeerList) XXX_Size

func (m *PeerList) XXX_Size() int

func (*PeerList) XXX_Unmarshal

func (m *PeerList) XXX_Unmarshal(b []byte) error

type PeerListQuery

type PeerListQuery struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerListQuery) Descriptor

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

func (*PeerListQuery) ProtoMessage

func (*PeerListQuery) ProtoMessage()

func (*PeerListQuery) Reset

func (m *PeerListQuery) Reset()

func (*PeerListQuery) String

func (m *PeerListQuery) String() string

func (*PeerListQuery) XXX_DiscardUnknown

func (m *PeerListQuery) XXX_DiscardUnknown()

func (*PeerListQuery) XXX_Marshal

func (m *PeerListQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerListQuery) XXX_Merge

func (m *PeerListQuery) XXX_Merge(src proto.Message)

func (*PeerListQuery) XXX_Size

func (m *PeerListQuery) XXX_Size() int

func (*PeerListQuery) XXX_Unmarshal

func (m *PeerListQuery) XXX_Unmarshal(b []byte) error

type PeerQuery

type PeerQuery struct {
	// PublicKey is the public key of a peer, computed from its private key.
	PublicKey            string   `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerQuery) Descriptor

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

func (*PeerQuery) GetPublicKey

func (m *PeerQuery) GetPublicKey() string

func (*PeerQuery) ProtoMessage

func (*PeerQuery) ProtoMessage()

func (*PeerQuery) Reset

func (m *PeerQuery) Reset()

func (*PeerQuery) String

func (m *PeerQuery) String() string

func (*PeerQuery) XXX_DiscardUnknown

func (m *PeerQuery) XXX_DiscardUnknown()

func (*PeerQuery) XXX_Marshal

func (m *PeerQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerQuery) XXX_Merge

func (m *PeerQuery) XXX_Merge(src proto.Message)

func (*PeerQuery) XXX_Size

func (m *PeerQuery) XXX_Size() int

func (*PeerQuery) XXX_Unmarshal

func (m *PeerQuery) XXX_Unmarshal(b []byte) error

type UnimplementedWgServer

type UnimplementedWgServer struct {
}

UnimplementedWgServer can be embedded to have forward compatible implementations.

func (*UnimplementedWgServer) AddPeer

func (*UnimplementedWgServer) GetPeer

func (*UnimplementedWgServer) GetPeer(ctx context.Context, req *PeerQuery) (*Peer, error)

func (*UnimplementedWgServer) ListPeers

func (*UnimplementedWgServer) SetPeers

type WgClient

type WgClient interface {
	AddPeer(ctx context.Context, in *PeerConfig, opts ...grpc.CallOption) (*ConfigSuccess, error)
	SetPeers(ctx context.Context, in *PeerConfigList, opts ...grpc.CallOption) (*ConfigSuccess, error)
	GetPeer(ctx context.Context, in *PeerQuery, opts ...grpc.CallOption) (*Peer, error)
	ListPeers(ctx context.Context, in *PeerListQuery, opts ...grpc.CallOption) (*PeerList, error)
}

WgClient is the client API for Wg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewWgClient

func NewWgClient(cc *grpc.ClientConn) WgClient

type WgServer

type WgServer interface {
	AddPeer(context.Context, *PeerConfig) (*ConfigSuccess, error)
	SetPeers(context.Context, *PeerConfigList) (*ConfigSuccess, error)
	GetPeer(context.Context, *PeerQuery) (*Peer, error)
	ListPeers(context.Context, *PeerListQuery) (*PeerList, error)
}

WgServer is the server API for Wg service.

Directories

Path Synopsis
cmd
wghost command
internal
adapt
Package adapt is used for morphing wgtypes into gRPC message types.
Package adapt is used for morphing wgtypes into gRPC message types.

Jump to

Keyboard shortcuts

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