mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-11-16 17:07:36 +00:00
fix: Reject input hostname with protocol
This is quick fix. Do not accept submitted tor address with protocol since it won't work. The initial clearnet validation can be done with `net.LookupIP`, but for tor network can't be done with that method. For now, just inform to remove the http:// or https:// part to the submitter.
This commit is contained in:
parent
76a54a0f29
commit
ef953b36fd
1 changed files with 4 additions and 0 deletions
|
@ -220,6 +220,10 @@ func (r *moneroRepo) Add(protocol string, hostname string, port uint) error {
|
||||||
|
|
||||||
ipAddr = hostIp.String()
|
ipAddr = hostIp.String()
|
||||||
ips = ip.SliceToString(hostIps)
|
ips = ip.SliceToString(hostIps)
|
||||||
|
} else {
|
||||||
|
if strings.HasPrefix(hostname, "http://") || strings.HasPrefix(hostname, "https://") {
|
||||||
|
return errors.New("Don't start hostname with http:// or https://, just put your hostname")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
row, err := r.db.Query(`
|
row, err := r.db.Query(`
|
||||||
|
|
Loading…
Reference in a new issue