Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) AuthClient(user, pass string) error
- func (c *Client) ConnChange(connCh chan *ConnChangeResult) (*rpc.ClientSubscription, error)
- func (c *Client) GetEndpoint(key string) (*data.Endpoint, error)
- func (c *Client) ServiceReady(key string) error
- func (c *Client) SetProductConfig(config map[string]string) error
- func (c *Client) StartSession(trustedIP, key string, port uint16) (*data.Offering, error)
- func (c *Client) StopSession(key string) error
- func (c *Client) UpdateSession(key string, units uint64) error
- type ConnChangeResult
- type Handler
- func (h *Handler) AuthClient(product, productPassword, clientKey, clientPassword string) error
- func (h *Handler) ConnChange(ctx context.Context, product, productPassword string) (*rpc.Subscription, error)
- func (h *Handler) GetEndpoint(product, productPassword, clientKey string) (*data.Endpoint, error)
- func (h *Handler) ServiceReady(product, productPassword, clientKey string) error
- func (h *Handler) SetProductConfig(product, productPassword string, config map[string]string) error
- func (h *Handler) StartSession(product, productPassword, clientKey, ip string, port uint16) (*data.Offering, error)
- func (h *Handler) StopSession(product, productPassword, clientKey string) error
- func (h *Handler) UpdateSession(product, productPassword, clientKey string, units uint64) error
Constants ¶
const ( // CRC16("github.com/privatix/dappctrl/sess") = 0x12DD ErrAccessDenied errors.Error = 0x12DD<<8 + iota ErrChannelNotFound ErrBadClientPassword ErrInternal ErrNonActiveChannel ErrSessionNotFound ErrEndpointNotFound ErrBadProductConfig )
Errors.
const ( ConnStart = "start" ConnStop = "stop" )
Adapter connection statuses.
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 (*Client) AuthClient ¶ added in v0.22.0
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
GetEndpoint finds endpoint by key.
func (*Client) ServiceReady ¶ added in v0.23.0
ServiceReady sends signal that service is ready.
func (*Client) SetProductConfig ¶ added in v0.22.0
SetProductConfig sets product config.
func (*Client) StartSession ¶ added in v0.22.0
StartSession start session.
func (*Client) StopSession ¶ added in v0.23.0
StopSession 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 ¶
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 ¶
GetEndpoint returns an endpoint for a given client key.
func (*Handler) ServiceReady ¶ added in v0.23.0
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
StopSession stops current client session.