chore: add quiet option to arguments (#234)

* feat: add quiet option to arguments

* docs: fit docs to new feature

* chore: rename the quiet option to silent, fix docs

* docs: remove mentions of the banner option

* feat!: remove the banner option

BREAKING CHANGES: the banner option is no longer supported

* chore: remove the useless PrintSimpleInfo function

* docs: improve the wording of the silent option
This commit is contained in:
Ilia Grigoriev 2024-09-08 16:43:09 +03:00 committed by GitHub
parent 78b9cdb3c2
commit 786d31cbb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 15 additions and 28 deletions

View File

@ -18,8 +18,6 @@ See the installation guide for SpoofDPI [here](https://github.com/xvzc/SpoofDPI/
Usage: spoofdpi [options...] Usage: spoofdpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -32,6 +30,8 @@ Usage: spoofdpi [options...]
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int
port (default 8080) port (default 8080)
-silent
do not show the banner and server information at start up
-system-proxy -system-proxy
enable system-wide proxy (default true) enable system-wide proxy (default true)
-timeout int -timeout int

View File

@ -19,8 +19,6 @@ See the installation guide for SpoofDPI [here](https://github.com/xvzc/SpoofDPI/
Usage: spoofdpi [options...] Usage: spoofdpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -33,6 +31,8 @@ Usage: spoofdpi [options...]
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int
port (default 8080) port (default 8080)
-silent
do not show the banner and server information at start up
-system-proxy -system-proxy
enable system-wide proxy (default true) enable system-wide proxy (default true)
-timeout int -timeout int

View File

@ -19,8 +19,6 @@ SpoofDPI의 설치과정은 [여기](https://github.com/xvzc/SpoofDPI/blob/main/
Usage: spoofdpi [options...] Usage: spoofdpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -33,6 +31,8 @@ Usage: spoofdpi [options...]
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int
port (default 8080) port (default 8080)
-silent
do not show the banner and server information at start up
-system-proxy -system-proxy
enable system-wide proxy (default true) enable system-wide proxy (default true)
-timeout int -timeout int

View File

@ -18,8 +18,6 @@
Usage: spoofdpi [опции...] Usage: spoofdpi [опции...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -32,6 +30,8 @@ Usage: spoofdpi [опции...]
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int
port (default 8080) port (default 8080)
-silent
do not show the banner and server information at start up
-system-proxy -system-proxy
enable system-wide proxy (default true) enable system-wide proxy (default true)
-timeout int -timeout int

View File

@ -21,8 +21,6 @@ See the installation guide for SpoofDPI [here](https://github.com/xvzc/SpoofDPI/
Usage: spoofdpi [options...] Usage: spoofdpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -35,6 +33,8 @@ Usage: spoofdpi [options...]
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int
port (default 8080) port (default 8080)
-silent
do not show the banner and server information at start up
-system-proxy -system-proxy
enable system-wide proxy (default true) enable system-wide proxy (default true)
-timeout int -timeout int

View File

@ -29,10 +29,8 @@ func main() {
pxy := proxy.New(config) pxy := proxy.New(config)
if config.Banner { if !config.Silent {
util.PrintColoredBanner() util.PrintColoredBanner()
} else {
util.PrintSimpleInfo()
} }
if config.SystemProxy { if config.SystemProxy {

View File

@ -15,7 +15,7 @@ type Args struct {
DnsPort uint16 DnsPort uint16
EnableDoh bool EnableDoh bool
Debug bool Debug bool
Banner bool Silent bool
SystemProxy bool SystemProxy bool
Timeout uint16 Timeout uint16
AllowedPattern StringArray AllowedPattern StringArray
@ -43,7 +43,7 @@ func ParseArgs() *Args {
uintNVar(&args.DnsPort, "dns-port", 53, "port number for dns") uintNVar(&args.DnsPort, "dns-port", 53, "port number for dns")
flag.BoolVar(&args.EnableDoh, "enable-doh", false, "enable 'dns-over-https'") flag.BoolVar(&args.EnableDoh, "enable-doh", false, "enable 'dns-over-https'")
flag.BoolVar(&args.Debug, "debug", false, "enable debug output") flag.BoolVar(&args.Debug, "debug", false, "enable debug output")
flag.BoolVar(&args.Banner, "banner", true, "enable banner") flag.BoolVar(&args.Silent, "silent", false, "do not show the banner and server information at start up")
flag.BoolVar(&args.SystemProxy, "system-proxy", true, "enable system-wide proxy") flag.BoolVar(&args.SystemProxy, "system-proxy", true, "enable system-wide proxy")
uintNVar(&args.Timeout, "timeout", 0, "timeout in milliseconds; no timeout when not given") uintNVar(&args.Timeout, "timeout", 0, "timeout in milliseconds; no timeout when not given")
uintNVar(&args.WindowSize, "window-size", 0, `chunk size, in number of bytes, for fragmented client hello, uintNVar(&args.WindowSize, "window-size", 0, `chunk size, in number of bytes, for fragmented client hello,

View File

@ -15,7 +15,7 @@ type Config struct {
DnsPort int DnsPort int
EnableDoh bool EnableDoh bool
Debug bool Debug bool
Banner bool Silent bool
SystemProxy bool SystemProxy bool
Timeout int Timeout int
WindowSize int WindowSize int
@ -38,7 +38,7 @@ func (c *Config) Load(args *Args) {
c.DnsPort = int(args.DnsPort) c.DnsPort = int(args.DnsPort)
c.Debug = args.Debug c.Debug = args.Debug
c.EnableDoh = args.EnableDoh c.EnableDoh = args.EnableDoh
c.Banner = args.Banner c.Silent = args.Silent
c.SystemProxy = args.SystemProxy c.SystemProxy = args.SystemProxy
c.Timeout = int(args.Timeout) c.Timeout = int(args.Timeout)
c.AllowedPatterns = parseAllowedPattern(args.AllowedPattern) c.AllowedPatterns = parseAllowedPattern(args.AllowedPattern)
@ -69,14 +69,3 @@ func PrintColoredBanner() {
pterm.DefaultBasicText.Println("Press 'CTRL + c' to quit") pterm.DefaultBasicText.Println("Press 'CTRL + c' to quit")
} }
func PrintSimpleInfo() {
fmt.Println("")
fmt.Println("- ADDR : ", config.Addr)
fmt.Println("- PORT : ", config.Port)
fmt.Println("- DNS : ", config.DnsAddr)
fmt.Println("- DEBUG : ", config.Debug)
fmt.Println("")
fmt.Println("Press 'CTRL + c to quit'")
fmt.Println("")
}