mirror of
https://github.com/hanzoai/ingress.git
synced 2026-10-26 02:47:15 +00:00
Standing fork rule: a hanzoai fork declares its OWN module path and is required directly -- never resolved via `replace` against the upstream path. Both of these violated it, and that is precisely why the upstream brand was still printed on every import line in pkg/plugins and pkg/middlewares/grpcweb. github.com/traefik/yaegi v0.16.1 -> github.com/hanzoai/yaegi v0.16.2 github.com/traefik/grpc-web v0.16.0 -> github.com/hanzoai/grpc-web v0.16.1 The forks now declare those module paths themselves (hanzoai/yaegi c54ababa, hanzoai/grpc-web 7f097a6), so both `replace` directives are deleted rather than repointed. Resolution is unchanged -- same source, same code, one patch bump each to carry the new module line. go.sum gains only the four new hashes; nothing else is rewritten, so the pre-existing luxfi/zap checksum entry is untouched. Verified: go build over the non-webui package set, plus ./pkg/plugins/... and ./pkg/middlewares/grpcweb/... green.
27 lines
727 B
Go
27 lines
727 B
Go
package grpcweb
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/hanzoai/grpc-web/go/grpcweb"
|
|
"github.com/hanzoai/ingress/pkg/config/dynamic"
|
|
"github.com/hanzoai/ingress/pkg/middlewares"
|
|
)
|
|
|
|
const typeName = "GRPCWeb"
|
|
|
|
// New builds a new gRPC web request converter.
|
|
func New(ctx context.Context, next http.Handler, config dynamic.GrpcWeb, name string) http.Handler {
|
|
middlewares.GetLogger(ctx, name, typeName).Debug().Msg("Creating middleware")
|
|
|
|
return grpcweb.WrapHandler(next, grpcweb.WithCorsForRegisteredEndpointsOnly(false), grpcweb.WithOriginFunc(func(origin string) bool {
|
|
for _, originCfg := range config.AllowOrigins {
|
|
if originCfg == "*" || originCfg == origin {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}))
|
|
}
|