Documentation ¶
Overview ¶
Package rpc implements SCION Infra RPC calls over QUIC.
Index ¶
Constants ¶
const ( // CtxTimedOutError is a custom QUIC error code that is used when canceling // writes due to context expiration. CtxTimedOutError = iota + 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Conn is the connection to initiate QUIC Sessions on. It can be shared // with Servers, because QUIC connection IDs are used to demux the packets. Conn net.PacketConn // TLSConfig is the client's TLS configuration for starting QUIC connections. TLSConfig *tls.Config // QUICConfig is the client's QUIC configuration. QUICConfig *quic.Config }
type Handler ¶
type Handler interface {
ServeRPC(rw ReplyWriter, request *Request)
}
Handler is called by RPC servers whenever a new request arrives. Implementations should write replies to rw.
type ReplyWriter ¶
type ReplyWriter interface { // WriteReply blocks until the Reply is sent back to the peer. The // underlying connection is always closed before WriteReply returns. WriteReply(*Reply) error // Close closes any connections kept open by this writer, and unblocks an // ongoing WriteReply. It is safe to call Close concurrently with // WriteReply. Close can be safely called multiple times. io.Closer }
ReplyWriter provides handlers a way to respond to requests. ReplyWriter keeps a connection alive for replying. Method WriteReply can block; to unblock the method (and to close the connection ahead of time), call Close. ReplyWriter implementations must also close the connection whenever they return from WriteReply.
type Server ¶
type Server struct { // Conn is the connection to listen on. It can be shared with Clients, // because QUIC connection IDs are used to demux the packets. Conn net.PacketConn // TLSConfig is the server's TLS configuration for starting QUIC connections. TLSConfig *tls.Config // QUICConfig is the server's QUIC configuration. QUICConfig *quic.Config // Handler is called for every RPC Request receivd by the server. Handler Handler // contains filtered or unexported fields }
Server is the configuration for a QUIC RPC server. Messages are SCION Infra Signed Control Payloads. For each accepted connection, the server parses the message from the client and passes it to the handler.
func (*Server) Close ¶
Close closes the Server's listener. All active QUIC connections are immediately torn down. It is safe to call close multiple times.