peering

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientHelloRPC

func ClientHelloRPC(ctx context.Context, stream sentryrpc.RelayPeerService_RelayPeerHelloRPCClient, interval time.Duration, relayUUID string, ip func() string)

ClientHelloRPC will handle periodic heartbeat messages between relay and the core service.

func ClientProbeRPC

func ClientProbeRPC(ctx context.Context, stream sentryrpc.RelayPeerService_RelayPeerProbeRPCClient, pcache *ristretto.Cache, relayUUID string, expiry time.Duration, peerProbeChanel chan string, ip func() string)

ClientProbeRPC will manage the probes. When a relay neeed to probe for connections for a cluster it will add a probe message to probe channel. The probe rpc will send that message to probe core service. When a probe response get inserted to peerCache.

func ClientSurveyRPC

func ClientSurveyRPC(ctx context.Context, stream sentryrpc.RelayPeerService_RelayPeerSurveyRPCClient, relayUUID string, ip func() string, dialinlookup func(string) int)

ClientSurveyRPC will handle the survey RPC. When a relay neeed to probe for connections for a cluster it will message to probe core service. The service then sends survey to all the connected relays (survey-request). On survey request, the relay will lookup its local-dialin-map and reply to core if connection from the given cluster is available.

func ClientTLSConfig

func ClientTLSConfig(tlsCrt string, tlsKey string, rootCA string, addr string) (*tls.Config, error)

ClientTLSConfig sets tls config

func GetPeerCache

func GetPeerCache(cache *ristretto.Cache, key interface{}) (string, bool)

GetPeerCache get value from cache and if more than 1 rnadomly select the peer

func GetPeeringServerCreds

func GetPeeringServerCreds(ctx context.Context, bs service.BootstrapService, rpcPort int, host string) (cert, key, ca []byte, err error)

GetPeeringServerCreds returns peering cert, key, ca

func InitPeerCache

func InitPeerCache(evict OnEvict) (*ristretto.Cache, error)

InitPeerCache initialize the cache to store dialin cluster-connection information of peers. When a dialin miss happens look into this cache to find the peer IP address to forward the user connection.

func InsertPeerCache

func InsertPeerCache(cache *ristretto.Cache, expiry time.Duration, key, value interface{}) bool

InsertPeerCache inserts the value to cache

Types

type OnEvict

type OnEvict = func(item *ristretto.Item)

type RelayClusterConnectionInfo

type RelayClusterConnectionInfo struct {
	Relayuuid string
	Relayip   string
}

RelayClusterConnectionInfo relay conn info

Jump to

Keyboard shortcuts

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