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/middlewares/accesslog/field_middleware.go | pkg/middlewares/accesslog/field_middleware.go | package accesslog
import (
"net/http"
"strings"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/middlewares/capture"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/vulcand/oxy/v2/utils"
)
// FieldApply function hook to add data in accesslog.
type FieldApply func(rw ht... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/accesslog/logger_test.go | pkg/middlewares/accesslog/logger_test.go | package accesslog
import (
"bytes"
"compress/gzip"
"context"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"
"github.com/containous/alice"
"github.com/stretchr/testify/assert... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | true |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/accesslog/logger.go | pkg/middlewares/accesslog/logger.go | package accesslog
import (
"context"
"fmt"
"io"
"net"
"net/http"
"net/textproto"
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/containous/alice"
"github.com/rs/zerolog/log"
"github.com/sirupsen/logrus"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/t... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/accesslog/logdata.go | pkg/middlewares/accesslog/logdata.go | package accesslog
import (
"net/http"
)
const (
// StartUTC is the map key used for the time at which request processing started.
StartUTC = "StartUTC"
// StartLocal is the map key used for the local time at which request processing started.
StartLocal = "StartLocal"
// Duration is the map key used for the tota... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/accesslog/save_retries.go | pkg/middlewares/accesslog/save_retries.go | package accesslog
import (
"net/http"
)
// SaveRetries is an implementation of RetryListener that stores RetryAttempts in the LogDataTable.
type SaveRetries struct{}
// Retried implements the RetryListener interface and will be called for each retry that happens.
func (s *SaveRetries) Retried(req *http.Request, att... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/accesslog/field_middleware_test.go | pkg/middlewares/accesslog/field_middleware_test.go | package accesslog
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestConcatFieldHandler_ServeHTTP(t *testing.T) {
testCases := []struct {
desc string
existingValue interface{}
newValue string
expectedResult string
}{
{
desc... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/ipwhitelist/ip_whitelist_test.go | pkg/middlewares/ipwhitelist/ip_whitelist_test.go | package ipwhitelist
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
func TestNewIPWhiteLister(t *testing.T) {
testCases := []struct {
desc string
whiteList dynamic... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/ipwhitelist/ip_whitelist.go | pkg/middlewares/ipwhitelist/ip_whitelist.go | package ipwhitelist
import (
"context"
"errors"
"fmt"
"net/http"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/ip"
"github.com/traefik/traefik/v3/pkg/middlewares"
"github.com/traefik/traefik/v3/pkg/middlewares/observability"
)
const (
type... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/redirect/redirect_regex_test.go | pkg/middlewares/redirect/redirect_regex_test.go | package redirect
import (
"crypto/tls"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
func TestRedirectRegexHandler(t *testing.T) {
testCases := []struct {
desc string
confi... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/redirect/redirect_scheme.go | pkg/middlewares/redirect/redirect_scheme.go | package redirect
import (
"context"
"errors"
"net"
"net/http"
"strings"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/middlewares"
)
const (
typeSchemeName = "RedirectScheme"
uriPattern = `^(https?:\/\/)?(\[[\w:.]+\]|[\w\._-]+)?(:\d+)?(.*)$`
xForwardedProto = "... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/redirect/redirect_scheme_test.go | pkg/middlewares/redirect/redirect_scheme_test.go | package redirect
import (
"crypto/tls"
"net/http"
"net/http/httptest"
"regexp"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
func TestRedirectSchemeHandler(t *testing.T) {
testCases := []struct {
desc str... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/redirect/redirect_regex.go | pkg/middlewares/redirect/redirect_regex.go | package redirect
import (
"context"
"net/http"
"strings"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/middlewares"
)
const typeRegexName = "RedirectRegex"
// NewRedirectRegex creates a redirect middleware.
func NewRedirectRegex(ctx context.Context, next http.Handler, co... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/middlewares/redirect/redirect.go | pkg/middlewares/redirect/redirect.go | package redirect
import (
"net/http"
"net/url"
"regexp"
"github.com/vulcand/oxy/v2/utils"
)
const (
schemeHTTP = "http"
schemeHTTPS = "https"
)
const typeName = "Redirect"
var uriRegexp = regexp.MustCompile(`^(https?):\/\/(\[[\w:.]+\]|[\w\._-]+)?(:\d+)?(.*)$`)
type redirect struct {
next ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/healthcheck/healthcheck.go | pkg/healthcheck/healthcheck.go | package healthcheck
import (
"bufio"
"context"
"errors"
"fmt"
"net"
"net/http"
"net/http/httptrace"
"net/url"
"strconv"
"sync"
"time"
gokitmetrics "github.com/go-kit/kit/metrics"
"github.com/rs/zerolog/log"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"g... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/healthcheck/healthcheck_test.go | pkg/healthcheck/healthcheck_test.go | package healthcheck
import (
"context"
"net/http"
"net/http/httptest"
"net/url"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"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/healthcheck/healthcheck_tcp.go | pkg/healthcheck/healthcheck_tcp.go | package healthcheck
import (
"context"
"errors"
"fmt"
"net"
"strconv"
"time"
"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/tcp"
)
// maxPayloadSize is the maximum payload size that can be ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/healthcheck/healthcheck_tcp_test.go | pkg/healthcheck/healthcheck_tcp_test.go | package healthcheck
import (
"context"
"crypto/tls"
"crypto/x509"
"net"
"strings"
"sync"
"testing"
"time"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
tr... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/healthcheck/mock_test.go | pkg/healthcheck/mock_test.go | package healthcheck
import (
"context"
"net"
"net/http"
"net/http/httptest"
"net/url"
"sync"
"testing"
"time"
gokitmetrics "github.com/go-kit/kit/metrics"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/testhelpers"
"google.golang... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/safe/safe_test.go | pkg/safe/safe_test.go | package safe
import "testing"
func TestSafe(t *testing.T) {
const ts1 = "test1"
const ts2 = "test2"
s := New(ts1)
result, ok := s.Get().(string)
if !ok {
t.Fatalf("Safe.Get() failed, got type '%T', expected string", s.Get())
}
if result != ts1 {
t.Errorf("Safe.Get() failed, got '%s', expected '%s'", res... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/safe/routine_test.go | pkg/safe/routine_test.go | package safe
import (
"context"
"errors"
"sync"
"testing"
"time"
"github.com/cenkalti/backoff/v4"
)
func TestNewPoolContext(t *testing.T) {
type testKeyType string
testKey := testKeyType("test")
ctx := context.WithValue(t.Context(), testKey, "test")
p := NewPool(ctx)
p.GoCtx(func(ctx context.Context) {... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/safe/safe.go | pkg/safe/safe.go | package safe
import (
"sync"
)
// Safe contains a thread-safe value.
type Safe struct {
value interface{}
lock sync.RWMutex
}
// New create a new Safe instance given a value.
func New(value interface{}) *Safe {
return &Safe{value: value, lock: sync.RWMutex{}}
}
// Get returns the value.
func (s *Safe) Get() in... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/safe/routine.go | pkg/safe/routine.go | package safe
import (
"context"
"fmt"
"runtime/debug"
"sync"
"github.com/cenkalti/backoff/v4"
"github.com/rs/zerolog/log"
)
type routineCtx func(ctx context.Context)
// Pool is a pool of go routines.
type Pool struct {
waitGroup sync.WaitGroup
ctx context.Context
cancel context.CancelFunc
}
// Ne... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_tcp.go | pkg/server/server_entrypoint_tcp.go | package server
import (
"context"
"errors"
"expvar"
"fmt"
stdlog "log"
"net"
"net/http"
"net/url"
"os"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"github.com/containous/alice"
gokitmetrics "github.com/go-kit/kit/metrics"
"github.com/pires/go-proxyproto"
"github.com/rs/zerolog"
"github.com/rs/z... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/aggregator_test.go | pkg/server/aggregator_test.go | package server
import (
"testing"
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"github.com/traefik/traefik/v3/pkg/tls"
)
func Test_mergeConfiguration(t *tes... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | true |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_unix.go | pkg/server/server_entrypoint_listenconfig_unix.go | //go:build linux || freebsd || openbsd || darwin
package server
import (
"fmt"
"net"
"syscall"
"github.com/traefik/traefik/v3/pkg/config/static"
"golang.org/x/sys/unix"
)
// newListenConfig creates a new net.ListenConfig for the given configuration of
// the entry point.
func newListenConfig(configuration *sta... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_other.go | pkg/server/server_entrypoint_listenconfig_other.go | //go:build !(linux || freebsd || openbsd || darwin)
package server
import (
"net"
"github.com/traefik/traefik/v3/pkg/config/static"
)
// newListenConfig creates a new net.ListenConfig for the given configuration of
// the entry point.
func newListenConfig(configuration *static.EntryPoint) (lc net.ListenConfig) {
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/configurationwatcher_test.go | pkg/server/configurationwatcher_test.go | package server
import (
"context"
"errors"
"strconv"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/provider/aggregator"
"github.com/traefik/traefik/v3/pkg/safe"
th "github.com/traefik/traefik/v3/pkg/testhel... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_tcp_http3_test.go | pkg/server/server_entrypoint_tcp_http3_test.go | package server
import (
"bufio"
"crypto/tls"
"crypto/x509"
"net/http"
"testing"
"time"
"github.com/quic-go/quic-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/static"
tcprouter "github.com/traefik/traefik/v3/pkg/server/router/tcp"
"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/keep_alive_middleware.go | pkg/server/keep_alive_middleware.go | package server
import (
"net/http"
"time"
"github.com/rs/zerolog/log"
ptypes "github.com/traefik/paerser/types"
)
func newKeepAliveMiddleware(next http.Handler, maxRequests int, maxTime ptypes.Duration) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
state, ok := req.C... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/routerfactory_test.go | pkg/server/routerfactory_test.go | package server
import (
"net/http"
"net/http/httptest"
"net/url"
"testing"
"time"
"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/static"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/aggregator.go | pkg/server/aggregator.go | package server
import (
"slices"
"strings"
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/observability/logs"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"github.com/traefik/t... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/socket_activation_windows.go | pkg/server/socket_activation_windows.go | //go:build windows
package server
func populateSocketActivationListeners() *SocketActivation {
return &SocketActivation{enabled: false}
}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_unix_sockopt_other.go | pkg/server/server_entrypoint_listenconfig_unix_sockopt_other.go | //go:build linux || openbsd || darwin
package server
import "golang.org/x/sys/unix"
const unixSOREUSEPORT = unix.SO_REUSEPORT
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/configurationwatcher.go | pkg/server/configurationwatcher.go | package server
import (
"context"
"encoding/json"
"reflect"
"github.com/rs/zerolog"
"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.com/traefik/traefik/v3/pkg/safe"
"git... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_signals_windows.go | pkg/server/server_signals_windows.go | //go:build windows
// +build windows
package server
import "context"
func (s *Server) configureSignals() {}
func (s *Server) listenSignals(ctx context.Context) {}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/socket_activation_unix.go | pkg/server/socket_activation_unix.go | //go:build !windows
package server
import (
"net"
"github.com/coreos/go-systemd/v22/activation"
"github.com/rs/zerolog/log"
)
func populateSocketActivationListeners() *SocketActivation {
// We use Files api due to activation not providing method for get PacketConn with names
files := activation.Files(true)
sa... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_tcp_test.go | pkg/server/server_entrypoint_tcp_test.go | package server
import (
"bufio"
"context"
"crypto/tls"
"errors"
"io"
"net"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/config/static"
"g... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server.go | pkg/server/server.go | package server
import (
"context"
"errors"
"os"
"os/signal"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/observability/metrics"
"github.com/traefik/traefik/v3/pkg/safe"
"github.com/traefik/traefik/v3/pkg/server/middleware"
)
// Server is the reverse-proxy/load-balancer engine.
type ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_unix_test.go | pkg/server/server_entrypoint_listenconfig_unix_test.go | //go:build linux || freebsd || openbsd || darwin
package server
import (
"net"
"testing"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/static"
)
func TestNewListenConfig(t *testing.T) {
ep := static.EntryPoint{Address: ":0"}
listenConfig := newListenConfig(&ep)
require.Nil(t... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_unix_sockopt_freebsd.go | pkg/server/server_entrypoint_listenconfig_unix_sockopt_freebsd.go | //go:build freebsd
package server
import "golang.org/x/sys/unix"
const unixSOREUSEPORT = unix.SO_REUSEPORT_LB
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_signals.go | pkg/server/server_signals.go | //go:build !windows
// +build !windows
package server
import (
"context"
"os/signal"
"syscall"
"github.com/rs/zerolog/log"
)
func (s *Server) configureSignals() {
signal.Notify(s.signals, syscall.SIGUSR1)
}
func (s *Server) listenSignals(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/socket_activation.go | pkg/server/socket_activation.go | package server
import (
"errors"
"net"
)
type SocketActivation struct {
enabled bool
listeners map[string]net.Listener
conns map[string]net.PacketConn
}
func (s *SocketActivation) isEnabled() bool {
return s.enabled
}
func (s *SocketActivation) getListener(name string) (net.Listener, error) {
listener,... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_listenconfig_other_test.go | pkg/server/server_entrypoint_listenconfig_other_test.go | //go:build !(linux || freebsd || openbsd || darwin)
package server
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/static"
)
func TestNewListenConfig(t *testing.T) {
ep := static.EntryPoint{Address: ":0"}
listenConfig := newListenConfig(&ep)
requir... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_udp_test.go | pkg/server/server_entrypoint_udp_test.go | package server
import (
"io"
"net"
"testing"
"time"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/config/static"
"github.com/traefik/traefik/v3/pkg/udp"
)
func TestShutdownUDPConn(t *testing.T) {
ep := static.EntryPoint{
Address: ":0",
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/routerfactory.go | pkg/server/routerfactory.go | package server
import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/static"
httpmuxer "github.com/traefik/traefik/v3/pkg/muxer/http"
"github.com/traefik/traefik/v3/pkg/server/middleware"
tcpmiddleware "github.com/trae... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_udp.go | pkg/server/server_entrypoint_udp.go | package server
import (
"context"
"fmt"
"sync"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/static"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/traefik/v3/pkg/udp"
)
// UDPEntryPoints maps UDP entry points by their names.
type UDPEntryPoints map[... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/server_entrypoint_tcp_http3.go | pkg/server/server_entrypoint_tcp_http3.go | package server
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"net/http"
"sync"
"github.com/quic-go/quic-go"
"github.com/quic-go/quic-go/http3"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/static"
tcprouter "github.com/traefik/traefik/v3/pkg/server/router/tcp"
)
type http3s... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/managerfactory.go | pkg/server/service/managerfactory.go | package service
import (
"net/http"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/api"
"github.com/traefik/traefik/v3/pkg/api/dashboard"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/config/static"
"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/server/service/transport_test.go | pkg/server/service/transport_test.go | package service
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"math/big"
"net"
"net/http"
"net/http/httptest"
"net/url"
"sync/atomic"
"testing"
"time"
"github.com/spiffe/go-spiffe/v2/bundle/x509bundle"
"github.com/spiffe/go-spiffe/v2/spiffeid"
"github.com/spiffe/go-... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/service.go | pkg/server/service/service.go | package service
import (
"context"
"encoding/json"
"errors"
"fmt"
"math/rand"
"net/http"
"net/url"
"reflect"
"strings"
"time"
"github.com/containous/alice"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traef... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/service_test.go | pkg/server/service/service_test.go | package service
import (
"context"
"crypto/tls"
"io"
"net/http"
"net/http/httptest"
"net/http/httptrace"
"net/textproto"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/conf... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/internalhandler.go | pkg/server/service/internalhandler.go | package service
import (
"context"
"errors"
"fmt"
"net/http"
"strings"
)
// InternalHandlers is the internal HTTP handlers builder.
type InternalHandlers struct {
api http.Handler
dashboard http.Handler
rest http.Handler
prometheus http.Handler
ping http.Handler
acmeHTTP http.Handler
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/smart_roundtripper.go | pkg/server/service/smart_roundtripper.go | package service
import (
"crypto/tls"
"net"
"net/http"
"time"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"golang.org/x/net/http/httpguts"
"golang.org/x/net/http2"
)
type h2cTransportWrapper struct {
*http2.Transport
}
func (t *h2cTransportWrapper) RoundTrip(req *http.Request) (*http.Response, error)... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/transport.go | pkg/server/service/transport.go | package service
import (
"context"
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"net"
"net/http"
"reflect"
"slices"
"strings"
"sync"
"time"
"github.com/rs/zerolog/log"
"github.com/spiffe/go-spiffe/v2/bundle/x509bundle"
"github.com/spiffe/go-spiffe/v2/spiffeid"
"github.com/spiffe/go-spiffe/v2/spiffetls/tl... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/tcp/service.go | pkg/server/service/tcp/service.go | package tcp
import (
"context"
"errors"
"fmt"
"maps"
"math/rand"
"net"
"slices"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/healthcheck"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/traefik/v3/pkg/s... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/tcp/service_test.go | pkg/server/service/tcp/service_test.go | package tcp
import (
"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/server/provider"
"github.com/traefik/traefik/v3/pkg/tcp"
)
func Tes... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/udp/service.go | pkg/server/service/udp/service.go | package udp
import (
"context"
"errors"
"fmt"
"math/rand"
"net"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/traefik/v3/pkg/server/provider"
"github.com/traefik/traefik/v3/pkg/udp"
)
// Mana... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/udp/service_test.go | pkg/server/service/udp/service_test.go | package udp
import (
"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/server/provider"
)
func TestManager_BuildUDP(t *testing.T) {
testCa... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/sticky_test.go | pkg/server/service/loadbalancer/sticky_test.go | package loadbalancer
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
func pointer[T any](v T) *T { return &v }
func TestSticky_StickyHandler(t *testing.T) {
testCases := []struct ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/sticky.go | pkg/server/service/loadbalancer/sticky.go | package loadbalancer
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"hash/fnv"
"net/http"
"strconv"
"sync"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
// NamedHandler is a http.Handler with a name.
type NamedHandler struct {
http.Handler
Name string
}
// stickyCookie represents a sticky... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/wrr/wrr.go | pkg/server/service/loadbalancer/wrr/wrr.go | package wrr
import (
"container/heap"
"context"
"errors"
"net/http"
"sync"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/server/service/loadbalancer"
)
var errNoAvailableServer = errors.New("no available server")
type namedHandler struct {
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/wrr/wrr_test.go | pkg/server/service/loadbalancer/wrr/wrr_test.go | package wrr
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
type key string
const serviceName key = "serviceName"
func pointer[T any](v T) *T { return &v }
func TestBalancer(t *testing.T) {
balancer := New... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/leasttime/leasttime.go | pkg/server/service/loadbalancer/leasttime/leasttime.go | package leasttime
import (
"context"
"errors"
"math"
"net/http"
"net/http/httptrace"
"sync"
"sync/atomic"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/server/service/loadbalancer"
)
const sampleSize = 100 // Number of response tim... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/leasttime/leasttime_test.go | pkg/server/service/loadbalancer/leasttime/leasttime_test.go | package leasttime
import (
"context"
"net/http"
"net/http/httptest"
"net/http/httptrace"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
type key string
const serviceName key = "serviceName"
func pointer[T any](v T) *T { retu... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | true |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/failover/failover_test.go | pkg/server/service/loadbalancer/failover/failover_test.go | package failover
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
type responseRecorder struct {
*httptest.ResponseRecorder
save map[string]int
sequence []string
status []i... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/failover/failover.go | pkg/server/service/loadbalancer/failover/failover.go | package failover
import (
"context"
"errors"
"net/http"
"sync"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
// Failover is an http.Handler that can forward requests to the fallback handler
// when the main handler status is down.
type Failover struct {
wantsHealthCheck bool... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/hrw/hrw_test.go | pkg/server/service/loadbalancer/hrw/hrw_test.go | package hrw
import (
"context"
"encoding/binary"
"math/rand"
"net"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
// genIPAddress generate randomly an IP address as a string.
func genIPAddress() string {
buf := make([]byte, 4)
ip := rand.Uint32()
binary.LittleEndian.PutU... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/hrw/hrw.go | pkg/server/service/loadbalancer/hrw/hrw.go | package hrw
import (
"context"
"errors"
"hash/fnv"
"math"
"net/http"
"sync"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/ip"
)
var errNoAvailableServer = errors.New("no available server")
type namedHandler struct {
http.Handler
name s... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/p2c/p2c.go | pkg/server/service/loadbalancer/p2c/p2c.go | package p2c
import (
"context"
"errors"
"math/rand"
"net/http"
"sync"
"sync/atomic"
"time"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/server/service/loadbalancer"
)
var errNoAvailableServer = errors.New("no available server")
type name... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/p2c/p2c_test.go | pkg/server/service/loadbalancer/p2c/p2c_test.go | package p2c
import (
"net/http"
"net/http/httptest"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
)
func TestP2C(t *testing.T) {
testCases := []struct {
desc string
handlers []*namedHandl... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/mirror/mirror.go | pkg/server/service/loadbalancer/mirror/mirror.go | package mirror
import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"io"
"net"
"net/http"
"sync"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/healthcheck"
"github.com/traefik/traefik/v3/pkg/middlewares/accesslog"
"github.com/traefik/traef... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/service/loadbalancer/mirror/mirror_test.go | pkg/server/service/loadbalancer/mirror/mirror_test.go | package mirror
import (
"bytes"
"io"
"net/http"
"net/http/httptest"
"sync/atomic"
"testing"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/safe"
)
const defaultMaxBodySize int64 = -1
func TestMirroringOn100(t *testing.T) {
var countMirror1, countMirror2 int32
handler := http.Handl... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/middleware/middlewares_test.go | pkg/server/middleware/middlewares_test.go | package middleware
import (
"errors"
"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/traefik/v3/pkg/server/provider"
)
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/middleware/middlewares.go | pkg/server/middleware/middlewares.go | package middleware
import (
"context"
"errors"
"fmt"
"net/http"
"reflect"
"slices"
"strings"
"github.com/containous/alice"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/middlewares/addprefix"
"github.com/traefik/traefik/v3/pkg/middlewares... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/middleware/plugins.go | pkg/server/middleware/plugins.go | package middleware
import (
"context"
"errors"
"net/http"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/plugins"
)
const typeName = "Plugin"
// PluginsBuilder the plugin's builder interface.
type PluginsBuilder interface {
Build(pName string, config map[string]interface... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/middleware/observability.go | pkg/server/middleware/observability.go | package middleware
import (
"context"
"io"
"net/http"
"github.com/containous/alice"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/static"
"github.com/traefik/traefik/v3/pkg/middlewares/accesslog"
"github.com/traefik/traefik/v3/pkg/mid... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/middleware/tcp/middlewares.go | pkg/server/middleware/tcp/middlewares.go | package tcpmiddleware
import (
"context"
"fmt"
"slices"
"strings"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/middlewares/tcp/inflightconn"
"github.com/traefik/traefik/v3/pkg/middlewares/tcp/ipallowlist"
"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/server/cookie/cookie_test.go | pkg/server/cookie/cookie_test.go | package cookie
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetName(t *testing.T) {
testCases := []struct {
desc string
cookieName string
backendName string
expectedCookieName string
}{
{
desc: "with backend name, without cookie name",... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/cookie/cookie.go | pkg/server/cookie/cookie.go | package cookie
import (
"crypto/sha1"
"fmt"
"strings"
"github.com/rs/zerolog/log"
)
const cookieNameLength = 6
// GetName of a cookie.
func GetName(cookieName, backendName string) string {
if len(cookieName) != 0 {
return sanitizeName(cookieName)
}
return GenerateName(backendName)
}
// GenerateName Gener... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/provider/provider.go | pkg/server/provider/provider.go | package provider
import (
"context"
"strings"
"github.com/rs/zerolog/log"
)
type contextKey int
const (
key contextKey = iota
)
// AddInContext Adds the provider name in the context.
func AddInContext(ctx context.Context, elementName string) context.Context {
parts := strings.Split(elementName, "@")
if len(p... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/provider/provider_test.go | pkg/server/provider/provider_test.go | package provider
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestAddInContext(t *testing.T) {
testCases := []struct {
desc string
ctx context.Context
name string
expected string
}{
{
desc: "without provider information",
ctx: t.Context(),
nam... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/deny.go | pkg/server/router/deny.go | package router
import (
"net/http"
"strings"
"github.com/rs/zerolog/log"
)
// denyFragment rejects the request if the URL path contains a fragment (hash character).
// When go receives an HTTP request, it assumes the absence of fragment URL.
// However, it is still possible to send a fragment in the request.
// I... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/router.go | pkg/server/router/router.go | package router
import (
"context"
"errors"
"fmt"
"math"
"net/http"
"slices"
"sort"
"strings"
"github.com/containous/alice"
"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/middlewares/acces... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/router_test.go | pkg/server/router/router_test.go | package router
import (
"context"
"crypto/tls"
"io"
"math"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
"github.com/containous/alice"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | true |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/deny_test.go | pkg/server/router/deny_test.go | package router
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_denyFragment(t *testing.T) {
tests := []struct {
name string
url string
wantStatus int
}{
{
name: "Rejects fragment character",
url: "http://example.com/#",
... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/tcp/manager_test.go | pkg/server/router/tcp/manager_test.go | package tcp
import (
"crypto/tls"
"math"
"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"
tcpmiddleware "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/server/router/tcp/postgres.go | pkg/server/router/tcp/postgres.go | package tcp
import (
"bufio"
"bytes"
"errors"
"io"
"net"
"sync"
"github.com/rs/zerolog/log"
tcpmuxer "github.com/traefik/traefik/v3/pkg/muxer/tcp"
"github.com/traefik/traefik/v3/pkg/tcp"
)
var (
PostgresStartTLSMsg = []byte{0, 0, 0, 8, 4, 210, 22, 47} // int32(8) + int32(80877103)
PostgresStartTLSReply ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/tcp/router.go | pkg/server/router/tcp/router.go | package tcp
import (
"bufio"
"bytes"
"crypto/tls"
"errors"
"io"
"net"
"net/http"
"slices"
"time"
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
"github.com/rs/zerolog/log"
tcpmuxer "github.com/traefik/traefik/v3/pkg/muxer/tcp"
"github.com/traefik/traefik/v3/pkg/tcp"
)
const defaultBufSize = 4096
// R... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/tcp/router_test.go | pkg/server/router/tcp/router_test.go | package tcp
import (
"bytes"
"crypto/tls"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"strings"
"testing"
"time"
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/tcp/manager.go | pkg/server/router/tcp/manager.go | package tcp
import (
"context"
"crypto/tls"
"errors"
"fmt"
"math"
"net/http"
"strings"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/middlewares/snicheck"
httpmuxer "github.com/traefik/traefik/v3/pkg/muxer/http"
tcpmuxer "github.com/traef... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/udp/router.go | pkg/server/router/udp/router.go | package udp
import (
"context"
"errors"
"sort"
"github.com/rs/zerolog/log"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/traefik/v3/pkg/server/provider"
udpservice "github.com/traefik/traefik/v3/pkg/server/service/udp"
"github.co... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/server/router/udp/router_test.go | pkg/server/router/udp/router_test.go | package udp
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
"github.com/traefik/traefik/v3/pkg/config/runtime"
"github.com/traefik/traefik/v3/pkg/server/service/udp"
)
func TestRuntimeConfiguration(t *testing.T) {
testCases := []struct {
desc ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/experimental.go | pkg/config/static/experimental.go | package static
import "github.com/traefik/traefik/v3/pkg/plugins"
// Experimental experimental Traefik features.
type Experimental struct {
Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty" export:"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/entrypoints_test.go | pkg/config/static/entrypoints_test.go | package static
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestEntryPointProtocol(t *testing.T) {
tests := []struct {
name string
address string
expectedAddress string
expectedProtocol string
expectedError bool
}{
{
name: "Without protocol",... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/static_config_test.go | pkg/config/static/static_config_test.go | package static
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/traefik/traefik/v3/pkg/provider/acme"
)
func pointer[T any](v T) *T { return &v }
func TestHasEntrypoint(t *testing.T) {
tests := []struct {
desc string
entryPoints map[string]*EntryPoint
assert assert.BoolAsser... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/plugins.go | pkg/config/static/plugins.go | package static
// PluginConf holds the plugin configuration.
type PluginConf map[string]interface{}
| go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/entrypoints.go | pkg/config/static/entrypoints.go | package static
import (
"fmt"
"math"
"net/http"
"strings"
ptypes "github.com/traefik/paerser/types"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
"github.com/traefik/traefik/v3/pkg/types"
)
// EntryPoint holds the entry point configuration.
type EntryPoint struct {
Address string ... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/static/static_config.go | pkg/config/static/static_config.go | package static
import (
"errors"
"fmt"
"path"
"strings"
"time"
legolog "github.com/go-acme/lego/v4/log"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/observability/logs"
otypes "github.com/traefik/traefik/v3/pkg/observabilit... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/dynamic/middleware_test.go | pkg/config/dynamic/middleware_test.go | package dynamic
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_GetStrategy_ipv6Subnet(t *testing.T) {
testCases := []struct {
desc string
expectError bool
ipv6Subnet *int
}{
{
desc: "Nil subnet",
},
{
desc: "Zero subnet"... | go | MIT | f7280439e6378221a541910f43a01323d52db048 | 2026-01-07T08:35:43.502324Z | false |
traefik/traefik | https://github.com/traefik/traefik/blob/f7280439e6378221a541910f43a01323d52db048/pkg/config/dynamic/zz_generated.deepcopy.go | pkg/config/dynamic/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 | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.