-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.go
66 lines (58 loc) · 1.54 KB
/
models.go
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
57
58
59
60
61
62
63
64
65
66
package scanner
import (
"time"
)
// TorRelayScanner ...
type TorRelayScanner interface {
Grab() (relays []ResultRelay)
GetJSON() []byte
}
type torRelayScanner struct {
relayInfo RelayInfo
// The number of concurrent relays tested. default=30
poolSize int
// Test until at least this number of working relays are found. default=5
goal int
// Socket connection timeout. default=1s
timeout time.Duration
// Preferred alternative URL for onionoo relay list. Could be used multiple times
urls []string
// Scan for relays running on specified port number. Could be used multiple times
ports []string
// Use ipv4 only nodes
ipv4 bool
// Use ipv6 only nodes
ipv6 bool
// Silent mode
silent bool
// Deadline time
deadline time.Duration
}
type (
version string
buildRevision string
relaysPublished string
bridgesPublished string
bridges []any
)
// RelayInfo struct with basics information relay lists
type RelayInfo struct {
Version version
BuildRevision buildRevision `json:"build_revision"`
RelaysPublished relaysPublished `json:"relays_published"`
Relays Relays `json:"relays"`
BridgesPublished bridgesPublished `json:"bridges_published"`
Bridges bridges `json:"bridges"`
}
// Relays ...
type Relays []Relay
// Relay ...
type Relay struct {
Fingerprint string `json:"fingerprint"`
OrAddresses []string `json:"or_addresses"`
}
// ResultRelay ...
type ResultRelay struct {
Fingerprint string `json:"fingerprint"`
Address string `json:"or_addresses"`
}