-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversions.go
38 lines (32 loc) · 1001 Bytes
/
versions.go
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
package esni
// Version represents a specific ESNI
// specification version for the DNS
// ESNI record
type Version uint16
const (
// VersionDraft01 represents the version value
// for the first draft of the ESNI specification.
//
// The version value specified in the second version
// of the draft is the same as the first draft.
VersionDraft01 Version = 0xff01
// VersionDraft03 represents the version value
// for the third draft of the ESNI specification
VersionDraft03 Version = 0xff02
)
// Version_name specifies a map of versions
// and their respective string representations
var Version_name = map[Version]string{
VersionDraft01: "draft-ietf-tls-esni-01",
VersionDraft03: "draft-ietf-tls-esni-03",
}
// String attempts to return the string
// representation of the Version based on
// those specified in Version_name, if no
// match is found "UNKNOWN" is returned
func (v Version) String() string {
if name, ok := Version_name[v]; ok {
return name
}
return "UNKNOWN"
}