check / check (push) Successful in 5m33s
The program is now sww, built from cmd/sww, with two modes: sww rproxy and sww discriminator. servewaf becomes discriminator everywhere it names that daemon: the package (internal/discriminator), its types, functions, files, the discriminator_line log field, and its docs and tests. smallwebwaf is left only where sneak's directive allows it: the documents' product name, the git.eeqj.de/sneak/smallwebwaf URLs, and the Go module path sneak.berlin/go/smallwebwaf. Everywhere else a name containing it takes the sww form: the package (internal/sww), metric names (sww_*), the X-Sww-* headers, the /_sww/ admin endpoints, the SWW_COMMAND setting, the OS user, and the state and rules directories. No logic changes. make check passes. Model: deepseek-v4-pro
28 lines
516 B
Go
28 lines
516 B
Go
package sww
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
)
|
|
|
|
func TestAppAddress(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for app, want := range map[string]string{
|
|
"http://127.0.0.1:8081": "127.0.0.1:8081",
|
|
"http://app": "app:80",
|
|
"https://app/": "app:443",
|
|
"https://[::1]": "[::1]:443",
|
|
} {
|
|
parsed, err := url.Parse(app)
|
|
if err != nil {
|
|
t.Fatalf("parse %q: %v", app, err)
|
|
}
|
|
|
|
got := appAddress(parsed)
|
|
if got != want {
|
|
t.Errorf("appAddress(%q) is %q, want %q", app, got, want)
|
|
}
|
|
}
|
|
}
|