Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Implement support for port forwarding, x11 forwarding and SOCKs proxi…
Browse files Browse the repository at this point in the history
…es (#103)
  • Loading branch information
tsipinakis authored Jun 3, 2022
1 parent 7ae1eac commit aeadef4
Show file tree
Hide file tree
Showing 53 changed files with 4,126 additions and 108 deletions.
15 changes: 15 additions & 0 deletions agentprotocol/NewForwardCtx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package agentprotocol

import (
"io"

log "github.com/containerssh/libcontainerssh/log"
)

func NewForwardCtx(fromBackend io.Reader, toBackend io.Writer, logger log.Logger) *ForwardCtx {
return &ForwardCtx{
fromBackend: fromBackend,
toBackend: toBackend,
logger: logger,
}
}
51 changes: 51 additions & 0 deletions agentprotocol/Protocol.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package agentprotocol

const (
CONNECTION_TYPE_X11 = iota
CONNECTION_TYPE_PORT_FORWARD = iota
CONNECTION_TYPE_PORT_DIAL = iota
CONNECTION_TYPE_SOCKET_FORWARD = iota
CONNECTION_TYPE_SOCKET_DIAL = iota
)

const (
PROTOCOL_TCP string = "tcp"
PROTOCOL_UNIX string = "unix"
)

const (
PACKET_SETUP = iota
PACKET_SUCCESS
PACKET_ERROR
PACKET_DATA
PACKET_NEW_CONNECTION
PACKET_CLOSE_CONNECTION
PACKET_NO_MORE_CONNECTIONS
)

type SetupPacket struct {
ConnectionType uint32
BindHost string
BindPort uint32
Protocol string

Screen string
SingleConnection bool
AuthProtocol string
AuthCookie string
}

type NewConnectionPayload struct {
Protocol string

ConnectedAddress string
ConnectedPort uint32
OriginatorAddress string
OriginatorPort uint32
}

type Packet struct {
Type int
ConnectionId uint64
Payload []byte
}
Loading

0 comments on commit aeadef4

Please sign in to comment.