grpc

package
v0.0.0-...-9e53f5f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WhitelistedIPs   = make(map[string]bool)
	WhitelistedCIDRs []*net.IPNet
)

Functions

func LoadWhitelist

func LoadWhitelist()

LoadWhitelist loads the whitelist using the config package

func StartGRPCServer

func StartGRPCServer(db *sql.DB, port string) error

StartGRPCServer starts the gRPC server for receiving block data

func StartGRPCServerWithRetries

func StartGRPCServerWithRetries(db *sql.DB, port string, retries int)

StartGRPCServerWithRetries retries gRPC server startup in case of failure

func UnaryInterceptor

func UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

UnaryInterceptor checks the IP of the client and allows/denies the connection

Types

type Server

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

Server implements the ExternalSubscriberServer

func (*Server) AcceptBlock

func (s *Server) AcceptBlock(ctx context.Context, req *pb.BlockRequest) (*emptypb.Empty, error)

AcceptBlock processes a new block, saves relevant data to the database, and stores transactions and actions

func (*Server) Initialize

func (s *Server) Initialize(ctx context.Context, req *pb.InitializeRequest) (*emptypb.Empty, error)

Initialize receives genesis data for initialization and saves it to the database Initialize receives genesis data for initialization and saves it to the database

Jump to

Keyboard shortcuts

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