2
0
mirror of https://github.com/stefan01/transocks.git synced 2025-02-22 03:30:45 +07:00

Set the default listen address to "localhost:1081".

This commit is contained in:
ymmt2005 2016-09-01 23:21:27 +09:00
parent 2f95b420e7
commit 30215d6637
3 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
### Changed
- The default configuration file path is now `/etc/transocks.toml`.
- "listen" config option becomes optional. Default is "localhost:1081".
- Configuration items for logging is changed.
[cmd]: https://github.com/cybozu-go/cmd

View File

@ -66,12 +66,11 @@ Configuration file format
`transocks.toml` is a [TOML][] file.
`listen` and `proxy_url` are mandatory.
Other items are optional.
`proxy_url` are mandatory. Other items are optional.
```
# listening address of transocks.
listen = "localhost:1081"
listen = "localhost:1081" # default is "localhost:1081"
proxy_url = "socks5://10.20.30.40:1080" # for SOCKS5 server
#proxy_url = "http://10.20.30.40:3128" # for HTTP proxy server

View File

@ -18,13 +18,19 @@ type tomlConfig struct {
Log cmd.LogConfig `toml:"log"`
}
const (
defaultAddr = "localhost:1081"
)
var (
configFile = flag.String("f", "/etc/transocks.toml",
"TOML configuration file path")
)
func loadConfig() (*transocks.Config, error) {
tc := new(tomlConfig)
tc := &tomlConfig{
Listen: defaultAddr,
}
md, err := toml.DecodeFile(*configFile, tc)
if err != nil {
return nil, err