daemon

package
v2.2.18 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 31 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) (cli rpc.DaemonClient)

func GetClientWithoutCache added in v2.2.9

func GetClientWithoutCache(ctx context.Context, isSudo bool) (cli rpc.DaemonClient, conn *grpc.ClientConn, err error)

func GetHttpClient

func GetHttpClient(isSudo bool) *http.Client

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
	ID     string
	// 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