core

package
v0.5.37 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      EventType
	Peer      bnet.PeerInfo
	From      string
	Content   string
	Name      string
	Size      int64
	Received  int64
	Total     int64
	Path      string
	Err       error
	LocalAddr string
	Outgoing  bool
}

type EventType

type EventType string
const (
	EventPeerFound    EventType = "peer_found"
	EventPeerLost     EventType = "peer_lost"
	EventTextReceived EventType = "text_received"
	EventFileStart    EventType = "file_start"
	EventFileProgress EventType = "file_progress"
	EventFileDone     EventType = "file_done"
	EventError        EventType = "error"
	EventReady        EventType = "ready"
	EventLog          EventType = "log"
)

type SendRequest

type SendRequest struct {
	To      peer.ID
	Content string
	File    string
}

type Service

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

func NewService

func NewService(cfg *config.Config, cfgPath string) *Service

func (*Service) Connect

func (s *Service) Connect(ctx context.Context, addr string) error

func (*Service) ConnectByNickname added in v0.2.8

func (s *Service) ConnectByNickname(ctx context.Context, nickname string) error

func (*Service) Events

func (s *Service) Events() <-chan Event

func (*Service) Send

func (s *Service) Send(ctx context.Context, req SendRequest) error

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Stop

func (s *Service) Stop() error

Jump to

Keyboard shortcuts

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