core

package
v0.0.0-...-851e5e8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package core provides Go HTTP client for interacting with Core API a.k.a. NordVPN API

Index

Constants

View Source
const (
	Online      = "online"
	Offline     = "offline"
	Maintenance = "maintenance"
)
View Source
const (
	HeaderDigest = "x-digest"

	// CDNURL is the url for NordCDN
	CDNURL = "https://downloads.nordcdn.com"

	// InsightsURL defines url to get information about ip
	// Used by JobInsights every 30mins to set the user country
	InsightsURL = "/v1/helpers/ips/insights"

	// PlanURL defines endpoint to fetch plans
	PlanURL = "/v1/plans?filters[plans.active]=1&filters[plans.type]=linux"

	// ServersURL defines url to get servers list
	// Used as a fallback if /v1/servers/recommendations returns
	// an empty list or a http error
	ServersURL = "/v1/servers"

	// ServersCountriesURL defines url to get servers countries list
	// Used by JobCountries every 6h to populate /var/lib/nordvpn/data/countries.dat
	ServersCountriesURL = ServersURL + "/countries"

	// RecommendedServersURL defines url for recommended servers list
	RecommendedServersURL = ServersURL + "/recommendations"

	// UsersURL defines url to create a new user
	UsersURL = "/v1/users"

	// TokensURL defines url to get user token
	TokensURL = UsersURL + "/tokens" // #nosec

	// ServicesURL defines url to check user's current/expired services
	ServicesURL = UsersURL + "/services"

	// CredentialsURL defines url to generate openvpn credentials
	CredentialsURL = ServicesURL + "/credentials"

	// CurrentUserURL defines url to check user's metadata
	CurrentUserURL = UsersURL + "/current"

	// TokenRenewURL defines url to renew user's token
	TokenRenewURL = UsersURL + "/tokens/renew" // #nosec

	// ServersURLConnectQuery is all servers query optimized
	// for minimal dm size required
	// to create servers maps and calculate their penalty scores
	// so instead of downloading 15mb we download 1.5mb
	// and when connecting, download all info about specific server
	//
	// no problems with this logic so far
	ServersURLConnectQuery = "?limit=1073741824" +
		"&filters[servers.status]=online" +
		"&fields[servers.id]" +
		"&fields[servers.name]" +
		"&fields[servers.hostname]" +
		"&fields[servers.station]" +
		"&fields[servers.status]" +
		"&fields[servers.load]" +
		"&fields[servers.created_at]" +
		"&fields[servers.groups.id]" +
		"&fields[servers.groups.title]" +
		"&fields[servers.technologies.id]" +
		"&fields[servers.technologies.metadata]" +
		"&fields[servers.technologies.pivot.status]" +
		"&fields[servers.specifications.identifier]" +
		"&fields[servers.specifications.values.value]" +
		"&fields[servers.locations.country.name]" +
		"&fields[servers.locations.country.code]" +
		"&fields[servers.locations.country.city.name]" +
		"&fields[servers.locations.country.city.latitude]" +
		"&fields[servers.locations.country.city.longitude]" +
		"&fields[servers.locations.country.city.hub_score]" +
		"&fields[servers.ips]"

	RecommendedServersURLConnectQuery = "?limit=%d" +
		"&filters[servers.status]=online" +
		"&filters[servers_technologies]=%d" +
		"&filters[servers_technologies][pivot][status]=online" +
		"&fields[servers.id]" +
		"&fields[servers.name]" +
		"&fields[servers.hostname]" +
		"&fields[servers.station]" +
		"&fields[servers.status]" +
		"&fields[servers.load]" +
		"&fields[servers.created_at]" +
		"&fields[servers.groups.id]" +
		"&fields[servers.groups.title]" +
		"&fields[servers.technologies.id]" +
		"&fields[servers.technologies.metadata]" +
		"&fields[servers.technologies.pivot.status]" +
		"&fields[servers.specifications.identifier]" +
		"&fields[servers.specifications.values.value]" +
		"&fields[servers.locations.country.name]" +
		"&fields[servers.locations.country.code]" +
		"&fields[servers.locations.country.city.name]" +
		"&fields[servers.locations.country.city.latitude]" +
		"&fields[servers.locations.country.city.longitude]" +
		"&coordinates[longitude]=%f&coordinates[latitude]=%f" +
		"&fields[servers.ips]"

	RecommendedServersCountryFilter = "&filters[country_id]=%d"
	RecommendedServersCityFilter    = "&filters[country_city_id]=%d"
	RecommendedServersGroupsFilter  = "&filters[servers_groups]=%d"

	// ServersURLSpecificQuery defines query params for a specific server
	ServersURLSpecificQuery = "?filters[servers.id]=%d"

	// DebFileinfoURLFormat is the path to debian repository's package information
	DebFileinfoURLFormat = "/deb/%s/debian/dists/stable/main/binary-%s/Packages.gz"

	// RpmRepoMdURLFormat is the path to rpm repository's information
	RpmRepoMdURLFormat = "/yum/%s/centos/%s/repodata/%s"

	// RpmRepoMdURL is the path to rpm repository's information file
	RpmRepoMdURL = "/repomd.xml"

	// RepoTypeProduction defines production repo type
	RepoTypeProduction = "nordvpn"

	// RepoTypeTest defines non-production (qa, development) repo type
	RepoTypeTest = "nordvpn-test"
)

Variables

View Source
var (
	// ErrBadRequest is returned for 400 HTTP responses.
	ErrBadRequest = errors.New(http.StatusText(http.StatusBadRequest))
	// ErrMaximumDeviceCount is returned for some of the 400 HTTP responses.
	ErrMaximumDeviceCount = errors.New("maximum device count reached")
	// error codes returned for meshnet nicknames, when 400 HTTP responses
	ErrRateLimitReach            = errors.New("reach max allowed nickname changes for a week")
	ErrNicknameTooLong           = errors.New("nickname is too long")
	ErrDuplicateNickname         = errors.New("nickname already exist")
	ErrContainsForbiddenWord     = errors.New("nickname contains forbidden word")
	ErrInvalidPrefixOrSuffix     = errors.New("nickname contains invalid prefix or suffix")
	ErrNicknameWithDoubleHyphens = errors.New("nickname contains double hyphens")
	ErrContainsInvalidChars      = errors.New("nickname contains invalid characters")

	// ErrUnauthorized is returned for 401 HTTP responses.
	ErrUnauthorized = errors.New(http.StatusText(http.StatusUnauthorized))
	// ErrForbidden is returned for 403 HTTP responses.
	ErrForbidden = errors.New(http.StatusText(http.StatusForbidden))
	// ErrNotFound is returned for 404 HTTP responses.
	ErrNotFound = errors.New(http.StatusText(http.StatusNotFound))
	// ErrConflict is returned for 409 HTTP responses.
	ErrConflict = errors.New(http.StatusText(http.StatusConflict))
	// ErrTooManyRequests is returned for 429 HTTP responses.
	ErrTooManyRequests = errors.New(http.StatusText(http.StatusTooManyRequests))
	// ErrServerInternal is returned for 500 HTTP responses.
	ErrServerInternal = errors.New(http.StatusText(http.StatusInternalServerError))
)
View Source
var (
	// ErrPublicKeyNotProvided is returned when peer does not have a public key set.
	ErrPublicKeyNotProvided = errors.New("public key not provided")
	// ErrPeerOSNotProvided is returned when peer does not have os name or os version set.
	ErrPeerOSNotProvided = errors.New("os not provided")
	// ErrPeerEndpointsNotProvided is returned when peer has on endpoints.
	ErrPeerEndpointsNotProvided = errors.New("endpoints not provided")
)

Functions

func ByGroup

func ByGroup(s config.ServerGroup) func(Group) bool

ByGroup is a Comparison function meant for use with github.com/NordSecurity/nordvpn-linux/slices.ContainsFunc function.

func ByTag

func ByTag(tag string) func(Group) bool

ByTag is a Comparison function meant for use with github.com/NordSecurity/nordvpn-linux/slices.ContainsFunc function.

func ExtractError

func ExtractError(resp *http.Response) error

ExtractError from the response if it exists

if an error was returned, do not try to read a response again.

Types

type Authentication

type Authentication interface {
	Login() (string, error)
	Token(string) (*LoginResponse, error)
}

Authentication is responsible for verifying user's identity.

type CDN

type CDN interface {
	ThreatProtectionLite() (*NameServers, error)
	ConfigTemplate(isObfuscated bool, method string) (http.Header, []byte, error)
}

CDN provides methods to interact with Nord's Content Delivery Network

type CDNAPI

type CDNAPI struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCDNAPI

func NewCDNAPI(
	agent string,
	baseURL string,
	client *http.Client,
	validator response.Validator,
) *CDNAPI

func (*CDNAPI) ConfigTemplate

func (api *CDNAPI) ConfigTemplate(isObfuscated bool, method string) (http.Header, []byte, error)

func (*CDNAPI) ThreatProtectionLite

func (api *CDNAPI) ThreatProtectionLite() (*NameServers, error)

type CDNAPIResponse

type CDNAPIResponse struct {
	Headers http.Header
	Body    io.ReadCloser
}

type Cities

type Cities []City

type City

type City struct {
	ID        int64    `json:"id"`
	Name      string   `json:"name"`
	Latitude  float64  `json:"latitude"`
	Longitude float64  `json:"longitude"`
	HubScore  *float64 `json:"hub_score"`
}

type CombinedAPI

type CombinedAPI interface {
	CredentialsAPI
	InsightsAPI
	ServersAPI
	Base() string
	Plans() (*Plans, error)
	Logout(token string) error
	CreateUser(email, password string) (*UserCreateResponse, error)
}

type Countries

type Countries []Country

type Country

type Country struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Code   string `json:"code"`
	City   `json:"city,omitempty"`
	Cities `json:"cities,omitempty"`
}

Country is a weird struct in that it is defined in two different ways by the backend. Server recommendations endpoint response has city field, while server countries endpoint response has cities field. Basically, only one of the city/cities field exists at a given time.

type CredentialsAPI

type CredentialsAPI interface {
	NotificationCredentials(token, appUserID string) (NotificationCredentialsResponse, error)
	ServiceCredentials(string) (*CredentialsResponse, error)
	TokenRenew(string) (*TokenRenewResponse, error)
	Services(string) (ServicesResponse, error)
	CurrentUser(string) (*CurrentUserResponse, error)
	DeleteToken(string) error
}

type CredentialsResponse

type CredentialsResponse struct {
	ID                 int64  `json:"id"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
	Username           string `json:"username"`
	Password           string `json:"password"`
	NordlynxPrivateKey string `json:"nordlynx_private_key"`
}

type CurrentUserResponse

type CurrentUserResponse struct {
	Username string `json:"username"`
	Email    string `json:"email"`
}

type DefaultAPI

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

func NewDefaultAPI

func NewDefaultAPI(
	agent string,
	baseURL string,
	client *http.Client,
	validator response.Validator,
) *DefaultAPI

func (*DefaultAPI) Accept

func (api *DefaultAPI) Accept(
	token string,
	self uuid.UUID,
	invitation uuid.UUID,
	doIAllowInbound bool,
	doIAllowRouting bool,
	doIAllowLocalNetwork bool,
	doIAllowFileshare bool,
) error

Accept invitation.

func (*DefaultAPI) Base

func (api *DefaultAPI) Base() string

func (*DefaultAPI) Configure

func (api *DefaultAPI) Configure(
	token string,
	id uuid.UUID,
	peerID uuid.UUID,
	peerUpdateInfo mesh.PeerUpdateRequest,
) error

Configure interaction with a specific peer.

func (*DefaultAPI) CreateUser

func (api *DefaultAPI) CreateUser(email, password string) (*UserCreateResponse, error)

CreateUser accepts email and password as arguments and creates the user

func (*DefaultAPI) CurrentUser

func (api *DefaultAPI) CurrentUser(token string) (*CurrentUserResponse, error)

CurrentUser returns metadata of current user

func (*DefaultAPI) DeleteToken

func (api *DefaultAPI) DeleteToken(token string) error

func (*DefaultAPI) Insights

func (api *DefaultAPI) Insights() (*Insights, error)

Insights returns insights about user

func (*DefaultAPI) Invite

func (api *DefaultAPI) Invite(
	token string,
	self uuid.UUID,
	email string,
	doIAllowInbound bool,
	doIAllowRouting bool,
	doIAllowLocalNetwork bool,
	doIAllowFileshare bool,
) error

Invite to mesh.

func (*DefaultAPI) List

func (api *DefaultAPI) List(token string, self uuid.UUID) (mesh.MachinePeers, error)

List peers in the mesh network for a given peer.

func (*DefaultAPI) Local

func (api *DefaultAPI) Local(token string) (mesh.Machines, error)

Local peer list.

func (*DefaultAPI) Logout

func (api *DefaultAPI) Logout(token string) error

func (*DefaultAPI) Map

func (api *DefaultAPI) Map(token string, self uuid.UUID) (*mesh.MachineMap, error)

func (*DefaultAPI) NotificationCredentials

func (api *DefaultAPI) NotificationCredentials(token, appUserID string) (NotificationCredentialsResponse, error)

NotificationCredentials retrieves the credentials for notification center appUserID

func (*DefaultAPI) NotifyNewTransfer

func (api *DefaultAPI) NotifyNewTransfer(
	token string,
	self uuid.UUID,
	peer uuid.UUID,
	fileName string,
	fileCount int,
) error

Notify peer about a new incoming transfer

func (*DefaultAPI) Plans

func (api *DefaultAPI) Plans() (*Plans, error)

func (*DefaultAPI) Received

func (api *DefaultAPI) Received(token string, self uuid.UUID) (mesh.Invitations, error)

Received invitations from other users.

func (*DefaultAPI) RecommendedServers

func (api *DefaultAPI) RecommendedServers(filter ServersFilter, longitude, latitude float64) (Servers, http.Header, error)

RecommendedServers returns recommended servers list

func (*DefaultAPI) Register

func (api *DefaultAPI) Register(token string, peer mesh.Machine) (*mesh.Machine, error)

Register peer to the mesh network.

func (*DefaultAPI) Reject

func (api *DefaultAPI) Reject(token string, self uuid.UUID, invitation uuid.UUID) error

Reject invitation.

func (*DefaultAPI) Revoke

func (api *DefaultAPI) Revoke(token string, self uuid.UUID, invitation uuid.UUID) error

Revoke invitation.

func (*DefaultAPI) Sent

func (api *DefaultAPI) Sent(token string, self uuid.UUID) (mesh.Invitations, error)

Sent invitations to other users.

func (*DefaultAPI) Server

func (api *DefaultAPI) Server(id int64) (*Server, error)

Server returns specific server

func (*DefaultAPI) Servers

func (api *DefaultAPI) Servers() (Servers, http.Header, error)

Servers returns servers list

func (*DefaultAPI) ServersCountries

func (api *DefaultAPI) ServersCountries() (Countries, http.Header, error)

ServersCountries returns server countries list

func (*DefaultAPI) ServiceCredentials

func (api *DefaultAPI) ServiceCredentials(token string) (*CredentialsResponse, error)

ServiceCredentials returns service credentials

func (*DefaultAPI) Services

func (api *DefaultAPI) Services(token string) (ServicesResponse, error)

Services returns all previously and currently used services by the user

func (*DefaultAPI) TokenRenew

func (api *DefaultAPI) TokenRenew(token string) (*TokenRenewResponse, error)

TokenRenew queries the renew token and returns new token data

func (*DefaultAPI) Unpair

func (api *DefaultAPI) Unpair(token string, self uuid.UUID, peer uuid.UUID) error

Unpair a given peer.

func (*DefaultAPI) Unregister

func (api *DefaultAPI) Unregister(token string, self uuid.UUID) error

Unregister peer from the mesh network.

func (*DefaultAPI) Update

func (api *DefaultAPI) Update(token string, id uuid.UUID, info mesh.MachineUpdateRequest) error

Update publishes new endpoints.

type Group

type Group struct {
	ID    config.ServerGroup `json:"id"`
	Title string             `json:"title"`
}

type Groups

type Groups []Group

type Insights

type Insights struct {
	CountryCode string  `json:"country_code"`
	Longitude   float64 `json:"longitude"`
	Latitude    float64 `json:"latitude"`
}

type InsightsAPI

type InsightsAPI interface {
	Insights() (*Insights, error)
}

type Location

type Location struct {
	Country `json:"country"`
}

type Locations

type Locations []Location

func (Locations) Country

func (l Locations) Country() (Country, error)

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	UserID     int64  `json:"user_id"`
	Token      string `json:"token"`
	RenewToken string `json:"renew_token"`
	ExpiresAt  string `json:"expires_at"`
	UpdatedAt  string `json:"updated_at"`
	CreatedAt  string `json:"created_at"`
	ID         int64  `json:"id"`
}

type NameServers

type NameServers struct {
	Servers []string `json:"servers"`
}

type NotificationCredentialsRequest

type NotificationCredentialsRequest struct {
	AppUserID  string `json:"app_user_uid"`
	PlatformID int    `json:"platform_id"`
}

type NotificationCredentialsResponse

type NotificationCredentialsResponse struct {
	Endpoint string `json:"endpoint"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type OAuth2

type OAuth2 struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewOAuth2

func NewOAuth2(client *http.Client, baseURL string) *OAuth2

func (*OAuth2) Login

func (o *OAuth2) Login() (string, error)

func (*OAuth2) Token

func (o *OAuth2) Token(exchangeToken string) (*LoginResponse, error)

Token to be used for further API requests.

type Pivot

type Pivot struct {
	Status Status `json:"status"`
}

type Plan

type Plan struct {
	ID         int64  `json:"id"`
	Identifier string `json:"identifier"`
	Type       string `json:"type"`
	Title      string `json:"title"`
	Cost       string `json:"cost"`
	Currency   string `json:"currency"`
}

type Plans

type Plans []Plan

type Predicate

type Predicate func(Server) bool

Predicate function used in algorithms like filter.

func IsConnectableVia

func IsConnectableVia(tech ServerTechnology) Predicate

IsConnectableVia returns true if it's possible to connect to server using a given technology.

func IsConnectableWithProtocol

func IsConnectableWithProtocol(tech config.Technology, proto config.Protocol) Predicate

IsConnectableWithProtocol behaves like IsConnectableVia, but also includes protocol.

func IsObfuscated

func IsObfuscated() Predicate

IsObfuscated returns a filter for keeping only obfuscated servers.

func IsOnline

func IsOnline() Predicate

IsOnline returns true for online servers.

type Server

type Server struct {
	ID                int64  `json:"id"`
	CreatedAt         string `json:"created_at"`
	UpdatedAt         string `json:"updated_at"`
	Name              string `json:"name"`
	Station           string `json:"station"`
	Hostname          string `json:"hostname"`
	Load              int64  `json:"load"`
	Status            Status `json:"status"`
	Locations         `json:"locations"`
	Technologies      Technologies `json:"technologies"`
	Groups            `json:"groups"`
	Specifications    []Specification  `json:"specifications"`
	Distance          float64          `json:"distance"`
	Timestamp         int64            `json:"timestamp"`
	Penalty           float64          `json:"penalty"`
	PartialPenalty    float64          `json:"partial_penalty"`
	NordLynxPublicKey string           `json:"-"`
	Keys              []string         `json:"-"`
	IPRecords         []ServerIPRecord `json:"ips"`
}

func (*Server) IPs

func (s *Server) IPs() []netip.Addr

func (*Server) IPv4

func (s *Server) IPv4() (netip.Addr, error)

func (*Server) SupportsIPv6

func (s *Server) SupportsIPv6() bool

func (*Server) UnmarshalJSON

func (s *Server) UnmarshalJSON(b []byte) error

func (*Server) Version

func (s *Server) Version() string

type ServerBy

type ServerBy int
const (
	ServerByUnknown ServerBy = iota
	ServerBySpeed
	ServerByCountry
	ServerByCity
	ServerByName
)

type ServerGroup

type ServerGroup int64

ServerGroup represents a server group type

const (
	// UndefinedGroup represents non existing server group
	UndefinedGroup ServerGroup = 0
	// DoubleVPN represents the double vpn server group
	DoubleVPN ServerGroup = 1
	// OnionOverVPN represents a OnionOverVPN server group
	OnionOverVPN ServerGroup = 3
	// UltraFastTV represents a UltraFastTV server group
	UltraFastTV ServerGroup = 5
	// AntiDDoS represents an AntiDDoS server group
	AntiDDoS ServerGroup = 7
	// DedicatedIP servers represents the Dedicated IP servers
	DedicatedIP ServerGroup = 9
	// StandardVPNServers represents a StandardVPNServers group
	StandardVPNServers ServerGroup = 11
	// NetflixUSA represents a NetflixUSA server group
	NetflixUSA ServerGroup = 13
	// P2P represents a P2P server group
	P2P ServerGroup = 15
	// Obfuscated represents an Obfuscated server group
	Obfuscated ServerGroup = 17
	// Europe servers represents the European servers
	Europe ServerGroup = 19
	// TheAmericas represents TheAmericas servers
	TheAmericas ServerGroup = 21
	// AsiaPacific represents a AsiaPacific server group
	AsiaPacific ServerGroup = 23
	// AfricaMiddleEastIndia represents a Africa, the Middle East and India server group
	AfricaMiddleEastIndia ServerGroup = 25
)

type ServerIP

type ServerIP struct {
	IP      string `json:"ip"`
	Version uint8  `json:"version"`
}

type ServerIPRecord

type ServerIPRecord struct {
	ServerIP `json:"ip"`
	Type     string `json:"type"`
}

type ServerObfuscationStatus

type ServerObfuscationStatus int

ServerObfuscationStatus is the return status of IsServerObfuscated

const (
	// ServerObfuscated status returned when server is obfuscated
	ServerObfuscated ServerObfuscationStatus = iota
	// ServerNotObfuscated status returned when server is not obfuscated
	ServerNotObfuscated
	// NotAServerName returned when server with such name has not been found
	// (there is no hostname beginning with given server tag)
	NotAServerName
)

func IsServerObfuscated

func IsServerObfuscated(servers Servers, serverTag string) ServerObfuscationStatus

IsServerObfuscated returns ServerObfuscationStatus for a given server tag

type ServerTag

type ServerTag struct {
	Action ServerBy
	ID     int64
}

type ServerTechnology

type ServerTechnology int64

ServerTechnology represents the nordvpn server technology

const (
	// Unknown is used for invalid cases
	Unknown ServerTechnology = 0
	// OpenVPNUDP represents the OpenVPN udp technology
	OpenVPNUDP ServerTechnology = 3
	// OpenVPNTCP represents the OpenVpn tcp technology
	OpenVPNTCP ServerTechnology = 5
	// Socks5 represents the socks 5 technology
	Socks5 ServerTechnology = 7
	// HTTPProxy represents the http proxy technology
	HTTPProxy ServerTechnology = 9
	// PPTP represents the pptp technology
	PPTP ServerTechnology = 11
	// L2TP represents the l2tp technology
	L2TP ServerTechnology = 13
	// OpenVPNUDPObfuscated represents the openvpn udp obfuscated technology
	OpenVPNUDPObfuscated ServerTechnology = 15
	// OpenVPNTCPObfuscated represents the openvpn tcp obfuscated technology
	OpenVPNTCPObfuscated ServerTechnology = 17
	// WireguardTech represents wireguard technology
	WireguardTech ServerTechnology = 35
)

type Servers

type Servers []Server

type ServersAPI

type ServersAPI interface {
	Servers() (Servers, http.Header, error)
	RecommendedServers(filter ServersFilter, longitude, latitude float64) (Servers, http.Header, error)
	Server(id int64) (*Server, error)
	ServersCountries() (Countries, http.Header, error)
}

type ServersFilter

type ServersFilter struct {
	Limit int
	Tech  ServerTechnology
	Group config.ServerGroup
	Tag   ServerTag
}

type Service

type Service struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type ServiceData

type ServiceData struct {
	ID        int64   `json:"ID"`
	ExpiresAt string  `json:"expires_at"`
	Service   Service `json:"service"`
}

type ServicesResponse

type ServicesResponse []ServiceData

type Specification

type Specification struct {
	Identifier string `json:"identifier"`
	Values     []struct {
		Value string `json:"value"`
	} `json:"values"`
}

type Status

type Status string

Status is used by Server and Technology to communicate availability

type Technologies

type Technologies []Technology

type Technology

type Technology struct {
	ID       ServerTechnology `json:"id"`
	Pivot    Pivot            `json:"pivot"`
	Metadata []struct {
		Name  string      `json:"name,omitempty"`
		Value interface{} `json:"value,omitempty"`
	} `json:"metadata"`
}

func (Technology) IsOnline

func (t Technology) IsOnline() bool

type TokenRenewResponse

type TokenRenewResponse struct {
	Token      string `json:"token"`
	RenewToken string `json:"renew_token"`
	ExpiresAt  string `json:"expires_at"`
}

type UserCreateRequest

type UserCreateRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UserCreateResponse

type UserCreateResponse struct {
	ID        int64  `json:"id"`
	Email     string `json:"email"`
	Username  string `json:"username"`
	ExpiresAt string `json:"password_expires_at"`
	CreateAt  string `json:"create_at"`
	UpdatedAt string `json:"updated_at"`
}

Directories

Path Synopsis
Package mesh implements mesh related data structure conversions.
Package mesh implements mesh related data structure conversions.

Jump to

Keyboard shortcuts

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