dnscrypt-proxy/vendor/github.com/quic-go/quic-go/internal/protocol/perspective.go

27 lines
501 B
Go
Raw Normal View History

2022-07-21 18:50:10 +02:00
package protocol
// Perspective determines if we're acting as a server or a client
type Perspective int
// the perspectives
const (
PerspectiveServer Perspective = 1
PerspectiveClient Perspective = 2
)
// Opposite returns the perspective of the peer
func (p Perspective) Opposite() Perspective {
return 3 - p
}
func (p Perspective) String() string {
switch p {
case PerspectiveServer:
2024-03-26 19:56:06 +01:00
return "server"
2022-07-21 18:50:10 +02:00
case PerspectiveClient:
2024-03-26 19:56:06 +01:00
return "client"
2022-07-21 18:50:10 +02:00
default:
return "invalid perspective"
}
}