server

package
v1.0.78 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 43 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(host, login, password string, enableAgent bool, sshConfig string, logger *zap.Logger) (credentials.Credentials, error)

func BuildCredsFromSSHConfig added in v1.0.46

func BuildCredsFromSSHConfig(login, password, host, sshConfigPassphrase, privateKeyPath string, logger *zap.Logger) (credentials.Credentials, error)

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

func NewAuthApp added in v1.0.46

func NewAuthApp(config authAppConfig, logger *zap.Logger) authApp

func NewHostParams added in v1.0.46

func NewHostParams(creds credentials.Credentials, device string, ip netip.Addr, port int, proxyJump, controlPath string) hostParams

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 Config added in v1.0.27

type Config struct {
	Logging    LogConfig `yaml:"logging"`
	Listen     string    `config:"port,description=Listen address" yaml:"port"`
	HttpListen string    `config:"http_port,description=Http listen address" yaml:"http_port"`
	// FIXME: Dev* in DevAuth, drop it
	DevLogin    string        `config:"dev-login,description=Default device login" yaml:"dev_login"`
	DevPass     string        `config:"dev-pass,description=Default device password" yaml:"dev_pass"`
	DevUseAgent bool          `config:"dev-use-agent" yaml:"dev_use_agent"`
	DevAuth     authAppConfig `yaml:"dev_auth"`
	ConfFile    string        `config:"conf-file,description=Path to config file. '-' for stdin"`
	DevConf     string        `config:"dev-conf,Path to yaml with device types" yaml:"dev_conf"`
	Tls         bool          `config:"tls,description=Connection uses TLS if true, else plain TCP" yaml:"tls"`
	CertFile    string        `config:"cert-file,description=The TLS cert file" yaml:"cert_file"`
	KeyFile     string        `config:"key-file,description=The TLS key file" yaml:"key_file"`
	BasicAuth   string        `config:"basic-auth,description=Authenticate client using Basic auth" yaml:"basic_auth"`
	DisableTcp  bool          `config:"disable_tcp,description=Disable TCP listener" yaml:"disable_tcp"`
	UnixSocket  string        `config:"unix-socket,description=Unix socket path" yaml:"unix_socket"`
	Debug       bool          `config:"debug,short=d,description=Set debug log level"`
}

func LoadConf added in v1.0.27

func LoadConf() (Config, error)

type ExecErrorType added in v1.0.65

type ExecErrorType string
const (
	ErrorTypeEOF     ExecErrorType = "error_eof"
	ErrorTypeUnknown ExecErrorType = "error_unknown"
)

type LogConfig added in v1.0.27

type LogConfig struct {
	Level zapcore.Level `yaml:"level"`
	Json  bool          `yaml:"json"`
}

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 WithLogger

func WithLogger(logger *zap.Logger) Option

type Server

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

func New

func New(devAuthApp authApp, deviceFilePath string, opts ...Option) (*Server, error)

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, cmdHostParams *pb.HostParams) (*emptypb.Empty, error)

func (*Server) Upload

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

Directories

Path Synopsis
Package gnetcli is a reverse proxy.
Package gnetcli is a reverse proxy.

Jump to

Keyboard shortcuts

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