Help us shape the future of Go! Take the 2026 Go Developer Survey

somc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CRC16("github.com/privatix/dappctrl/client/somc") = 0x42AE
	ErrUnknownSOMCType errors.Error = 0x42AE<<8 + iota
)

Errors returned by workers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Endpoint(data.Base64String) (data.Base64String, error)
	Offering(data.HexString) (data.Base64String, error)
	Ping() error
}

Client is expected somc clients interface.

type ClientBuilder

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

ClientBuilder responsible for creating Client's.

func NewClientBuilder

func NewClientBuilder(torSocks uint) *ClientBuilder

NewClientBuilder creates new ClientBuilder.

func (*ClientBuilder) NewClient

func (b *ClientBuilder) NewClient(somcType uint8, somcData data.Base64String) (Client, error)

NewClient returns new client instance based given somc type and data.

type ClientBuilderInterface

type ClientBuilderInterface interface {
	NewClient(uint8, data.Base64String) (Client, error)
}

ClientBuilderInterface an abstract layer for builder, introduced mainly for tests.

type TestClient

type TestClient struct {
	V   data.Base64String
	Err error
}

TestClient for tests.

func NewTestClient

func NewTestClient() *TestClient

NewTestClient creates new test client instance.

func (*TestClient) Endpoint

Endpoint return stored V, Err values.

func (*TestClient) Offering

func (c *TestClient) Offering(data.HexString) (data.Base64String, error)

Offering return stored V, Err values.

func (*TestClient) Ping

func (c *TestClient) Ping() error

Ping return stored Err value.

type TestClientBuilder

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

TestClientBuilder for tests.

func NewTestClientBuilder

func NewTestClientBuilder(client Client) *TestClientBuilder

NewTestClientBuilder creates client builder that always returns same client.

func (*TestClientBuilder) NewClient

NewClient returns stored client instance.

Jump to

Keyboard shortcuts

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