1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

enable prefix lookup via config

This commit is contained in:
Matthias Hannig
2017-07-04 12:36:48 +02:00
parent c770ddd294
commit 9db9b700b2
4 changed files with 18 additions and 9 deletions

View File

@@ -89,8 +89,10 @@ func apiRegisterEndpoints(router *httprouter.Router) error {
endpoint(apiRoutesList))
// Querying
router.GET("/api/lookup/prefix",
endpoint(apiLookupPrefixGlobal))
if AliceConfig.Server.EnablePrefixLookup == true {
router.GET("/api/lookup/prefix",
endpoint(apiLookupPrefixGlobal))
}
return nil
}
@@ -114,8 +116,9 @@ func apiConfigShow(_req *http.Request, _params httprouter.Params) (api.Response,
Asn: AliceConfig.Ui.RoutesNoexports.Asn,
NoexportId: AliceConfig.Ui.RoutesNoexports.NoexportId,
},
NoexportReasons: AliceConfig.Ui.RoutesNoexports.Reasons,
RoutesColumns: AliceConfig.Ui.RoutesColumns,
NoexportReasons: AliceConfig.Ui.RoutesNoexports.Reasons,
RoutesColumns: AliceConfig.Ui.RoutesColumns,
PrefixLookupEnabled: AliceConfig.Server.EnablePrefixLookup,
}
return result, nil
}

View File

@@ -24,6 +24,8 @@ type ConfigResponse struct {
NoexportReasons map[int]string `json:"noexport_reasons"`
RoutesColumns map[string]string `json:"routes_columns"`
PrefixLookupEnabled bool `json:"prefix_lookup_enabled"`
}
type Rejection struct {

View File

@@ -17,9 +17,8 @@ const SOURCE_UNKNOWN = 0
const SOURCE_BIRDWATCHER = 1
type ServerConfig struct {
Listen string `ini:"listen_http"`
EnablePrefixLookup bool `ini:"enable_prefix_lookup"`
Listen string `ini:"listen_http"`
EnablePrefixLookup bool `ini:"enable_prefix_lookup"`
}
type RejectionsConfig struct {

View File

@@ -36,11 +36,16 @@ func main() {
// Setup local routes store
AliceRoutesStore = NewRoutesStore(AliceConfig)
AliceRoutesStore.Start()
if AliceConfig.Server.EnablePrefixLookup == true {
AliceRoutesStore.Start()
}
// Setup local neighbours store
AliceNeighboursStore = NewNeighboursStore(AliceConfig)
AliceNeighboursStore.Start()
if AliceConfig.Server.EnablePrefixLookup == true {
AliceNeighboursStore.Start()
}
// Setup request routing
router := httprouter.New()