server

package
v10.312.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 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 APIServer

type APIServer interface {
	// Run runs an API server
	Run(ctx context.Context) error
}

APIServer is the main interface of the API server. Allows to create mock functions for testing.

type EventServer

type EventServer struct {
	// contains filtered or unexported fields
}

EventServer is a new event server

func NewEventServer

func NewEventServer(address string, registerer registerer.Registerer) (*EventServer, error)

NewEventServer creates a new event server

func (*EventServer) Run

func (e *EventServer) Run(ctx context.Context) error

Run runs the server. The server will run in the background. It will gracefully die with the provided context.

func (*EventServer) ServeHTTP

func (e *EventServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is called for every request.

type UIDAddr

type UIDAddr struct {
	NetworkAddress string
	Address        string
}

UIDAddr implements the Addr interface and allows us to customize the address.

func (*UIDAddr) Network

func (a *UIDAddr) Network() string

Network returns the network of the connection

func (*UIDAddr) String

func (a *UIDAddr) String() string

String returns a string representation.

type UIDConnection

type UIDConnection struct {
	// contains filtered or unexported fields
}

UIDConnection is a connection wrapper that allows to recover the user ID of the calling process.

func (UIDConnection) Close

func (c UIDConnection) Close() error

Close implements the close interface of the connection.

func (UIDConnection) LocalAddr

func (c UIDConnection) LocalAddr() net.Addr

LocalAddr implements the LocalAddr interface of the connection.

func (UIDConnection) Read

func (c UIDConnection) Read(b []byte) (n int, err error)

Read implements the read interface of the connection.

func (UIDConnection) RemoteAddr

func (c UIDConnection) RemoteAddr() net.Addr

RemoteAddr implements the RemoteAddr interface of the connection. This is the main change where we actually use the FD of the unix socket to find the remote UID.

func (UIDConnection) SetDeadline

func (c UIDConnection) SetDeadline(t time.Time) error

SetDeadline implements the SetDeadLine interface.

func (UIDConnection) SetReadDeadline

func (c UIDConnection) SetReadDeadline(t time.Time) error

SetReadDeadline implements the SetReadDeadling interface

func (UIDConnection) SetWriteDeadline

func (c UIDConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements the SetWriteDeadline method of the interface.

func (UIDConnection) Write

func (c UIDConnection) Write(b []byte) (n int, err error)

Write implements the write interface of the connection.

type UIDListener

type UIDListener struct {
	// contains filtered or unexported fields
}

UIDListener is a custom net listener that uses the UID connection

func NewUIDListener

func NewUIDListener(nl *net.UnixListener) *UIDListener

NewUIDListener creates a new UID listener.

func (UIDListener) Accept

func (l UIDListener) Accept() (c net.Conn, err error)

Accept implements the accept method of the interface.

func (UIDListener) Addr

func (l UIDListener) Addr() net.Addr

Addr returns the address of the listener.

func (UIDListener) Close

func (l UIDListener) Close() error

Close implements the close method of the interface.

Jump to

Keyboard shortcuts

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