update conf

This commit is contained in:
fatedier 2016-12-25 02:09:01 +08:00
parent eb4f779384
commit 6f90c3400c
6 changed files with 12 additions and 7 deletions

View File

@ -77,5 +77,7 @@ local_ip = 127.0.0.1
local_port = 80 local_port = 80
use_gzip = true use_gzip = true
custom_domains = web03.yourdomain.com custom_domains = web03.yourdomain.com
# locations is only useful for http type
locations = /,/pic
host_header_rewrite = example.com host_header_rewrite = example.com
subdomain = dev subdomain = dev

View File

@ -35,7 +35,7 @@
</td> </td>
<td><span ng-bind="x.type"></span></td> <td><span ng-bind="x.type"></span></td>
<td><span ng-bind="x.listen_port"></span></td> <td><span ng-bind="x.listen_port"></span></td>
<td><span ng-bind="x.status_desc"></span></td> <td><span ng-bind="x.status"></span></td>
<td><span ng-bind="x.current_conns"></span></td> <td><span ng-bind="x.current_conns"></span></td>
<td><span ng-bind="x.daily[x.daily.length-1].flow_out"></span></td> <td><span ng-bind="x.daily[x.daily.length-1].flow_out"></span></td>
<td><span ng-bind="x.daily[x.daily.length-1].flow_in"></span></td> <td><span ng-bind="x.daily[x.daily.length-1].flow_in"></span></td>
@ -66,7 +66,7 @@
current_conns: <<< .CurrentConns >>> , current_conns: <<< .CurrentConns >>> ,
domains: [ <<< range.CustomDomains >>> "<<< . >>>", <<< end >>> ], domains: [ <<< range.CustomDomains >>> "<<< . >>>", <<< end >>> ],
locations: [ <<< range.Locations >>> "<<< . >>>", <<< end >>> ], locations: [ <<< range.Locations >>> "<<< . >>>", <<< end >>> ],
stat: "<<< .StatusDesc >>>", stat: "<<< .Status>>>",
use_encryption: "<<< .UseEncryption >>>", use_encryption: "<<< .UseEncryption >>>",
use_gzip: "<<< .UseGzip >>>", use_gzip: "<<< .UseGzip >>>",
privilege_mode: "<<< .PrivilegeMode >>>", privilege_mode: "<<< .PrivilegeMode >>>",

File diff suppressed because one or more lines are too long

View File

@ -297,6 +297,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
} }
// set infomations from frpc // set infomations from frpc
s.BindAddr = server.BindAddr
s.UseEncryption = req.UseEncryption s.UseEncryption = req.UseEncryption
s.UseGzip = req.UseGzip s.UseGzip = req.UseGzip
s.HostHeaderRewrite = req.HostHeaderRewrite s.HostHeaderRewrite = req.HostHeaderRewrite
@ -332,7 +333,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
} }
// update metric's proxy status // update metric's proxy status
metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip, s.PrivilegeMode, s.CustomDomains, s.ListenPort) metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip, s.PrivilegeMode, s.CustomDomains, s.Locations, s.ListenPort)
// start proxy and listen for user connections, no block // start proxy and listen for user connections, no block
err := s.Start(c) err := s.Start(c)

View File

@ -34,6 +34,7 @@ type ServerMetric struct {
BindAddr string `json:"bind_addr"` BindAddr string `json:"bind_addr"`
ListenPort int64 `json:"listen_port"` ListenPort int64 `json:"listen_port"`
CustomDomains []string `json:"custom_domains"` CustomDomains []string `json:"custom_domains"`
Locations []string `json:"locations"`
Status string `json:"status"` Status string `json:"status"`
UseEncryption bool `json:"use_encryption"` UseEncryption bool `json:"use_encryption"`
UseGzip bool `json:"use_gzip"` UseGzip bool `json:"use_gzip"`
@ -112,7 +113,7 @@ func GetProxyMetrics(proxyName string) *ServerMetric {
func SetProxyInfo(proxyName string, proxyType, bindAddr string, func SetProxyInfo(proxyName string, proxyType, bindAddr string,
useEncryption, useGzip, privilegeMode bool, customDomains []string, useEncryption, useGzip, privilegeMode bool, customDomains []string,
listenPort int64) { locations []string, listenPort int64) {
smMutex.Lock() smMutex.Lock()
info, ok := ServerMetricInfoMap[proxyName] info, ok := ServerMetricInfoMap[proxyName]
if !ok { if !ok {
@ -127,6 +128,7 @@ func SetProxyInfo(proxyName string, proxyType, bindAddr string,
info.BindAddr = bindAddr info.BindAddr = bindAddr
info.ListenPort = listenPort info.ListenPort = listenPort
info.CustomDomains = customDomains info.CustomDomains = customDomains
info.Locations = locations
ServerMetricInfoMap[proxyName] = info ServerMetricInfoMap[proxyName] = info
smMutex.Unlock() smMutex.Unlock()
} }

View File

@ -340,7 +340,7 @@ func loadProxyConf(confFile string) (proxyServers map[string]*ProxyServer, err e
// set metric statistics of all proxies // set metric statistics of all proxies
for name, p := range proxyServers { for name, p := range proxyServers {
metric.SetProxyInfo(name, p.Type, p.BindAddr, p.UseEncryption, p.UseGzip, metric.SetProxyInfo(name, p.Type, p.BindAddr, p.UseEncryption, p.UseGzip,
p.PrivilegeMode, p.CustomDomains, p.ListenPort) p.PrivilegeMode, p.CustomDomains, p.Locations, p.ListenPort)
} }
return proxyServers, nil return proxyServers, nil
} }
@ -402,7 +402,7 @@ func CreateProxy(s *ProxyServer) error {
} }
ProxyServers[s.Name] = s ProxyServers[s.Name] = s
metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip, metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip,
s.PrivilegeMode, s.CustomDomains, s.ListenPort) s.PrivilegeMode, s.CustomDomains, s.Locations, s.ListenPort)
s.Init() s.Init()
return nil return nil
} }