mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2025-10-13 22:39:08 +00:00
Add a flag to disable TCP scanning (#45)
* Add a flag to disable TCP scanning * Move the option definition
This commit is contained in:
@@ -41,6 +41,7 @@ type settings struct {
|
|||||||
TrustedPortHeader string
|
TrustedPortHeader string
|
||||||
EnableSecureHeaders bool
|
EnableSecureHeaders bool
|
||||||
EnableHTTP3 bool
|
EnableHTTP3 bool
|
||||||
|
DisableTCPScan bool
|
||||||
Server serverSettings
|
Server serverSettings
|
||||||
Resolver resolver
|
Resolver resolver
|
||||||
version bool
|
version bool
|
||||||
@@ -111,6 +112,12 @@ func Setup(args []string) (output string, err error) {
|
|||||||
false,
|
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.",
|
"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)
|
err = flags.Parse(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -24,7 +24,9 @@ func SetupTemplate(r *gin.Engine) {
|
|||||||
func Setup(r *gin.Engine, geo *service.Geo) {
|
func Setup(r *gin.Engine, geo *service.Geo) {
|
||||||
geoSvc = geo
|
geoSvc = geo
|
||||||
r.GET("/", getRoot)
|
r.GET("/", getRoot)
|
||||||
r.GET("/scan/tcp/:port", scanTCPPort)
|
if !setting.App.DisableTCPScan {
|
||||||
|
r.GET("/scan/tcp/:port", scanTCPPort)
|
||||||
|
}
|
||||||
r.GET("/client-port", getClientPortAsString)
|
r.GET("/client-port", getClientPortAsString)
|
||||||
r.GET("/geo", getGeoAsString)
|
r.GET("/geo", getGeoAsString)
|
||||||
r.GET("/geo/:field", getGeoAsString)
|
r.GET("/geo/:field", getGeoAsString)
|
||||||
|
Reference in New Issue
Block a user