@@ -29,23 +29,24 @@ var (
2929
3030// Config represents the configuration for sshproxy.
3131type Config struct {
32- Debug bool
33- Log string
34- CheckInterval Duration `yaml:"check_interval"`
35- ErrorBanner string `yaml:"error_banner"`
36- Dump string
37- DumpLimitSize uint64 `yaml:"dump_limit_size"`
38- DumpLimitWindow Duration `yaml:"dump_limit_window"`
39- Etcd etcdConfig
40- EtcdStatsInterval Duration `yaml:"etcd_stats_interval"`
41- LogStatsInterval Duration `yaml:"log_stats_interval"`
42- BgCommand string `yaml:"bg_command"`
43- SSH sshConfig
44- TranslateCommands map [string ]* TranslateCommandConfig `yaml:"translate_commands"`
45- Environment map [string ]string
46- Routes map [string ]* RouteConfig
47- Users []map [string ]subConfig
48- Groups []map [string ]subConfig
32+ Debug bool
33+ Log string
34+ CheckInterval Duration `yaml:"check_interval"`
35+ ErrorBanner string `yaml:"error_banner"`
36+ Dump string
37+ DumpLimitSize uint64 `yaml:"dump_limit_size"`
38+ DumpLimitWindow Duration `yaml:"dump_limit_window"`
39+ Etcd etcdConfig
40+ EtcdStatsInterval Duration `yaml:"etcd_stats_interval"`
41+ LogStatsInterval Duration `yaml:"log_stats_interval"`
42+ BgCommand string `yaml:"bg_command"`
43+ SSH sshConfig
44+ TranslateCommands map [string ]* TranslateCommandConfig `yaml:"translate_commands"`
45+ Environment map [string ]string
46+ Routes map [string ]* RouteConfig
47+ MaxConnectionsPerUser int `yaml:"max_connections_per_user"`
48+ Users []map [string ]subConfig
49+ Groups []map [string ]subConfig
4950}
5051
5152// TranslateCommandConfig represents the configuration of a translate_command.
@@ -82,6 +83,7 @@ type etcdConfig struct {
8283 Username string
8384 Password string
8485 KeyTTL int64
86+ Mandatory bool
8587}
8688
8789type etcdTLSConfig struct {
@@ -93,19 +95,20 @@ type etcdTLSConfig struct {
9395// We use interface{} instead of real type to check if the option was specified
9496// or not.
9597type subConfig struct {
96- Debug interface {}
97- Log interface {}
98- ErrorBanner interface {} `yaml:"error_banner"`
99- Dump interface {}
100- DumpLimitSize interface {} `yaml:"dump_limit_size"`
101- DumpLimitWindow interface {} `yaml:"dump_limit_window"`
102- EtcdStatsInterval interface {} `yaml:"etcd_stats_interval"`
103- LogStatsInterval interface {} `yaml:"log_stats_interval"`
104- BgCommand interface {} `yaml:"bg_command"`
105- TranslateCommands map [string ]* TranslateCommandConfig `yaml:"translate_commands"`
106- Environment map [string ]string
107- Routes map [string ]* RouteConfig
108- SSH sshConfig
98+ Debug interface {}
99+ Log interface {}
100+ ErrorBanner interface {} `yaml:"error_banner"`
101+ Dump interface {}
102+ DumpLimitSize interface {} `yaml:"dump_limit_size"`
103+ DumpLimitWindow interface {} `yaml:"dump_limit_window"`
104+ EtcdStatsInterval interface {} `yaml:"etcd_stats_interval"`
105+ LogStatsInterval interface {} `yaml:"log_stats_interval"`
106+ BgCommand interface {} `yaml:"bg_command"`
107+ TranslateCommands map [string ]* TranslateCommandConfig `yaml:"translate_commands"`
108+ Environment map [string ]string
109+ Routes map [string ]* RouteConfig
110+ MaxConnectionsPerUser interface {} `yaml:"max_connections_per_user"`
111+ SSH sshConfig
109112}
110113
111114func parseSubConfig (config * Config , subconfig * subConfig ) error {
@@ -170,6 +173,10 @@ func parseSubConfig(config *Config, subconfig *subConfig) error {
170173 config .Routes [service ] = opts
171174 }
172175
176+ if subconfig .MaxConnectionsPerUser != nil {
177+ config .MaxConnectionsPerUser = subconfig .MaxConnectionsPerUser .(int )
178+ }
179+
173180 // merge translate_commands
174181 for k , v := range subconfig .TranslateCommands {
175182 config .TranslateCommands [k ] = v
0 commit comments