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 ¶
This section is empty.
Types ¶
type ASInfoRequestHandler ¶
type ASInfoRequestHandler struct {
ASInspector infra.ASInspector
}
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 ConnHandler ¶ added in v0.4.0
type ConnHandler struct { Conn net.PacketConn // State for request Handlers Handlers map[proto.SCIONDMsg_Which]Handler Logger log.Logger }
ConnHandler is a SCIOND API server running on top of a PacketConn. It reads messages from the transport, and passes them to the relevant request handler.
func NewConnHandler ¶ added in v0.4.0
func NewConnHandler(conn net.PacketConn, handlers HandlerMap, logger log.Logger) *ConnHandler
func (*ConnHandler) Close ¶ added in v0.4.0
func (srv *ConnHandler) Close() error
func (*ConnHandler) Handle ¶ added in v0.4.0
func (srv *ConnHandler) Handle(b common.RawBytes, address net.Addr)
func (*ConnHandler) Serve ¶ added in v0.4.0
func (srv *ConnHandler) Serve() error
type HandlerMap ¶
type HandlerMap map[proto.SCIONDMsg_Which]Handler
type IFInfoRequestHandler ¶
type IFInfoRequestHandler struct{}
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 VerifierFactory infra.VerificationFactory NextQueryCleaner segfetcher.NextQueryCleaner }
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 ¶
type SVCInfoRequestHandler struct{}
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 ¶
func NewServer(network string, address string, filemode os.FileMode, handlers HandlerMap, logger log.Logger) *Server
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.