latency1

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

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

func NewHandler(dir string, cacheTTL time.Duration) *Handler

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL