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:
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user