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