File: tunnel_constraints.go

package info (click to toggle)
golang-github-microsoft-dev-tunnels 0.0.25-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,988 kB
  • sloc: cs: 9,969; java: 2,767; javascript: 328; xml: 186; makefile: 5
file content (188 lines) | stat: -rw-r--r-- 7,775 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/TunnelConstraints.cs

package tunnels

import (
	"regexp"
)

const (
	// Min length of tunnel cluster ID.
	TunnelConstraintsClusterIDMinLength = 3

	// Max length of tunnel cluster ID.
	TunnelConstraintsClusterIDMaxLength = 12

	// Length of V1 tunnel id.
	TunnelConstraintsOldTunnelIDLength = 8

	// Min length of V2 tunnelId.
	TunnelConstraintsNewTunnelIDMinLength = 3

	// Max length of V2 tunnelId.
	TunnelConstraintsNewTunnelIDMaxLength = 60

	// Length of a tunnel alias.
	TunnelConstraintsTunnelAliasLength = 8

	// Min length of tunnel name.
	TunnelConstraintsTunnelNameMinLength = 3

	// Max length of tunnel name.
	TunnelConstraintsTunnelNameMaxLength = 60

	// Max length of tunnel or port description.
	TunnelConstraintsDescriptionMaxLength = 400

	// Min length of a single tunnel or port tag.
	TunnelConstraintsTagMinLength = 1

	// Max length of a single tunnel or port tag.
	TunnelConstraintsTagMaxLength = 50

	// Maximum number of tags that can be applied to a tunnel or port.
	TunnelConstraintsMaxTags = 100

	// Min length of a tunnel domain.
	TunnelConstraintsTunnelDomainMinLength = 4

	// Max length of a tunnel domain.
	TunnelConstraintsTunnelDomainMaxLength = 180

	// Maximum number of items allowed in the tunnel ports array. The actual limit on number
	// of ports that can be created may be much lower, and may depend on various resource
	// limitations or policies.
	TunnelConstraintsTunnelMaxPorts = 1000

	// Maximum number of access control entries (ACEs) in a tunnel or tunnel port access
	// control list (ACL).
	TunnelConstraintsAccessControlMaxEntries = 40

	// Maximum number of subjects (such as user IDs) in a tunnel or tunnel port access
	// control entry (ACE).
	TunnelConstraintsAccessControlMaxSubjects = 100

	// Max length of an access control subject or organization ID.
	TunnelConstraintsAccessControlSubjectMaxLength = 200

	// Max length of an access control subject name, when resolving names to IDs.
	TunnelConstraintsAccessControlSubjectNameMaxLength = 200

	// Maximum number of scopes in an access control entry.
	TunnelConstraintsAccessControlMaxScopes = 10

	// Regular expression that can match or validate tunnel cluster ID strings.
	//
	// Cluster IDs are alphanumeric; hyphens are not permitted.
	TunnelConstraintsClusterIDPattern = "^(([a-z]{3,4}[0-9]{1,3})|asse|aue|brs|euw|use)$"

	// Characters that are valid in tunnel IDs. Includes numbers and lowercase letters,
	// excluding vowels and 'y' (to avoid accidentally generating any random words).
	TunnelConstraintsOldTunnelIDChars = "0123456789bcdfghjklmnpqrstvwxz"

	// Regular expression that can match or validate tunnel ID strings.
	//
	// Tunnel IDs are fixed-length and have a limited character set of numbers and lowercase
	// letters (minus vowels and y).
	TunnelConstraintsOldTunnelIDPattern = "[" + TunnelConstraintsOldTunnelIDChars + "]{8}"

	// Characters that are valid in tunnel IDs. Includes numbers and lowercase letters,
	// excluding vowels and 'y' (to avoid accidentally generating any random words).
	TunnelConstraintsNewTunnelIDChars = "0123456789abcdefghijklmnopqrstuvwxyz-"

	// Regular expression that can match or validate tunnel ID strings.
	//
	// Tunnel IDs are fixed-length and have a limited character set of numbers and lowercase
	// letters (minus vowels and y).
	TunnelConstraintsNewTunnelIDPattern = "[a-z0-9][a-z0-9-]{1,58}[a-z0-9]"

	// Characters that are valid in tunnel IDs. Includes numbers and lowercase letters,
	// excluding vowels and 'y' (to avoid accidentally generating any random words).
	TunnelConstraintsTunnelAliasChars = "0123456789bcdfghjklmnpqrstvwxz"

	// Regular expression that can match or validate tunnel alias strings.
	//
	// Tunnel Aliases are fixed-length and have a limited character set of numbers and
	// lowercase letters (minus vowels and y).
	TunnelConstraintsTunnelAliasPattern = "[" + TunnelConstraintsTunnelAliasChars + "]{3,60}"

	// Regular expression that can match or validate tunnel names.
	//
	// Tunnel names are alphanumeric and may contain hyphens. The pattern also allows an
	// empty string because tunnels may be unnamed.
	TunnelConstraintsTunnelNamePattern = "([a-z0-9][a-z0-9-]{1,58}[a-z0-9])|(^$)"

	// Regular expression that can match or validate tunnel or port tags.
	TunnelConstraintsTagPattern = "[\\w-=]{1,50}"

	// Regular expression that can match or validate tunnel domains.
	//
	// The tunnel service may perform additional contextual validation at the time the domain
	// is registered.
	TunnelConstraintsTunnelDomainPattern = "[0-9a-z][0-9a-z-.]{1,158}[0-9a-z]|(^$)"

	// Regular expression that can match or validate an access control subject or
	// organization ID.
	//
	// The : and / characters are allowed because subjects may include IP addresses and
	// ranges. The @ character is allowed because MSA subjects may be identified by email
	// address.
	TunnelConstraintsAccessControlSubjectPattern = "[0-9a-zA-Z-._:/@]{0,200}"

	// Regular expression that can match or validate an access control subject name, when
	// resolving subject names to IDs.
	//
	// Note angle-brackets are only allowed when they wrap an email address as part of a
	// formatted name with email. The service will block any other use of angle-brackets, to
	// avoid any XSS risks.
	TunnelConstraintsAccessControlSubjectNamePattern = "[ \\w\\d-.,/'\"_@()<>]{0,200}"
)
var (
	// Regular expression that can match or validate tunnel cluster ID strings.
	//
	// Cluster IDs are alphanumeric; hyphens are not permitted.
	TunnelConstraintsClusterIDRegex = regexp.MustCompile(TunnelConstraintsClusterIDPattern)

	// Regular expression that can match or validate tunnel ID strings.
	//
	// Tunnel IDs are fixed-length and have a limited character set of numbers and lowercase
	// letters (minus vowels and y).
	TunnelConstraintsOldTunnelIDRegex = regexp.MustCompile(TunnelConstraintsOldTunnelIDPattern)

	// Regular expression that can match or validate tunnel ID strings.
	//
	// Tunnel IDs are fixed-length and have a limited character set of numbers and lowercase
	// letters (minus vowels and y).
	TunnelConstraintsNewTunnelIDRegex = regexp.MustCompile(TunnelConstraintsNewTunnelIDPattern)

	// Regular expression that can match or validate tunnel alias strings.
	//
	// Tunnel Aliases are fixed-length and have a limited character set of numbers and
	// lowercase letters (minus vowels and y).
	TunnelConstraintsTunnelAliasRegex = regexp.MustCompile(TunnelConstraintsTunnelAliasPattern)

	// Regular expression that can match or validate tunnel names.
	//
	// Tunnel names are alphanumeric and may contain hyphens. The pattern also allows an
	// empty string because tunnels may be unnamed.
	TunnelConstraintsTunnelNameRegex = regexp.MustCompile(TunnelConstraintsTunnelNamePattern)

	// Regular expression that can match or validate tunnel or port tags.
	TunnelConstraintsTagRegex = regexp.MustCompile(TunnelConstraintsTagPattern)

	// Regular expression that can match or validate tunnel domains.
	//
	// The tunnel service may perform additional contextual validation at the time the domain
	// is registered.
	TunnelConstraintsTunnelDomainRegex = regexp.MustCompile(TunnelConstraintsTunnelDomainPattern)

	// Regular expression that can match or validate an access control subject or
	// organization ID.
	TunnelConstraintsAccessControlSubjectRegex = regexp.MustCompile(TunnelConstraintsAccessControlSubjectPattern)

	// Regular expression that can match or validate an access control subject name, when
	// resolving subject names to IDs.
	TunnelConstraintsAccessControlSubjectNameRegex = regexp.MustCompile(TunnelConstraintsAccessControlSubjectNamePattern)
)