xvzc / SpoofDPI

A simple and fast anti-censorship tool written in Go
Apache License 2.0
3.72k stars 257 forks source link

Configuration file support #241

Open dtcyganok opened 2 months ago

dtcyganok commented 2 months ago

Description

It would be nice to have an ability to control the SpoofDPI behavior (all of the CLI options) via config file. Usually it's quite an expected feature and a lot of CLI apps have such a feature.

gray1717 commented 1 month ago
Ledorub commented 1 month ago

We can create a config file of the following format:

proxy:
    addr: "127.0.0.1"
    port: 8080
    connection:
        timeout: 1
        https:
            window-size: 0
    system-proxy: false
    patterns:
        - "example.com"
dns:
    addr: "8.8.8.8"
    port: 53
    enable-doh: false
    ip-v4-only: false
output:
    silent: false
    debug: false

and specify the path to it via -config-file option.

Source Precedence
Defaults 0
File 1
Flags 2

@xvzc

dtcyganok commented 1 month ago

@Ledorub that's nice! I'd also suggest to read the config file by default instead of using option -config-file. It'd be way more conventional. And it would be nice to have the global/system and the local/user config files on linux systems.