traefik

package
v0.97.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package traefik implements the Traefik reverse-proxy API provider.

Index

Constants

View Source
const (
	ID          = "traefik"
	EndpointKey = "endpoint"
	UsernameKey = "username"
	PasswordKey = "password"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Overview

type Overview struct {
	HTTP     *ProtocolStats `json:"http"`
	TCP      *ProtocolStats `json:"tcp"`
	UDP      *ProtocolStats `json:"udp"`
	Features map[string]any `json:"features"`
}

Overview is Traefik /api/overview statistics.

type ProtocolStats

type ProtocolStats struct {
	Routers     map[string]int `json:"routers"`
	Services    map[string]int `json:"services"`
	Middlewares map[string]int `json:"middlewares"`
}

ProtocolStats holds counts for a protocol family.

type Router

type Router struct {
	Name        string   `json:"name"`
	Rule        string   `json:"rule"`
	Service     string   `json:"service"`
	Status      string   `json:"status"`
	Provider    string   `json:"provider"`
	EntryPoints []string `json:"entryPoints"`
	Priority    int64    `json:"priority"`
}

Router is an HTTP router from Traefik.

type Service

type Service struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Status   string `json:"status"`
	Provider string `json:"provider"`
}

Service is an HTTP service from Traefik.

type Traefik

type Traefik struct {
	// contains filtered or unexported fields
}

Traefik is an HTTP client for the Traefik API.

func GetClient

func GetClient() *Traefik

GetClient builds a Traefik client from vendors.traefik config. Returns nil when endpoint is not configured.

func NewTraefik

func NewTraefik(endpoint, username, password string) *Traefik

NewTraefik creates a Traefik client with optional Basic auth. Returns nil when endpoint is empty.

func (*Traefik) ListRouters

func (t *Traefik) ListRouters(ctx context.Context) ([]Router, error)

ListRouters returns HTTP routers.

func (*Traefik) ListServices

func (t *Traefik) ListServices(ctx context.Context) ([]Service, error)

ListServices returns HTTP services.

func (*Traefik) Overview

func (t *Traefik) Overview(ctx context.Context) (*Overview, error)

Overview returns Traefik overview statistics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL