This commit is contained in:
Zeev Diukman 2025-03-07 07:33:12 +00:00
parent bd58a7f648
commit b4088175a2
4 changed files with 6 additions and 58 deletions

10
go.mod
View file

@ -4,12 +4,7 @@ go 1.24.0
require github.com/gookit/goutil v0.6.18 // indirect
require (
github.com/zeevdiukman/go-interpreter v0.0.0-20250305163450-43423a7e8ba7
github.com/zeevdiukman/go-reverseproxy v0.0.0-20250305093102-9882ad3edb31
github.com/zeevdiukman/go-router v0.0.0-20250305093130-650cd1d241f5
github.com/zeevdiukman/go-server v0.0.0-20250305093228-f3ab0096fcba
)
require github.com/zeevdiukman/go-zgate v0.0.0-20250307073122-f7ca358b2107
require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
@ -25,6 +20,9 @@ require (
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/zeevdiukman/go-reverseproxy v0.0.0-20250305093102-9882ad3edb31 // indirect
github.com/zeevdiukman/go-router v0.0.0-20250305093130-650cd1d241f5 // indirect
github.com/zeevdiukman/go-server v0.0.0-20250305093228-f3ab0096fcba // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect

4
go.sum
View file

@ -63,14 +63,14 @@ github.com/zeevdiukman/go-config v0.0.0-20250305101848-6cef80370123 h1:AYl8UZu7+
github.com/zeevdiukman/go-config v0.0.0-20250305101848-6cef80370123/go.mod h1:oK8ESatUsIFPpj/p/0iMW3HPs8+97F52O40xjotcY64=
github.com/zeevdiukman/go-helper v0.0.0-20250305091316-396bd5057e2f h1:1UyqJ/MzVw+Oxl8kryguBsObG7qVw+IhlKTE/HhpLGE=
github.com/zeevdiukman/go-helper v0.0.0-20250305091316-396bd5057e2f/go.mod h1:buB5zo+BkiM7kNOI2o33rmXBSlnjH1zpN0DtgNDbnCc=
github.com/zeevdiukman/go-interpreter v0.0.0-20250305163450-43423a7e8ba7 h1:3iW+LgqdYt9OvhcFX5aK3eI5Kr9Ue/wTpiZqBFEWMT8=
github.com/zeevdiukman/go-interpreter v0.0.0-20250305163450-43423a7e8ba7/go.mod h1:fofniVuiVQ022IcHdrRsO67GXj2jIp/D8K+DP7APUrQ=
github.com/zeevdiukman/go-reverseproxy v0.0.0-20250305093102-9882ad3edb31 h1:OaOVvayXo4yf/gg8/IuZzGnFxTXEXGOVXiNVxPC0OgM=
github.com/zeevdiukman/go-reverseproxy v0.0.0-20250305093102-9882ad3edb31/go.mod h1:RAFNKzQy/q2eDB/2WI88dHuiVC8Qqp6iAPDZ+btXACk=
github.com/zeevdiukman/go-router v0.0.0-20250305093130-650cd1d241f5 h1:ssP7N61mi0MLfnaH/ob7xOlu+prPwULl0nZ2hPw/QdE=
github.com/zeevdiukman/go-router v0.0.0-20250305093130-650cd1d241f5/go.mod h1:wY15gRD14GOWs8j6bazZypGkMfCbSdr5cQK77MwzReA=
github.com/zeevdiukman/go-server v0.0.0-20250305093228-f3ab0096fcba h1:BHG0fbASaIBXr+JyIaIt+/x1MIH+wAB5MTj2VQ1nlnU=
github.com/zeevdiukman/go-server v0.0.0-20250305093228-f3ab0096fcba/go.mod h1:HQARDR3c1btC+vNSDekVtC1KM/tVFrJqr3yGrPN3pbo=
github.com/zeevdiukman/go-zgate v0.0.0-20250307073122-f7ca358b2107 h1:1PldMKThu/U5vkmrAJzycaXJE6XR52nVA3NAgZiPl6k=
github.com/zeevdiukman/go-zgate v0.0.0-20250307073122-f7ca358b2107/go.mod h1:b9fvxFwJrZiJ0Q2tv5enpCxL3JYUKJDUb+nVXqeAWIg=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=

50
main.go
View file

@ -1,22 +1,3 @@
/*
Example:
rp1 := reverseproxy.New(ctx, "http://localhost:8080")
rp2 := reverseproxy.New(ctx, "http://localhost:3001")
rp3 := reverseproxy.New(ctx, "http://localhost:3002")
router := router.NewRouter()
pr1 := router.NewHostRouter("keycloak.z.com")
pr1.Handler(rp1)
go func() {
s := server.New().Name("proxy1").Port(443).Router(router)
s.CertKey(CERTS_PATH, "z.com.cert.pem", "z.com.key.pem")
err := s.ListenAndServeTLS()
if err != nil {
log.Println(err.Error())
}
}()
*/
package main
import (
@ -30,43 +11,12 @@ import (
// for demonstration purposes.
func main() {
helper.AppRunner(true, func() {
helper.Clear()
zGate := zgate.New()
zGate.BuildActiveEntryPoints()
zGate.BuildRouters()
zGate.ListenAndServe()
helper.StartTestHTTPServer(3001, "app1")
helper.StartTestHTTPServer(3002, "app2")
})
}
/*
func main() {
Test()
}
func Test() {
ctx := context.Background()
conf := config.New()
rp1 := reverseproxy.New(ctx, conf.HTTP.Services["keycloak"].URL)
rp2 := reverseproxy.New(ctx, conf.HTTP.Services["app1"].URL)
rp3 := reverseproxy.New(ctx, conf.HTTP.Services["app2"].URL)
r := router.NewRouter()
r.NewDomainRouter(conf.HTTP.Routers["keycloak"].Rules.Map["Domain"].Value).Handler(rp1)
r.NewDomainRouter(conf.HTTP.Routers["app1"].Rules.Map["Domain"].Value).Handler(rp2)
r.NewDomainRouter(conf.HTTP.Routers["app2"].Rules.Map["Domain"].Value).Handler(rp3)
s := server.New().Name("proxy1").Port(443).Router(r)
s.CertKey(zgate.CERTS_PATH, "z.com.cert.pem", "z.com.key.pem")
go s.ListenAndServeTLS()
helper.StartTestHTTPServer(3001, "app1")
helper.StartTestHTTPServer(3002, "app2")
select {}
}
*/

BIN
tmp/main

Binary file not shown.