import "github.com/micro/go-micro/transport"
Package transport is an interface for synchronous connection based communication
http_proxy.go http_transport.go options.go transport.go
type DialOption func(*DialOptions)
func WithStream() DialOption
Indicates whether this is a streaming connection
func WithTimeout(d time.Duration) DialOption
Timeout used when dialling the remote side
type DialOptions struct { // Tells the transport this is a streaming connection with // multiple calls to send/recv and that send may not even be called Stream bool // Timeout for dialing Timeout time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context }
type ListenOption func(*ListenOptions)
type ListenOptions struct { // Other options for implementations of the interface // can be stored in a context Context context.Context }
Addrs to use for transport
Codec sets the codec used for encoding where the transport does not support message headers
Use secure communication. If TLSConfig is not specified we use InsecureSkipVerify and generate a self signed cert
TLSConfig to be used for the transport.
Timeout sets the timeout for Send/Recv execution
type Options struct { // Addrs is the list of intermediary addresses to connect to Addrs []string // Codec is the codec interface to use where headers are not supported // by the transport and the entire payload must be encoded Codec codec.Marshaler // Secure tells the transport to secure the connection. // In the case TLSConfig is not specified best effort self-signed // certs should be used Secure bool // TLSConfig to secure the connection. The assumption is that this // is mTLS keypair TLSConfig *tls.Config // Timeout sets the timeout for Send/Recv Timeout time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context }
type Socket interface { Recv(*Message) error Send(*Message) error Close() error Local() string Remote() string }
type Transport interface { Init(...Option) error Options() Options Dial(addr string, opts ...DialOption) (Client, error) Listen(addr string, opts ...ListenOption) (Listener, error) String() string }
Transport is an interface which is used for communication between services. It uses connection based socket send/recv semantics and has various implementations; http, grpc, quic.
Path | Synopsis |
---|---|
grpc | Package grpc provides a grpc transport |
grpc/proto | |
http | Package http returns a http2 transport using net/http |
memory | Package memory is an in-memory transport |
quic | Package quic provides a QUIC based transport |
Package transport imports 22 packages (graph) and is imported by 243 packages. Updated 2019-12-05. Refresh now. Tools for package owners.