mycsnode

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	Node userspace.SpaceNode

	// x-auth-key header
	AuthIDKey string

	// authenticated rest client for
	// api requests
	RestApiClient *rest.RestApiClient
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(
	refName, refID,
	clientIDKey,
	clientRSAKeyPEM string,
	node userspace.SpaceNode,
	authPath string,
) (*ApiClient, error)

func NewUninitializedApiClient

func NewUninitializedApiClient(
	refName, refID,
	authPath string,
) *ApiClient

func (*ApiClient) AuthCallback

func (a *ApiClient) AuthCallback() (time.Duration, error)

func (*ApiClient) AuthTokenKey

func (a *ApiClient) AuthTokenKey() string

func (*ApiClient) Authenticate

func (a *ApiClient) Authenticate() (bool, error)

func (*ApiClient) Crypt

func (a *ApiClient) Crypt() (*crypto.Crypt, *sync.Mutex)

func (*ApiClient) GetNode

func (a *ApiClient) GetNode() userspace.SpaceNode

func (*ApiClient) Initialize

func (a *ApiClient) Initialize(
	clientIDKey string,
	clientRSAKey *crypto.RSAKey,
	node userspace.SpaceNode,
) error

func (*ApiClient) IsAuthenticated

func (a *ApiClient) IsAuthenticated() bool

func (*ApiClient) IsRunning

func (a *ApiClient) IsRunning() bool

func (*ApiClient) Reset

func (a *ApiClient) Reset()

func (*ApiClient) Start

func (a *ApiClient) Start() error

func (*ApiClient) Stop

func (a *ApiClient) Stop()

func (*ApiClient) WaitForAuth

func (a *ApiClient) WaitForAuth() bool

type AuthReqKey

type AuthReqKey struct {
	RefID   string `json:"refID"`
	ECDHKey string `json:"ecdhKey"`
	Nonce   int64  `json:"nonce"`
}

type AuthRequest

type AuthRequest struct {
	AuthReqIDKey string `json:"authReqIDKey"`
	AuthReqKey   string `json:"authReqKey"`
}

type AuthRespKey

type AuthRespKey struct {
	NodeECDHKey string `json:"nodeECDHKey"`
	Nonce       int64  `json:"nonce"`
	TimeoutAt   int64  `json:"timeoutAt"`
	RefName     string `json:"refName"`
}

type AuthResponse

type AuthResponse struct {
	AuthRespIDKey string `json:"authRespIDKey"`
	AuthRespKey   string `json:"authRespKey"`
}

type CreateMeshAuthKeyReq

type CreateMeshAuthKeyReq struct {
	ExpiresIn int64 `json:"expiresIn,omitempty"`
}

type CreateMeshAuthKeyResp

type CreateMeshAuthKeyResp struct {
	AuthKey     string   `json:"authKey,omitempty"`
	DNS         []string `json:"dns,omitempty"`
	SpaceNode   TSNode   `json:"space_node,omitempty"`
	DeviceNodes []TSNode `json:"device_nodes,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	ErrorCode    int    `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

type TSNode

type TSNode struct {
	Name      string   `json:"name,omitempty"`
	IP        string   `json:"ip,omitempty"`
	Endpoints []string `json:"endpoints,omitempty"`
	Routes    []string `json:"routes,omitempty"`
}

Jump to

Keyboard shortcuts

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