bdclient

package
v0.14.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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) (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) 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) 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 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