structs

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ACLTokenTypeClient ...
	ACLTokenTypeClient = "client"

	// ACLTokenTypeManagement ...
	ACLTokenTypeManagement = "management"
)
View Source
const (
	NodeStatusInit  = "initializing"
	NodeStatusReady = "ready"
	NodeStatusDown  = "down"
)

Variables

View Source
var (
	// ErrPermissionDenied :
	ErrPermissionDenied = errors.New(errPermissionDenied)

	// ErrACLAlreadyBootstrapped ...
	ErrACLAlreadyBootstrapped = errors.New(errACLAlreadyBootstrapped)

	// ErrACLDisabled ...
	ErrACLDisabled = errors.New(errACLDisabled)

	// ErrInternal ...
	ErrInternal = errors.New(errInternal)

	// ErrInvalidInput ...
	ErrInvalidInput = errors.New(errInvalidInput)

	// ErrNotFound ...
	ErrNotFound = errors.New(errNotFound)
)

Functions

func IsValidNodeStatus

func IsValidNodeStatus(s string) bool

IsValidNodeStatus returns true if the status passed as argument corresponds to a valid node status. Otherwise returns false.

func NewError

func NewError(base error, extra ...interface{}) error

NewError ...

func NewInternalError

func NewInternalError(msg string) error

func NewInvalidInputError

func NewInvalidInputError(msg string) error

func Validate

func Validate(s interface{}) error

Validate validates a struct/DTO, returning an error in case its attributes are not compliant with the allowed values.

Types

type ACLBootstrapRequest

type ACLBootstrapRequest struct {
	ResetIndex uint64

	WriteRequest
}

ACLBootstrapRequest :

type ACLPolicy

type ACLPolicy struct {
	Name        string
	Description string
	Rules       []*ACLPolicyRule
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

ACLPolicy contains a composition of subpolicies for each resource exposed by Drago. It can be assigned to an ACL Token and, according to the capabilities within each subpolicy, gives different levels of access to these resources.

func (*ACLPolicy) Merge

func (p *ACLPolicy) Merge(in *ACLPolicy) *ACLPolicy

func (*ACLPolicy) Stub

func (p *ACLPolicy) Stub() *ACLPolicyListStub

Stub :

func (*ACLPolicy) Validate

func (p *ACLPolicy) Validate() error

type ACLPolicyDeleteRequest

type ACLPolicyDeleteRequest struct {
	// Name contains the name of the policy to be deleted.
	Names []string

	WriteRequest
}

ACLPolicyDeleteRequest :

type ACLPolicyListRequest

type ACLPolicyListRequest struct {
	QueryOptions
}

ACLPolicyListRequest :

type ACLPolicyListResponse

type ACLPolicyListResponse struct {
	Response

	// Items contains the policies found.
	Items []*ACLPolicyListStub
}

ACLPolicyListResponse :

type ACLPolicyListStub

type ACLPolicyListStub struct {
	Name        string
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

ACLPolicyListStub :

type ACLPolicyRule

type ACLPolicyRule struct {
	Resource     string
	Path         string
	Capabilities []string
}

ACLPolicyRule ...

type ACLPolicySpecificRequest

type ACLPolicySpecificRequest struct {
	// Name contains the name of the policy to be retrieved.
	Name string

	QueryOptions
}

ACLPolicySpecificRequest :

type ACLPolicyUpsertRequest

type ACLPolicyUpsertRequest struct {
	ACLPolicy *ACLPolicy

	WriteRequest
}

ACLPolicyUpsertRequest :

type ACLState

type ACLState struct {
	RootTokenID         string
	RootTokenResetIndex int
}

ACLState ...

func (*ACLState) Update

func (s *ACLState) Update(rootID string) error

Update ...

type ACLToken

type ACLToken struct {
	ID        string
	Type      string
	Name      string
	Secret    string
	Policies  []string
	CreatedAt time.Time
	UpdatedAt time.Time
}

ACLToken :

func (*ACLToken) Merge

func (t *ACLToken) Merge(in *ACLToken) *ACLToken

Merge :

func (*ACLToken) Stub

func (t *ACLToken) Stub() *ACLTokenListStub

Stub :

func (*ACLToken) Validate

func (t *ACLToken) Validate() error

type ACLTokenDeleteRequest

type ACLTokenDeleteRequest struct {
	ACLTokenIDs []string

	WriteRequest
}

ACLTokenDeleteRequest :

type ACLTokenListRequest

type ACLTokenListRequest struct {
	QueryOptions
}

ACLTokenListRequest :

type ACLTokenListResponse

type ACLTokenListResponse struct {
	Items []*ACLTokenListStub

	Response
}

ACLTokenListResponse :

type ACLTokenListStub

type ACLTokenListStub struct {
	ID        string
	Name      string
	Type      string
	Policies  []string
	CreatedAt time.Time
	UpdatedAt time.Time
}

ACLTokenListStub :

type ACLTokenSpecificRequest

type ACLTokenSpecificRequest struct {
	ACLTokenID string

	QueryOptions
}

ACLTokenSpecificRequest :

type ACLTokenUpsertRequest

type ACLTokenUpsertRequest struct {
	ACLToken *ACLToken

	WriteRequest
}

ACLTokenUpsertRequest :

type ACLTokenUpsertResponse

type ACLTokenUpsertResponse struct {
	ACLToken *ACLToken

	Response
}

ACLTokenUpsertResponse :

type Agent

type Agent struct {
	Config map[string]interface{}
	Stats  map[string]map[string]string
}

Agent :

type Connection

type Connection struct {
	ID        string
	NetworkID string

	// PeerSettings contains the ID and the configurations to be applied
	// to each of the connected interfaces.
	PeerSettings []*PeerSettings

	// If the connection is going from a NAT-ed peer to a public peer,
	// the node behind the NAT must regularly send an outgoing ping to
	// keep the bidirectional connection alive in the NAT router's
	// connection table.
	PersistentKeepalive *int

	CreatedAt time.Time
	UpdatedAt time.Time
}

Connection :

func (*Connection) ConnectedInterfaceIDs

func (c *Connection) ConnectedInterfaceIDs() []string

ConnectedInterfaceIDs :

func (*Connection) ConnectedNodeIDs

func (c *Connection) ConnectedNodeIDs() []string

ConnectedNodeIDs :

func (*Connection) ConnectsInterface

func (c *Connection) ConnectsInterface(s string) bool

ConnectsInterface : checks whether a connection connects an interface whose index is passed as argument.

func (*Connection) ConnectsInterfaces

func (c *Connection) ConnectsInterfaces(a, b string) bool

ConnectsInterfaces : checks whether a Connection connects two interfaces whose indices are passed as arguments.

func (*Connection) Merge

func (c *Connection) Merge(in *Connection) *Connection

Merge :

func (*Connection) OtherPeerSettingsByInterfaceID

func (c *Connection) OtherPeerSettingsByInterfaceID(s string) *PeerSettings

OtherPeerSettingsByInterfaceID : given the ID of one of the connected interfaces, returns the settings for the peer/interface at the other end of the connection.

func (*Connection) PeerSettingsByInterfaceID

func (c *Connection) PeerSettingsByInterfaceID(s string) *PeerSettings

PeerSettingsByInterfaceID :

func (*Connection) PeerSettingsByNodeID

func (c *Connection) PeerSettingsByNodeID(s string) *PeerSettings

PeerSettingsByNodeID :

func (*Connection) Stub

func (c *Connection) Stub() *ConnectionListStub

Stub :

func (*Connection) Validate

func (c *Connection) Validate() error

Validate :

type ConnectionDeleteRequest

type ConnectionDeleteRequest struct {
	ConnectionIDs []string

	WriteRequest
}

ConnectionDeleteRequest :

type ConnectionListRequest

type ConnectionListRequest struct {
	InterfaceID string
	NodeID      string
	NetworkID   string

	QueryOptions
}

ConnectionListRequest :

type ConnectionListResponse

type ConnectionListResponse struct {
	Items []*ConnectionListStub

	Response
}

ConnectionListResponse :

type ConnectionListStub

type ConnectionListStub struct {
	ID                  string
	NetworkID           string
	NodeIDs             []string
	Peers               []string
	PeerSettings        []*PeerSettings
	PersistentKeepalive *int
	BytesTransferred    uint64
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

ConnectionListStub :

type ConnectionSpecificRequest

type ConnectionSpecificRequest struct {
	ConnectionID string

	QueryOptions
}

ConnectionSpecificRequest :

type ConnectionUpsertRequest

type ConnectionUpsertRequest struct {
	Connection *Connection

	WriteRequest
}

ConnectionUpsertRequest :

type Error

type Error struct {
	Message string
}

Error :

func (Error) Error

func (e Error) Error() string

type Filters

type Filters map[string][]string

func (Filters) Add

func (f Filters) Add(k, v string)

func (Filters) Get

func (f Filters) Get(k string) []string

type GenericRequest

type GenericRequest struct {
	QueryOptions
}

GenericRequest is used to request where no specific information is needed.

type GenericResponse

type GenericResponse struct {
	Response
}

GenericResponse is used to respond to a request where no specific response information is needed.

type Interface

type Interface struct {
	ID          string
	NodeID      string
	NetworkID   string
	Name        *string
	Address     *string
	ListenPort  *int
	PublicKey   *string
	Peers       []*Peer
	Connections []string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	// contains filtered or unexported fields
}

func (*Interface) Merge

func (i *Interface) Merge(in *Interface) *Interface

Merge :

func (*Interface) RemoveConnection

func (i *Interface) RemoveConnection(id string)

RemoveConnection :

func (*Interface) Stub

func (i *Interface) Stub() *InterfaceListStub

Stub :

func (*Interface) UpsertConnection

func (i *Interface) UpsertConnection(id string)

UpsertConnection :

func (*Interface) Validate

func (i *Interface) Validate() error

Validate : validate interface fields

type InterfaceDeleteRequest

type InterfaceDeleteRequest struct {
	InterfaceIDs []string

	WriteRequest
}

InterfaceDeleteRequest :

type InterfaceListRequest

type InterfaceListRequest struct {
	NodeID    string
	NetworkID string

	QueryOptions
}

InterfaceListRequest :

type InterfaceListResponse

type InterfaceListResponse struct {
	Items []*InterfaceListStub

	Response
}

InterfaceListResponse :

type InterfaceListStub

type InterfaceListStub struct {
	ID               string
	NodeID           string
	NetworkID        string
	Name             *string
	Address          *string
	ListenPort       *int
	ConnectionsCount int
	PublicKey        *string
	HasPublicKey     bool
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

InterfaceListStub :

type InterfaceSpecificRequest

type InterfaceSpecificRequest struct {
	InterfaceID string

	QueryOptions
}

InterfaceSpecificRequest :

type InterfaceUpsertRequest

type InterfaceUpsertRequest struct {
	Interface *Interface

	WriteRequest
}

InterfaceUpsertRequest :

type Network

type Network struct {
	ID           string
	Name         string
	AddressRange string
	Interfaces   []string
	Connections  []string
	CreatedAt    time.Time
	UpdatedAt    time.Time
	// contains filtered or unexported fields
}

Network :

func (*Network) CheckAddressInRange

func (n *Network) CheckAddressInRange(ip string) error

CheckAddressInRange : Check whether an IP address in CIDR notation is within the allowed range of the network.

func (*Network) Merge

func (n *Network) Merge(in *Network) *Network

Merge :

func (*Network) RemoveConnection

func (n *Network) RemoveConnection(id string)

RemoveConnection :

func (*Network) RemoveInterface

func (n *Network) RemoveInterface(id string)

RemoveInterface :

func (*Network) Stub

func (n *Network) Stub() *NetworkListStub

Stub :

func (*Network) UpsertConnection

func (n *Network) UpsertConnection(id string)

UpsertConnection :

func (*Network) UpsertInterface

func (n *Network) UpsertInterface(id string)

UpsertInterface :

func (*Network) Validate

func (n *Network) Validate() error

Validate :

type NetworkDeleteRequest

type NetworkDeleteRequest struct {
	NetworkIDs []string

	WriteRequest
}

NetworkDeleteRequest :

type NetworkListRequest

type NetworkListRequest struct {
	QueryOptions
}

NetworkListRequest :

type NetworkListResponse

type NetworkListResponse struct {
	Items []*NetworkListStub

	Response
}

NetworkListResponse :

type NetworkListStub

type NetworkListStub struct {
	ID               string
	Name             string
	AddressRange     string
	InterfacesCount  int
	ConnectionsCount int
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

NetworkListStub :

type NetworkSpecificRequest

type NetworkSpecificRequest struct {
	NetworkID string

	QueryOptions
}

NetworkSpecificRequest :

type NetworkUpsertRequest

type NetworkUpsertRequest struct {
	Network *Network

	WriteRequest
}

NetworkUpsertRequest :

type Node

type Node struct {
	ID               string
	SecretID         string
	Name             string
	AdvertiseAddress string
	Status           string
	Interfaces       []string
	Connections      []string
	Meta             map[string]string
	CreatedAt        time.Time
	UpdatedAt        time.Time
	// contains filtered or unexported fields
}

Node :

func (*Node) Merge

func (n *Node) Merge(in *Node) *Node

Merge :

func (*Node) RemoveConnection

func (n *Node) RemoveConnection(id string)

RemoveConnection :

func (*Node) RemoveInterface

func (n *Node) RemoveInterface(id string)

RemoveInterface :

func (*Node) Stub

func (n *Node) Stub() *NodeListStub

Stub :

func (*Node) UpsertConnection

func (n *Node) UpsertConnection(id string)

UpsertConnection :

func (*Node) UpsertInterface

func (n *Node) UpsertInterface(id string)

UpsertInterface :

func (*Node) Validate

func (n *Node) Validate() error

Validate validates a structs.Node object

type NodeInterfaceUpdateRequest

type NodeInterfaceUpdateRequest struct {
	NodeID     string
	Interfaces []*Interface

	WriteRequest
}

NodeInterfaceUpdateRequest :

type NodeInterfacesResponse

type NodeInterfacesResponse struct {
	Items []*Interface

	Response
}

NodeInterfacesResponse :

type NodeJoinNetworkRequest

type NodeJoinNetworkRequest struct {
	NodeID    string
	NetworkID string

	WriteRequest
}

NodeJoinNetworkRequest :

type NodeLeaveNetworkRequest

type NodeLeaveNetworkRequest struct {
	NodeID    string
	NetworkID string

	WriteRequest
}

NodeLeaveNetworkRequest :

type NodeListRequest

type NodeListRequest struct {
	QueryOptions
}

NodeListRequest :

type NodeListResponse

type NodeListResponse struct {
	Items []*NodeListStub

	Response
}

NodeListResponse :

type NodeListStub

type NodeListStub struct {
	ID               string
	Name             string
	AdvertiseAddress string
	Status           string
	InterfacesCount  int
	ConnectionsCount int
	Meta             map[string]string
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

NodeListStub :

type NodePreregisterRequest

type NodePreregisterRequest struct {
	Node *Node

	WriteRequest
}

NodePreregisterRequest :

type NodePreregisterResponse

type NodePreregisterResponse struct {
	Node *Node

	Response
}

NodePreregisterResponse :

type NodeRegisterRequest

type NodeRegisterRequest struct {
	Node *Node

	WriteRequest
}

NodeRegisterRequest :

func (*NodeRegisterRequest) Validate

func (r *NodeRegisterRequest) Validate() error

Validate validates a structs.NodeRegisterRequest

type NodeSpecificRequest

type NodeSpecificRequest struct {
	NodeID   string
	SecretID string

	QueryOptions
}

NodeSpecificRequest :

type NodeUpdateResponse

type NodeUpdateResponse struct {
	Servers []string

	Response
}

NodeUpdateResponse is used to update nodes

type NodeUpdateStatusRequest

type NodeUpdateStatusRequest struct {
	NodeID           string
	Status           string
	AdvertiseAddress string
	Meta             map[string]string
	WriteRequest
}

NodeUpdateStatusRequest :

type Peer

type Peer struct {
	PublicKey           *string
	Address             *string
	Port                *int
	AllowedIPs          []string
	PersistentKeepalive *int
}

type PeerSettings

type PeerSettings struct {
	NodeID       string
	InterfaceID  string
	RoutingRules *RoutingRules
}

PeerSettings :

func (*PeerSettings) Merge

func (r *PeerSettings) Merge(in *PeerSettings) *PeerSettings

Merge :

type QueryOptions

type QueryOptions struct {
	AuthToken string
	Filters   Filters
}

QueryOptions contains information that is common to all read requests.

type ResolveACLTokenRequest

type ResolveACLTokenRequest struct {
	Secret string

	QueryOptions
}

ResolveACLTokenRequest :

type ResolveACLTokenResponse

type ResolveACLTokenResponse struct {
	ACLToken *ACLToken

	Response
}

ResolveACLTokenResponse :

type Response

type Response struct {
}

Response contains information that is common to all responses.

type RoutingRules

type RoutingRules struct {
	// AllowedIPs defines the IP ranges for which traffic will be routed/accepted.
	// Example: If AllowedIPs = [192.0.2.3/32, 192.168.1.1/24], the node
	// will accept traffic for itself (192.0.2.3/32), and for all nodes in the
	// local network (192.168.1.1/24).
	AllowedIPs []string
}

RoutingRules :

func (*RoutingRules) Merge

func (r *RoutingRules) Merge(in *RoutingRules) *RoutingRules

Merge :

type SingleACLPolicyResponse

type SingleACLPolicyResponse struct {
	ACLPolicy *ACLPolicy

	Response
}

SingleACLPolicyResponse :

type SingleACLTokenResponse

type SingleACLTokenResponse struct {
	ACLToken *ACLToken

	Response
}

SingleACLTokenResponse :

type SingleConnectionResponse

type SingleConnectionResponse struct {
	Connection *Connection

	Response
}

SingleConnectionResponse :

type SingleInterfaceResponse

type SingleInterfaceResponse struct {
	Interface *Interface

	Response
}

SingleInterfaceResponse :

type SingleNetworkResponse

type SingleNetworkResponse struct {
	Network *Network

	Response
}

SingleNetworkResponse :

type SingleNodeResponse

type SingleNodeResponse struct {
	Node *Node

	Response
}

SingleNodeResponse :

type StatusVersionResponse

type StatusVersionResponse struct {
	Version string

	QueryOptions
}

StatusVersionResponse ...

type WriteRequest

type WriteRequest struct {
	AuthToken string
}

WriteRequest contains information that is common to all write requests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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