rpc

package
v0.0.0-...-04e8804 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented     = errors.New("interceptor support is not implemented")
	ErrUnknownID          = errors.New("unknown id")
	ErrInvalidCertificate = errors.New("unable to parse certificate")
)

Functions

This section is empty.

Types

type ADRequest

type ADRequest struct {
	ID uuid.UUID
}

type ADResponse

type ADResponse struct{}

type AORequest

type AORequest struct {
	ID          uuid.UUID
	AlicePubKey ed25519.PublicKey
}

type AOResponse

type AOResponse struct {
	RefundDetails *bob.RefundDetails
}

type BobServer

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

func NewBobServer

func NewBobServer(network string, address string, certFile string, keyFile string, target string,
	newAtomicSwap func(now time.Time) *bob.AtomicSwap) (*BobServer, error)

func (*BobServer) AcceptOffer

func (s *BobServer) AcceptOffer(req *AORequest) (*AOResponse, error)

func (*BobServer) AnnounceDeposit

func (s *BobServer) AnnounceDeposit(req *ADRequest) (*ADResponse, error)

func (*BobServer) Check

func (s *BobServer) Check(now time.Time) error

func (*BobServer) EnableFunding

func (s *BobServer) EnableFunding(req *EFRequest) (*EFResponse, error)

func (*BobServer) Register

func (s *BobServer) Register(maxAge big.Int, ethChain ethereum.Blockchain) error

func (*BobServer) Report

func (s *BobServer) Report()

func (*BobServer) RequestAdaptorDetails

func (s *BobServer) RequestAdaptorDetails(req *RADRequest) (*RADResponse, error)

func (*BobServer) RequestBindingOffer

func (s *BobServer) RequestBindingOffer(req *RBORequest) (*RBOResponse, error)

func (*BobServer) RequestNonBindingOffer

func (s *BobServer) RequestNonBindingOffer(req *RNBORequest) (*RNBOResponse, error)

func (*BobServer) Serve

func (s *BobServer) Serve() error

type Client

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

func Dial

func Dial(target string, cert []byte) (*Client, error)

func (*Client) AcceptOffer

func (c *Client) AcceptOffer(id uuid.UUID, alicePubKey ed25519.PublicKey) (*bob.RefundDetails, error)

func (*Client) AnnounceDeposit

func (c *Client) AnnounceDeposit(id uuid.UUID) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) EnableFunding

func (c *Client) EnableFunding(id uuid.UUID,
	aliceRefundNoncePoint ed25519.CurvePoint, refundSigAlice []byte) (*types.TransactionID, error)

func (*Client) RequestAdaptorDetails

func (c *Client) RequestAdaptorDetails(id uuid.UUID,
	aliceClaimUnlockHash types.UnlockHash, aliceClaimNoncePoint ed25519.CurvePoint) (*bob.AdaptorDetails, error)

func (*Client) RequestBindingOffer

func (c *Client) RequestBindingOffer(id uuid.UUID, antiSpamID big.Int) (*trader.Offer, error)

func (*Client) RequestNonBindingOffer

func (c *Client) RequestNonBindingOffer(siacoin types.Currency) (*uuid.UUID, *trader.Offer, error)

type EFRequest

type EFRequest struct {
	ID                    uuid.UUID
	AliceRefundNoncePoint ed25519.CurvePoint
	RefundSigAlice        []byte
}

type EFResponse

type EFResponse struct {
	TxID *types.TransactionID
}

type JSONCodec

type JSONCodec struct{}

func (JSONCodec) Marshal

func (c JSONCodec) Marshal(v interface{}) ([]byte, error)

func (JSONCodec) Name

func (c JSONCodec) Name() string

func (JSONCodec) Unmarshal

func (c JSONCodec) Unmarshal(data []byte, v interface{}) error

type RADRequest

type RADRequest struct {
	ID                   uuid.UUID
	AliceClaimUnlockHash types.UnlockHash
	AliceClaimNoncePoint ed25519.CurvePoint
}

type RADResponse

type RADResponse struct {
	AdaptorDetails *bob.AdaptorDetails
}

type RBORequest

type RBORequest struct {
	ID         uuid.UUID
	AntiSpamID big.Int
}

type RBOResponse

type RBOResponse struct {
	Offer *trader.Offer
}

type RNBORequest

type RNBORequest struct {
	Siacoin types.Currency
}

type RNBOResponse

type RNBOResponse struct {
	ID    uuid.UUID
	Offer *trader.Offer
}

type Server

type Server interface {
	RequestNonBindingOffer(*RNBORequest) (*RNBOResponse, error)
	RequestBindingOffer(req *RBORequest) (*RBOResponse, error)
	AcceptOffer(req *AORequest) (*AOResponse, error)
	EnableFunding(req *EFRequest) (*EFResponse, error)
	RequestAdaptorDetails(req *RADRequest) (*RADResponse, error)
	AnnounceDeposit(req *ADRequest) (*ADResponse, error)
}

Jump to

Keyboard shortcuts

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