model

package
v0.0.0-...-ad02071 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Id          string     `json:"id"          bson:"id"`
	Parent      string     `json:"parent"      bson:"parent"`
	Email       string     `json:"email"       bson:"email"`
	Name        string     `json:"name"        bson:"name"`
	AccountName string     `json:"accountName" bson:"accountName"`
	NetId       string     `json:"netId"       bson:"netId"`
	NetName     string     `json:"netName"     bson:"netName"`
	Picture     string     `json:"picture"     bson:"picture"`
	Role        string     `json:"role"        bson:"role"`
	Status      string     `json:"status"      bson:"status"`
	ApiKey      string     `json:"apiKey"      bson:"apiKey"`
	CreatedBy   string     `json:"createdBy"   bson:"createdBy"`
	UpdatedBy   string     `json:"updatedBy"   bson:"updatedBy"`
	Created     time.Time  `json:"created"     bson:"created"`
	Updated     time.Time  `json:"updated"     bson:"updated"`
	Networks    []*Network `json:"networks"    bson:"networks"`
	VPNs        []*VPN     `json:"vpns"        bson:"vpns"`
	Devices     []*Device  `json:"devices"     bson:"devices"`
}

func (Account) IsValid

func (a Account) IsValid() []error

IsValid check if model is valid

type AgentNotification

type AgentNotification struct {
	Type string `json:"type" bson:"type"`
	Text string `json:"text" bson:"text"`
}

AgentNotification structure type: dns, info, error text: message

type Auth

type Auth struct {
	Oauth2   bool   `json:"oauth2"`
	ClientId string `json:"clientId"`
	Code     string `json:"code"`
	State    string `json:"state"`
	CodeUrl  string `json:"codeUrl"`
	Redirect string `json:"redirect_uri"`
	Audience string `json:"audience"`
}

Auth structure

type Authentication

type Authentication interface {
	Setup() error
	CodeUrl(state string) string
	CodeUrl2(state string) string
	Exchange(code string) (*oauth2.Token, error)
	Exchange2(code string) (*oauth2.Token, error)
	UserInfo(oauth2Token *oauth2.Token) (*User, error)
}

Auth interface to implement as auth provider

type Device

type Device struct {
	Id            string     `json:"id"                        bson:"id"`
	Server        string     `json:"server"                    bson:"server"`
	ApiKey        string     `json:"apiKey"                    bson:"apiKey"`
	AccountID     string     `json:"accountid"                 bson:"accountid"`
	Name          string     `json:"name"                      bson:"name"`
	Description   string     `json:"description"               bson:"description"`
	Type          string     `json:"type,omitempty"            bson:"type,omitempty"`
	Enable        bool       `json:"enable"                    bson:"enable"`
	Tags          []string   `json:"tags"                      bson:"tags"`
	Platform      string     `json:"platform"                  bson:"platform"`
	OS            string     `json:"os"                        bson:"os"`
	Architecture  string     `json:"arch"                      bson:"arch"`
	ClientID      string     `json:"clientid,omitempty"        bson:"clientid,omitempty"`
	AuthDomain    string     `json:"authdomain,omitempty"      bson:"authdomain,omitempty"`
	ApiID         string     `json:"apiid,omitempty"           bson:"apiid,omitempty"`
	AppData       string     `json:"appdata,omitempty"         bson:"appdata,omitempty"`
	CheckInterval int64      `json:"checkInterval"             bson:"checkInterval"`
	ServiceGroup  string     `json:"serviceGroup,omitempty"    bson:"serviceGroup,omitempty"`
	ServiceApiKey string     `json:"serviceApiKey,omitempty"   bson:"serviceApiKey,omitempty"`
	SourceAddress string     `json:"sourceAddress,omitempty"   bson:"sourceAddress,omitempty"`
	Debug         bool       `json:"debug,omitempty"           bson:"debug,omitempty"`
	Quiet         bool       `json:"quiet,omitempty"           bson:"quiet,omitempty"`
	Registered    bool       `json:"registered"                bson:"registered"`
	UpdateKeys    bool       `json:"updateKeys"                bson:"updateKeys"`
	Version       string     `json:"version"                   bson:"version"`
	InstanceID    string     `json:"instanceid,omitempty"      bson:"instanceid,omitempty"`
	EZCode        string     `json:"ezcode,omitempty"          bson:"ezcode,omitempty"`
	CreatedBy     string     `json:"createdBy"                 bson:"createdBy"`
	UpdatedBy     string     `json:"updatedBy"                 bson:"updatedBy"`
	Created       time.Time  `json:"created"                   bson:"created"`
	Updated       time.Time  `json:"updated"                   bson:"updated"`
	LastSeen      *time.Time `json:"lastSeen,omitempty"        bson:"lastSeen,omitempty"`
	VPNs          []*VPN     `json:"vpns,omitempty"            bson:"vpns,omitempty"`
}

Device structure swagger:model Device Defines the device model

func (Device) IsValid

func (a Device) IsValid() []error

IsValid check if model is valid

type Limits

type Limits struct {
	Id          string    `json:"id"                        bson:"id"`
	AccountID   string    `json:"accountid"                 bson:"accountid"`
	Devices     int       `json:"devices"                   bson:"devices"`
	MaxDevices  int       `json:"maxdevices"                bson:"maxdevices"`
	Networks    int       `json:"networks"                  bson:"networks"`
	MaxNetworks int       `json:"maxnetworks"               bson:"maxnetworks"`
	Members     int       `json:"members"                   bson:"members"`
	MaxMembers  int       `json:"maxmembers"                bson:"maxmembers"`
	Services    int       `json:"services"                  bson:"services"`
	MaxServices int       `json:"maxservices"               bson:"maxservices"`
	Tolerance   float64   `json:"tolerance"                 bson:"tolerance"`
	CreatedBy   string    `json:"createdBy"                 bson:"createdBy"`
	UpdatedBy   string    `json:"updatedBy"                 bson:"updatedBy"`
	Created     time.Time `json:"created"                   bson:"created"`
	Updated     time.Time `json:"updated"                   bson:"updated"`
}

func (Limits) DevicesLimitReached

func (l Limits) DevicesLimitReached(count int) bool

func (Limits) IsValid

func (a Limits) IsValid() []error

IsValid check if model is valid

func (Limits) MembersLimitReached

func (l Limits) MembersLimitReached(count int) bool

func (Limits) NetworksLimitReached

func (l Limits) NetworksLimitReached(count int) bool

func (Limits) RelaysLimitReached

func (l Limits) RelaysLimitReached(count int) bool

type Message

type Message struct {
	Id     string      `json:"id"       bson:"id"`
	Device *Device     `json:"device"   bson:"device"`
	Config []VPNConfig `json:"config"   bson:"config"`
}

Host structure

type Network

type Network struct {
	Id          string     `json:"id"          bson:"id"`
	AccountID   string     `json:"accountid"   bson:"accountid"`
	NetName     string     `json:"netName"     bson:"netName"`
	Description string     `json:"description" bson:"description"`
	Tags        []string   `json:"tags"        bson:"tags"`
	CreatedBy   string     `json:"createdBy"   bson:"createdBy"`
	UpdatedBy   string     `json:"updatedBy"   bson:"updatedBy"`
	Created     *time.Time `json:"created"     bson:"created"`
	Updated     *time.Time `json:"updated"     bson:"updated"`
	ForceUpdate bool       `json:"forceUpdate" bson:"forceUpdate"`
	Critical    bool       `json:"critical"    bson:"critical"`
	Policies    Policies   `json:"policies"    bson:"policies"`
	Default     *Settings  `json:"default"     bson:"default"`
}

Network structure

func (Network) IsValid

func (a Network) IsValid() []error

IsValid check if model is valid

type OAuth2Token

type OAuth2Token struct {
	AccessToken  string `json:"access_token"`
	IdToken      string `json:"id_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Expiry       string `json:"expiry,omitempty"`
}

type Policies

type Policies struct {
	UserEndpoints bool `json:"userEndpoints" bson:"userEndpoints"`
	OnlyEndpoints bool `json:"onlyEndpoints" bson:"onlyEndpoints"`
}

type Server

type Server struct {
	Id            string `json:"id"            bson:"id"`
	Name          string `json:"name"          bson:"name"`
	Description   string `json:"description"   bson:"description"`
	IpAddress     string `json:"ipAddress"     bson:"ipAddress"`
	PortMin       int    `json:"portMin"       bson:"portMin"`
	PortMax       int    `json:"portMax"       bson:"portMax"`
	ServiceGroup  string `json:"serviceGroup"  bson:"serviceGroup"`
	ServiceApiKey string `json:"serviceApiKey" bson:"serviceApiKey"`
	DefaultSubnet string `json:"defaultSubnet" bson:"defaultSubnet"`
}

Server structure

func (Server) IsValid

func (a Server) IsValid() []error

IsValid check if model is valid

type Service

type Service struct {
	Id             string    `json:"id"             bson:"id"`
	ServiceGroup   string    `json:"serviceGroup"   bson:"serviceGroup"`
	ApiKey         string    `json:"apikey"         bson:"apikey"`
	AccountID      string    `json:"accountid"      bson:"accountid"`
	Email          string    `json:"email"          bson:"email"`
	SubscriptionId string    `json:"subscriptionid" bson:"subscriptionid"`
	Created        time.Time `json:"created"        bson:"created"`
	Updated        time.Time `json:"updated"        bson:"updated"`
	CreatedBy      string    `json:"createdBy"      bson:"createdBy"`
	UpdatedBy      string    `json:"updatedBy"      bson:"updatedBy"`
	Device         *Device   `json:"device"         bson:"device"`
	Net            *Network  `json:"net"            bson:"net"`
	VPN            *VPN      `json:"vpn"            bson:"vpn"`
	ContainerId    string    `json:"containerid"    bson:"containerid"`
	Status         string    `json:"status"         bson:"status"`
	IpAddress      string    `json:"ipAddress"      bson:"ipAddress"`
	Name           string    `json:"name"           bson:"name"`
	Description    string    `json:"description"    bson:"description"`
	ServiceType    string    `json:"serviceType"    bson:"serviceType"`
	ServicePort    int       `json:"servicePort"    bson:"servicePort"`
	DefaultSubnet  string    `json:"defaultSubnet"  bson:"defaultSubnet"`
}

Net structure

func (Service) IsValid

func (s Service) IsValid() []error

IsValid check if model is valid

type ServiceMessage

type ServiceMessage struct {
	Id     string    `json:"id"       bson:"id"`
	Config []Service `json:"config"   bson:"config"`
}

type Settings

type Settings struct {
	PrivateKey          string   `json:"privateKey"                bson:"privateKey"`
	PublicKey           string   `json:"publicKey"                 bson:"publicKey"`
	PresharedKey        string   `json:"presharedKey"              bson:"presharedKey"`
	AllowedIPs          []string `json:"allowedIPs"                bson:"allowedIPs"`
	Address             []string `json:"address"                   bson:"address"`
	Dns                 []string `json:"dns"                       bson:"dns"`
	Table               string   `json:"table,omitempty"           bson:"table,omitempty"`
	PersistentKeepalive int      `json:"persistentKeepalive"       bson:"persistentKeepalive"`
	ListenPort          int      `json:"listenPort"                bson:"listenPort"`
	Endpoint            string   `json:"endpoint"                  bson:"endpoint"`
	Mtu                 int      `json:"mtu"                       bson:"mtu"`
	SubnetRouting       bool     `json:"subnetRouting,omitempty"   bson:"subnetRouting,omitempty"`
	UPnP                bool     `json:"upnp,omitempty"            bson:"upnp,omitempty"`
	SyncEndpoint        bool     `json:"syncEndpoint,omitempty"    bson:"syncEndpoint,omitempty"`
	FailSafe            bool     `json:"failsafe,omitempty"        bson:"failsafe,omitempty"`
	EnableDns           bool     `json:"enableDns,omitempty"       bson:"enableDns,omitempty"`
	HasSSH              bool     `json:"hasSSH,omitempty"          bson:"hasSSH,omitempty"`
	HasRDP              bool     `json:"hasRDP,omitempty"          bson:"hasRDP,omitempty"`
	PreUp               string   `json:"preUp,omitempty"           bson:"preUp,omitempty"`
	PostUp              string   `json:"postUp,omitempty"          bson:"postUp,omitempty"`
	PreDown             string   `json:"preDown,omitempty"         bson:"preDown,omitempty"`
	PostDown            string   `json:"postDown,omitempty"        bson:"postDown,omitempty"`
}

Host structure

func (Settings) IsValid

func (a Settings) IsValid() []error

IsValid check if model is valid

type StatusResponse

type StatusResponse struct {
	Status  int    `json:"status" bson:"status"`
	Message string `json:"message" bson:"message"`
}

type Subscription

type Subscription struct {
	Id          string     `json:"id"          bson:"id"`
	AccountID   string     `json:"accountid"   bson:"accountid"`
	Email       string     `json:"email"       bson:"email"`
	Name        string     `json:"name"        bson:"name"`
	Description string     `json:"description" bson:"description"`
	Issued      *time.Time `json:"issued"      bson:"issued"`
	Expires     *time.Time `json:"expires"     bson:"expires"`
	LastUpdated *time.Time `json:"lastUpdated" bson:"lastUpdated"`
	CreatedBy   string     `json:"createdBy"   bson:"createdBy"`
	UpdatedBy   string     `json:"updatedBy"   bson:"updatedBy"`
	Status      string     `json:"status"      bson:"status"`
	Sku         string     `json:"sku"         bson:"sku"`
	Credits     int        `json:"credits"     bson:"credits"`
	AutoRenew   bool       `json:"autoRenew"   bson:"autoRenew"`
}

Net structure

func (Subscription) IsValid

func (s Subscription) IsValid() []error

IsValid check if model is valid

type User

type User struct {
	Sub       string    `json:"sub"          bson:"sub"`
	Name      string    `json:"name"         bson:"name"`
	Email     string    `json:"email"        bson:"email"`
	AccountID string    `json:"accountid"    bson:"accountid"`
	Profile   string    `json:"profile"      bson:"profile"`
	Picture   string    `json:"picture"      bson:"picture"`
	Issuer    string    `json:"issuer"       bson:"issuer"`
	Plan      string    `json:"plan"         bson:"plan"`
	IssuedAt  time.Time `json:"issuedAt"     bson:"issuedAt"`
	CreatedBy string    `json:"createdBy"    bson:"createdBy"`
	Created   time.Time `json:"created_at"   bson:"created_at"`
	UpdatedBy string    `json:"updatedBy"    bson:"updatedBy"`
	Updated   time.Time `json:"updated_at"   bson:"updated_at"`
}

User structure

func (User) IsValid

func (a User) IsValid() []error

IsValid check if model is valid

type VPN

type VPN struct {
	Id        string     `json:"id"                        bson:"id"`
	AccountID string     `json:"accountid"                 bson:"accountid"`
	DeviceID  string     `json:"deviceid"                  bson:"deviceid"`
	Name      string     `json:"name"                      bson:"name"`
	NetId     string     `json:"netid"                     bson:"netid"`
	NetName   string     `json:"netName"                   bson:"netName"`
	Role      string     `json:"role,omitempty"            bson:"role,omitempty"`
	Type      string     `json:"type,omitempty"            bson:"type,omitempty"`
	Failover  int        `json:"failover"                  bson:"failover"`
	FailCount int        `json:"failCount"                 bson:"failCount"`
	Enable    bool       `json:"enable"                    bson:"enable"`
	Tags      []string   `json:"tags"                      bson:"tags"`
	CreatedBy string     `json:"createdBy"                 bson:"createdBy"`
	UpdatedBy string     `json:"updatedBy"                 bson:"updatedBy"`
	Created   *time.Time `json:"created"                   bson:"created"`
	Updated   *time.Time `json:"updated"                   bson:"updated"`
	Current   *Settings  `json:"current,omitempty"         bson:"current,omitempty"`
	Default   *Settings  `json:"default,omitempty"         bson:"default,omitempty"`
	Devices   []*Device  `json:"devices,omitempty"         bson:"devices,omitempty"`
}

VPN structure

func (VPN) IsValid

func (a VPN) IsValid() []error

IsValid check if model is valid

type VPNConfig

type VPNConfig struct {
	NetName string `json:"netName"  bson:"netName"`
	NetId   string `json:"netid"    bson:"netid"`
	VPNs    []VPN  `json:"vpns"     bson:"vpns"`
}

Peer structure

Jump to

Keyboard shortcuts

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