mirror of
https://github.com/stefan01/transocks.git
synced 2025-02-22 11:40:54 +07:00
Set the default listen address to "localhost:1081".
This commit is contained in:
parent
2f95b420e7
commit
30215d6637
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- The default configuration file path is now `/etc/transocks.toml`.
|
- 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.
|
- Configuration items for logging is changed.
|
||||||
|
|
||||||
[cmd]: https://github.com/cybozu-go/cmd
|
[cmd]: https://github.com/cybozu-go/cmd
|
||||||
|
@ -66,12 +66,11 @@ Configuration file format
|
|||||||
|
|
||||||
`transocks.toml` is a [TOML][] file.
|
`transocks.toml` is a [TOML][] file.
|
||||||
|
|
||||||
`listen` and `proxy_url` are mandatory.
|
`proxy_url` are mandatory. Other items are optional.
|
||||||
Other items are optional.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
# listening address of transocks.
|
# 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 = "socks5://10.20.30.40:1080" # for SOCKS5 server
|
||||||
#proxy_url = "http://10.20.30.40:3128" # for HTTP proxy server
|
#proxy_url = "http://10.20.30.40:3128" # for HTTP proxy server
|
||||||
|
@ -18,13 +18,19 @@ type tomlConfig struct {
|
|||||||
Log cmd.LogConfig `toml:"log"`
|
Log cmd.LogConfig `toml:"log"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultAddr = "localhost:1081"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
configFile = flag.String("f", "/etc/transocks.toml",
|
configFile = flag.String("f", "/etc/transocks.toml",
|
||||||
"TOML configuration file path")
|
"TOML configuration file path")
|
||||||
)
|
)
|
||||||
|
|
||||||
func loadConfig() (*transocks.Config, error) {
|
func loadConfig() (*transocks.Config, error) {
|
||||||
tc := new(tomlConfig)
|
tc := &tomlConfig{
|
||||||
|
Listen: defaultAddr,
|
||||||
|
}
|
||||||
md, err := toml.DecodeFile(*configFile, tc)
|
md, err := toml.DecodeFile(*configFile, tc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user