guard

package
v0.0.0-...-c935f35 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Guard

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

func CreateGuard

func CreateGuard(conf config.Config, wg *wgctrl.Client, redisConn redis.Conn) *Guard

func (*Guard) CleanupPeers

func (guard *Guard) CleanupPeers() error

func (*Guard) DeletePeer

func (guard *Guard) DeletePeer(uuid string) (err error)

func (*Guard) DeleteRedisPeer

func (guard *Guard) DeleteRedisPeer(uuid string, publicKey string) error

func (*Guard) FormatUpdateStorage

func (guard *Guard) FormatUpdateStorage(oldStorage map[string]string, newStorage map[string]interface{}) (storage map[string]string)

func (*Guard) GetGroupPeers

func (guard *Guard) GetGroupPeers(group string) (peers map[string]*Peer, err error)

func (*Guard) GetPeers

func (guard *Guard) GetPeers() (peers map[string]*Peer, err error)

func (*Guard) GetRedisPeer

func (guard *Guard) GetRedisPeer(id string) (*RedisPeer, error)

func (*Guard) GetRedisPeerGroup

func (guard *Guard) GetRedisPeerGroup(group string) (peers []string, err error)

func (*Guard) GetRedisPeerMap

func (guard *Guard) GetRedisPeerMap() (peers map[string]string, err error)

func (*Guard) GetWgPeer

func (guard *Guard) GetWgPeer(id string) (*Peer, error)

func (*Guard) SetPeer

func (guard *Guard) SetPeer(peer *Peer) (err error)

func (*Guard) SetRedisPeer

func (guard *Guard) SetRedisPeer(peer *RedisPeer) error

func (*Guard) UpdatePeer

func (guard *Guard) UpdatePeer(peer *Peer) (err error)

type Peer

type Peer struct {
	Uuid          string `json:"uuid"`
	Group         string `json:"group"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	PublicKey     string
	AllowedIPs    []net.IPNet       `json:"allowedIPs"`
	KeepAlive     time.Duration     `json:"keepAlive"`
	LastHandshake time.Time         `json:"lastSeen"`
	LastEndpoint  string            `json:"lastExternalIp"`
	Storage       map[string]string `json:"storage"`
}

func CreatePeer

func CreatePeer(publicKey, group, name, description string, keepAlive time.Duration, allowedIPs []net.IPNet, storage map[string]string) *Peer

type RedisPeer

type RedisPeer struct {
	Uuid        string
	Group       string
	Name        string
	Description string
	PublicKey   string
	Storage     map[string]string
}

func CreateRedisPeer

func CreateRedisPeer(publicKey, group, name, description string, storage map[string]string) *RedisPeer

Jump to

Keyboard shortcuts

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