| 178 | } |
| 179 | |
| 180 | func createInternalProxy(config configuration.Configuration, debugLogger *zerolog.Logger, invocation workflow.InvocationContext) (*proxy.WrapperProxy, error) { |
| 181 | caData, err := GetGlobalCertAuthority(config, debugLogger) |
| 182 | if err != nil { |
| 183 | return nil, err |
| 184 | } |
| 185 | |
| 186 | wrapperProxy, err := proxy.NewWrapperProxy(config, cliv2.GetFullVersion(), debugLogger, caData) |
| 187 | if err != nil { |
| 188 | return nil, errors.Wrap(err, "Failed to create proxy!") |
| 189 | } |
| 190 | |
| 191 | wrapperProxy.RegisterInterceptor(interceptor.NewV1AnalyticsInterceptor(invocation)) |
| 192 | wrapperProxy.RegisterInterceptor(interceptor.NewLegacyFeatureFlagInterceptor(invocation)) |
| 193 | // The networkinjector intercepts all requests from the legacy CLI and re-routes them to the existing networking |
| 194 | // layer. It should therefore be kept as the last interceptor in the chain, as it circuit breaks goproxy's own |
| 195 | // routing. Any interceptor added later will not be called. |
| 196 | wrapperProxy.RegisterInterceptor(interceptor.NewNetworkInjector(invocation)) |
| 197 | |
| 198 | err = wrapperProxy.Start() |
| 199 | if err != nil { |
| 200 | return nil, errors.Wrap(err, "Failed to start the proxy!") |
| 201 | } |
| 202 | |
| 203 | return wrapperProxy, nil |
| 204 | } |
| 205 | |
| 206 | // ValidateGlibcVersion checks if the glibc version is supported and returns an Error Catalog error if it is not. |
| 207 | // This check only applies to glibc-based Linux systems (amd64, arm64). |