Documentation ¶
Index ¶
Constants ¶
View Source
const ( ProtocolHTTP = "http" ProtocolHTTPS = "https" ProtocolGRPC = "grpc" ProtocolGRPCS = "grpcs" ProtocolUDP = "udp" ProtocolTCP = "tcp" ProtocolTLS = "tls" ProtocolTLSPassthrough = "tls_passthrough" ProtocolWS = "ws" ProtocolWSS = "wss" )
View Source
const (
HTTPHeaderNamePattern = "^[A-Za-z0-9!#$%&'*+-.^_|~]{1,64}$"
)
Variables ¶
View Source
var ( HostnamePattern = fmt.Sprintf("^%s", hostnamePattern) WilcardHostnamePattern = fmt.Sprintf("^(\\*\\.)?%s", hostnamePattern) )
View Source
var AllProtocols = &generator.Schema{ Type: "string", Enum: []interface{}{ ProtocolHTTP, ProtocolHTTPS, ProtocolGRPC, ProtocolGRPCS, ProtocolTCP, ProtocolUDP, ProtocolTLS, ProtocolTLSPassthrough, ProtocolWS, ProtocolWSS, }, }
View Source
var CIDRPort = &generator.Schema{ Type: "object", Properties: map[string]*generator.Schema{ "ip": { Type: "string", AnyOf: []*generator.Schema{ { Description: "must be a valid IP or CIDR", Pattern: "^([0-9]{1,3}[.]{1}){3}[0-9]{1,3}$", }, { Description: "must be a valid IP or CIDR", Pattern: "^([0-9]{1,3}[.]{1}){3}[0-9]{1,3}/[0-9]{1,3}$", }, }, }, "port": Port, }, AnyOf: []*generator.Schema{ { Description: "at least one of 'ip' or 'port' is required", Required: []string{"ip"}, }, { Description: "at least one of 'ip' or 'port' is required", Required: []string{"port"}, }, }, }
View Source
var Header = &generator.Schema{ Type: "string", Pattern: HTTPHeaderNamePattern, }
View Source
var Host = &generator.Schema{ Description: "must be a valid hostname", Type: "string", MaxLength: maxHostnameLength, Pattern: HostnamePattern, }
View Source
var ID = &generator.Schema{
Description: "must be a valid UUID",
Type: "string",
Pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
}
View Source
var Name = &generator.Schema{
Type: "string",
Pattern: namePattern,
MinLength: 1,
MaxLength: maxNameLength,
}
View Source
var Path = &generator.Schema{ Type: "string", AllOf: []*generator.Schema{ { Description: "must begin with `/`", Pattern: "^/.*", }, { Description: fmt.Sprintf("length must not exceed %d", maxPathLength), MaxLength: maxPathLength, }, { Not: &generator.Schema{ Description: "must not contain `//`", Pattern: "//", }, }, }, }
View Source
var Port = &generator.Schema{
Type: "integer",
Minimum: intP(1),
Maximum: maxPort,
}
View Source
var Protocol = &generator.Schema{ Type: "string", Enum: []interface{}{ ProtocolHTTP, ProtocolHTTPS, ProtocolGRPC, ProtocolGRPCS, ProtocolTCP, ProtocolUDP, ProtocolTLS, ProtocolTLSPassthrough, }, }
View Source
var ReferenceObject = &generator.Schema{ Type: "object", Properties: map[string]*generator.Schema{ "id": ID, }, Required: []string{"id"}, AdditionalProperties: &falsy, }
View Source
var RouterPath = &generator.Schema{ Type: "string", AllOf: []*generator.Schema{ { Description: "must begin with `/` (prefix path) or `~/` (regex path)", Pattern: "^/.*|^~/.*", }, { Description: fmt.Sprintf("length must not exceed %d", maxPathLength), MaxLength: maxPathLength, }, { Not: &generator.Schema{ Description: "must not contain `//`", Pattern: "//", }, }, }, }
View Source
var Tags = &generator.Schema{ Type: "array", Items: tag, MaxItems: maxTags, UniqueItems: true, }
View Source
var Timeout = &generator.Schema{
Type: "integer",
Minimum: intP(1),
Maximum: maxTimeout,
}
View Source
var UnixEpoch = &generator.Schema{
Type: "integer",
Minimum: intP(1),
}
View Source
var WilcardHost = &generator.Schema{ Description: "must be a valid hostname with a wildcard prefix '*' or without", Type: "string", MaxLength: maxHostnameLength, Pattern: WilcardHostnamePattern, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.