serve

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 102 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyParsedFlags

func ApplyParsedFlags(cfg *config.Config, cmd *cli.Command, state *FlagState, validateListeners bool) error

func Command

func Command() *cli.Command

Command returns the serve sub-command.

func EmbeddedFlags

func EmbeddedFlags(cfg *config.Config, state *FlagState) []cli.Flag

func Flags

func Flags(cfg *config.Config, state *FlagState) []cli.Flag

func GetTokenResolver added in v0.0.3

func GetTokenResolver(s *Server) *security.TokenResolver

GetTokenResolver returns the TokenResolver used by this server, or nil if not yet built. Used by embedded MCP to call ConfigureEmbeddedMCP after BuildServer.

Types

type FlagState

type FlagState struct {
	ReadHeaderTimeoutSecs int
	CacheLocalMaxBytes    string
	CacheLocalNumCounters int
	CacheLocalBufferItems int
}

func NewFlagState

func NewFlagState(cfg *config.Config) *FlagState

type PreparedListener

type PreparedListener struct {
	Listener net.Listener
	Network  string
	Address  string
	Cleanup  func() error
}

type RunningServers

type RunningServers struct {
	Addr            net.Addr
	Port            int
	Endpoint        string
	Network         string
	HTTPServerPlain *http.Server
	HTTPServerTLS   *http.Server
	GRPCServer      *grpc.Server
	Close           func(ctx context.Context) error
}

func StartSinglePortHTTPAndGRPC

func StartSinglePortHTTPAndGRPC(
	_ context.Context,
	cfg config.ListenerConfig,
	httpHandler http.Handler,
	grpcServer *grpc.Server,
) (*RunningServers, error)

type Server

type Server struct {
	Config        *config.Config
	Store         registrystore.MemoryStore
	Router        *gin.Engine
	GRPCServer    *grpc.Server
	Running       *RunningServers
	TokenResolver *security.TokenResolver
	// contains filtered or unexported fields
}

Server holds the running server and its subsystems.

func BuildServer

func BuildServer(ctx context.Context, cfg *config.Config) (*Server, error)

BuildServer initializes all subsystems without binding any network listeners.

func StartServer

func StartServer(ctx context.Context, cfg *config.Config) (*Server, error)

StartServer initializes all subsystems and starts HTTP+gRPC on a single port. Use cfg.HTTPPort=0 for a random port. Actual port: Server.Running.Port.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server. Order: management listener → main listener drain → tracer provider flush. Both listeners are drained before provider shutdown so that spans ending during either drain are exported rather than silently dropped. All three error values are joined and returned together.

Jump to

Keyboard shortcuts

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