uri

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 16 Imported by: ? 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 (
	// FromRandom is the from generating a random password, as the
	// "source random" of an install line or an environment reference.
	FromRandom = "random"
)

Variables

View Source
var (
	ErrFromUnknown = errors.New("from is unknown")
	ErrFromEmpty   = errors.New("from is empty")
)
View Source
var ClusterSources func() (urls, cidrs []string)

ClusterSources returns the urls and the address ranges the cluster allows on top of the policy of the node, which the object layer sets: a util knows nothing of the configuration of a cluster. Left unset, as in a client with no cluster, the policy of the node is the whole of it.

Functions

func CheckHttpUrl

func CheckHttpUrl(s string) (net.IP, string, error)

func DeprecatedFrom

func DeprecatedFrom(from string) (string, bool)

DeprecatedFrom says a from is deprecated, and returns the one to use instead, for the command to warn of: /dev/urandom, which reads as a path and generates a password, is FromRandom.

func IsValidHttp

func IsValidHttp(s string) bool

IsValidHttp validates if the provided string is a well-formed HTTP or HTTPS URL.

func ReadAllFrom

func ReadAllFrom(from string) (map[string][]byte, error)

func SafeHttpClient

func SafeHttpClient(s string) (*http.Client, error)

SafeHttpClient returns an HTTP client configured with rules to prevent SSRF vulnerabilities for the provided URL.

Types

type T

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

func New

func New(s string) T

func (T) CallerFetch

func (t T) CallerFetch() (string, error)

CallerFetch fetches the url a command is given, in the process of the command, and returns the path of a temporary file holding the body.

It is held to no SSRF policy: the url is the argument of who runs the command, fetched from where they run it, with nothing more than they could fetch with curl and pass on the standard input of the same command. A url a configuration names, fetched by a node, as the source of a key or the image of a vm, is the SafeHttpClient's to fetch.

func (T) IsValidHttp

func (t T) IsValidHttp() bool

IsValidHttp checks if the encapsulated URI is a valid HTTP or HTTPS URL.

Jump to

Keyboard shortcuts

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