32 lines
606 B
Go
32 lines
606 B
Go
package proxy
|
|
|
|
import (
|
|
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
|
)
|
|
|
|
type Option struct {
|
|
ServerConfig config.ProxyServerConfig
|
|
RedisConfig config.RedisConfig
|
|
}
|
|
|
|
type OptionFunc func(*Option)
|
|
|
|
func defaultOption() *Option {
|
|
return &Option{
|
|
ServerConfig: config.NewDefaultProxyServerConfig(),
|
|
RedisConfig: config.NewDefaultRedisConfig(),
|
|
}
|
|
}
|
|
|
|
func WithServerConfig(conf config.ProxyServerConfig) OptionFunc {
|
|
return func(opt *Option) {
|
|
opt.ServerConfig = conf
|
|
}
|
|
}
|
|
|
|
func WithRedisConfig(conf config.RedisConfig) OptionFunc {
|
|
return func(opt *Option) {
|
|
opt.RedisConfig = conf
|
|
}
|
|
}
|