package server
import "gvisor.dev/gvisor/pkg/control/server"
Package server provides a basic control server interface.
Note that no objects are registered by default. Users must provide their own implementations of the control interface.
Index ¶
- func CreateSocket(addr string) (int, error)
- type Server
- func Create(addr string) (*Server, error)
- func CreateFromFD(fd int) (*Server, error)
- func New(socket *unet.ServerSocket) *Server
- func (s *Server) FD() int
- func (s *Server) Register(obj any)
- func (s *Server) ResetServer()
- func (s *Server) StartServing() error
- func (s *Server) Stop(timeout time.Duration)
- func (s *Server) Wait()
Functions ¶
func CreateSocket ¶
CreateSocket creates a socket that can be used with control server, but doesn't start control server. 'addr' must be a valid and unique abstract socket name. Returns socket's FD, -1 in case of error.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a basic control server.
func Create ¶
Create creates a new control server with an abstract unix socket with the given address, which must must be unique and a valid abstract socket name.
func CreateFromFD ¶
CreateFromFD creates a new control bound to the given 'fd'. It has no registered interfaces and will not start serving until StartServing is called.
func New ¶
func New(socket *unet.ServerSocket) *Server
New returns a new bound control server.
func (*Server) FD ¶
FD returns the file descriptor that the server is running on.
func (*Server) Register ¶
Register registers a specific control interface with the server.
func (*Server) ResetServer ¶
func (s *Server) ResetServer()
ResetServer resets the server, clearing all registered objects. It stops the old server asynchronously.
func (*Server) StartServing ¶
StartServing starts listening for connect and spawns the main service goroutine for handling incoming control requests. StartServing does not block; to wait for the control server to exit, call Wait.
func (*Server) Stop ¶
Stop stops the server. Note that this function should only be called once and the server should not be used afterwards.
func (*Server) Wait ¶
func (s *Server) Wait()
Wait waits for the main server goroutine to exit. This should be called after a call to Serve.
Source Files ¶
server.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 4 hours ago –
Tools for package owners.