Support IPv4 HTTP public gateway entries
This commit is contained in:
1 parent
6f01d31f97
commit
6d5973bea3
11 files changed
+146
-32
No files matched your search
@@ -111,6 +111,18 @@ func TestRenderHTTPCustomPort(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderHTTPIPv4AndRejectHTTPSIPv4(t *testing.T) {
|
||||
opts := RenderOptions{Domain: "121.4.111.208", Scheme: "http", Port: 28080}
|
||||
site, httpsSite, err := RenderWithOptions(opts, nil, 0)
|
||||
if err != nil || httpsSite != "" || !strings.Contains(site, "listen 28080;") || !strings.Contains(site, "server_name 121.4.111.208;") {
|
||||
t.Fatalf("HTTP IPv4 rendering failed: %v, %q, %q", err, site, httpsSite)
|
||||
}
|
||||
opts.Scheme = "https"
|
||||
if _, _, err := RenderWithOptions(opts, nil, 0); err == nil {
|
||||
t.Fatal("HTTPS IPv4 must be rejected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderHTTPSCustomPort(t *testing.T) {
|
||||
routes := gin.RoutesInfo{{Method: "GET", Path: "/api/health"}}
|
||||
httpSite, httpsSite, err := RenderWithOptions(RenderOptions{Domain: "vpn.example.com", Scheme: "https", Port: 8443}, routes, 0)
|
||||
|
||||
Reference in new issue
Block a user