repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/testhelpers/config.go | pkg/testhelpers/config.go | package testhelpers
import (
"github.com/traefik/traefik/v3/pkg/config/dynamic"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
)
// BuildConfiguration is a helper to create a configuration.
func BuildConfiguration(dynamicConfigBuilders ...func(*dynamic.HTTPConfiguration)) *dynamic.HTTPConfiguration ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/testhelpers/helpers.go | pkg/testhelpers/helpers.go | package testhelpers
import (
"fmt"
"io"
"net/http"
"net/url"
)
// MustNewRequest creates a new http get request or panics if it can't.
func MustNewRequest(method, urlStr string, body io.Reader) *http.Request {
request, err := http.NewRequest(method, urlStr, body)
if err != nil {
panic(fmt.Sprintf("failed to c... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/switcher.go | pkg/udp/switcher.go | package udp
import (
"github.com/traefik/traefik/v3/pkg/safe"
)
// HandlerSwitcher is a switcher implementation of the Handler interface.
type HandlerSwitcher struct {
handler safe.Safe
}
// ServeUDP implements the Handler interface.
func (s *HandlerSwitcher) ServeUDP(conn *Conn) {
handler := s.handler.Get()
h, ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/conn_test.go | pkg/udp/conn_test.go | package udp
import (
"errors"
"io"
"net"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestConsecutiveWrites(t *testing.T) {
ln, err := Listen(net.ListenConfig{}, "udp", ":0", 3*time.Second)
require.NoError(t, err)
defer func() {
err := ln.Close()
re... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/proxy.go | pkg/udp/proxy.go | package udp
import (
"io"
"net"
"github.com/rs/zerolog/log"
)
// Proxy is a reverse-proxy implementation of the Handler interface.
type Proxy struct {
// TODO: maybe optimize by pre-resolving it at proxy creation time
target string
}
// NewProxy creates a new Proxy.
func NewProxy(address string) (*Proxy, error... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/wrr_load_balancer.go | pkg/udp/wrr_load_balancer.go | package udp
import (
"errors"
"sync"
"github.com/rs/zerolog/log"
)
type server struct {
Handler
weight int
}
// WRRLoadBalancer is a naive RoundRobin load balancer for UDP services.
type WRRLoadBalancer struct {
servers []server
lock sync.Mutex
currentWeight int
index int
}
// NewWR... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/proxy_test.go | pkg/udp/proxy_test.go | package udp
import (
"crypto/rand"
"net"
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestProxy_ServeUDP(t *testing.T) {
backendAddr := ":8081"
go newServer(t, backendAddr, HandlerFunc(func(conn *Conn) {
for {
b := make([]byte, 1024*1024)
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/conn.go | pkg/udp/conn.go | package udp
import (
"context"
"errors"
"fmt"
"io"
"net"
"sync"
"time"
)
// maxDatagramSize is the maximum size of a UDP datagram.
const maxDatagramSize = 65535
const closeRetryInterval = 500 * time.Millisecond
var errClosedListener = errors.New("udp: listener closed")
// Listener augments a session-oriente... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/udp/handler.go | pkg/udp/handler.go | package udp
// Handler is the UDP counterpart of the usual HTTP handler.
type Handler interface {
ServeUDP(conn *Conn)
}
// The HandlerFunc type is an adapter to allow the use of ordinary functions as handlers.
type HandlerFunc func(conn *Conn)
// ServeUDP implements the Handler interface for UDP.
func (f HandlerFu... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/version/version.go | pkg/version/version.go | package version
import (
"context"
"net/http"
"net/url"
"time"
"github.com/google/go-github/v28/github"
"github.com/gorilla/mux"
goversion "github.com/hashicorp/go-version"
"github.com/rs/zerolog/log"
"github.com/unrolled/render"
)
var (
// Version holds the current version of traefik.
Version = "dev"
//... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/rules/parser.go | pkg/rules/parser.go | package rules
import (
"fmt"
"strings"
"github.com/vulcand/predicate"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
const (
and = "and"
or = "or"
)
// TreeBuilder defines the type for a Tree builder.
type TreeBuilder func() *Tree
// Tree represents the rules' tree structure.
type Tree struct {
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/rules/parser_test.go | pkg/rules/parser_test.go | package rules
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// testTree = Tree + CheckErr
type testTree struct {
Matcher string
Not bool
Value []string
RuleLeft *testTree
RuleRight *testTree
// CheckErr allow knowing if a Tree has a rule error.... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/observability.go | pkg/observability/observability.go | package observability
import (
"fmt"
"os"
)
func EnsureUserEnvVar() error {
if os.Getenv("USER") == "" {
if err := os.Setenv("USER", "traefik"); err != nil {
return fmt.Errorf("could not set USER environment variable: %w", err)
}
}
return nil
}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/elastic_test.go | pkg/observability/logs/elastic_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewElasticLogger(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.Co... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/hclog_test.go | pkg/observability/logs/hclog_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewRetryableHTTPLogger(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zero... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/log_test.go | pkg/observability/logs/log_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNoLevel(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.ConsoleWrit... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/logrus.go | pkg/observability/logs/logrus.go | package logs
import (
"github.com/rs/zerolog"
)
type LogrusStdWrapper struct {
logger zerolog.Logger
}
func NewLogrusWrapper(logger zerolog.Logger) *LogrusStdWrapper {
return &LogrusStdWrapper{logger: logger}
}
func (l LogrusStdWrapper) Print(args ...interface{}) {
l.logger.Debug().CallerSkipFrame(1).MsgFunc(ms... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/instana_test.go | pkg/observability/logs/instana_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewInstanaLogger(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.Co... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/instana.go | pkg/observability/logs/instana.go | package logs
import (
"github.com/rs/zerolog"
)
type InstanaLogger struct {
logger zerolog.Logger
}
func NewInstanaLogger(logger zerolog.Logger) *InstanaLogger {
return &InstanaLogger{logger: logger}
}
func (l InstanaLogger) Debug(args ...interface{}) {
l.logger.Debug().CallerSkipFrame(1).MsgFunc(msgFunc(args..... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/otel_test.go | pkg/observability/logs/otel_test.go | package logs
import (
"compress/gzip"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"go.opentelemetry.io/collector/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/wasm.go | pkg/observability/logs/wasm.go | package logs
import (
"context"
"github.com/http-wasm/http-wasm-host-go/api"
"github.com/rs/zerolog"
)
// compile-time check to ensure ConsoleLogger implements api.Logger.
var _ api.Logger = WasmLogger{}
// WasmLogger is a convenience which writes anything above LogLevelInfo to os.Stdout.
type WasmLogger struct ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/hclog.go | pkg/observability/logs/hclog.go | package logs
import (
"fmt"
"strings"
"unicode"
"github.com/rs/zerolog"
)
// RetryableHTTPLogger wraps our logger and implements retryablehttp.LeveledLogger.
// The retry library sends fields as pairs of keys and values as structured logging,
// so we need to adapt them to our logger.
type RetryableHTTPLogger st... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/log.go | pkg/observability/logs/log.go | package logs
import (
"fmt"
"github.com/rs/zerolog"
)
func NoLevel(logger zerolog.Logger, level zerolog.Level) zerolog.Logger {
return logger.Hook(NewNoLevelHook(logger.GetLevel(), level))
}
type NoLevelHook struct {
minLevel zerolog.Level
level zerolog.Level
}
func NewNoLevelHook(minLevel zerolog.Level, l... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/datadog_test.go | pkg/observability/logs/datadog_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewDatadogLogger(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.Co... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/aws.go | pkg/observability/logs/aws.go | package logs
import (
"github.com/aws/smithy-go/logging"
"github.com/rs/zerolog"
)
func NewAWSWrapper(logger zerolog.Logger) logging.LoggerFunc {
if logger.GetLevel() > zerolog.DebugLevel {
return func(classification logging.Classification, format string, args ...interface{}) {}
}
return func(classification l... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/logrus_test.go | pkg/observability/logs/logrus_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewLogrusStdWrapper(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/oxy.go | pkg/observability/logs/oxy.go | package logs
import "github.com/rs/zerolog"
type OxyWrapper struct {
logger zerolog.Logger
}
func NewOxyWrapper(logger zerolog.Logger) *OxyWrapper {
return &OxyWrapper{logger: logger}
}
func (l OxyWrapper) Debug(s string, i ...interface{}) {
l.logger.Debug().CallerSkipFrame(1).Msgf(s, i...)
}
func (l OxyWrapper... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/gokit.go | pkg/observability/logs/gokit.go | package logs
import (
kitlog "github.com/go-kit/log"
"github.com/rs/zerolog"
)
func NewGoKitWrapper(logger zerolog.Logger) kitlog.LoggerFunc {
if logger.GetLevel() > zerolog.DebugLevel {
return func(args ...interface{}) error { return nil }
}
return func(args ...interface{}) error {
logger.Debug().CallerSki... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/otel.go | pkg/observability/logs/otel.go | package logs
import (
"context"
"encoding/json"
"fmt"
"reflect"
"time"
"github.com/rs/zerolog"
"github.com/traefik/traefik/v3/pkg/observability"
"github.com/traefik/traefik/v3/pkg/observability/types"
otellog "go.opentelemetry.io/otel/log"
)
// SetupOTelLogger sets up the OpenTelemetry logger.
func SetupOTe... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/aws_test.go | pkg/observability/logs/aws_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/aws/smithy-go/logging"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewAWSWrapper(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := ze... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/oxy_test.go | pkg/observability/logs/oxy_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewOxyWrapper(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.Conso... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/datadog.go | pkg/observability/logs/datadog.go | package logs
import "github.com/rs/zerolog"
type DatadogLogger struct {
logger zerolog.Logger
}
func NewDatadogLogger(logger zerolog.Logger) *DatadogLogger {
return &DatadogLogger{logger: logger}
}
func (d DatadogLogger) Log(msg string) {
d.logger.Debug().CallerSkipFrame(1).Msg(msg)
}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/fields.go | pkg/observability/logs/fields.go | package logs
// Log entry names.
const (
EntryPointName = "entryPointName"
RouterName = "routerName"
Rule = "rule"
MiddlewareName = "middlewareName"
MiddlewareType = "middlewareType"
ProviderName = "providerName"
ServiceName = "serviceName"
MetricsPr... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/elastic.go | pkg/observability/logs/elastic.go | package logs
import "github.com/rs/zerolog"
type ElasticLogger struct {
logger zerolog.Logger
}
func NewElasticLogger(logger zerolog.Logger) *ElasticLogger {
return &ElasticLogger{logger: logger}
}
func (l ElasticLogger) Debugf(format string, args ...interface{}) {
l.logger.Debug().CallerSkipFrame(1).Msgf(format... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/logs/gokit_test.go | pkg/observability/logs/gokit_test.go | package logs
import (
"bytes"
"os"
"testing"
"time"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestNewGoKitWrapper(t *testing.T) {
buf := bytes.NewBuffer(nil)
cwb := zerolog.ConsoleWriter{Out: buf, TimeFormat: time.RFC3339, NoColor: true}
out := zerolog.MultiLevelWriter(zerolog.Con... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/tracing/tracing_test.go | pkg/observability/tracing/tracing_test.go | package tracing
import (
"compress/gzip"
"io"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"time"
"github.com/containous/alice"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/static"
otypes "github.com/traefik/traefik/v3/pkg/obser... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/tracing/tracing.go | pkg/observability/tracing/tracing.go | package tracing
import (
"context"
"fmt"
"io"
"net"
"net/http"
"net/url"
"slices"
"strconv"
"strings"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/static"
"github.com/traefik/traefik/v3/pkg/observability"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"go.opentel... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/metrics.go | pkg/observability/metrics/metrics.go | package metrics
import (
"errors"
"time"
"github.com/go-kit/kit/metrics"
"github.com/go-kit/kit/metrics/multi"
)
const defaultMetricsPrefix = "traefik"
// Registry has to implemented by any system that wants to monitor and expose metrics.
type Registry interface {
// IsEpEnabled shows whether metrics instrumen... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/statsd.go | pkg/observability/metrics/statsd.go | package metrics
import (
"context"
"time"
"github.com/go-kit/kit/metrics/statsd"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/observability/logs"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"github.com/traefik/traefik/v3/pkg/safe"
)
var (
statsdClient *statsd.Statsd
stat... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/prometheus.go | pkg/observability/metrics/prometheus.go | package metrics
import (
"context"
"errors"
"net/http"
"sync"
"time"
"github.com/go-kit/kit/metrics"
stdprometheus "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog/log... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/influxdb2_test.go | pkg/observability/metrics/influxdb2_test.go | package metrics
import (
"fmt"
"io"
"net/http"
"net/http/httptest"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
)
func TestInfluxDB2(t *testing.T) {
c := make(chan *string)
ts := h... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/otel_test.go | pkg/observability/metrics/otel_test.go | package metrics
import (
"compress/gzip"
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"regexp"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
otypes "github.com/traefik/traefik/v3/pkg/observabil... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/datadog_test.go | pkg/observability/metrics/datadog_test.go | package metrics
import (
"net/http"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stvp/go-udp-testing"
ptypes "github.com/traefik/paerser/types"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
)
func TestDatadog(t *testing.T) {
t.Cleanup(StopDatadog)
udp.SetAdd... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/statsd_test.go | pkg/observability/metrics/statsd_test.go | package metrics
import (
"net/http"
"strconv"
"testing"
"time"
"github.com/stvp/go-udp-testing"
ptypes "github.com/traefik/paerser/types"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
)
func TestStatsD(t *testing.T) {
t.Cleanup(func() {
StopStatsd()
})
udp.SetAddr(":18125")
// This is ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/influxdb2.go | pkg/observability/metrics/influxdb2.go | package metrics
import (
"context"
"errors"
"time"
"github.com/go-kit/kit/metrics/influx"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
influxdb2api "github.com/influxdata/influxdb-client-go/v2/api"
"github.com/influxdata/influxdb-client-go/v2/api/write"
influxdb2log "github.com/influxdata/influxdb-... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/prometheus_test.go | pkg/observability/metrics/prometheus_test.go | package metrics
import (
"fmt"
"net/http"
"strconv"
"testing"
"time"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
otypes "github.com/traefik/traefik/v3/pkg/observability/ty... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/otel.go | pkg/observability/metrics/otel.go | package metrics
import (
"context"
"fmt"
"net"
"net/url"
"strings"
"sync"
"time"
"github.com/go-kit/kit/metrics"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/observability"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"github.com/traefik/traefik/v3/pkg/types"
"github.c... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/metrics_test.go | pkg/observability/metrics/metrics_test.go | package metrics
import (
"bytes"
"net/http"
"strings"
"testing"
"time"
"github.com/go-kit/kit/metrics"
"github.com/go-kit/kit/metrics/generic"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestScalableHistogram(t *testing.T) {
h := generic.NewHistogram("test", 1)
sh, er... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/datadog.go | pkg/observability/metrics/datadog.go | package metrics
import (
"context"
"net"
"strings"
"time"
"github.com/go-kit/kit/metrics/dogstatsd"
"github.com/go-kit/kit/util/conn"
gokitlog "github.com/go-kit/log"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/observability/logs"
otypes "github.com/traefik/traefik/v3/pkg/observability/ty... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/metrics/headers.go | pkg/observability/metrics/headers.go | package metrics
import (
"net/http"
"github.com/go-kit/kit/metrics"
)
// CounterWithHeaders represents a counter that can use http.Header values as label values.
type CounterWithHeaders interface {
Add(delta float64)
With(headers http.Header, labelValues ...string) CounterWithHeaders
}
// MultiCounterWithHeader... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/types/metrics.go | pkg/observability/types/metrics.go | package types
import (
"net"
"os"
"time"
"github.com/traefik/paerser/types"
)
// Metrics provides options to expose and send Traefik metrics to different third party monitoring systems.
type Metrics struct {
AddInternals bool `description:"Enables metrics for internal services (ping, dashboard, etc...)." json:"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/types/tracing_test.go | pkg/observability/types/tracing_test.go | package types
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestTracingVerbosity_Allows(t *testing.T) {
tests := []struct {
desc string
from TracingVerbosity
to TracingVerbosity
allows bool
}{
{
desc: "minimal vs minimal",
from: MinimalVerbosity,
to: MinimalVe... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/types/tracing.go | pkg/observability/types/tracing.go | package types
import (
"context"
"fmt"
"io"
"net"
"net/url"
"time"
"github.com/rs/zerolog/log"
ttypes "github.com/traefik/traefik/v3/pkg/types"
"github.com/traefik/traefik/v3/pkg/version"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/types/logs.go | pkg/observability/types/logs.go | package types
import (
"context"
"fmt"
"net"
"net/url"
"github.com/traefik/paerser/types"
ttypes "github.com/traefik/traefik/v3/pkg/types"
"github.com/traefik/traefik/v3/pkg/version"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc"
"go.opentelemetry.io/otel/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/observability/types/otel.go | pkg/observability/types/otel.go | package types
import "github.com/traefik/traefik/v3/pkg/types"
// OTelGRPC provides configuration settings for the gRPC open-telemetry.
type OTelGRPC struct {
Endpoint string `description:"Sets the gRPC endpoint (host:port) of the collector." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpo... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_http.go | pkg/api/handler_http.go | package api
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/tls"
)
type routerRepresentation struct {
*runtime.RouterInfo
Name string `jso... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/sort.go | pkg/api/sort.go | package api
import (
"cmp"
"net/url"
"sort"
)
const (
sortByParam = "sortBy"
directionParam = "direction"
)
const (
ascendantSorting = "asc"
descendantSorting = "desc"
)
type orderedWithName interface {
name() string
}
type orderedRouter interface {
orderedWithName
provider() string
priority() int
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_test.go | pkg/api/handler_test.go | package api
import (
"encoding/json"
"flag"
"io"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_support_dump.go | pkg/api/handler_support_dump.go | package api
import (
"archive/tar"
"compress/gzip"
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/redactor"
"github.com/traefik/traefik/v3/pkg/version"
)
func (h Handler) getSupportDump(rw http.ResponseWriter, req *http.Request) {
logger := log.Ctx(re... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_udp_test.go | pkg/api/handler_udp_test.go | package api
import (
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_overview.go | pkg/api/handler_overview.go | package api
import (
"encoding/json"
"net/http"
"reflect"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/static"
)
type schemeOverview struct {
Routers *section `json:"routers,omitempty"`
Services *section `json:"services,omitem... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_udp.go | pkg/api/handler_udp.go | package api
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
)
type udpRouterRepresentation struct {
*runtime.UDPRouterInfo
Name string `json:"name,omitempty"`
Provider strin... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/debug.go | pkg/api/debug.go | package api
import (
"expvar"
"fmt"
"net/http"
"net/http/pprof"
"runtime"
"github.com/gorilla/mux"
)
func init() {
// TODO Goroutines2 -> Goroutines
expvar.Publish("Goroutines2", expvar.Func(goroutines))
}
func goroutines() interface{} {
return runtime.NumGoroutine()
}
// DebugHandler expose debug routes.... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_tcp.go | pkg/api/handler_tcp.go | package api
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
)
type tcpRouterRepresentation struct {
*runtime.TCPRouterInfo
Name string `json:"name,omitempty"`
Provider strin... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_entrypoint.go | pkg/api/handler_entrypoint.go | package api
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"sort"
"strconv"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/static"
)
type entryPointRepresentation struct {
*static.EntryPoint
Name string `json:"name,omitempty"`
}
func (h Handler) getEnt... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/criterion.go | pkg/api/criterion.go | package api
import (
"fmt"
"net/http"
"net/url"
"slices"
"strconv"
"strings"
)
const (
defaultPerPage = 100
defaultPage = 1
)
const nextPageHeader = "X-Next-Page"
type pageInfo struct {
startIndex int
endIndex int
nextPage int
}
type searchCriterion struct {
Search string `url:"search"`
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_overview_test.go | pkg/api/handler_overview_test.go | package api
import (
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_support_dump_test.go | pkg/api/handler_support_dump_test.go | package api
import (
"archive/tar"
"compress/gzip"
"errors"
"io"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/tra... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler.go | pkg/api/handler.go | package api
import (
"encoding/json"
"net/http"
"reflect"
"strings"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/static"
"github.com/traefik/traefik/v3/pkg/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_entrypoint_test.go | pkg/api/handler_entrypoint_test.go | package api
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/static"
)
func TestHan... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_http_test.go | pkg/api/handler_http_test.go | package api
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/t... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/handler_tcp_test.go | pkg/api/handler_tcp_test.go | package api
import (
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/sort_test.go | pkg/api/sort_test.go | package api
import (
"fmt"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
)
func TestSortRouters(t *testing.T) {
testCases := []struct {
direction string
s... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | true |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/dashboard/dashboard_test.go | pkg/api/dashboard/dashboard_test.go | package dashboard
import (
"errors"
"io/fs"
"net/http"
"net/http/httptest"
"testing"
"testing/fstest"
"time"
"github.com/stretchr/testify/assert"
)
func Test_ContentSecurityPolicy(t *testing.T) {
testCases := []struct {
desc string
handler Handler
expected int
}{
{
desc: "OK",
handler: H... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/api/dashboard/dashboard.go | pkg/api/dashboard/dashboard.go | package dashboard
import (
"fmt"
"io/fs"
"net/http"
"strings"
"text/template"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/webui"
)
type indexTemplateData struct {
APIUrl string
}
// Handler expose dashboard routes.
type Handler struct {
BasePath string
assets fs.F... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/middlewareyaegi.go | pkg/plugins/middlewareyaegi.go | package plugins
import (
"context"
"errors"
"fmt"
"net/http"
"os"
"path"
"reflect"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/yaegi/interp"
"github.com/traefik/yaegi/stdlib"
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/manager_test.go | pkg/plugins/manager_test.go | package plugins
import (
zipa "archive/zip"
"context"
"encoding/json"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
// mockDownloader is a test implementation of PluginDownloader
type mockDownloader struct {
downloadFunc func(... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/providers.go | pkg/plugins/providers.go | package plugins
import (
"context"
"encoding/json"
"fmt"
"path"
"reflect"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/traefik/v3/pkg/provider"
"github... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/downloader.go | pkg/plugins/downloader.go | package plugins
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
)
// PluginDownloader defines the interface for downloading and validating plugins from remote sources.
type PluginDownloader interface {
// Download downloads a plugin archive and returns its hash.
Down... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/middlewareyaegi_test.go | pkg/plugins/middlewareyaegi_test.go | package plugins
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/yaegi/interp"
)
// TestNewInterpreter_SyscallErrorCase - Tests the security gate logic
func TestNewInterpreter_SyscallErrorCase(t *testing.T) {
manifest := &Manifest{
Im... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/middlewarewasm.go | pkg/plugins/middlewarewasm.go | package plugins
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"github.com/http-wasm/http-wasm-host-go/handler"
wasm "github.com/http-wasm/http-wasm-host-go/handler/nethttp"
"github.com/tetratelabs/wazero"
"github.com/traefik/traefik/v3/pkg/middlewa... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/types.go | pkg/plugins/types.go | package plugins
const (
runtimeYaegi = "yaegi"
runtimeWasm = "wasm"
)
const (
typeMiddleware = "middleware"
typeProvider = "provider"
)
type Settings struct {
Envs []string `description:"Environment variables to forward to the wasm guest." json:"envs,omitempty" toml:"envs,omitempty" yaml:"envs,omitempty... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/plugins_test.go | pkg/plugins/plugins_test.go | package plugins
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_checkRemotePluginsConfiguration(t *testing.T) {
testCases := []struct {
name string
plugins map[string]Descriptor
wantErr bool
}{
{
name: "nil plugins configuration returns no error",
plugins: nil,
wantErr:... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/middlewarewasm_test.go | pkg/plugins/middlewarewasm_test.go | package plugins
import (
"net/http"
"net/http/httptest"
"os"
"path"
"reflect"
"testing"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tetratelabs/wazero"
)
func TestSettingsWithoutSocket(t *testing.T) {
cache := ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/plugins.go | pkg/plugins/plugins.go | package plugins
import (
"context"
"errors"
"fmt"
"strings"
"github.com/hashicorp/go-multierror"
"github.com/rs/zerolog/log"
"golang.org/x/mod/module"
)
const localGoPath = "./plugins-local/"
// SetupRemotePlugins setup remote plugins environment.
func SetupRemotePlugins(manager *Manager, plugins map[string]... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/wasip_mock.go | pkg/plugins/wasip_mock.go | //go:build !linux && !darwin
package plugins
import (
"context"
"github.com/tetratelabs/wazero"
)
type ContextApplier func(ctx context.Context) context.Context
// InstantiateHost instantiates the Host module.
func InstantiateHost(ctx context.Context, runtime wazero.Runtime, mod wazero.CompiledModule, settings Se... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/downloader_test.go | pkg/plugins/downloader_test.go | package plugins
import (
"archive/zip"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestHTTPPluginDownloader_Download(t *testing.T) {
tests := []struct {
name string
serverRes... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/builder.go | pkg/plugins/builder.go | package plugins
import (
"context"
"errors"
"fmt"
"net/http"
"path/filepath"
"github.com/rs/zerolog/log"
)
// Constructor creates a plugin handler.
type Constructor func(context.Context, http.Handler) (http.Handler, error)
type pluginMiddleware interface {
NewHandler(ctx context.Context, next http.Handler) (... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/wasip.go | pkg/plugins/wasip.go | //go:build linux || darwin
package plugins
import (
"context"
"fmt"
"os"
"github.com/stealthrocket/wasi-go/imports"
wazergo_wasip1 "github.com/stealthrocket/wasi-go/imports/wasi_snapshot_preview1"
"github.com/stealthrocket/wazergo"
"github.com/tetratelabs/wazero"
wazero_wasip1 "github.com/tetratelabs/wazero/... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/manager.go | pkg/plugins/manager.go | package plugins
import (
zipa "archive/zip"
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"golang.org/x/mod/module"
"golang.org/x/mod/zip"
"gopkg.in/yaml.v3"
)
const (
sourcesFolder = "sources"
archivesFolder = "archives"
stateFilename ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/fixtures/src/testpluginsafe/testpluginsafe.go | pkg/plugins/fixtures/src/testpluginsafe/testpluginsafe.go | package testpluginsafe
import (
"context"
"net/http"
)
type Config struct {
Message string
}
func CreateConfig() *Config {
return &Config{Message: "safe plugin"}
}
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
return http.HandlerFunc(func(rw http.Response... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/fixtures/src/testpluginunsafe/testpluginunsafe.go | pkg/plugins/fixtures/src/testpluginunsafe/testpluginunsafe.go | package testpluginunsafe
import (
"context"
"net/http"
"unsafe"
)
type Config struct {
Message string
}
func CreateConfig() *Config {
return &Config{Message: "unsafe only plugin"}
}
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
// Use ONLY unsafe to test... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/fixtures/src/testpluginsyscall/testpluginsyscall.go | pkg/plugins/fixtures/src/testpluginsyscall/testpluginsyscall.go | package testpluginsyscall
import (
"context"
"net/http"
"syscall"
"unsafe"
)
type Config struct {
Message string
}
func CreateConfig() *Config {
return &Config{Message: "syscall plugin"}
}
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
// Use syscall and... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/plugins/fixtures/withoutsocket/demo.go | pkg/plugins/fixtures/withoutsocket/demo.go | package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"github.com/http-wasm/http-wasm-guest-tinygo/handler"
"github.com/http-wasm/http-wasm-guest-tinygo/handler/api"
)
type config struct {
File string `json:"file"`
Envs []string `json:"envs"`
}
var cfg config
// Built with
// tinygo build -o plugin... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/host_resolver.go | pkg/types/host_resolver.go | package types
// HostResolverConfig contain configuration for CNAME Flattening.
type HostResolverConfig struct {
CnameFlattening bool `description:"A flag to enable/disable CNAME flattening" json:"cnameFlattening,omitempty" toml:"cnameFlattening,omitempty" yaml:"cnameFlattening,omitempty" export:"true"`
ResolvConf... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/tls_test.go | pkg/types/tls_test.go | package types
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// go run $GOROOT/src/crypto/tls/generate_cert.go --rsa-bits 1024 --host localhost --start-date "Jan 1 00:00:00 1970" --duration=1000000h
var cert = `-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIQI3edJc... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/domains.go | pkg/types/domains.go | package types
import (
"strings"
)
// +k8s:deepcopy-gen=true
// Domain holds a domain name with SANs.
type Domain struct {
// Main defines the main domain name.
Main string `description:"Default subject name." json:"main,omitempty" toml:"main,omitempty" yaml:"main,omitempty"`
// SANs defines the subject alternat... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/zz_generated.deepcopy.go | pkg/types/zz_generated.deepcopy.go | //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
The MIT License (MIT)
Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the So... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/k8sdetector.go | pkg/types/k8sdetector.go | package types
import (
"context"
"errors"
"fmt"
"os"
"strings"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
kerror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kclientset "k8s.io/client-go/kubern... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/types/route_appender.go | pkg/types/route_appender.go | package types
import (
"github.com/gorilla/mux"
)
// RouteAppender appends routes on a router (/api, /ping ...).
type RouteAppender interface {
Append(systemRouter *mux.Router)
}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.