echogy

package module
v0.0.0-...-6e4d8ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: BSD-3-Clause Imports: 27 Imported by: 0

README

Echogy

A lightweight and efficient SSH reverse proxy tool implemented in Go, featuring a beautiful Terminal User Interface (TUI).

Features

Terminal User Interface (TUI)
  • Modern and responsive terminal interface
  • SSH session management
  • Real-time connection status monitoring
  • User-friendly interface for managing SSH connections
Core Features
  • SSH reverse proxy functionality
  • Multiple concurrent SSH connections support
  • TCP port forwarding
  • Secure session management
  • Built-in logging system

Quick Start

  1. Clone the repository:
git clone https://github.com/youkale/echogy.git
cd echogy
  1. Install dependencies:
go mod download
  1. Configure your settings in config.json:
{
  "addr": ":443",
  "ssh_addr": ":22",
  "domain": "your-domain.com",
  "idle_timeout": 300,
  "key": "YOUR_SSH_KEY"
}
  1. Build and run:
make build
./echogy

Project Structure

.
├── cmd/           # Command line tools
├── logger/        # Logging framework
├── tui/          # Terminal User Interface components
├── pprof/        # Performance profiling
├── echogy.go     # Core SSH implementation
├── conn.go       # Connection management
├── facade.go     # Facade pattern implementation
├── forward.go    # Port forwarding logic
└── util.go       # Utility functions
Key Components
  • SSH Server: Handles SSH connections and session management
  • Forward Proxy: Manages TCP port forwarding
  • TUI: Provides an interactive terminal interface
  • Logger: Structured logging with multiple output formats

Configuration

SSH Key Setup
ssh-keygen -b 2048 -f echogy_rsa
# Copy the private key content to config.json
Domain Configuration
# DNS A records
A your-domain.com YOUR_SERVER_IP
A *.your-domain.com YOUR_SERVER_IP

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the BSD License - see the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	NotFound = `HTTP/1.0 404 Not Found
Server: webs.sh
Content-Length: %d

Tunnel %s not found
`

	BadRequest = `HTTP/1.0 400 Bad Request
Server: webs.sh
Content-Length: 12

Bad Request
`
)
View Source
const (
	// Lowercase Character sets for random string generation
	Lowercase = "abcdefghijklmnopqrstuvwxyz"
	Uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Digits    = "0123456789"
	// AlphaNum Predefined character sets
	AlphaNum = Lowercase + Digits
)

Variables

This section is empty.

Functions

func DirectTCPIPHandler

func DirectTCPIPHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx ssh.Context)

func Serve

func Serve(ctx context.Context, config *Config, auth auth.Auth)

Types

type Config

type Config struct {
	HttpAddr   string `json:"httpAddr"`
	SSHAddr    string `json:"SSHAddr"`
	Domain     string `json:"domain"`
	PrivateKey string `json:"privateKey"`
}

type Dispatch

type Dispatch func(*http.Response, *http.Request, int64)

type EventMessage

type EventMessage struct {
	Name string      `json:"name"`
	Data interface{} `json:"data"`
}

type Request

type Request struct {
	Method  string            `json:"method"`
	Uri     string            `json:"uri"`
	Headers map[string]string `json:"headers"`
}

type Response

type Response struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
}

type Stats

type Stats struct {
	RequestBytes      int64 `json:"requestBytes"`
	ResponseBytes     int64 `json:"responseBytes"`
	Requests          int   `json:"requests"`
	Responses         int   `json:"responses"`
	ActiveConnections int   `json:"activeConnections"`
	TotalConnections  int   `json:"totalConnections"`
}

type SyncEventMessage

type SyncEventMessage struct {
	Tunnel       string            `json:"tunnel"`
	Stats        *Stats            `json:"stats"`
	HttpEntities []*WrapHttpEntity `json:"httpEntities"`
}

type UpdateEventMessage

type UpdateEventMessage struct {
	Stats      *Stats          `json:"stats"`
	HttpEntity *WrapHttpEntity `json:"httpEntity"`
}

type WrapHttpEntity

type WrapHttpEntity struct {
	Id       int       `json:"id"`
	Response *Response `json:"response"`
	Request  *Request  `json:"request"`
	UseTime  int64     `json:"useTime"`
}

Directories

Path Synopsis
pkg
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL