mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
fix: Allow tor address with subdomain #149
This commit is contained in:
parent
3f5c2b9905
commit
f227371fa6
1 changed files with 5 additions and 3 deletions
|
@ -296,10 +296,12 @@ func (r *moneroRepo) Add(protocol string, hostname string, port uint) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Checks if a given hostname is a valid TOR v3 .onion address
|
||||
// TOR v3 .onion addresses are 56 characters of base32 followed by ".onion"
|
||||
// validTorHostname shecks if a given hostname is a valid TOR v3 .onion address
|
||||
// with optional subdomain
|
||||
//
|
||||
// TOR v3 .onion addresses are 56 characters of `base32` followed by ".onion"
|
||||
func validTorHostname(hostname string) bool {
|
||||
return regexp.MustCompile(`^[a-z2-7]{56}\.onion$`).MatchString(hostname)
|
||||
return regexp.MustCompile(`^([a-z0-9-]+\.)*[a-z2-7]{56}\.onion$`).MatchString(hostname)
|
||||
}
|
||||
|
||||
func (r *moneroRepo) Delete(id uint) error {
|
||||
|
|
Loading…
Reference in a new issue