Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachAgentPath

func AttachAgentPath(name string) string

AttachAgentPath returns the URL path to the agent service attach HTTP endpoint.

func DecodeAttachRequest

func DecodeAttachRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*agent.AgentAttachPayload, error)

DecodeAttachRequest returns a decoder for requests sent to the agent attach endpoint.

func DecodeReleaseRequest

func DecodeReleaseRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*agent.ReleasePayload, error)

DecodeReleaseRequest returns a decoder for requests sent to the agent release endpoint.

func DecodeRenewRequest

func DecodeRenewRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*agent.RenewPayload, error)

DecodeRenewRequest returns a decoder for requests sent to the agent renew endpoint.

func DecodeStatusRequest

func DecodeStatusRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*agent.StatusPayload, error)

DecodeStatusRequest returns a decoder for requests sent to the agent status endpoint.

func EncodeAttachError

func EncodeAttachError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeAttachError returns an encoder for errors returned by the attach agent endpoint.

func EncodeAttachResponse

func EncodeAttachResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeAttachResponse returns an encoder for responses returned by the agent attach endpoint.

func EncodeReleaseError

func EncodeReleaseError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeReleaseError returns an encoder for errors returned by the release agent endpoint.

func EncodeReleaseResponse

func EncodeReleaseResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeReleaseResponse returns an encoder for responses returned by the agent release endpoint.

func EncodeRenewError

func EncodeRenewError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeRenewError returns an encoder for errors returned by the renew agent endpoint.

func EncodeRenewResponse

func EncodeRenewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeRenewResponse returns an encoder for responses returned by the agent renew endpoint.

func EncodeStatusError

func EncodeStatusError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(ctx context.Context, err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeStatusError returns an encoder for errors returned by the status agent endpoint.

func EncodeStatusResponse

func EncodeStatusResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeStatusResponse returns an encoder for responses returned by the agent status endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the agent endpoints.

func MountAttachHandler

func MountAttachHandler(mux goahttp.Muxer, h http.Handler)

MountAttachHandler configures the mux to serve the "agent" service "attach" endpoint.

func MountReleaseHandler

func MountReleaseHandler(mux goahttp.Muxer, h http.Handler)

MountReleaseHandler configures the mux to serve the "agent" service "release" endpoint.

func MountRenewHandler

func MountRenewHandler(mux goahttp.Muxer, h http.Handler)

MountRenewHandler configures the mux to serve the "agent" service "renew" endpoint.

func MountStatusHandler

func MountStatusHandler(mux goahttp.Muxer, h http.Handler)

MountStatusHandler configures the mux to serve the "agent" service "status" endpoint.

func NewAttachAgentAttachPayload

func NewAttachAgentAttachPayload(body *AttachRequestBody, name string, namespace string) *agent.AgentAttachPayload

NewAttachAgentAttachPayload builds a agent service attach endpoint payload.

func NewAttachHandler

func NewAttachHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewAttachHandler creates a HTTP handler which loads the HTTP request and calls the "agent" service "attach" endpoint.

func NewReleaseHandler

func NewReleaseHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewReleaseHandler creates a HTTP handler which loads the HTTP request and calls the "agent" service "release" endpoint.

func NewReleasePayload

func NewReleasePayload(name string, namespace string, sessionID string) *agent.ReleasePayload

NewReleasePayload builds a agent service release endpoint payload.

func NewRenewHandler

func NewRenewHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewRenewHandler creates a HTTP handler which loads the HTTP request and calls the "agent" service "renew" endpoint.

func NewRenewPayload

func NewRenewPayload(name string, namespace string, sessionID string) *agent.RenewPayload

NewRenewPayload builds a agent service renew endpoint payload.

func NewStatusHandler

func NewStatusHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewStatusHandler creates a HTTP handler which loads the HTTP request and calls the "agent" service "status" endpoint.

func NewStatusPayload

func NewStatusPayload(name string, namespace string) *agent.StatusPayload

NewStatusPayload builds a agent service status endpoint payload.

func ReleaseAgentPath

func ReleaseAgentPath(name string) string

ReleaseAgentPath returns the URL path to the agent service release HTTP endpoint.

func RenewAgentPath

func RenewAgentPath(name string) string

RenewAgentPath returns the URL path to the agent service renew HTTP endpoint.

func StatusAgentPath

func StatusAgentPath(name string) string

StatusAgentPath returns the URL path to the agent service status HTTP endpoint.

Types

type AttachRequestBody

type AttachRequestBody struct {
	// Viewer-chosen participant label, echoed in session records. Not an
	// authorization boundary
	Participant *string `form:"participant,omitempty" json:"participant,omitempty" xml:"participant,omitempty"`
}

AttachRequestBody is the type of the "agent" service "attach" endpoint HTTP request body.

type AttachResponseBody

type AttachResponseBody struct {
	// Opaque server-side session identifier for renew/release correlation. Never
	// sent to the guest
	ID string `form:"id" json:"id" xml:"id"`
	// Signed bearer ticket (id.payload.signature) to present in the agent attach
	// message
	Ticket string `form:"ticket" json:"ticket" xml:"ticket"`
	// Ticket/session lifetime in milliseconds; renew at half of it
	TTLMs int `form:"ttl_ms" json:"ttl_ms" xml:"ttl_ms"`
	// Agent ticket/API revision
	Protocol int `form:"protocol" json:"protocol" xml:"protocol"`
}

AttachResponseBody is the type of the "agent" service "attach" endpoint HTTP response body.

func NewAttachResponseBody

func NewAttachResponseBody(res *agentviews.AgentTicketView) *AttachResponseBody

NewAttachResponseBody builds the HTTP response body from the result of the "attach" endpoint of the "agent" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type ReleaseResponseBody

type ReleaseResponseBody struct {
	// Whether the session is gone (unknown ids report ok: best-effort release)
	OK bool `form:"ok" json:"ok" xml:"ok"`
}

ReleaseResponseBody is the type of the "agent" service "release" endpoint HTTP response body.

func NewReleaseResponseBody

func NewReleaseResponseBody(res *agentviews.AgentReleaseView) *ReleaseResponseBody

NewReleaseResponseBody builds the HTTP response body from the result of the "release" endpoint of the "agent" service.

type RenewResponseBody

type RenewResponseBody struct {
	// Renewed lifetime in milliseconds
	TTLMs int `form:"ttl_ms" json:"ttl_ms" xml:"ttl_ms"`
	// Agent ticket/API revision
	Protocol int `form:"protocol" json:"protocol" xml:"protocol"`
}

RenewResponseBody is the type of the "agent" service "renew" endpoint HTTP response body.

func NewRenewResponseBody

func NewRenewResponseBody(res *agentviews.AgentRenewView) *RenewResponseBody

NewRenewResponseBody builds the HTTP response body from the result of the "renew" endpoint of the "agent" service.

type Server

type Server struct {
	Mounts  []*MountPoint
	Attach  http.Handler
	Renew   http.Handler
	Status  http.Handler
	Release http.Handler
}

Server lists the agent service endpoint HTTP handlers.

func New

func New(
	e *agent.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the agent service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) MethodNames

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the agent endpoints.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type StatusResponseBody

type StatusResponseBody struct {
	// Whether at least one live agent session is bound to this workspace
	Active bool `form:"active" json:"active" xml:"active"`
	// Live (unexpired) session count for this workspace
	Sessions int `form:"sessions" json:"sessions" xml:"sessions"`
	// Agent ticket/API revision
	Protocol int `form:"protocol" json:"protocol" xml:"protocol"`
}

StatusResponseBody is the type of the "agent" service "status" endpoint HTTP response body.

func NewStatusResponseBody

func NewStatusResponseBody(res *agentviews.AgentStatusView) *StatusResponseBody

NewStatusResponseBody builds the HTTP response body from the result of the "status" endpoint of the "agent" service.

Jump to

Keyboard shortcuts

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