Documentation ¶
Index ¶
- Constants
- Variables
- func AppVersion() string
- func DefaultTLSConfig() *tls.Config
- func FilterGlob(g string, values []string) []string
- func FilterGlobNotMatches(g string, values []string) []string
- func GetFreeListenAddr() (string, error)
- func GetFreePort() (int, error)
- func HashPB(h Hashable, ignore map[string]struct{}) uint64
- func HashStr(s string) uint64
- func IsJSONFileTypeExt(fileName string) bool
- func IsSupportedFileType(fileName string) bool
- func IsSupportedFileTypeExt(fileName string) (string, bool)
- func IsSupportedTestFile(fileName string) bool
- func LoadFromJSONOrYAML(fsys fs.FS, path string, dest proto.Message) error
- func MatchesGlob(globExpr, val string) bool
- func OpenOneOfSupportedFiles(fsys fs.FS, fileName string) (fs.File, error)
- func ParseListenAddress(listenAddr string) (network, addr string, err error)
- func ReadJSONOrYAML(src io.Reader, dest proto.Message) error
- func ToStructPB(v interface{}) (*structpb.Value, error)
- func WriteYAML(dest io.Writer, data proto.Message) error
- type Hashable
Constants ¶
const TestDataDirectory = "testdata"
TestDataDirectory is the name of the special directory containing test fixtures. It is defined here to avoid an import loop.
Variables ¶
var ( AppName = "cerbos" BuildDate = "unknown" Commit = "unknown" Version = "unknown" )
var (
ErrMultipleYAMLDocs = errors.New("more than one YAML document detected")
)
var ErrNoMatchingFiles = errors.New("no matching files")
Functions ¶
func AppVersion ¶ added in v0.9.0
func AppVersion() string
func DefaultTLSConfig ¶
DefaultTLSConfig returns the default TLS configuration.
func FilterGlob ¶ added in v0.12.0
FilterGlob returns the set of values that match the given glob.
func FilterGlobNotMatches ¶ added in v0.12.0
FilterGlobNotMatches returns the set of values that do not match the given glob.
func GetFreeListenAddr ¶
func GetFreePort ¶
func IsJSONFileTypeExt ¶ added in v0.14.0
IsJSONFileTypeExt returns true if the given file has a json file extension.
func IsSupportedFileType ¶
IsSupportedFileType returns true if the given file has a supported file extension.
func IsSupportedFileTypeExt ¶ added in v0.7.0
IsSupportedFileTypeExt returns true and a file extension if the given file has a supported file extension.
func IsSupportedTestFile ¶ added in v0.7.0
IsSupportedTestFile return true if the given file is a supported test file name, i.e. "*_test.{yaml,yml,json}".
func LoadFromJSONOrYAML ¶
LoadFromJSONOrYAML reads a JSON or YAML encoded protobuf from the given path.
func MatchesGlob ¶ added in v0.12.0
MatchesGlob returns true if the given glob expression matches the given string.
func OpenOneOfSupportedFiles ¶ added in v0.7.0
OpenOneOfSupportedFiles attempts to open a fileName adding supported extensions.
func ParseListenAddress ¶
ParseListenAddress parses an address and returns the network type and the address to dial. inspired by https://github.com/ghostunnel/ghostunnel/blob/6e58c75c8762fe371c1134e89dd55033a6d577a4/socket/net.go#L31