feature: Adds basic TCP support for SSHAppBackend.

This commit is contained in:
Tera << 8 2025-02-18 13:15:09 -05:00
parent 432d457ad7
commit 15176831e6
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
5 changed files with 622 additions and 172 deletions

View file

@ -0,0 +1,30 @@
package gaslighter
import "io"
type Gaslighter struct {
Byte byte
HasGaslit bool
ProxiedReader io.Reader
}
func (gaslighter *Gaslighter) Read(p []byte) (n int, err error) {
if gaslighter.HasGaslit {
return gaslighter.ProxiedReader.Read(p)
}
if len(p) == 0 {
return 0, nil
}
p[0] = gaslighter.Byte
gaslighter.HasGaslit = true
if len(p) > 1 {
n, err := gaslighter.ProxiedReader.Read(p[1:])
return n + 1, err
} else {
return 1, nil
}
}