Documentation ¶
Overview ¶
Package rendezvous provides a client for magic wormhole rendezvous servers.
Index ¶
- type Client
- func (c *Client) AddMessage(ctx context.Context, phase, body string) error
- func (c *Client) AttachMailbox(ctx context.Context, nameplate string) error
- func (c *Client) Close(ctx context.Context, mood Mood) error
- func (c *Client) Connect(ctx context.Context) (*ConnectInfo, error)
- func (c *Client) CreateMailbox(ctx context.Context) (string, error)
- func (c *Client) ListNameplates(ctx context.Context) ([]string, error)
- func (c *Client) MsgChan(ctx context.Context) <-chan MailboxEvent
- type ClientOption
- type ConnectInfo
- type MailboxEvent
- type Mood
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(url, sideID, appID string, opts ...ClientOption) *Client
NewClient returns a Rendezvous client. URL is the websocket url of Rendezvous server. SideID is the id for the client to use to distinguish messages in a mailbox from the other client. AppID is the application identity string of the client.
Two clients can only communicate if they have the same AppID.
func (*Client) AddMessage ¶
AddMessage adds a message to the opened mailbox. This must be called after either CreateMailbox or AttachMailbox.
func (*Client) AttachMailbox ¶
AttachMailbox opens an existing mailbox and releases the associated nameplate.
func (*Client) Connect ¶
func (c *Client) Connect(ctx context.Context) (*ConnectInfo, error)
Connect opens a connection and binds to the rendezvous server. It returns the Welcome information the server responds with.
func (*Client) CreateMailbox ¶
CreateMailbox allocates a nameplate, claims it, and then opens the associated mailbox. It returns the nameplate id string.
func (*Client) ListNameplates ¶
ListNameplates returns a list of active nameplates on the rendezvous server.
type ClientOption ¶ added in v1.0.1
type ClientOption interface {
// contains filtered or unexported methods
}
func WithVersion ¶ added in v1.0.1
func WithVersion(agentID string, version string) ClientOption
WithVersion returns a ClientOption to override the default client identifier and version reported to the rendezvous server.