daemon

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDowngradingHandler

func CreateDowngradingHandler(grpcServer *grpc.Server, httpHandler http.Handler) http.Handler

CreateDowngradingHandler takes a gRPC server and a plain HTTP handler, and returns an HTTP handler that has the capability of handling HTTP requests and gRPC requests that may require downgrading the response to gRPC-Web or gRPC-WebSocket.

if r.ProtoMajor == 2 && strings.HasPrefix(
	r.Header.Get("Content-Type"), "application/grpc") {
	grpcServer.ServeHTTP(w, r)
} else {
	yourMux.ServeHTTP(w, r)
}

func GetClient

func GetClient(isSudo bool) rpc.DaemonClient

func GetHttpClient

func GetHttpClient(isSudo bool) *http.Client

func GetPidPath

func GetPidPath(isSudo bool) string

func GetSockPath

func GetSockPath(isSudo bool) string

func GetTCPClient

func GetTCPClient(isSudo bool) net.Conn

func StartupDaemon

func StartupDaemon(ctx context.Context, path ...string) error

Types

type SvrOption

type SvrOption struct {
	IsSudo bool
	// contains filtered or unexported fields
}

func (*SvrOption) Start

func (o *SvrOption) Start(ctx context.Context) error

func (*SvrOption) Stop

func (o *SvrOption) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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