server

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package server implements GRPC-server upon gnetcli library.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

func BuildCreds

func BuildCreds(login, password string, enableAgent bool, logger *zap.Logger) credentials.Credentials

func BuildEmptyCreds added in v1.0.1

func BuildEmptyCreds(logger *zap.Logger) credentials.Credentials

func MakeFileResult

func MakeFileResult(path string, file streamer.File) *pb.FileData

Types

type Auth

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

func NewAuth

func NewAuth(logger *zap.Logger, login string, password credentials.Secret) *Auth

func NewAuthInsecure

func NewAuthInsecure(logger *zap.Logger) *Auth

func (*Auth) AuthenticateStream

func (m *Auth) AuthenticateStream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*Auth) AuthenticateUnary

func (m *Auth) AuthenticateUnary(ctx context.Context, req interface{}, servInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

type MultiTrace

type MultiTrace interface {
	AddTrace(gtrace.Trace) int
	DelTrace(int) error
}

type MultiTraceImp

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

func NewMultiTrace

func NewMultiTrace() *MultiTraceImp

func (*MultiTraceImp) Add

func (m *MultiTraceImp) Add(op gtrace.Operation, data []byte)

func (*MultiTraceImp) AddTrace

func (m *MultiTraceImp) AddTrace(tr gtrace.Trace) int

func (*MultiTraceImp) DelTrace

func (m *MultiTraceImp) DelTrace(index int) error

func (*MultiTraceImp) List

func (m *MultiTraceImp) List() []gtrace.Item

type Option

type Option func(*Server)

func WithCredentials

func WithCredentials(creds credentials.Credentials) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

type Server

type Server struct {
	pb.UnimplementedGnetcliServer
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Server

func (*Server) AddDevice

func (m *Server) AddDevice(ctx context.Context, device *pb.Device) (*pb.DeviceResult, error)

func (*Server) Download added in v1.0.4

func (m *Server) Download(ctx context.Context, req *pb.FileDownloadRequest) (*pb.FilesResult, error)

func (*Server) Exec

func (m *Server) Exec(ctx context.Context, cmd *pb.CMD) (*pb.CMDResult, error)

func (*Server) ExecChat

func (m *Server) ExecChat(stream pb.Gnetcli_ExecChatServer) error

func (*Server) SetupHostParams added in v1.0.4

func (m *Server) SetupHostParams(ctx context.Context, hostParams *pb.HostParams) (*emptypb.Empty, error)

func (*Server) Upload

func (m *Server) Upload(ctx context.Context, req *pb.FileUploadRequest) (*emptypb.Empty, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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