mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
feat: Added remote nodes i2p filter #148
This commit is contained in:
parent
e892733a55
commit
f339bc9c3c
3 changed files with 11 additions and 7 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var nettypes = []string{"mainnet", "stagenet", "testnet"}
|
var nettypes = []string{"mainnet", "stagenet", "testnet"}
|
||||||
var protocols = []string{"tor", "http", "https"}
|
var protocols = []string{"tor", "i2p", "http", "https"}
|
||||||
|
|
||||||
type nodeStatus struct {
|
type nodeStatus struct {
|
||||||
Code int
|
Code int
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var nettypes = []string{"mainnet", "stagenet", "testnet"}
|
var nettypes = []string{"mainnet", "stagenet", "testnet"}
|
||||||
var protocols = []string{"tor", "http", "https"}
|
var protocols = []string{"tor", "i2p", "http", "https"}
|
||||||
|
|
||||||
type nodeStatus struct {
|
type nodeStatus struct {
|
||||||
Code int
|
Code int
|
||||||
|
|
|
@ -99,13 +99,17 @@ func (q *QueryNodes) toSQL() (args []interface{}, where string) {
|
||||||
wq = append(wq, "nettype = ?")
|
wq = append(wq, "nettype = ?")
|
||||||
args = append(args, q.Nettype)
|
args = append(args, q.Nettype)
|
||||||
}
|
}
|
||||||
if q.Protocol != "any" && slices.Contains([]string{"tor", "http", "https"}, q.Protocol) {
|
if q.Protocol != "any" && slices.Contains([]string{"tor", "i2p", "http", "https"}, q.Protocol) {
|
||||||
if q.Protocol == "tor" {
|
switch q.Protocol {
|
||||||
|
case "i2p":
|
||||||
|
wq = append(wq, "is_i2p = ?")
|
||||||
|
args = append(args, 1)
|
||||||
|
case "tor":
|
||||||
wq = append(wq, "is_tor = ?")
|
wq = append(wq, "is_tor = ?")
|
||||||
args = append(args, 1)
|
args = append(args, 1)
|
||||||
} else {
|
default:
|
||||||
wq = append(wq, "(protocol = ? AND is_tor = ?)")
|
wq = append(wq, "(protocol = ? AND is_tor = ? AND is_i2p = ?)")
|
||||||
args = append(args, q.Protocol, 0)
|
args = append(args, q.Protocol, 0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if q.CC != "any" {
|
if q.CC != "any" {
|
||||||
|
|
Loading…
Reference in a new issue