Documentation
¶
Index ¶
- func NewConfig(httpAddress string, httpPort int, udpAddress string, udpPort int, ...) *config
- func NewHTTPServer() *httpServer
- func NewServer(conns Storer[uint64, time.Time], torrents Storer[InfoHash, *Torrent], ...) (*server, error)
- func NewUDPServer() *udpServer
- type Cacher
- type InfoHash
- type Peer
- type PeerID
- type Serverer
- type Storer
- type Torrent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPServer ¶
func NewHTTPServer() *httpServer
func NewUDPServer ¶
func NewUDPServer() *udpServer
Types ¶
type Cacher ¶
type Cacher[K comparable, V any] interface { Get(key K) (V, bool) Freeze(s Storer[K, V]) Size() int json.Marshaler }
func NewCache ¶
func NewCache[K comparable, V any]() Cacher[K, V]
type Peer ¶
type Peer struct {
Downloaded uint64 `json:"downloaded"`
Left uint64 `json:"left"`
Uploaded uint64 `json:"uploaded"`
Event uint32 `json:"event"`
IP uint32 `json:"ip"`
Port uint16 `json:"port"`
Key uint32 `json:"key"`
Time time.Time `json:"time"`
}
func (*Peer) MarshalJSON ¶
type Storer ¶
type Storer[K comparable, V any] interface { Set(key K, value V) Get(key K) (V, bool) Delete(key K) Map(fn func(K, V)) json.Marshaler }
func NewStore ¶
func NewStore[K comparable, V any]() Storer[K, V]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.