Help us shape the future of Go! Take the 2026 Go Developer Survey

sess

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CRC16("github.com/privatix/dappctrl/sess") = 0x12DD
	ErrAccessDenied errors.Error = 0x12DD<<8 + iota
	ErrChannelNotFound
	ErrBadClientPassword
	ErrInternal
	ErrNonActiveChannel
	ErrSessionNotFound
	ErrEndpointNotFound
	ErrBadProductConfig
)

Errors.

View Source
const (
	ConnStart = "start"
	ConnStop  = "stop"
)

Adapter connection statuses.

View Source
const ProductExternalIP = "externalIP"

ProductExternalIP is a configuration key for external IP address.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.22.0

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

Client is an adapter on top of rpc client to talk to session server.

func Dial added in v0.22.0

func Dial(ctx context.Context, endpoint, origin, product, password string) (*Client, error)

Dial returns client with established connection to session server.

func (*Client) AuthClient added in v0.22.0

func (c *Client) AuthClient(user, pass string) error

AuthClient verifies user credentials.

func (*Client) ConnChange added in v0.22.0

func (c *Client) ConnChange(connCh chan *ConnChangeResult) (*rpc.ClientSubscription, error)

ConnChange subscribes to connection changes.

func (*Client) GetEndpoint added in v0.22.0

func (c *Client) GetEndpoint(key string) (*data.Endpoint, error)

GetEndpoint finds endpoint by key.

func (*Client) ServiceReady added in v0.23.0

func (c *Client) ServiceReady(key string) error

ServiceReady sends signal that service is ready.

func (*Client) SetProductConfig added in v0.22.0

func (c *Client) SetProductConfig(config map[string]string) error

SetProductConfig sets product config.

func (*Client) StartSession added in v0.22.0

func (c *Client) StartSession(trustedIP, key string, port uint16) (*data.Offering, error)

StartSession start session.

func (*Client) StopSession added in v0.23.0

func (c *Client) StopSession(key string) error

StopSession updates session.

func (*Client) UpdateSession added in v0.22.0

func (c *Client) UpdateSession(key string, units uint64) error

UpdateSession updates session.

type ConnChangeResult

type ConnChangeResult struct {
	Channel string `json:"channel,omitempty"`
	Status  string `json:"command,omitempty"`
}

ConnChangeResult is an ConnChange notification result.

type Handler

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

Handler is a session RPC handler.

func NewHandler

func NewHandler(logger log.Logger, db *reform.DB,
	countryConf *country.Config, queue job.Queue) *Handler

NewHandler creates a new session handler.

func (*Handler) AuthClient

func (h *Handler) AuthClient(product, productPassword,
	clientKey, clientPassword string) error

AuthClient verifies password for a given client key.

func (*Handler) ConnChange

func (h *Handler) ConnChange(ctx context.Context,
	product, productPassword string) (*rpc.Subscription, error)

ConnChange subscribes to changes for adapter connection changes.

func (*Handler) GetEndpoint

func (h *Handler) GetEndpoint(
	product, productPassword, clientKey string) (*data.Endpoint, error)

GetEndpoint returns an endpoint for a given client key.

func (*Handler) ServiceReady added in v0.23.0

func (h *Handler) ServiceReady(product, productPassword, clientKey string) error

ServiceReady signals that service is ready to recieve connections. For agents only.

func (*Handler) SetProductConfig

func (h *Handler) SetProductConfig(
	product, productPassword string, config map[string]string) error

SetProductConfig sets product configuration.

func (*Handler) StartSession

func (h *Handler) StartSession(product, productPassword,
	clientKey, ip string, port uint16) (*data.Offering, error)

StartSession creates a new client session.

func (*Handler) StopSession added in v0.23.0

func (h *Handler) StopSession(product, productPassword, clientKey string) error

StopSession stops current client session.

func (*Handler) UpdateSession

func (h *Handler) UpdateSession(product, productPassword, clientKey string,
	units uint64) error

UpdateSession updates current client session.

Jump to

Keyboard shortcuts

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