transport

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseADNLAddress added in v1.6.0

func ParseADNLAddress(addr string) ([]byte, error)

Types

type ADNL

type ADNL interface {
	RemoteAddr() string
	GetID() []byte
	Query(ctx context.Context, req, result tl.Serializable) error
	SetCustomMessageHandler(handler func(msg *adnl.MessageCustom) error)
	SetDisconnectHandler(handler func(addr string, key ed25519.PublicKey))
	GetDisconnectHandler() func(addr string, key ed25519.PublicKey)
	SendCustomMessage(ctx context.Context, req tl.Serializable) error
	GetCloserCtx() context.Context
	Close()
}

type Capabilities added in v1.6.0

type Capabilities struct {
	Value int64 `tl:"long"`
}

type DHT

type DHT interface {
	StoreAddress(ctx context.Context, addresses address.List, ttl time.Duration, ownerKey ed25519.PrivateKey, copies int) (int, []byte, error)
	FindAddresses(ctx context.Context, key []byte) (*address.List, ed25519.PublicKey, error)
	Close()
}

type GetCapabilities added in v1.6.0

type GetCapabilities struct {
	Capabilities int64 `tl:"long"`
}

type GetNextPayloadPart added in v1.6.0

type GetNextPayloadPart struct {
	ID           []byte `tl:"int256"`
	Seqno        int32  `tl:"int"`
	MaxChunkSize int32  `tl:"int"`
}
type Header struct {
	Name  string `tl:"string"`
	Value string `tl:"string"`
}

type PayloadPart added in v1.6.0

type PayloadPart struct {
	Data    []byte   `tl:"bytes"`
	Trailer []Header `tl:"vector struct"`
	IsLast  bool     `tl:"bool"`
}

type RLDP

type RLDP interface {
	Close()
	DoQuery(ctx context.Context, maxAnswerSize uint64, query, result tl.Serializable) error
	SetOnQuery(handler func(transferId []byte, query *rldp.Query) error)
	SetOnDisconnect(handler func())
	SendAnswer(ctx context.Context, maxAnswerSize uint64, timeoutAt uint32, queryId, transferId []byte, answer tl.Serializable) error
	GetADNL() rldp.ADNL
}

type Request added in v1.6.0

type Request struct {
	ID      []byte   `tl:"int256"`
	Method  string   `tl:"string"`
	URL     string   `tl:"string"`
	Version string   `tl:"string"`
	Headers []Header `tl:"vector struct"`
}

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, domain string) (*dns.Domain, error)
}

type Response added in v1.6.0

type Response struct {
	Version    string   `tl:"string"`
	StatusCode int32    `tl:"int"`
	Reason     string   `tl:"string"`
	Headers    []Header `tl:"vector struct"`
	NoPayload  bool     `tl:"bool"`
}

type Transport

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

func NewTransport

func NewTransport(gate *adnl.Gateway, dht DHT, resolver Resolver, storeConn storage.NetConnector, store *VirtualStorage) *Transport

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(request *http.Request) (_ *http.Response, err error)

func (*Transport) Stop

func (t *Transport) Stop()

type VirtualStorage

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

func NewVirtualStorage

func NewVirtualStorage() *VirtualStorage

func (*VirtualStorage) GetActiveFiles

func (v *VirtualStorage) GetActiveFiles(bagId []byte) ([]uint32, error)

func (*VirtualStorage) GetAll

func (v *VirtualStorage) GetAll() []*storage.Torrent

func (*VirtualStorage) GetFS

func (v *VirtualStorage) GetFS() storage.FS

func (*VirtualStorage) GetForcedPieceSize added in v1.7.0

func (v *VirtualStorage) GetForcedPieceSize() uint32

func (*VirtualStorage) GetPiece

func (v *VirtualStorage) GetPiece(bagId []byte, id uint32) (*storage.PieceInfo, error)

func (*VirtualStorage) GetTorrentByOverlay

func (v *VirtualStorage) GetTorrentByOverlay(overlay []byte) *storage.Torrent

func (*VirtualStorage) PiecesMask

func (v *VirtualStorage) PiecesMask(bagId []byte, num uint32) []byte

func (*VirtualStorage) RemovePiece

func (v *VirtualStorage) RemovePiece(bagId []byte, id uint32) error

func (*VirtualStorage) SetActiveFiles

func (v *VirtualStorage) SetActiveFiles(bagId []byte, ids []uint32) error

func (*VirtualStorage) SetPiece

func (v *VirtualStorage) SetPiece(bagId []byte, id uint32, p *storage.PieceInfo) error

func (*VirtualStorage) SetTorrent

func (v *VirtualStorage) SetTorrent(t *storage.Torrent) error

func (*VirtualStorage) UpdateUploadStats added in v1.5.0

func (v *VirtualStorage) UpdateUploadStats(bagId []byte, val uint64) error

func (*VirtualStorage) VerifyOnStartup added in v1.7.0

func (v *VirtualStorage) VerifyOnStartup() bool

Jump to

Keyboard shortcuts

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