gossip

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientName = "mithril"
)
View Source
const (
	DefaultBindAddr = "0.0.0.0:0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.3.0

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

func NewClient added in v0.3.0

func NewClient(cfg Config) (*Client, error)

func (*Client) Identity added in v0.3.0

func (c *Client) Identity() ed25519.PrivateKey

func (*Client) Pubkey added in v0.3.0

func (c *Client) Pubkey() Pubkey

func (*Client) RepairPeers added in v0.3.0

func (c *Client) RepairPeers() []RepairPeer

func (*Client) Run added in v0.3.0

func (c *Client) Run(ctx context.Context) error

func (*Client) ShredVersion added in v0.3.0

func (c *Client) ShredVersion() uint16

func (*Client) Stats added in v0.3.0

func (c *Client) Stats() Stats

type Config added in v0.3.0

type Config struct {
	Entrypoint        string
	BindAddr          string
	TVUAddr           string
	AdvertisedIP      string
	ShredVersion      uint16
	Identity          ed25519.PrivateKey
	PushInterval      time.Duration
	PingInterval      time.Duration
	EntrypointTimeout time.Duration
	Name              string
}

type ContactInfo

type ContactInfo struct {
	Pubkey          Pubkey
	Wallclock       uint64
	Outset          uint64
	ShredVer        uint16
	Version         Version
	Addrs           []net.IP
	Sockets         []SocketEntry
	GossipAddr      *net.UDPAddr
	ServeRepairAddr *net.UDPAddr
	TVUAddr         *net.UDPAddr
	Extensions      [][]byte
}

func NewContactInfo added in v0.3.0

func NewContactInfo(pubkey Pubkey, shredVersion uint16, gossipAddr, tvuAddr *net.UDPAddr) (*ContactInfo, error)

func (*ContactInfo) CloneWithWallclock added in v0.3.0

func (c *ContactInfo) CloneWithWallclock(wallclock uint64) *ContactInfo

func (*ContactInfo) SetSocket added in v0.3.0

func (c *ContactInfo) SetSocket(key uint8, addr *net.UDPAddr) error

type CrdsValue

type CrdsValue struct {
	Signature   Signature
	ContactInfo *ContactInfo
	Data        []byte
}

func (CrdsValue) Verify added in v0.3.0

func (v CrdsValue) Verify() bool

type EchoResponse added in v0.3.0

type EchoResponse struct {
	Address      net.IP
	ShredVersion uint16
}

func QueryEntrypoint added in v0.3.0

func QueryEntrypoint(entrypoint *net.UDPAddr, timeout time.Duration) (EchoResponse, error)

type Hash

type Hash [32]byte

type Ping

type Ping struct {
	From      Pubkey
	Token     [32]byte
	Signature Signature
}

func (Ping) Verify

func (p Ping) Verify() bool

type Pong added in v0.3.0

type Pong struct {
	From      Pubkey
	Hash      Hash
	Signature Signature
}

func (Pong) Verify added in v0.3.0

func (p Pong) Verify() bool

type Pubkey

type Pubkey [32]byte

type RepairPeer added in v0.3.0

type RepairPeer struct {
	Pubkey   Pubkey
	Addr     *net.UDPAddr
	LastSeen time.Time
}

type Signature

type Signature [64]byte

type SocketEntry added in v0.3.0

type SocketEntry struct {
	Key   uint8
	Index uint8
	Port  uint16
}

type Stats added in v0.3.0

type Stats struct {
	RxPackets        uint64
	TxPackets        uint64
	RxDecodeErrors   uint64
	TxErrors         uint64
	RxPings          uint64
	RxPongs          uint64
	RxContacts       uint64
	AcceptedContacts uint64
	RxPullRequests   uint64
	TxPushMessages   uint64
	TxPingMessages   uint64
	TxPongMessages   uint64
	TxPullResponses  uint64
	LastRxUnix       int64
	LastTxUnix       int64
	Peers            int
	RepairPeers      int
}

type Version added in v0.3.0

type Version struct {
	Major      uint16
	Minor      uint16
	Patch      uint16
	Commit     uint32
	FeatureSet uint32
	Client     uint16
}

Jump to

Keyboard shortcuts

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