Documentation ¶
Index ¶
- type Config
- type Conn
- type FakeSOMC
- func (s *FakeSOMC) Close()
- func (s *FakeSOMC) Read(t *testing.T, method string) *JSONRPCMessage
- func (s *FakeSOMC) ReadPublishEndpoint(t *testing.T) TestEndpointParams
- func (s *FakeSOMC) ReadPublishOfferings(t *testing.T) TestOfferingParams
- func (s *FakeSOMC) Write(t *testing.T, msg *JSONRPCMessage)
- type JSONRPCMessage
- type OfferingData
- type TestConfig
- type TestEndpointParams
- type TestOfferingParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a websocket connection to SOMC.
func (*Conn) FindOfferings ¶
func (c *Conn) FindOfferings(hashes []string) ([]OfferingData, error)
FindOfferings requests SOMC to find offerings by their hashes.
func (*Conn) PublishEndpoint ¶
PublishEndpoint publishes an endpoint for a state channel in SOMC.
func (*Conn) PublishOffering ¶
PublishOffering publishes a given offering JSON in SOMC.
type FakeSOMC ¶
type FakeSOMC struct { sync.Mutex // To make sure conn cannot be implicitly rewritten. // contains filtered or unexported fields }
FakeSOMC is a fake somc server.
func NewFakeSOMC ¶
NewFakeSOMC returns new fake somc server.
func (*FakeSOMC) Read ¶
func (s *FakeSOMC) Read(t *testing.T, method string) *JSONRPCMessage
Read reads from connection.
func (*FakeSOMC) ReadPublishEndpoint ¶
func (s *FakeSOMC) ReadPublishEndpoint(t *testing.T) TestEndpointParams
ReadPublishEndpoint recieves and returns published endpoint.
func (*FakeSOMC) ReadPublishOfferings ¶
func (s *FakeSOMC) ReadPublishOfferings(t *testing.T) TestOfferingParams
ReadPublishOfferings recieves and returns published endpoint.
type JSONRPCMessage ¶
type JSONRPCMessage struct { Version string `json:"jsonrpc"` ID uint32 `json:"id"` Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` Result json.RawMessage `json:"result,omitempty"` ErrorData json.RawMessage `json:"error,omitempty"` }
JSONRPCMessage is a format of the rpc message.
func (*JSONRPCMessage) IDString ¶
func (m *JSONRPCMessage) IDString() string
IDString helper func returns message id as string.
type OfferingData ¶
OfferingData is a simple container for offering JSON.
type TestConfig ¶
type TestConfig struct {
ServerStartupDelay uint // In milliseconds.
}
TestConfig the config related to somc tests.
type TestEndpointParams ¶
type TestEndpointParams endpointParams
TestEndpointParams exported for tests.
type TestOfferingParams ¶
type TestOfferingParams publishOfferingParams
TestOfferingParams used for tests.