forked from jjeffery/stomp
-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathversion.go
40 lines (34 loc) · 843 Bytes
/
version.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
39
40
package stomp
// Version is the STOMP protocol version.
type Version string
const (
V10 Version = "1.0"
V11 Version = "1.1"
V12 Version = "1.2"
)
// String returns a string representation of the STOMP version.
func (v Version) String() string {
return string(v)
}
// CheckSupported is used to determine whether a particular STOMP
// version is supported by this library. Returns nil if the version is
// supported, or ErrUnsupportedVersion if not supported.
func (v Version) CheckSupported() error {
switch v {
case V10, V11, V12:
return nil
}
return ErrUnsupportedVersion
}
// SupportsNack indicates whether this version of the STOMP protocol
// supports use of the NACK command.
func (v Version) SupportsNack() bool {
switch v {
case V10:
return false
case V11, V12:
return true
}
// unknown version
return false
}