Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTransport(auth *config.Auth, transportConfig *http.Transport, timeout time.Duration, ...) (http.RoundTripper, error)
- func GetTLSConfig(auth *config.Auth) (*tls.Config, error)
- func GuessKialiURL(r *http.Request) string
- func HttpGet(url string, auth *config.Auth, timeout time.Duration, ...) ([]byte, int, []*http.Cookie, error)
- func HttpMethods() []string
- func HttpPost(url string, auth *config.Auth, body io.Reader, timeout time.Duration, ...) ([]byte, int, []*http.Cookie, error)
- type PortForwarder
- type PortPool
Constants ¶
View Source
const DefaultTimeout = 10 * time.Second
Variables ¶
Functions ¶
func CreateTransport ¶ added in v1.28.0
func CreateTransport(auth *config.Auth, transportConfig *http.Transport, timeout time.Duration, customHeaders map[string]string) (http.RoundTripper, error)
Creates a new HTTP Transport with TLS, Timeouts, and optional custom headers.
Please remember that setting long timeouts is not recommended as it can make idle connections stay open for as long as 2 * timeout. This should only be done in cases where you know the request is very likely going to be reused at some point in the near future.
func GuessKialiURL ¶ added in v1.19.0
func HttpMethods ¶ added in v1.14.0
func HttpMethods() []string
Types ¶
type PortForwarder ¶ added in v1.38.1
type PortForwarder interface { Start() error Stop() }
type PortPool ¶ added in v1.38.1
type PortPool struct { // lastBusyPort is a pointer to the last free port given, therefore is in use. LastBusyPort int // mutex is the mutex used to solve concurrency problems while managing the port Mutex sync.Locker // portsMap tracks whether an specific port is busy // portsMap[14100] = true => means that port 14100 is busy // portsMap[14101] = false => means that port 14101 is free PortsMap map[int]bool // portRangeInit is the first port number managed in the pool PortRangeInit int // portRangeSize is the size of the port range. // for example, the pool with portRangeSize 100 and portRangeInit 14000 manages // the ports from 14000 to 14099. PortRangeSize int }
func (*PortPool) FreePort ¶ added in v1.38.1
FreePort frees the port and makes it available for being pick to use.
func (*PortPool) GetFreePort ¶ added in v1.38.1
GetFreePort returns a non-busy port available within the reserved port range (14100 - 14199). The returned port is instantaneously marked as busy until is not freed using the FreePort method.
Click to show internal directories.
Click to hide internal directories.