Documentation
¶
Index ¶
- Variables
- func Allowlisted(r *http.Request) bool
- func Deny(r *http.Request, user string) bool
- func GetHostsMap() map[string]string
- func GetSitesMap(key string) map[string]bool
- func GetSitesURLs(fn func(siteURL string))
- func HostAllowed(host string) bool
- func HostsSetup(cfg string) error
- func RefreshAllowlist() error
- func RefreshFence() error
- func RefreshHosts() error
- func RefreshSites() error
- func RewriteHost(host string) string
- func SetHTTPClient(client *http.Client)
- func SetHostsMap(m map[string]string)
- func SetSitesMap(key string, value map[string]bool)
- type HostRewrite
Constants ¶
This section is empty.
Variables ¶
var ( FenceURL = flag.String("fence-url", "", "URL to user fencing config (eg. https://github.com/myorg/beyond-config/main/raw/fence.json)") SitesURL = flag.String("sites-url", "", "URL to allowed sites config (eg. https://github.com/myorg/beyond-config/main/raw/sites.json)") AllowlistURL = flag.String("allowlist-url", "", "URL to site allowlist (eg. https://github.com/myorg/beyond-config/main/raw/allowlist.json)") )
var ( HostsCSV = flag.String("hosts-csv", "", "rewrite nexthop hosts (format: from1=to1,from2=to2)") HostsURL = flag.String("hosts-url", "", "URL to host mapping config (eg. https://github.com/myorg/beyond-config/main/raw/hosts.json)") HostsOnly = flag.Bool("hosts-only", false, "only allow requests to hosts in the host mapping") )
Functions ¶
func Allowlisted ¶
Allowlisted checks if a request is on the allowlist
func GetHostsMap ¶
GetHostsMap returns the current host mappings (for testing)
func GetSitesMap ¶
GetSitesMap returns the sites map for a given key (for testing)
func GetSitesURLs ¶
func GetSitesURLs(fn func(siteURL string))
GetSitesURLs returns all site URLs for proxy configuration
func HostAllowed ¶
HostAllowed checks if a host is allowed based on hosts-only configuration.
func HostsSetup ¶
HostsSetup initializes host mappings from CSV configuration
func RefreshAllowlist ¶
func RefreshAllowlist() error
RefreshAllowlist loads the site allowlist configuration
func RefreshHosts ¶
func RefreshHosts() error
RefreshHosts loads host mappings from URL configuration
func RewriteHost ¶
RewriteHost returns the rewritten host (backward compatibility)
func SetHTTPClient ¶
SetHTTPClient sets the HTTP client for ACL operations (useful for testing)
func SetHostsMap ¶
SetHostsMap sets the host mappings (for testing)
func SetSitesMap ¶
SetSitesMap sets the sites map for a given key (for testing)
Types ¶
type HostRewrite ¶
type HostRewrite struct {
Host string
Scheme string // http, https, or empty (preserve original)
Port string // port number or empty
FullURL string // complete rewritten URL if available
}
HostRewrite contains the rewritten host information
func HostRewriteDetailed ¶
func HostRewriteDetailed(authority string) *HostRewrite
HostRewriteDetailed returns a consistent hostname and URL for the backend.