Documentation ¶
Overview ¶
Package client provides discovery service client.
Index ¶
- func GRPCDialOptions(options Options) []grpc.DialOption
- type Affiliate
- type Client
- func (client *Client) DeleteLocalAffiliate()
- func (client *Client) GetAffiliates() []*Affiliate
- func (client *Client) GetPublicIP() []byte
- func (client *Client) Run(ctx context.Context, logger *zap.Logger, notifyCh chan<- struct{}) error
- func (client *Client) SetLocalData(localAffiliate *Affiliate, otherEndpoints []Endpoint) error
- type Endpoint
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCDialOptions ¶ added in v0.1.9
func GRPCDialOptions(options Options) []grpc.DialOption
GRPCDialOptions returns gRPC dial options for the given client options.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps all details related to discovery service interaction.
Inputs for the client are: * Affiliate protobuf structure (for the node itself) * Additional endpoints discovered for other nodes (affiliates)
Outputs are: * list of Affiliates (except for the node itself) * channel which notifies when list of Affiliates changes
Client handles encryption of the data.
func (*Client) DeleteLocalAffiliate ¶
func (client *Client) DeleteLocalAffiliate()
DeleteLocalAffiliate marks local affiliate for deletion.
Actual deletion happens on the next update in the Run loop.
func (*Client) GetAffiliates ¶
GetAffiliates returns discovered affiliates.
func (*Client) GetPublicIP ¶ added in v0.1.3
GetPublicIP returns client's discovered public IP.
type Options ¶
type Options struct { // Cipher, should have 32-bytes (128-bit key). Cipher cipher.Block // gRPC initial endpoint. Endpoint string // ClusterID of the client. ClusterID string // AffiliateID of the client. AffiliateID string // ClientVersion for the Hello request. ClientVersion string // TTL for the submitted data. TTL time.Duration // Insecure gRPC connection (only for testing) Insecure bool }
Options configures the client.