utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceColor

func ForceColor() bool

func GetEnvFiles

func GetEnvFiles(root string) ([]string, error)

func GetRand

func GetRand[T any](s []T) (v T)

func NewDiscoveryGrpcConn

func NewDiscoveryGrpcConn(ctx context.Context, conf *Backend, d registry.Discovery) (*grpc.ClientConn, error)

func NewEtcdGrpcConn

func NewEtcdGrpcConn(ctx context.Context, conf *EtcdBackend) (*grpc.ClientConn, error)

func NewSignalGrpcConn

func NewSignalGrpcConn(ctx context.Context, conf *Backend) (*grpc.ClientConn, error)

Types

type Backend

type Backend struct {
	Endpoint  string
	Tls       bool
	JwtSecret string
	CustomCA  string
	TimeOut   string
}

type EtcdBackend

type EtcdBackend struct {
	Backend
	ServiceName string
	Username    string
	Password    string
}

type GrpcGatewayServer

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

func NewGrpcGatewayServer

func NewGrpcGatewayServer(config *conf.GrpcServer) *GrpcGatewayServer

func (*GrpcGatewayServer) Endpoint

func (s *GrpcGatewayServer) Endpoint() (*url.URL, error)

func (*GrpcGatewayServer) Endpoints

func (s *GrpcGatewayServer) Endpoints() ([]*url.URL, error)

func (*GrpcGatewayServer) GrpcRegistrar

func (s *GrpcGatewayServer) GrpcRegistrar() grpc.ServiceRegistrar

func (*GrpcGatewayServer) HttpRegistrar

func (s *GrpcGatewayServer) HttpRegistrar() *ghttp.Server

func (*GrpcGatewayServer) Start

func (s *GrpcGatewayServer) Start(ctx context.Context) error

func (*GrpcGatewayServer) Stop

func (s *GrpcGatewayServer) Stop(ctx context.Context) error

type TCPHandler

type TCPHandler interface {
	ServeTcp(ctx context.Context, conn net.Conn) error
}

type TcpServer

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

func NewTcpServer

func NewTcpServer(conf *conf.TcpServer, handler TCPHandler) *TcpServer

func (*TcpServer) Endpoint

func (s *TcpServer) Endpoint() (*url.URL, error)

func (*TcpServer) Start

func (s *TcpServer) Start(ctx context.Context) error

func (*TcpServer) Stop

func (s *TcpServer) Stop(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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