Documentation ¶
Index ¶
- Variables
- func DialAddressInsecure(ctx context.Context, address string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
- type Client
- type Observer
- type SimulatedNetwork
- type Timeouts
- type Transport
- func (transport *Transport) DialAddress(ctx context.Context, address string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
- func (transport *Transport) DialNode(ctx context.Context, node *pb.Node, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
- func (transport *Transport) Identity() *identity.FullIdentity
- func (transport *Transport) WithObservers(obs ...Observer) Client
Constants ¶
This section is empty.
Variables ¶
var ( //Error is the errs class of standard Transport Client errors Error = errs.Class("transport error") )
Functions ¶
func DialAddressInsecure ¶
func DialAddressInsecure(ctx context.Context, address string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
DialAddressInsecure returns an insecure grpc connection without tls to a node.
Use this method for communication with localhost. For example, with the inspector or debugging services. Otherwise in most cases DialNode should be used for communicating with nodes since it is secure.
Types ¶
type Client ¶
type Client interface { DialNode(ctx context.Context, node *pb.Node, opts ...grpc.DialOption) (*grpc.ClientConn, error) DialAddress(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) Identity() *identity.FullIdentity WithObservers(obs ...Observer) Client }
Client defines the interface to an transport client.
type Observer ¶
type Observer interface { ConnSuccess(ctx context.Context, node *pb.Node) ConnFailure(ctx context.Context, node *pb.Node, err error) }
Observer implements the ConnSuccess and ConnFailure methods for Discovery and other services to use
type SimulatedNetwork ¶
SimulatedNetwork allows creating connections that try to simulated realistic network conditions.
func (*SimulatedNetwork) DialOptions ¶
func (network *SimulatedNetwork) DialOptions() []grpc.DialOption
DialOptions returns options such that it will use simulated network parameters
func (*SimulatedNetwork) GRPCDialContext ¶
func (network *SimulatedNetwork) GRPCDialContext(ctx context.Context, address string) (_ net.Conn, err error)
GRPCDialContext implements DialContext that is suitable for `grpc.WithContextDialer`
func (*SimulatedNetwork) NewClient ¶
func (network *SimulatedNetwork) NewClient(client Client) Client
NewClient wraps an exiting client with the simulated network params.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport interface structure
func (*Transport) DialAddress ¶
func (transport *Transport) DialAddress(ctx context.Context, address string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
DialAddress returns a grpc connection with tls to an IP address.
Do not use this method unless having a good reason. In most cases DialNode should be used for communicating with nodes as it is more secure than DialAddress.
func (*Transport) DialNode ¶
func (transport *Transport) DialNode(ctx context.Context, node *pb.Node, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
DialNode returns a grpc connection with tls to a node.
Use this method for communicating with nodes as it is more secure than DialAddress. The connection will be established successfully only if the target node has the private key for the requested node ID.
func (*Transport) Identity ¶
func (transport *Transport) Identity() *identity.FullIdentity
Identity is a getter for the transport's identity
func (*Transport) WithObservers ¶
WithObservers returns a new transport including the listed observers.