pkg

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(ctx context.Context) (err error)

Broadcast sends the broadcast message to all the potential ip addresses

func FindWaiters

func FindWaiters(ctx context.Context, waiter chan string)

func Retry

func Retry(count int, callback func() error) (err error)

Retry run the callback for the specific times

Types

type HeaderBuilder

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

func NewHeaderBuilder

func NewHeaderBuilder(file string) *HeaderBuilder

NewHeaderBuilder creates an instance of the HeaderBuilder

func (*HeaderBuilder) Build

func (h *HeaderBuilder) Build() (err error)

func (*HeaderBuilder) CreateHeader

func (h *HeaderBuilder) CreateHeader(index int, data []byte) []byte

CreateHeader creates the header with index

func (*HeaderBuilder) GetBufferCount

func (h *HeaderBuilder) GetBufferCount() int

GetBufferCount returns the buffer count

func (*HeaderBuilder) GetChunk

func (h *HeaderBuilder) GetChunk() int

GetChunk returns the chunk size

func (*HeaderBuilder) GetFileSize

func (h *HeaderBuilder) GetFileSize() int64

GetFileSize returns the file size

func (*HeaderBuilder) GetFilename

func (h *HeaderBuilder) GetFilename() string

GetFilename returns the file name

type Queue

type Queue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Queue) Pop

func (q *Queue) Pop() (item *int)

func (*Queue) Push

func (q *Queue) Push(value int)

func (*Queue) Size

func (q *Queue) Size() int

type SafeMap

type SafeMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSafeMap

func NewSafeMap(count int) (safeMap *SafeMap)

func (*SafeMap) Get

func (m *SafeMap) Get() *int

func (*SafeMap) GetAndRemove

func (m *SafeMap) GetAndRemove() (target *int)

func (*SafeMap) GetKeys

func (m *SafeMap) GetKeys() (result []int)

func (*SafeMap) GetLowestAndRemove

func (m *SafeMap) GetLowestAndRemove() (target *int)

func (*SafeMap) Put

func (m *SafeMap) Put(k int, val string)

func (*SafeMap) Remove

func (m *SafeMap) Remove(k int)

func (*SafeMap) Size

func (m *SafeMap) Size() int

type UDPSender

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

func NewUDPSender

func NewUDPSender(ip string) *UDPSender

func (*UDPSender) Send

func (s *UDPSender) Send(msg chan string, file string) (err error)

func (*UDPSender) WithPort

func (s *UDPSender) WithPort(port int) *UDPSender

type UDPWaiter

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

UDPWaiter represents a UDP component for receiving data

func NewUDPWaiter

func NewUDPWaiter(port int) *UDPWaiter

NewUDPWaiter creates an instance of NewUDPWaiter

func (*UDPWaiter) ListenAddress

func (w *UDPWaiter) ListenAddress(address string) *UDPWaiter

ListenAddress set the listen address

func (*UDPWaiter) Start

func (w *UDPWaiter) Start(msg chan string) (err error)

Start starts UDP connection

Jump to

Keyboard shortcuts

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