Add a flag to disable TCP scanning (#45)

* Add a flag to disable TCP scanning

* Move the option definition
This commit is contained in:
AdamB
2025-09-26 14:59:39 +01:00
committed by GitHub
parent 751e5f3885
commit 9b87d28433
2 changed files with 10 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ type settings struct {
TrustedPortHeader string
EnableSecureHeaders bool
EnableHTTP3 bool
DisableTCPScan bool
Server serverSettings
Resolver resolver
version bool
@@ -111,6 +112,12 @@ func Setup(args []string) (output string, err error) {
false,
"Enable HTTP/3 protocol. HTTP/3 requires --tls-bind set, as HTTP/3 starts as a TLS connection that then gets upgraded to UDP. The UDP port is the same as the one used for the TLS server.",
)
flags.BoolVar(
&App.DisableTCPScan,
"disable-scan",
false,
"Disable TCP port scanning functionality",
)
err = flags.Parse(args)
if err != nil {

View File

@@ -24,7 +24,9 @@ func SetupTemplate(r *gin.Engine) {
func Setup(r *gin.Engine, geo *service.Geo) {
geoSvc = geo
r.GET("/", getRoot)
if !setting.App.DisableTCPScan {
r.GET("/scan/tcp/:port", scanTCPPort)
}
r.GET("/client-port", getClientPortAsString)
r.GET("/geo", getGeoAsString)
r.GET("/geo/:field", getGeoAsString)