tcp stream (und damit: tls passthrough) ist implementiert

This commit is contained in:
br committed 2026-10-11 01:04:45 +02:00
1 parent 6a5cb95f92
commit fdcd06c93f
16 files changed
+1008 -75

No files matched your search

+21 -7
View File
@@ -21,22 +21,36 @@ func Merge(configs ...*Configuration) (*Configuration, error) {
Services: map[string]*Service{},
Middlewares: map[string]Middleware{},
}
tcp := &TCPConfiguration{
Routers: map[string]*TCPRouter{},
Services: map[string]*TCPService{},
}
var errs []error
for _, c := range configs {
if c == nil || c.HTTP == nil {
if c == nil {
continue
}
errs = append(errs, mergeInto(out.Routers, c.HTTP.Routers, "router")...)
errs = append(errs, mergeInto(out.Services, c.HTTP.Services, "service")...)
errs = append(errs, mergeInto(out.Middlewares, c.HTTP.Middlewares, "middleware")...)
if c.HTTP != nil {
errs = append(errs, mergeInto(out.Routers, c.HTTP.Routers, "router")...)
errs = append(errs, mergeInto(out.Services, c.HTTP.Services, "service")...)
errs = append(errs, mergeInto(out.Middlewares, c.HTTP.Middlewares, "middleware")...)
}
if c.TCP != nil {
errs = append(errs, mergeInto(tcp.Routers, c.TCP.Routers, "tcp router")...)
errs = append(errs, mergeInto(tcp.Services, c.TCP.Services, "tcp service")...)
}
}
if len(errs) > 0 {
return nil, errors.Join(errs...)
}
if len(out.Routers) == 0 && len(out.Services) == 0 && len(out.Middlewares) == 0 {
return &Configuration{}, nil
res := &Configuration{}
if len(out.Routers) > 0 || len(out.Services) > 0 || len(out.Middlewares) > 0 {
res.HTTP = out
}
return &Configuration{HTTP: out}, nil
if len(tcp.Routers) > 0 || len(tcp.Services) > 0 {
res.TCP = tcp
}
return res, nil
}
func mergeInto[V any](dst, src map[string]V, kind string) []error {