This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for port forwarding, x11 forwarding and SOCKs proxi…
…es (#103)
- Loading branch information
1 parent
7ae1eac
commit aeadef4
Showing
53 changed files
with
4,126 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.