database

package
v0.0.0-...-144c93b Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("object not found")
	ErrInUse    = fmt.Errorf("object is in use")
)
View Source
var EmptyRoute = &DNSRoute{
	ID:        "0",
	NetworkID: "none",
}

Functions

This section is empty.

Types

type Client

type Client struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Address string `json:"address"`
}

type ClientDatabase

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

func (*ClientDatabase) Delete

func (d *ClientDatabase) Delete(ctx context.Context, id string) error

func (*ClientDatabase) Get

func (d *ClientDatabase) Get(ctx context.Context, id string) (*Client, error)

func (*ClientDatabase) List

func (d *ClientDatabase) List(ctx context.Context) ([]*Client, error)

func (*ClientDatabase) Put

func (d *ClientDatabase) Put(ctx context.Context, client *Client) (*Client, error)

func (*ClientDatabase) Update

func (d *ClientDatabase) Update(ctx context.Context, client *Client) error

type ClientNetwork

type ClientNetwork struct {
	ClientID  string `json:"client_id"`
	NetworkID string `json:"network_id"`
}

type ClientNetworkDatabase

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

func (*ClientNetworkDatabase) Delete

func (d *ClientNetworkDatabase) Delete(ctx context.Context, id string) error

func (*ClientNetworkDatabase) Get

func (*ClientNetworkDatabase) List

func (*ClientNetworkDatabase) Put

func (*ClientNetworkDatabase) Update

type Config

type Config struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Host     string `json:"host"`
	UserCred string `json:"user_cred,omitempty"`
	PassCred string `json:"pass_cred,omitempty"`
	CACred   string `json:"ca_cred,omitempty"`
	OVPNCred string `json:"ovpn_cred,omitempty"`
}

type ConfigDatabase

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

func (*ConfigDatabase) Delete

func (d *ConfigDatabase) Delete(ctx context.Context, id string) error

func (*ConfigDatabase) Get

func (d *ConfigDatabase) Get(ctx context.Context, id string) (*Config, error)

func (*ConfigDatabase) List

func (d *ConfigDatabase) List(ctx context.Context) ([]*Config, error)

func (*ConfigDatabase) Put

func (d *ConfigDatabase) Put(ctx context.Context, cfg *Config) (*Config, error)

func (*ConfigDatabase) Update

func (d *ConfigDatabase) Update(ctx context.Context, cfg *Config) error

type Credential

type Credential struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Value string `json:"value,omitempty"`
}

type CredentialDatabase

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

func (*CredentialDatabase) Delete

func (d *CredentialDatabase) Delete(ctx context.Context, id string) error

func (*CredentialDatabase) Get

func (*CredentialDatabase) List

func (d *CredentialDatabase) List(ctx context.Context) ([]*Credential, error)

func (*CredentialDatabase) Put

func (d *CredentialDatabase) Put(ctx context.Context, name, value string) (*Credential, error)

func (*CredentialDatabase) Update

func (d *CredentialDatabase) Update(ctx context.Context, cred *Credential) error

type DNSDatabase

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

func (*DNSDatabase) Delete

func (d *DNSDatabase) Delete(ctx context.Context) error

func (*DNSDatabase) Get

func (d *DNSDatabase) Get(ctx context.Context) (*DNSRoute, error)

func (*DNSDatabase) Put

func (d *DNSDatabase) Put(ctx context.Context, route *DNSRoute) (*DNSRoute, error)

func (*DNSDatabase) Update

func (d *DNSDatabase) Update(ctx context.Context, route *DNSRoute) error

type DNSRoute

type DNSRoute struct {
	ID        string `json:"-"`
	NetworkID string `json:"network_id"`
}

type Database

type Database struct {
	Credentials    *CredentialDatabase
	Configs        *ConfigDatabase
	Networks       *NetworkDatabase
	Clients        *ClientDatabase
	ClientNetworks *ClientNetworkDatabase
	DNS            *DNSDatabase
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, dbPath string) (*Database, error)

type Network

type Network struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	ConfigID string `json:"config_id"`
}

type NetworkDatabase

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

func (*NetworkDatabase) Delete

func (d *NetworkDatabase) Delete(ctx context.Context, id string) error

func (*NetworkDatabase) Get

func (d *NetworkDatabase) Get(ctx context.Context, id string) (*Network, error)

func (*NetworkDatabase) List

func (d *NetworkDatabase) List(ctx context.Context) ([]*Network, error)

func (*NetworkDatabase) Put

func (d *NetworkDatabase) Put(ctx context.Context, net *Network) (*Network, error)

func (*NetworkDatabase) Update

func (d *NetworkDatabase) Update(ctx context.Context, net *Network) error

Jump to

Keyboard shortcuts

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