From 4a7557f2bd78e48449a1ffded03d4e634a20b910 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 14 Oct 2013 16:13:09 -0400 Subject: [PATCH] go.crypto/ssh: add String method to RejectionReason. R=agl, dave CC=golang-dev https://golang.org/cl/14494055 --- ssh/channel.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ssh/channel.go b/ssh/channel.go index 4861e41..990c04c 100644 --- a/ssh/channel.go +++ b/ssh/channel.go @@ -77,6 +77,21 @@ const ( ResourceShortage ) +// String converts the rejection reason to human readable form. +func (r RejectionReason) String() string { + switch r { + case Prohibited: + return "administratively prohibited" + case ConnectionFailed: + return "connect failed" + case UnknownChannelType: + return "unknown channel type" + case ResourceShortage: + return "resource shortage" + } + return fmt.Sprintf("unknown reason %d", int(r)) +} + type channel struct { packetConn // the underlying transport localId, remoteId uint32