sock

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout           = fmt.Errorf("unix socket timeout")
	ErrConnectionRefused = fmt.Errorf("unix socket connection failed")
)
View Source
var ErrServerRequestedShutdown = errors.New(
	"socket frontend is requested to shutdown",
)

Functions

This section is empty.

Types

type Client

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

Client is a unix socket client that can send requests to the frontend over HTTP.

func NewClient

func NewClient(addr string) *Client

func (*Client) Request

func (cl *Client) Request(method, url string) (string, error)

Request sends a request to the frontend and returns the response.

type HTTPHandlerFunc

type HTTPHandlerFunc func(w http.ResponseWriter, r *http.Request)

HTTPHandlerFunc is a function that handles HTTP requests.

type Server

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

Server is a unix socket frontend that passes http requests to HandlerFunc.

func NewServer

func NewServer(
	addr string,
	handlerFunc HTTPHandlerFunc,
	lg logger.Logger,
) (*Server, error)

NewServer creates a new unix socket frontend.

func (*Server) Serve

func (srv *Server) Serve(listen chan error) error

Serve starts listening and serving requests.

func (*Server) Shutdown

func (srv *Server) Shutdown() error

Shutdown stops the frontend.

Jump to

Keyboard shortcuts

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