burble.dn42 customisations
This commit is contained in:
parent
8457b18d46
commit
b5204d87e6
59
.drone.yml
Normal file
59
.drone.yml
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build frontend
|
||||
image: golang
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- cd frontend
|
||||
- go vet
|
||||
- go build
|
||||
|
||||
- name: build proxy
|
||||
image: golang
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- cd proxy
|
||||
- go vet
|
||||
- go build
|
||||
|
||||
- name: stage
|
||||
image: alpine
|
||||
commands:
|
||||
- mkdir artifacts
|
||||
- mv frontend/frontend artifacts/
|
||||
- mv proxy/proxy artifacts/
|
||||
|
||||
- name: upload
|
||||
image: plugins/s3
|
||||
settings:
|
||||
bucket: artifacts
|
||||
access_key:
|
||||
from_secret: MINIO_ACCESS_KEY
|
||||
secret_key:
|
||||
from_secret: MINIO_SECRET_KEY
|
||||
endpoint: https://minio.burble.dn42
|
||||
region: uk-lon3
|
||||
path_style: true
|
||||
source: artifacts/*
|
||||
strip_prefix: artifacts/
|
||||
target: /bird-lg-go/${DRONE_BRANCH}
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: MINIO_ACCESS_KEY
|
||||
get:
|
||||
path: burble.dn42/kv/data/drone/minio
|
||||
name: ACCESS_KEY
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: MINIO_SECRET_KEY
|
||||
get:
|
||||
path: burble.dn42/kv/data/drone/minio
|
||||
name: SECRET_KEY
|
@ -1,5 +1,7 @@
|
||||
# Bird-lg-go
|
||||
|
||||
[](https://ci.burble.dn42/burble.dn42/bird-lg-go)
|
||||
|
||||
An alternative implementation for [bird-lg](https://github.com/sileht/bird-lg) written in Go. Both frontend and backend (proxy) are implemented, and can work with either the original Python implementation or the Go implementation.
|
||||
|
||||
> The code on master branch no longer support BIRDv1. Branch "bird1" is the last version that supports BIRDv1.
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h2>BGPmap: {{ html .Target }}</h2>
|
||||
<h2><span class="badge badge-info mr-3">BGPmap</span>{{ html .Target }}</h2>
|
||||
<div id="bgpmap">
|
||||
</div>
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
<h2>{{ html .ServerName }}: {{ html .Target }}</h2>
|
||||
<h2 class="mb-3"><span class="badge badge-info mr-3">{{ html .ServerName }}</span>{{ html .Target }}</h2>
|
||||
{{ .Result }}
|
||||
|
@ -12,7 +12,7 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<a class="navbar-brand" href="{{ .BrandURL }}">{{ .Brand }}</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@ -70,7 +70,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="container mt-4">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
|
@ -3,16 +3,17 @@
|
||||
<table class="table table-striped table-bordered table-sm sortable">
|
||||
<thead>
|
||||
{{ range .Header }}
|
||||
{{ if ne . "Table" }}
|
||||
<th scope="col">{{ html . }}</th>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Rows }}
|
||||
<tr class="table-{{ .MappedState }}">
|
||||
<tr>
|
||||
<td><a href="/detail/{{ $ServerName }}/{{ urlquery .Name }}">{{ html .Name }}</a></td>
|
||||
<td>{{ html .Proto }}</td>
|
||||
<td>{{ html .Table }}</td>
|
||||
<td>{{ html .State }}</td>
|
||||
<td><span class="badge badge-{{ .MappedState }}">{{ html .State }}</span></td>
|
||||
<td>{{ html .Since }}</td>
|
||||
<td>{{ html .Info }}</td>
|
||||
</tr>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<h2>whois {{ html .Target }}</h2>
|
||||
<h2><span class="badge badge-info mr-3">whois<span>{{ html .Target }}</h2>
|
||||
{{ .Result }}
|
||||
|
@ -88,6 +88,12 @@ func webBackendCommunicator(endpoint string, command string) func(w http.Respons
|
||||
urlCommands = split[2]
|
||||
}
|
||||
|
||||
if (command == "generic") && !(urlCommands == "memory" || urlCommands == "status") {
|
||||
renderPageTemplate(w, r, " - "+html.EscapeString(endpoint+" show "+urlCommands),
|
||||
"<h2>'show "+urlCommands+"' not supported</h2>")
|
||||
return
|
||||
}
|
||||
|
||||
var backendCommand string
|
||||
if strings.Contains(backendCommandPrimitive, "%") {
|
||||
backendCommand = fmt.Sprintf(backendCommandPrimitive, urlCommands)
|
||||
@ -235,8 +241,8 @@ func webServerStart(l net.Listener) {
|
||||
http.HandleFunc("/generic/", webBackendCommunicator("bird", "generic"))
|
||||
http.HandleFunc("/traceroute/", webBackendCommunicator("traceroute", "traceroute"))
|
||||
http.HandleFunc("/whois/", webHandlerWhois)
|
||||
http.HandleFunc("/api/", apiHandler)
|
||||
http.HandleFunc("/telegram/", webHandlerTelegramBot)
|
||||
// http.HandleFunc("/api/", apiHandler)
|
||||
// http.HandleFunc("/telegram/", webHandlerTelegramBot)
|
||||
|
||||
// Start HTTP server
|
||||
http.Serve(l, handlers.LoggingHandler(os.Stdout, http.DefaultServeMux))
|
||||
|
Loading…
x
Reference in New Issue
Block a user