runtimecfg

package
v0.0.0-...-d8b0a59 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StatusEnabled  = "enabled"
	StatusDisabled = "disabled"
	StatusWarning  = "warning"
)

Status of the router/service.

View Source
const (
	StatusUp   = "UP"
	StatusDown = "DOWN"
)

Status of the servers.

Variables

This section is empty.

Functions

func SetNcpHttpAddress

func SetNcpHttpAddress(address ServerAddress)

func SetNcpHttpsAddress

func SetNcpHttpsAddress(address ServerAddress)

func SetWebuiAddress

func SetWebuiAddress(address ServerAddress)

Types

type Configuration

type Configuration struct {
	Routers        map[string]*RouterInfo        `json:"routers,omitempty"`
	Middlewares    map[string]*MiddlewareInfo    `json:"middlewares,omitempty"`
	Services       map[string]*ServiceInfo       `json:"services,omitempty"`
	Models         map[string]*dynamic.Model     `json:"-"`
	TCPRouters     map[string]*TCPRouterInfo     `json:"tcpRouters,omitempty"`
	TCPMiddlewares map[string]*TCPMiddlewareInfo `json:"tcpMiddlewares,omitempty"`
	TCPServices    map[string]*TCPServiceInfo    `json:"tcpServices,omitempty"`
	UDPRouters     map[string]*UDPRouterInfo     `json:"udpRouters,omitempty"`
	UDPServices    map[string]*UDPServiceInfo    `json:"udpServices,omitempty"`
}

Configuration holds the information about the currently running traefik instance.

func (*Configuration) GetRoutersByEntryPoints

func (c *Configuration) GetRoutersByEntryPoints(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*RouterInfo

GetRoutersByEntryPoints returns all the http routers by entry points name and routers name.

func (*Configuration) GetTCPRoutersByEntryPoints

func (c *Configuration) GetTCPRoutersByEntryPoints(ctx context.Context, entryPoints []string) map[string]map[string]*TCPRouterInfo

GetTCPRoutersByEntryPoints returns all the tcp routers by entry points name and routers name.

type DirInfo

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

type MiddlewareInfo

type MiddlewareInfo struct {
	*dynamic.Middleware // dynamic configuration

	// Err contains all the errors that occurred during service creation.
	Err    []string `json:"error,omitempty"`
	Status string   `json:"status,omitempty"`
	UsedBy []string `json:"usedBy,omitempty"` // list of routers and services using that middleware.
}

MiddlewareInfo holds information about a currently running middleware.

type PackageDir

type PackageDir struct {
	WorkDir
	// contains filtered or unexported fields
}

type RouterInfo

type RouterInfo struct {
	*dynamic.Router // dynamic configuration

	// Err contains all the errors that occurred during router's creation.
	Err []string `json:"error,omitempty"`
	// Status reports whether the router is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	Using  []string `json:"using,omitempty"` // Effective entry points used by that router.

	// ChildRefs contains the names of child routers.
	// This field is only filled during multi-layer routing computation of parentRefs,
	// and used when building the runtime configuration.
	ChildRefs []string `json:"-"`
}

RouterInfo holds information about a currently running HTTP router.

func (*RouterInfo) AddError

func (r *RouterInfo) AddError(err error, critical bool)

AddError adds err to r.Err, if it does not already exist. If critical is set, r is marked as disabled.

type RuntimeCfg

type RuntimeCfg struct {
	Server  Server
	DirInfo DirInfo
}

RuntimeCfg 运行时生成的配置

type Server

type Server struct {
	NcpHttpAddress  ServerAddress
	NcpHttpsAddress ServerAddress
	WebuiAddress    ServerAddress
}

type ServerAddress

type ServerAddress struct {
	Name    string
	Address string
}

func GetNcpHttpAddress

func GetNcpHttpAddress() ServerAddress

func GetNcpHttpsAddress

func GetNcpHttpsAddress() ServerAddress

func GetWebuiAddress

func GetWebuiAddress() ServerAddress

type ServiceInfo

type ServiceInfo struct {
	*dynamic.Service // dynamic configuration

	// Err contains all the errors that occurred during service creation.
	Err []string `json:"error,omitempty"`
	// Status reports whether the service is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service
	// contains filtered or unexported fields
}

ServiceInfo holds information about a currently running service.

func (*ServiceInfo) AddError

func (s *ServiceInfo) AddError(err error, critical bool)

AddError adds err to s.Err, if it does not already exist. If critical is set, s is marked as disabled.

func (*ServiceInfo) GetAllStatus

func (s *ServiceInfo) GetAllStatus() map[string]string

GetAllStatus returns all the statuses of all the servers in ServiceInfo. It is the responsibility of the caller to check that s is not nil.

func (*ServiceInfo) UpdateServerStatus

func (s *ServiceInfo) UpdateServerStatus(server, status string)

UpdateServerStatus sets the status of the server in the ServiceInfo. It is the responsibility of the caller to check that s is not nil.

type TCPMiddlewareInfo

type TCPMiddlewareInfo struct {
	*dynamic.TCPMiddleware // dynamic configuration

	// Err contains all the errors that occurred during service creation.
	Err    []string `json:"error,omitempty"`
	Status string   `json:"status,omitempty"`
	UsedBy []string `json:"usedBy,omitempty"` // list of TCP routers and services using that middleware.
}

TCPMiddlewareInfo holds information about a currently running middleware.

type TCPRouterInfo

type TCPRouterInfo struct {
	*dynamic.TCPRouter // dynamic configuration

	Err []string `json:"error,omitempty"` // initialization error
	// Status reports whether the router is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	Using  []string `json:"using,omitempty"` // Effective entry points used by that router.
}

TCPRouterInfo holds information about a currently running TCP router.

func (*TCPRouterInfo) AddError

func (r *TCPRouterInfo) AddError(err error, critical bool)

AddError adds err to r.Err, if it does not already exist. If critical is set, r is marked as disabled.

type TCPServiceInfo

type TCPServiceInfo struct {
	*dynamic.TCPService // dynamic configuration

	Err []string `json:"error,omitempty"` // initialization error
	// Status reports whether the service is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service
	// contains filtered or unexported fields
}

TCPServiceInfo holds information about a currently running TCP service.

func (*TCPServiceInfo) AddError

func (s *TCPServiceInfo) AddError(err error, critical bool)

AddError adds err to s.Err, if it does not already exist. If critical is set, s is marked as disabled.

func (*TCPServiceInfo) GetAllStatus

func (s *TCPServiceInfo) GetAllStatus() map[string]string

GetAllStatus returns all the statuses of all the servers in TCPServiceInfo.

func (*TCPServiceInfo) UpdateServerStatus

func (s *TCPServiceInfo) UpdateServerStatus(server, status string)

UpdateServerStatus sets the status of the server in the TCPServiceInfo.

type UDPRouterInfo

type UDPRouterInfo struct {
	*dynamic.UDPRouter // dynamic configuration

	Err []string `json:"error,omitempty"` // initialization error
	// Status reports whether the router is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	Using  []string `json:"using,omitempty"` // Effective entry points used by that router.
}

UDPRouterInfo holds information about a currently running UDP router.

type UDPServiceInfo

type UDPServiceInfo struct {
	*dynamic.UDPService // dynamic configuration

	Err []string `json:"error,omitempty"` // initialization error
	// Status reports whether the service is disabled, in a warning state, or all good (enabled).
	// If not in "enabled" state, the reason for it should be in the list of Err.
	// It is the caller's responsibility to set the initial status.
	Status string   `json:"status,omitempty"`
	UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service
}

UDPServiceInfo holds information about a currently running UDP service. udp 服务器,当routers多的时候,分别分配给不同的udp服务器

type WorkDir

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

Jump to

Keyboard shortcuts

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