Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c1811aab4 |
@@ -164,6 +164,17 @@ func addDShieldNetwork(builder *netipx.IPSetBuilder, line string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// onionooDetails is the part of an Onionoo details document that holds the
|
||||
// relays' addresses.
|
||||
//
|
||||
//nolint:tagliatelle // Onionoo's own field names
|
||||
type onionooDetails struct {
|
||||
Relays []struct {
|
||||
ExitAddresses []string `json:"exit_addresses"`
|
||||
ORAddresses []string `json:"or_addresses"`
|
||||
} `json:"relays"`
|
||||
}
|
||||
|
||||
// parseOnionoo returns every address in the exit_addresses and or_addresses
|
||||
// fields of the relays in an Onionoo details document. A document with no
|
||||
// addresses fails, because the Tor network always has relays.
|
||||
@@ -173,13 +184,7 @@ func parseOnionoo(r io.Reader) (*netipx.IPSet, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//nolint:tagliatelle // Onionoo's own field names
|
||||
var details struct {
|
||||
Relays []struct {
|
||||
ExitAddresses []string `json:"exit_addresses"`
|
||||
ORAddresses []string `json:"or_addresses"`
|
||||
} `json:"relays"`
|
||||
}
|
||||
var details onionooDetails
|
||||
|
||||
err = json.Unmarshal(data, &details)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user