-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.nim
56 lines (50 loc) · 1.39 KB
/
types.nim
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import net, uri, asyncnet
import comptest
import bitvector
#type btClient = enum
# aTorrentAndroid = "7T"
type PeerAddr* = tuple[ip: IpAddress, port: Port]
#type TFiles* = object #temp experiment, remove
# name*: seq[string]
# path*: DictComp[seq[string]]
# size*: seq[uint]
#type PeerIdData = object
# client:
type Peer* = ref object
host*: PeerAddr
state: char
asocket*: AsyncSocket
socket: Socket
choking*, interested*, amChoking*, amInterested*: bool
peer_id*: string
bitField*: BitVector[uint]
type TorrentFile* = ref object
path*: string
offset*, size*: uint
type Torrent* = ref object #of RootObj
name*, rootPath: string
sha1*, sha1hex*: string
sourceUri*: Uri
trackers*, trackerReqURLs*, urls*: seq[Uri]
private*: bool
pieceSize*, size*, numFiles*, numPieces*, numBlocks*: uint
#files*: TFiles
dirPaths: seq[seq[string]]
uniqPaths: seq[seq[uint32]]
files*: seq[TorrentFile]
#paths*: DictComp[seq[string]]
#filePaths*: seq[string] #temp
peerList*: seq[PeerAddr]
aPeer*: Peer
conns*: seq[Peer]
createdBy*, comment*, source*:string #and encoding?
createdOn*: uint64
handshake*: string
paused*: bool
pcsHashes*: seq[string]
pcsHave*, pcsWant*, pcsActive*, blkHave*, blkWant*, blkActive*: BitVector[uint]
type httpAnnounceParams* = seq[(string,string)]
type btClientProfile = object
httpParams: httpAnnounceParams
peer_id: string
ext: byte