bdclient

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadAuth = errors.New("access denied")

ErrBadAuth indicates incorrect credentials

Functions

This section is empty.

Types

type BridgeInfo

type BridgeInfo struct {
	Cookie   []byte
	Host     string
	LastSeen time.Time
}

BridgeInfo describes a bridge

type Client

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

Client represents a binder client.

func NewClient

func NewClient(frontDomain, realDomain, useragent string) *Client

NewClient creates a new domain-fronting binder client with the given frontDomain and realDomain. frontDomain should start with `https://`.

func (*Client) AddBridge

func (cl *Client) AddBridge(secret string, cookie []byte, host string, allocGroup string) (err error)

AddBridge uploads some bridge info.

func (*Client) GetBridges

func (cl *Client) GetBridges(ubmsg, ubsig []byte) (bridges []BridgeInfo, err error)

GetBridges obtains a set of bridges.

func (*Client) GetClientInfo

func (cl *Client) GetClientInfo() (ui ClientInfo, err error)

GetClientInfo checks user info

func (*Client) GetEphBridges added in v0.17.0

func (cl *Client) GetEphBridges(ubmsg []byte, ubsig []byte, exit string) (bridges []BridgeInfo, err error)

GetEphBridges obtains a set of ephemeral e2e bridges.

func (*Client) GetTicket

func (cl *Client) GetTicket(username, password string) (ubmsg, ubsig []byte, details TicketResp, err error)

GetTicket obtains an authentication ticket.

func (*Client) GetTicketKey

func (cl *Client) GetTicketKey(tier string) (tkey *rsa.PublicKey, err error)

GetTicketKey obtains the remote ticketing key. TODO caching, gossip?

func (*Client) GetTier

func (cl *Client) GetTier(username, password string) (tier string, err error)

GetTier gets the tier of a user.

func (*Client) GetWarpfronts added in v0.20.0

func (cl *Client) GetWarpfronts() (host2front map[string]string, err error)

GetWarpfronts gets warpfront bridges

func (*Client) RedeemTicket

func (cl *Client) RedeemTicket(tier string, ubmsg, ubsig []byte) (err error)

RedeemTicket redeems a ticket.

type ClientInfo

type ClientInfo struct {
	Address string
	Country string
}

ClientInfo describes user IP and country.

type Multiclient added in v0.22.5

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

Multiclient wraps around mutliple clients, R/R-ing between them until something works.

func NewMulticlient added in v0.22.5

func NewMulticlient(clients []*Client) *Multiclient

NewMulticlient creates a Multiclient from multiple clients

func (*Multiclient) Do added in v0.22.5

func (mc *Multiclient) Do(f func(client *Client) error) error

type PaymentTx

type PaymentTx struct {
	Date   time.Time
	Amount int
}

PaymentTx is a payment in USD cents.

type TicketResp

type TicketResp struct {
	Ticket       []byte
	Tier         string
	PaidExpiry   time.Time
	Transactions []PaymentTx
}

TicketResp is the response for ticket getting

Jump to

Keyboard shortcuts

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