mirror of
				https://github.com/stefan01/transocks.git
				synced 2025-10-31 18:18:06 +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 | ||||
| - 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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user