diff options
Diffstat (limited to 'internal/net/conn.go')
| -rw-r--r-- | internal/net/conn.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/net/conn.go b/internal/net/conn.go index 6d78d8f..a7c53ec 100644 --- a/internal/net/conn.go +++ b/internal/net/conn.go @@ -92,6 +92,23 @@ func (t *tcpConn) SetEcho(on bool) error { return t.writeTelnetCmd(will, echo) } +// EchoSequence returns the telnet negotiation bytes that switch the client's +// echo state. Queued sessions transmit these through the session writer so a +// stalled client cannot block the caller (see Session.SetEcho); the local +// echo state is applied separately via SetEchoState. +func (t *tcpConn) EchoSequence(on bool) []byte { + if on { + return []byte{iac, wont, echo} + } + return []byte{iac, will, echo} +} + +// SetEchoState records the echo state without writing to the network; used +// when the negotiation bytes are queued instead of written inline. +func (t *tcpConn) SetEchoState(on bool) { + t.echoOff = !on +} + const ( iac = 255 will = 251 |
