utils

package
v0.0.0-...-3388463 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 8

Documentation

Index

Constants

View Source
const (
	DomainAPIServer      = "apiserver.master.svc"
	ServiceMasterProxy   = "masterproxy"
	ServiceAPIServer     = "apiserver"
	ServiceKusciaStorage = "kusciastorage"
	ServiceHandshake     = "kuscia-handshake"
	ServiceKusciaAPI     = "kusciaapi"
	EnvoyClusterName     = "envoy-cluster"
)
View Source
const (
	HeaderTransitHash = "Kuscia-Transit-Hash"
	HeaderTransitFlag = "Kuscia-Transit-Flag"
)
View Source
const KusciaEnvoyMsgHeaderKey = "Kuscia-Error-Message"

Variables

View Source
var (
	InternalServer = "http://127.0.0.1:80"
)

Functions

func DoHTTP

func DoHTTP(in interface{}, out interface{}, hp *HTTPParam) error

func DoHTTPWithRetry

func DoHTTPWithRetry(in interface{}, out interface{}, hp *HTTPParam, waitTime time.Duration, maxRetryTimes int) error

func GetHandshakePathOfEndpoint

func GetHandshakePathOfEndpoint(endpoint v1alpha1.DomainEndpoint) string

func GetHandshakePathOfPrefix

func GetHandshakePathOfPrefix(pathPrefix string) string

func GetHandshakePathSuffix

func GetHandshakePathSuffix() string

func GetHostname

func GetHostname() string

func GetPrefixIfPresent

func GetPrefixIfPresent(endpoint v1alpha1.DomainEndpoint) string

func IsReverseTunnelTransit

func IsReverseTunnelTransit(transit *v1alpha1.Transit) bool

func IsThirdPartyTransit

func IsThirdPartyTransit(transit *v1alpha1.Transit) bool

func IsTransit

func IsTransit(transit *v1alpha1.Transit) bool

func ParseURL

func ParseURL(url string) (string, string, uint32, string, error)

func ProbePeerEndpoint

func ProbePeerEndpoint(endpointURL string) error

Types

type HTTPParam

type HTTPParam struct {
	Method       string
	Path         string
	ClusterName  string
	KusciaSource string
	KusciaHost   string
	Transit      bool
	Headers      map[string]string
}

type Whitelist

type Whitelist struct {
	Items []WhitelistItem `yaml:"items,omitempty"`
}

func NewWhitelistChecker

func NewWhitelistChecker(whitelist string) (*Whitelist, error)

Init a new whitelist checker from given file path, returns nil if any error occurs.

func (*Whitelist) Check

func (c *Whitelist) Check(address string, ports []uint32) bool

type WhitelistChecker

type WhitelistChecker interface {
	Check(address string, ports []uint32) bool
}

type WhitelistItem

type WhitelistItem struct {
	// address may be an ip 127.0.0.1, a CIDR 10.0.0.1/24, or an explicit hostname gw.abc.com
	Address string `yaml:"address,omitempty"`
	// optional config for allow ports, none means all ports are acceptable
	Ports []uint32 `yaml:"ports,omitempty"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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