added code for rpx handling
This commit is contained in:
@ -73,6 +73,12 @@ type RPXServiceConfig struct {
|
||||
Addrs []string `yaml:"addresses"`
|
||||
}
|
||||
|
||||
type RPXClientTokenConfig struct {
|
||||
AttrName string `yaml:"attr-name"`
|
||||
Regex string `yaml:"regex"`
|
||||
SubmatchIndex int `yaml:"submatch-index"`
|
||||
}
|
||||
|
||||
type PXYServiceConfig struct {
|
||||
Addrs []string `yaml:"addresses"`
|
||||
}
|
||||
@ -127,8 +133,9 @@ type ServerConfig struct {
|
||||
} `yaml:"ctl"`
|
||||
|
||||
RPX struct {
|
||||
Service RPXServiceConfig `yaml:"service"`
|
||||
TLS ServerTLSConfig `yaml:"tls"`
|
||||
Service RPXServiceConfig `yaml:"service"`
|
||||
TLS ServerTLSConfig `yaml:"tls"`
|
||||
ClientToken RPXClientTokenConfig `yaml:"client-token"`
|
||||
} `yaml:"rpx"`
|
||||
|
||||
PXY struct {
|
||||
@ -158,6 +165,12 @@ type ClientConfig struct {
|
||||
Endpoint RPCEndpointConfig `yaml:"endpoint"`
|
||||
TLS ClientTLSConfig `yaml:"tls"`
|
||||
} `yaml:"rpc"`
|
||||
RPX struct {
|
||||
Target struct {
|
||||
Addr string `yaml:"address"`
|
||||
TLS ClientTLSConfig `yaml:"tls"`
|
||||
} `yaml:"target"`
|
||||
}
|
||||
}
|
||||
|
||||
func load_server_config_to(cfgfile string, cfg *ServerConfig) error {
|
||||
|
@ -121,7 +121,6 @@ main_loop:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func (l *AppLogger) Write(id string, level hodu.LogLevel, fmtstr string, args ...interface{}) {
|
||||
if l.mask & hodu.LogMask(level) == 0 { return }
|
||||
l.write(id, level, 1, fmtstr, args...)
|
||||
|
11
cmd/main.go
11
cmd/main.go
@ -10,6 +10,7 @@ import "net"
|
||||
import "os"
|
||||
import "os/signal"
|
||||
import "path/filepath"
|
||||
import "regexp"
|
||||
import "strings"
|
||||
import "sync"
|
||||
import "syscall"
|
||||
@ -131,6 +132,13 @@ func server_main(ctl_addrs []string, rpc_addrs []string, rpx_addrs[] string, pxy
|
||||
if len(config.PxyAddrs) <= 0 { config.PxyAddrs = cfg.PXY.Service.Addrs }
|
||||
if len(config.WpxAddrs) <= 0 { config.WpxAddrs = cfg.WPX.Service.Addrs }
|
||||
|
||||
config.RpxClientTokenAttrName = cfg.RPX.ClientToken.AttrName
|
||||
if cfg.RPX.ClientToken.Regex != "" {
|
||||
config.RpxClientTokenRegex, err = regexp.Compile(cfg.RPX.ClientToken.Regex)
|
||||
if err != nil { return err }
|
||||
}
|
||||
config.RpxClientTokenSubmatchIndex = cfg.RPX.ClientToken.SubmatchIndex
|
||||
|
||||
config.CtlCors = cfg.CTL.Service.Cors
|
||||
config.CtlAuth, err = make_http_auth_config(&cfg.CTL.Service.Auth)
|
||||
if err != nil { return err }
|
||||
@ -282,10 +290,13 @@ func client_main(ctl_addrs []string, rpc_addrs []string, route_configs []string,
|
||||
if err != nil { return err }
|
||||
config.RpcTls, err = make_tls_client_config(&cfg.RPC.TLS)
|
||||
if err != nil { return err }
|
||||
config.RpxTargetTls, err = make_tls_client_config(&cfg.RPX.Target.TLS)
|
||||
if err != nil { return err }
|
||||
|
||||
if len(rpc_addrs) <= 0 { rpc_addrs = cfg.RPC.Endpoint.Addrs }
|
||||
if len(config.CtlAddrs) <= 0 { config.CtlAddrs = cfg.CTL.Service.Addrs }
|
||||
|
||||
config.RpxTargetAddr = cfg.RPX.Target.Addr
|
||||
config.CtlPrefix = cfg.CTL.Service.Prefix
|
||||
config.CtlCors = cfg.CTL.Service.Cors
|
||||
config.CtlAuth, err = make_http_auth_config(&cfg.CTL.Service.Auth)
|
||||
|
Reference in New Issue
Block a user