-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathclient_types.go
More file actions
36 lines (33 loc) · 843 Bytes
/
client_types.go
File metadata and controls
36 lines (33 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
// Client 定义不同下载客户端的统一行为接口.
type Client interface {
GetClientType() string
ConfigPath() string
SetURL() bool
Login() bool
FetchTorrents() ([]*Torrent, error)
FetchTorrentPeers(torrent *Torrent) ([]*Peer, error)
SubmitBlockPeer(blockPeerMap map[string]BlockPeerInfoStruct) bool
SubmitShadowBanPeer(blockPeerMap map[string]BlockPeerInfoStruct) bool
Detect() bool
}
// Torrent 统一表示不同客户端返回的种子信息.
type Torrent struct {
Hash string
Tracker string
LeechCount int64
TotalSize int64
Peers []*Peer
}
// Peer 统一表示不同客户端返回的 Peer 信息.
type Peer struct {
IP string
Port int
ID string
Client string
DlSpeed int64
UpSpeed int64
Progress float64
Downloaded int64
Uploaded int64
}