grpc

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnnouncementForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var GRPCClientSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "useProxy",
			Validators: []forms.Validator{
				forms.IsOptional{Default: true},
				forms.IsBoolean{},
			},
		},
		{
			Name: "tls",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &tls.TLSSettingsForm,
				},
			},
		},
	},
}
View Source
var GRPCServerSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "bind_address",
			Validators: []forms.Validator{
				forms.IsOptional{Default: "localhost:4444"},
				forms.IsString{},
			},
		},
		net.TCPRateLimitsField,
		{
			Name: "tls",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &tls.TLSSettingsForm,
				},
			},
		},
	},
}
View Source
var MaxMessageSize = 1024 * 1024 * 4

currently we allow messages up to 4MB in size

Functions

This section is empty.

Types

type Client

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

func MakeClient

func MakeClient(settings *GRPCClientSettings, dialer Dialer, directory eps.Directory) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(address, serverName string) error

func (*Client) SendRequest

func (c *Client) SendRequest(request *eps.Request) (*eps.Response, error)

func (*Client) ServerCall

func (c *Client) ServerCall(handler Handler, stop chan bool) error

type ClientAnnouncement added in v0.1.22

type ClientAnnouncement struct {
	Name string `json:"name"`
}

type ClientInfoAuthInfo

type ClientInfoAuthInfo struct {
	credentials.AuthInfo
	ClientInfos *ClientInfos
}

type ClientInfos added in v0.1.20

type ClientInfos struct {
	Infos []*eps.ClientInfo
}

func MakeClientInfos added in v0.1.20

func MakeClientInfos() *ClientInfos

func (*ClientInfos) ClientInfo added in v0.1.20

func (c *ClientInfos) ClientInfo(name string) *eps.ClientInfo

func (*ClientInfos) HasName added in v0.1.20

func (c *ClientInfos) HasName(name string) bool

func (*ClientInfos) PrimaryName added in v0.1.20

func (c *ClientInfos) PrimaryName() string

type ConnectedClient

type ConnectedClient struct {
	CallServer protobuf.EPS_ServerCallServer
	Stop       chan bool

	Info *eps.ClientInfo
	// contains filtered or unexported fields
}

func (*ConnectedClient) DeliverRequest

func (c *ConnectedClient) DeliverRequest(request *eps.Request) (*eps.Response, error)

type Dialer added in v0.2.2

type Dialer func(context context.Context, addr string) (net.Conn, error)

type GRPCClientSettings

type GRPCClientSettings struct {
	TLS      *tls.TLSSettings `json:"tls"`
	UseProxy bool             `json:"useProxy"`
	Enabled  bool             `json:"enabled"`
}

Settings for the gRPC client

type GRPCServerSettings

type GRPCServerSettings struct {
	TLS           *tls.TLSSettings `json:"tls"`
	BindAddress   string           `json:"bind_address"`
	TCPRateLimits []*net.RateLimit `json:"tcp_rate_limits"`
	Enabled       bool             `json:"enabled"`
}

Settings for the gRPC server

type Handler

type Handler interface {
	HandleRequest(*eps.Request, *eps.ClientInfo) (*eps.Response, error)
}

type Server

type Server struct {
	protobuf.UnimplementedEPSServer
	// contains filtered or unexported fields
}

func MakeServer

func MakeServer(settings *GRPCServerSettings, handler Handler, listener net.Listener, directory eps.Directory) (*Server, error)

func (*Server) Call

func (s *Server) Call(context context.Context, pbRequest *protobuf.Request) (*protobuf.Response, error)

func (*Server) CanDeliverTo

func (s *Server) CanDeliverTo(address *eps.Address) bool

func (*Server) DeliverRequest

func (s *Server) DeliverRequest(request *eps.Request) (*eps.Response, error)

func (*Server) ServerCall

func (s *Server) ServerCall(server protobuf.EPS_ServerCallServer) error

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

type VerifyCredentials

type VerifyCredentials struct {
	credentials.TransportCredentials

	ClientInfos *ClientInfos
	// contains filtered or unexported fields
}

func (VerifyCredentials) ClientHandshake

func (c VerifyCredentials) ClientHandshake(ctx context.Context, endpoint string, conn net.Conn) (net.Conn, credentials.AuthInfo, error)

func (VerifyCredentials) ServerHandshake

func (c VerifyCredentials) ServerHandshake(conn net.Conn) (net.Conn, credentials.AuthInfo, error)

Jump to

Keyboard shortcuts

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