tpu_quic

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_FANOUT_SLOTS uint64 = 12
View Source
var MAX_FANOUT_SLOTS uint64 = 100
View Source
var MAX_SLOT_SKIP_DISTANCE uint64 = 48

Functions

func CheckIfDuplicate

func CheckIfDuplicate(array []string, item string) bool

func ConvertURLToWS

func ConvertURLToWS(url string) string

func NewSelfSignedTLSCertificate

func NewSelfSignedTLSCertificate(ip net.IP) (tls.Certificate, error)

func NewSelfSignedTLSCertificateChain

func NewSelfSignedTLSCertificateChain(rawIP string, pub ed25519.PublicKey, priv ed25519.PrivateKey) (*x509.CertPool, error)

Types

type ConnectionPool added in v0.0.2

type ConnectionPool struct {
	CurrentConnections []string
	Sockets            []*net.UDPConn
	// contains filtered or unexported fields
}

func NewConnectionPool added in v0.0.2

func NewConnectionPool() (*ConnectionPool, error)

func (*ConnectionPool) CheckIfDuplicate added in v0.0.2

func (p *ConnectionPool) CheckIfDuplicate(arr []string, obj string) bool

func (*ConnectionPool) Clear added in v0.0.2

func (p *ConnectionPool) Clear()

func (*ConnectionPool) Create added in v0.0.2

func (p *ConnectionPool) Create(address string) error

func (*ConnectionPool) Get added in v0.0.2

func (p *ConnectionPool) Get(address string) (quic.Connection, error)

func (*ConnectionPool) GetDefaultQUICConfiguration added in v0.0.2

func (p *ConnectionPool) GetDefaultQUICConfiguration() quic.Config

func (*ConnectionPool) GetDefaultTLSConfiguration added in v0.0.2

func (p *ConnectionPool) GetDefaultTLSConfiguration() (tls.Config, error)

type LeaderTPUCache

type LeaderTPUCache struct {
	LeaderTPUMap      map[string]string
	Connection        *rpc.Client
	FirstSlot         uint64
	SlotsInEpoch      uint64
	LastEpochInfoSlot uint64
	Leaders           []solana.PublicKey
}

func (*LeaderTPUCache) FetchClusterTPUSockets

func (leaderTPUCache *LeaderTPUCache) FetchClusterTPUSockets() (map[string]string, error)

func (*LeaderTPUCache) FetchSlotLeaders

func (leaderTPUCache *LeaderTPUCache) FetchSlotLeaders(startSlot uint64, fanoutSlots uint64, slotsInEpoch uint64) ([]solana.PublicKey, error)

func (*LeaderTPUCache) GetLeaderSockets

func (leaderTPUCache *LeaderTPUCache) GetLeaderSockets(fanoutSlots uint64) []string

func (*LeaderTPUCache) GetSlotLeader

func (leaderTPUCache *LeaderTPUCache) GetSlotLeader(slot uint64) solana.PublicKey

func (*LeaderTPUCache) LastSlot

func (leaderTPUCache *LeaderTPUCache) LastSlot() uint64

func (*LeaderTPUCache) Load

func (leaderTPUCache *LeaderTPUCache) Load(connection *rpc.Client, startSlot uint64, fanout uint64) error

type LeaderTPUService

type LeaderTPUService struct {
	RecentSlots    *RecentLeaderSlots
	LTPUCache      *LeaderTPUCache
	Subscription   *ws.SlotsUpdatesSubscription
	Connection     *rpc.Client
	WSConnection   *ws.Client
	ConnectionPool *ConnectionPool
}

func (*LeaderTPUService) GetLeaderConnections

func (leaderTPUService *LeaderTPUService) GetLeaderConnections(fanoutSlots uint64) []quic.Connection

func (*LeaderTPUService) LeaderTPUSockets

func (leaderTPUService *LeaderTPUService) LeaderTPUSockets(fanoutSlots uint64) []string

func (*LeaderTPUService) LeaderTPUSocketsWithConn

func (leaderTPUService *LeaderTPUService) LeaderTPUSocketsWithConn(fanoutSlots uint64) []string

func (*LeaderTPUService) Load

func (leaderTPUService *LeaderTPUService) Load(connection *rpc.Client, websocketURL string, fanout uint64) error

func (*LeaderTPUService) Run

func (leaderTPUService *LeaderTPUService) Run(fanout uint64)

type RecentLeaderSlots

type RecentLeaderSlots struct {
	RecentSlots []float64
}

func (*RecentLeaderSlots) EstimatedCurrentSlot

func (recentLeaderSlots *RecentLeaderSlots) EstimatedCurrentSlot() uint64

func (*RecentLeaderSlots) Load

func (recentLeaderSlots *RecentLeaderSlots) Load(currentSlot uint64)

func (*RecentLeaderSlots) RecordSlot

func (recentLeaderSlots *RecentLeaderSlots) RecordSlot(currentSlot uint64)

type TPUClient

type TPUClient struct {
	FanoutSlots uint64
	LTPUService *LeaderTPUService
	Exit        bool
	Connection  *rpc.Client
	SendMutex   sync.Mutex
}

func New

func New(connection *rpc.Client, websocketURL string, config TPUClientConfig) (*TPUClient, error)

func (*TPUClient) Load

func (tpuClient *TPUClient) Load(connection *rpc.Client, websocketURL string, config TPUClientConfig) error

func (*TPUClient) SendRawTransaction

func (tpuClient *TPUClient) SendRawTransaction(transaction []byte, amount int) error

func (*TPUClient) SendRawTransactionSameConn

func (tpuClient *TPUClient) SendRawTransactionSameConn(transaction []byte, amount int) error

func (*TPUClient) SendTransaction

func (tpuClient *TPUClient) SendTransaction(transaction *solana.Transaction, amount int) (solana.Signature, error)

func (*TPUClient) SendTransactionSameConn

func (tpuClient *TPUClient) SendTransactionSameConn(transaction *solana.Transaction, amount int) (solana.Signature, error)

type TPUClientConfig

type TPUClientConfig struct {
	FanoutSlots uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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