mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Prototyped TunEndpoint struct, data flow commentary
This commit is contained in:
parent
25d85f6759
commit
48b0c41f62
2 changed files with 29 additions and 1 deletions
|
@ -50,6 +50,8 @@ const (
|
|||
CSONone = iota // No error, normal packet
|
||||
CSOHmacInvalid // HMAC mismatch detected on remote end
|
||||
CSOTermSize // set term size (rows:cols)
|
||||
CSOTunReq // client tunnel open request (dstport)
|
||||
CSOTunAck // server tunnel open ack (tunport)
|
||||
CSOExitStatus // Remote cmd exit status
|
||||
CSOChaff // Dummy packet, do not pass beyond decryption
|
||||
)
|
||||
|
|
|
@ -73,7 +73,29 @@ type (
|
|||
szMax uint // max size in bytes
|
||||
}
|
||||
|
||||
//h *hkex.HerraduraKEx // TODO: make an interface?
|
||||
// Tunnels
|
||||
// --
|
||||
// 1. client is given (lport, remhost, rport) by local user
|
||||
// 2. client sends [CSOTunReq:rport] to server
|
||||
// client=> [CSOTunReq:rport] =>remhost
|
||||
// t := TunEndpoint{dataPort: lport, peer: remhost}
|
||||
//
|
||||
// remhost allocates dynamic (Tport)
|
||||
// t := TunEndpoint{dataPort: rport, peer: client, tunPort: Tport}
|
||||
//
|
||||
// remhost spawns goroutine forwarding data between (Tport,rport)
|
||||
// client<= [CSOTunAck:Tport] <=remhost
|
||||
// t.tunPort = Tport
|
||||
//
|
||||
// client spawns goroutine forwarding data between (lport,Tport)
|
||||
// --
|
||||
|
||||
// TunEndpoint [securePort:peer:dataPort]
|
||||
TunEndpoint struct {
|
||||
tunPort uint16
|
||||
peer net.Addr
|
||||
dataPort uint16
|
||||
}
|
||||
|
||||
// Conn is a connection wrapping net.Conn with KEX & session state
|
||||
Conn struct {
|
||||
|
@ -791,6 +813,10 @@ func (hc Conn) Read(b []byte) (n int, err error) {
|
|||
hc.SetStatus(CSETruncCSO)
|
||||
}
|
||||
hc.Close()
|
||||
} else if ctrlStatOp == CSOTunReq {
|
||||
Log.Notice("[Client Tunnel Open Request - TODO]\n")
|
||||
} else if ctrlStatOp == CSOTunAck {
|
||||
Log.Notice("[Server Tunnel Open Ack - TODO]\n")
|
||||
} else {
|
||||
hc.dBuf.Write(payloadBytes)
|
||||
//log.Printf("hc.dBuf: %s\n", hex.Dump(hc.dBuf.Bytes()))
|
||||
|
|
Loading…
Reference in a new issue