ping

package
v1.54.10 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FxPingProtocolID = "/fx.land/ping/0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FxPing

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

func NewFxPing

func NewFxPing(h host.Host, o ...Option) (*FxPing, error)

func (*FxPing) Ping

func (pn *FxPing) Ping(ctx context.Context, to peer.ID) (int, int, error)

func (*FxPing) Shutdown

func (pn *FxPing) Shutdown(ctx context.Context) error

func (*FxPing) Start

func (pn *FxPing) Start(ctx context.Context) error

func (*FxPing) Status

func (pn *FxPing) Status() bool

Get the status of Ping server

func (*FxPing) StopClient

func (pn *FxPing) StopClient(ctx context.Context)

func (*FxPing) StopServer

func (pn *FxPing) StopServer(ctx context.Context) error

type Option

type Option func(*options) error

func WithAllowTransientConnection

func WithAllowTransientConnection(t bool) Option

func WithCount

func WithCount(n int) Option

func WithTimeout

func WithTimeout(to int) Option

func WithWg

func WithWg(wg *sync.WaitGroup) Option

type Ping

type Ping interface {
	Start(context.Context) error
	Ping(context.Context, peer.ID) (int, int, error)
	StopServer(context.Context) error
	StopClient(context.Context)
	Shutdown(context.Context) error
}

type PingRequest

type PingRequest struct {
	ID   string `json:"id"`
	Data string `json:"data"`
}

type PingResponse

type PingResponse struct {
	ID   string `json:"id"`
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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