Skip to content

Commit

Permalink
Update code style in bfe_modules (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxinheihei authored and iyangsj committed Dec 11, 2019
1 parent fc079cc commit 9458fd3
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 25 deletions.
4 changes: 2 additions & 2 deletions bfe_modules/mod_auth_basic/mod_auth_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ func (m *ModuleAuthBasic) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.We
return fmt.Errorf("%s.Init(): AddFilter(m.authBasicHandler): %v", m.name, err)
}

err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init():RegisterHandlers(m.monitorHandlers): %v", m.name, err)
}

err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %v", m.name, err)
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_modules/mod_block/mod_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ func (m *ModuleBlock) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHan
}

// register web handler for monitor
err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init():RegisterHandlers(m.monitorHandlers): %s", m.name, err.Error())
}
// register web handler for reload
err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_RELOAD, m.reloadHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleReload, m.reloadHandlers())
if err != nil {
return fmt.Errorf("%s.Init():RegisterHandlers(m.reloadHandlers): %s", m.name, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_modules/mod_compress/mod_compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ func (m *ModuleCompress) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.Web
return fmt.Errorf("%s.Init(): AddFilter(m.compressHandler): %v", m.name, err)
}

err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandlers(m.monitorHandlers): %v", m.name, err)
}

err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_RELOAD, m.reloadHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleReload, m.reloadHandlers())
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandlers(m.reloadHandlerr): %v", m.name, err)
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_errors/mod_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (m *ModuleErrors) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHa
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_modules/mod_geo/mod_geo.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ func (m *ModuleGeo) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHandl
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
// register web handler for monitor
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_MONITOR, m.name, m.getState)
err = whs.RegisterHandler(web_monitor.WebHandleMonitor, m.name, m.getState)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.getState): %s", m.name, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_header/mod_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (m *ModuleHeader) init(cfg *ConfModHeader, cbs *bfe_module.BfeCallbacks,
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_http_code/mod_http_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (m *ModuleHttpCode) Init(cbs *bfe_module.BfeCallbacks,
}

// register web handlers for monitor
err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandlers(m.monitorHandlers): %v", m.name, err)
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_logid/mod_logid.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (m *ModuleLogId) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHan
}

// register web handler
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_MONITOR, m.name, m.getState)
err = whs.RegisterHandler(web_monitor.WebHandleMonitor, m.name, m.getState)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.getState): %s", m.name, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_redirect/mod_redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (m *ModuleRedirect) init(cfg *ConfModRedirect, cbs *bfe_module.BfeCallbacks
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion bfe_modules/mod_rewrite/mod_rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (m *ModuleReWrite) init(cfg *ConfModReWrite, cbs *bfe_module.BfeCallbacks,
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_modules/mod_static/mod_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ func (m *ModuleStatic) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHa
return fmt.Errorf("%s.Init(): AddFilter(m.staticFileHandler): %v", m.name, err)
}

err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init():RegisterHandlers(m.monitorHandlers): %s", m.name, err.Error())
}

err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %v", m.name, err)
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_modules/mod_trust_clientip/mod_trust_clientip.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ func (m *ModuleTrustClientIP) init(cfg *ConfModTrustClientIP, cbs *bfe_module.Bf
}

// register web handler for monitor
err = web_monitor.RegisterHandlers(whs, web_monitor.WEB_HANDLE_MONITOR, m.monitorHandlers())
err = web_monitor.RegisterHandlers(whs, web_monitor.WebHandleMonitor, m.monitorHandlers())
if err != nil {
return fmt.Errorf("%s.Init():RegisterHandlers(m.monitorHandlers): %s", m.name, err.Error())
}

// register web handler for reload
err = whs.RegisterHandler(web_monitor.WEB_HANDLE_RELOAD, m.name, m.loadConfData)
err = whs.RegisterHandler(web_monitor.WebHandleReload, m.name, m.loadConfData)
if err != nil {
return fmt.Errorf("%s.Init(): RegisterHandler(m.loadConfData): %s", m.name, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions bfe_server/web_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ func (m *BfeMonitor) reloadHandlers() map[string]interface{} {

func (m *BfeMonitor) WebHandlersInit(srv *BfeServer) error {
// register handlers for monitor
err := web_monitor.RegisterHandlers(m.WebHandlers, web_monitor.WEB_HANDLE_MONITOR,
err := web_monitor.RegisterHandlers(m.WebHandlers, web_monitor.WebHandleMonitor,
m.monitorHandlers())
if err != nil {
return err
}

// register handlers for for reload
err = web_monitor.RegisterHandlers(m.WebHandlers, web_monitor.WEB_HANDLE_RELOAD,
err = web_monitor.RegisterHandlers(m.WebHandlers, web_monitor.WebHandleReload,
m.reloadHandlers())
if err != nil {
return err
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ go 1.12
require (
github.com/abbot/go-http-auth v0.4.1-0.20181019201920-860ed7f246ff
github.com/asergeyev/nradix v0.0.0-20170505151046-3872ab85bb56 // indirect
github.com/baidu/go-lib v0.0.0-20191203131845-1dc193267345
github.com/baidu/go-lib v0.0.0-20191211084149-f80a8a568e3f
github.com/gomodule/redigo v2.0.0+incompatible
github.com/oschwald/geoip2-golang v1.3.0
github.com/oschwald/maxminddb-golang v1.5.0 // indirect
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7
github.com/spaolacci/murmur3 v1.1.0
github.com/zmap/go-iptree v0.0.0-20170831022036-1948b1097e25
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed
golang.org/x/tools v0.0.0-20191206204035-259af5ff87bd // indirect
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
gopkg.in/gcfg.v1 v1.2.3
gopkg.in/warnings.v0 v0.1.2 // indirect
)

0 comments on commit 9458fd3

Please sign in to comment.