add ConnectionMode.String() helper

This commit is contained in:
mappu 2016-11-29 19:22:28 +13:00
parent 11564b8c32
commit b592e8ef7e

View File

@ -28,11 +28,27 @@ const (
type ConnectionMode rune type ConnectionMode rune
const ( const (
CONNECTIONMODE_ACTIVE ConnectionMode = 'A' CONNECTIONMODE_ACTIVE ConnectionMode = 'A' // 65
CONNECTIONMODE_PASSIVE ConnectionMode = 'P' CONNECTIONMODE_PASSIVE ConnectionMode = 'P' // 49
CONNECTIONMODE_SOCKS5 ConnectionMode = '5' CONNECTIONMODE_SOCKS5 ConnectionMode = '5' // 53
) )
func (this ConnectionMode) String() string {
switch this {
case CONNECTIONMODE_ACTIVE:
return "Active"
case CONNECTIONMODE_PASSIVE:
return "Passive"
case CONNECTIONMODE_SOCKS5:
return "SOCKS5"
default:
return fmt.Sprintf("ConnectionMode(\"%s\")", string(this))
}
}
// This structure represents a user connected to a hub. // This structure represents a user connected to a hub.
type UserInfo struct { type UserInfo struct {
Nick string Nick string