Understand more useragents to be commandline
This commit is contained in:
parent
3ef4ff2570
commit
8906365897
12
main.go
12
main.go
|
@ -3,13 +3,14 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
proxyproto "github.com/pires/go-proxyproto"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
proxyproto "github.com/pires/go-proxyproto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
|
@ -243,5 +244,10 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isReqFromCmdLine(ua string) bool {
|
func isReqFromCmdLine(ua string) bool {
|
||||||
return strings.HasPrefix(ua, "curl") || strings.HasPrefix(ua, "HTTPie")
|
parts := strings.SplitN(ua, "/", 2)
|
||||||
|
switch parts[0] {
|
||||||
|
case "curl", "HTTPie", "httpie-go", "Wget", "fetch libfetch", "Go", "Go-http-client", "ddclient", "Mikrotik", "xh":
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue