Skip to content

Commit d0dc84b

Browse files
committed
Added patterns for ipv4, ipv4-cidr, and ipv4-cidr-optional
1 parent 0aaaae9 commit d0dc84b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

pkg/vhost/schema.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ type Definition struct {
2020
}
2121

2222
var Patterns = map[string]string{
23-
"domain": `^[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*$`,
24-
"version": `^[0-9]+(\.[0-9]+)*$`,
25-
"endpoint": `^(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*)(?::\d{1,5})$`,
26-
"yes-no": `^(yes|no)$`,
23+
"domain": `^[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*$`,
24+
"version": `^[0-9]+(\.[0-9]+)*$`,
25+
"endpoint": `^(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*)(?::\d{1,5})$`,
26+
"yes-no": `^(yes|no)$`,
27+
"ipv4": `^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.?\b){4}$`,
28+
"ipv4-cidr": `^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.?\b){4}/(?:3[0-2]|[1-2][0-9]|[0-9])$`,
29+
"ipv4-cidr-optional": `^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.?\b){4}(?:/(?:3[0-2]|[1-2][0-9]|[0-9]))?$`,
2730
}
2831

2932
var (

0 commit comments

Comments
 (0)