go-http-peering: forge.cadoles.com/wpetit/go-http-peering/client Index | Files

package client

import "forge.cadoles.com/wpetit/go-http-peering/client"

Index

Package Files

client.go option.go

Variables

var (
    ErrInvalidPrivateKey  = errors.New("invalid private key")
    ErrUnexpectedResponse = errors.New("unexpected response")
    ErrUnauthorized       = errors.New("unauthorized")
    ErrRejected           = errors.New("rejected")
    ErrInvalidServerToken = errors.New("invalid server token")
)

type Client Uses

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

func New Uses

func New(funcs ...OptionFunc) *Client

func (*Client) Advertise Uses

func (c *Client) Advertise(attrs peering.PeerAttributes) error

func (*Client) Get Uses

func (c *Client) Get(url string) (*http.Response, error)

func (*Client) PeerID Uses

func (c *Client) PeerID(serverPublicKey *rsa.PublicKey) (peering.PeerID, error)

func (*Client) Ping Uses

func (c *Client) Ping() error

func (*Client) Post Uses

func (c *Client) Post(url string, data interface{}) (*http.Response, error)

func (*Client) UpdateAttributes Uses

func (c *Client) UpdateAttributes(attrs peering.PeerAttributes) error

type HTTPClient Uses

type HTTPClient interface {
    Do(*http.Request) (*http.Response, error)
}

type OptionFunc Uses

type OptionFunc func(*Options)

func WithBaseURL Uses

func WithBaseURL(url string) OptionFunc

func WithHTTPClient Uses

func WithHTTPClient(client HTTPClient) OptionFunc

func WithPrivateKey Uses

func WithPrivateKey(pk *rsa.PrivateKey) OptionFunc

func WithServerToken Uses

func WithServerToken(token string) OptionFunc

type Options Uses

type Options struct {
    HTTPClient  HTTPClient
    BaseURL     string
    PrivateKey  *rsa.PrivateKey
    ServerToken string
}

Package client imports 11 packages (graph). Updated 2019-05-21. Refresh now. Tools for package owners.