Documentation ¶
Overview ¶
Package servers contains the logic for creating and managing SCIOND API servers. It currently supports listening on ReliableSocket and UNIX Domain socket (in unixgram mode).
Index ¶
Constants ¶
const ( // DefaultReplyTimeout is allocated to SCIOND handlers to reply back to the client. DefaultReplyTimeout = 2 * time.Second // DefaultWorkTimeout is allocated to SCIOND handlers work (e.g., network // traffic and crypto operations) DefaultWorkTimeout = 10 * time.Second DefaultEarlyReply = 200 * time.Millisecond // DefaultServiceTTL is the TTL value for ServiceInfoReply objects, // expressed in seconds. DefaultServiceTTL uint32 = 300 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ASInfoRequestHandler ¶
type ASInfoRequestHandler struct { TrustStore infra.TrustStore Topology *topology.Topo }
ASInfoRequestHandler represents the shared global state for the handling of all ASInfoRequest queries. The SCIOND API spawns a goroutine with method Handle for each ASInfoRequest it receives.
type HandlerMap ¶
type HandlerMap map[proto.SCIONDMsg_Which]Handler
type IFInfoRequestHandler ¶
IFInfoRequestHandler represents the shared global state for the handling of all IFInfoRequest queries. The SCIOND API spawns a goroutine with method Handle for each IFInfoRequest it receives.
type PathRequestHandler ¶
PathRequestHandler represents the shared global state for the handling of all PathRequest queries. The SCIOND API spawns a goroutine with method Handle for each PathRequest it receives.
type RevNotificationHandler ¶
type RevNotificationHandler struct { RevCache revcache.RevCache TrustStore infra.TrustStore }
RevNotificationHandler represents the shared global state for the handling of all RevNotification announcements. The SCIOND API spawns a goroutine with method Handle for each RevNotification it receives.
type SVCInfoRequestHandler ¶
SVCInfoRequestHandler represents the shared global state for the handling of all SVCInfoRequest queries. The SCIOND API spawns a goroutine with method Handle for each SVCInfoRequest it receives.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens for new connections on a "unixpacket" or "rsock" network. Whenever a new connection is accepted, a SCIOND API server is created to handle the connection.
func NewServer ¶
NewServer initializes a new server at address on the specified network. The server will route requests to their correct handlers based on the HandlerMap. To start listening on the address, call ListenAndServe.
Network must be "unixpacket" or "rsock".
func (*Server) Close ¶
Close makes the Server stop listening for new connections, and immediately closes all running SCIONDMsg servers that have been launched by this server.
func (*Server) ListenAndServe ¶
ListenAndServe starts listening on srv's address, and repeatedly accepts connections from clients. For each accepted connection, a SCIONDMsg server is started as a separate goroutine; the server will manage the connection until it is closed by the client.
type TransportHandler ¶
type TransportHandler struct { Transport infra.Transport // State for request Handlers Handlers map[proto.SCIONDMsg_Which]Handler Logger log.Logger }
TransportHandler is a SCIOND API server running on top of a Transport. It reads messages from the transport, and passes them to the relevant request handler.
func NewTransportHandler ¶
func NewTransportHandler(transport infra.Transport, handlers HandlerMap, logger log.Logger) *TransportHandler
func (*TransportHandler) Close ¶
func (srv *TransportHandler) Close() error
func (*TransportHandler) Handle ¶
func (srv *TransportHandler) Handle(b common.RawBytes, address net.Addr)
func (*TransportHandler) Serve ¶
func (srv *TransportHandler) Serve() error
func (*TransportHandler) Shutdown ¶
func (srv *TransportHandler) Shutdown() error
Shutdown cleanly stops the server from handling future requests, while allowing pending requests to finish.