Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the handler for latency tests.
func NewHandler ¶
NewHandler returns a new handler for the UDP latency test. It sets up a cache for sessions that writes the results to disk on item eviction.
func (*Handler) Authorize ¶
func (h *Handler) Authorize(rw http.ResponseWriter, req *http.Request)
Authorize verifies that the request includes a valid JWT, extracts its jti and adds a new empty session to the sessions cache. It returns a valid kickoff LatencyPacket for this new session in the response body.
func (*Handler) ProcessPacketLoop ¶
func (h *Handler) ProcessPacketLoop(conn net.PacketConn)
ProcessPacketLoop is the main packet processing loop. For each incoming packet, it records its timestamp and acts depending on the packet type.
func (*Handler) Result ¶
func (h *Handler) Result(rw http.ResponseWriter, req *http.Request)
Result returns a result for a given measurement id. Possible status codes are: - 400 if the request does not contain a mid - 404 if the mid is not found in the sessions cache - 500 if the session JSON cannot be marshalled