Commit f553ab0c authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Save all of a bridge's OR addresses

Bridges can have multiple OR addresses, indicated by the 'a' keywork in
the the network status document:
https://gitlab.torproject.org/tpo/core/torspec/-/blob/c17c36c57635a9ebf88b2b41dc41cbddcf56f7ef/dir-spec.txt#L1616
parent 396e9c87
Pipeline #12530 failed with stage
in 2 minutes and 50 seconds
......@@ -157,13 +157,12 @@ func loadBridgesFromNetworkstatus(networkstatusFile string) (map[string]*resourc
if addr, err := net.ResolveIPAddr("", status.Address.IPv6Address.String()); err == nil {
b.Address = resources.IPAddr{*addr}
b.Port = status.Address.IPv6ORPort
} else {
addr, err := net.ResolveIPAddr("", status.Address.IPv4Address.String())
if err != nil {
continue
}
b.ORAddresses = append(b.ORAddresses, b.Address)
}
if addr, err := net.ResolveIPAddr("", status.Address.IPv4Address.String()); err == nil {
b.Address = resources.IPAddr{*addr}
b.Port = status.Address.IPv4ORPort
b.ORAddresses = append(b.ORAddresses, b.Address)
}
//check to see if the bridge has the running flag
......
......@@ -45,11 +45,12 @@ func (a *IPAddr) UnmarshalJSON(data []byte) error {
// BridgeBase implements variables and methods that are shared by vanilla and
// pluggable transport bridges.
type BridgeBase struct {
Protocol string `json:"protocol"`
Address IPAddr `json:"address"`
Port uint16 `json:"port"`
Fingerprint string `json:"fingerprint"`
Distributor string `json:"-"`
Protocol string `json:"protocol"`
Address IPAddr `json:"address"`
Port uint16 `json:"port"`
Fingerprint string `json:"fingerprint"`
Distributor string `json:"-"`
ORAddresses []IPAddr `json: "or-addresses"`
}
// Bridge represents a Tor bridge.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment