47 lines
2.2 KiB
Go
47 lines
2.2 KiB
Go
|
|
// unreachableHosts provides functions to keep track of unreachable hosts
|
|
|
|
package unreachableHosts
|
|
|
|
// A host may be unreachable temporarily, or due to a misconfiguration of the user's client, not the host.
|
|
// Thus, the unreachable hosts list must be pruned periodically.
|
|
// The list should be reset whenever the client changes their configuration (assuming no hosts were reachable before).
|
|
//
|
|
// Each host has an unreachable status for each network type
|
|
// This is because a host can be hosting on two network types at the same time
|
|
// For example, a host's server could crash on one network type but not the other
|
|
//
|
|
// A host may be unreachable from their Tor address but reachable from their clearnet address.
|
|
// An example of why could be that their Tor address is being DDOSed.
|
|
// Thus, requestors keep track of an unreachable status for the Tor and clearnet address of each host.
|
|
// If a host updates their Tor/Clearnet address, their unreachable status will be unknown for the new address.
|
|
|
|
// A host must be unreachable two times via each address type for them to be considered unreachable.
|
|
// This is to give lenience for instances when a connection cuts out unexpectedly, but the host is still reachable.
|
|
// This feature also prevents malicious hosts from sharing unreachable addresses to waste requestor time.
|
|
// The user will try each address type for the host, and then stop trying until the unreachable status is reset for that host.
|
|
// Even if the host changes their addresses, the requestor will still consider them unreachable.
|
|
|
|
// We also have to deal with the scenario when a user is unable to access the entire internet/only the Tor network
|
|
// All unreachable status updates during that time are invalid
|
|
// Thus, before updating the status of hosts using this package, we should verify
|
|
// using check.torproject.org, and a clearnet internet site (example.com), to make sure they can connect.
|
|
|
|
|
|
//TODO: Build package
|
|
|
|
func CheckIfHostIsUnreachable(hostIdentityHash [16]byte, networkType byte, addressType string)(bool, error){
|
|
|
|
return false, nil
|
|
}
|
|
|
|
|
|
func AddHostIsUnreachableEvent(hostIdentityHash [16]byte, networkType byte, addressType string)error{
|
|
|
|
//TODO: Add time of event?
|
|
|
|
return nil
|
|
}
|
|
|
|
|
|
|