client

package
v0.0.0-...-a27e026 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: AGPL-3.0 Imports: 11 Imported by: 2 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

This section is empty.

Variables

View Source
var SecureDialer = &net.Dialer{
	Control: func(network, address string, c syscall.RawConn) error {
		host, _, err := net.SplitHostPort(address)
		if err != nil {
			return err
		}
		ip, err := netip.ParseAddr(host)
		if err != nil || !isPublicIP(ip) {
			return fmt.Errorf("blocked address %s", host)
		}
		return nil
	},
}

SecureDialer is a net.Dialer that performs some additional checks of an address before performing connection logic. It will ensure that the address is actually a public address. This also covers redirects, since every connection the client makes goes through the hook. Note that if you use a proxy, the dial goes to the proxy, so the check won't apply to the final destination.

Functions

func IsPublicURL

func IsPublicURL(ctx context.Context, u *url.URL) (bool, error)

IsPublicURL performs checks on the given url.URL to ensure that it is a public address.

func New

func New() *resty.Client

New creates a new resty.Client with some default headers, redirects enabled (up to 3) and logging to the default slog.Logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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