Documentation ¶
Overview ¶
Package nspkt interacts with Northstar servers using connectionless packets.
Index ¶
- Variables
- func DebugMonitorHandler(l *Listener) http.Handler
- type Listener
- func (l *Listener) Close()
- func (l *Listener) ListenAndServe(addr netip.AddrPort) error
- func (l *Listener) LocalAddr() net.Addr
- func (l *Listener) Monitor(ctx context.Context, c chan<- MonitorPacket)
- func (l *Listener) SendAtlasSigreq1(addr netip.AddrPort, key string, obj any) error
- func (l *Listener) SendAtlasSigreq1Raw(addr netip.AddrPort, key, data []byte) error
- func (l *Listener) SendConnect(addr netip.AddrPort, uid uint64) error
- func (l *Listener) Serve(conn *net.UDPConn) error
- func (l *Listener) WaitConnectReply(ctx context.Context, addr netip.AddrPort, uid uint64) error
- func (l *Listener) WritePrometheus(w io.Writer)
- type MonitorPacket
Constants ¶
This section is empty.
Variables ¶
var ErrListenerClosed = errors.New("listener closed")
Functions ¶
func DebugMonitorHandler ¶
DebugMonitorHandler returns a HTTP handler which serves a webpage to monitor sent and received connectionless packets in real-time.
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener sends and receives Northstar connectionless packets over a UDP socket.
func (*Listener) Close ¶
func (l *Listener) Close()
Close immediately closes the active socket, if any, and unbinds it from the Listener, then waits for Serve to return.
func (*Listener) ListenAndServe ¶
ListenAndServe creates new UDP socket on addr and calls Listener.Serve.
func (*Listener) Monitor ¶
func (l *Listener) Monitor(ctx context.Context, c chan<- MonitorPacket)
Monitor writes unencrypted sent/received packets to c until ctx is cancelled, discarding them if c doesn't have room.
func (*Listener) SendAtlasSigreq1 ¶
SendAtlasSigreq1 sends a signed Atlas JSON request.
func (*Listener) SendAtlasSigreq1Raw ¶
SendAtlasSigreq1Raw sends a raw `Tsigreq1` packet.
func (*Listener) SendConnect ¶
SendConnect sends a `Hconnect` packet to addr for uid.
func (*Listener) Serve ¶
Serve binds the listener to conn, which should not be used afterwards. If l is already bound, the existing conn will be closed and replaced.
func (*Listener) WaitConnectReply ¶
WaitConnectReply waits for a reply to `Hconnect` from addr with uid.
func (*Listener) WritePrometheus ¶
WritePrometheus writes prometheus text metrics to w.