emulatedclient

package
v0.0.0-...-4af7ccb Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TagNameFunction = func(fld reflect.StructField) string {
	name := strings.SplitN(fld.Tag.Get("yaml"), ",", 2)[0]
	if name == "" {
		name = strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
	}
	if name == "-" {
		return ""
	}
	return name
}

Functions

This section is empty.

Types

type AnnounceCapabilities

type AnnounceCapabilities struct {
	SupportAnnounceList         bool `yaml:"supportAnnounceList"`
	AnnounceToAllTiers          bool `yaml:"announceToAllTiers"`
	AnnounceToAllTrackersInTier bool `yaml:"announceToAllTrackersInTier"`
}

type EmulatedClient

type EmulatedClient struct {
	Name                 string                           `yaml:"name" validate:"required"`
	Version              string                           `yaml:"version" validate:"required"`
	KeyGenerator         *keygenerator.KeyGenerator       `yaml:"keyGenerator" validate:"required"`
	PeerIdGenerator      *peeridgenerator.PeerIdGenerator `yaml:"peerIdGenerator" validate:"required"`
	NumWant              int32                            `yaml:"numwant" validate:"min=1"`
	NumWantOnStop        int32                            `yaml:"numwantOnStop"`
	AnnounceCapabilities AnnounceCapabilities             `yaml:"announceCapabilities" validate:"required"`
	Announcer            *announcer.Announcer             `yaml:"announcer" validate:"required"`
	Listener             *Listener                        `yaml:"listener" validate:"required"`
}

func (*EmulatedClient) AfterPropertiesSet

func (c *EmulatedClient) AfterPropertiesSet(proxyFunc func(*http.Request) (*url.URL, error)) error

func (*EmulatedClient) Announce

func (c *EmulatedClient) Announce(request *announces.AnnounceRequest)

func (*EmulatedClient) GetAnnounceCapabilities

func (c *EmulatedClient) GetAnnounceCapabilities() AnnounceCapabilities

func (*EmulatedClient) GetName

func (c *EmulatedClient) GetName() string

func (*EmulatedClient) GetVersion

func (c *EmulatedClient) GetVersion() string

func (*EmulatedClient) StartListener

func (c *EmulatedClient) StartListener(proxyFunc func(*http.Request) (*url.URL, error)) error

func (*EmulatedClient) StopListener

func (c *EmulatedClient) StopListener(ctx context.Context)

func (*EmulatedClient) SupportsHttpAnnounce

func (c *EmulatedClient) SupportsHttpAnnounce() bool

func (*EmulatedClient) SupportsUdpAnnounce

func (c *EmulatedClient) SupportsUdpAnnounce() bool

type IEmulatedClient

type IEmulatedClient interface {
	GetName() string
	GetVersion() string
	Announce(request *announces.AnnounceRequest)
	StartListener(proxyFunc func(*http.Request) (*url.URL, error)) error
	StopListener(ctx context.Context)
	GetAnnounceCapabilities() AnnounceCapabilities
	SupportsHttpAnnounce() bool
	SupportsUdpAnnounce() bool
}

func FromClientFile

func FromClientFile(path string, proxyFunc func(*http.Request) (*url.URL, error)) (IEmulatedClient, error)

func FromReader

func FromReader(reader io.Reader, proxyFunc func(*http.Request) (*url.URL, error)) (IEmulatedClient, error)

type Listener

type Listener struct {
	Port Port `yaml:"port" validate:"required"`
	// contains filtered or unexported fields
}

func (*Listener) AfterPropertiesSet

func (l *Listener) AfterPropertiesSet() error

func (*Listener) Start

func (l *Listener) Start(proxyFunc func(*http.Request) (*url.URL, error)) error

Blocking call until the listener is ready and public ip is retrieved.

func (*Listener) Stop

func (l *Listener) Stop(context.Context)

type Port

type Port struct {
	Min uint16 `yaml:"min" validate:"min=1"`
	Max uint16 `yaml:"max" validate:"min=1,gtefield=Min"`
}

Directories

Path Synopsis
key

Jump to

Keyboard shortcuts

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