Understand more useragents to be commandline

This commit is contained in:
George Shammas 2022-01-05 10:29:56 -05:00
parent 3ef4ff2570
commit 8906365897
1 changed files with 9 additions and 3 deletions

12
main.go
View File

@ -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
} }