checkin README.md files

This commit is contained in:
eyedeekay
2025-04-10 19:05:32 -04:00
parent 635c0f8aca
commit cbd126ff4d
4 changed files with 234 additions and 1 deletions

56
mirror/README.md Normal file
View File

@ -0,0 +1,56 @@
# Mirror Listener
A network listener implementation that simultaneously listens on clearnet (TLS), Tor onion services, and I2P garlic services.
## Overview
Mirror Listener is a wrapper around the [go-meta-listener](https://github.com/go-i2p/go-meta-listener) package that provides a simplified interface for setting up multi-protocol listeners. It automatically configures:
- TLS-secured clearnet connections with Let's Encrypt certificates
- Tor onion service endpoints
- I2P garlic service endpoints
This allows you to run a single service that's accessible through multiple network layers and protocols.
## Installation
```bash
go get github.com/go-i2p/go-meta-listener/mirror
```
## Usage
```go
import (
"github.com/go-i2p/go-meta-listener/mirror"
"net/http"
)
func main() {
// Create a multi-protocol listener
listener, err := mirror.Listen(
"yourdomain.com", // Domain name for TLS
"your.email@example.com", // Email for Let's Encrypt
"./certs", // Certificate directory
false, // Enable/disable TLS on hidden services
)
if err != nil {
panic(err)
}
defer listener.Close()
// Use with standard library
http.Serve(listener, yourHandler)
}
```
## Configuration Options
- **Domain Name**: Required for TLS certificate issuance through Let's Encrypt
- **Email Address**: Used for Let's Encrypt registration
- **Certificate Directory**: Where TLS certificates will be stored
- **Hidden TLS**: When set to true, enables TLS for Tor and I2P services as well
## Example: Connection Forwarding
See the [example directory](./example) for a complete example of using Mirror Listener to forward connections to a local service.

View File

@ -0,0 +1,44 @@
# metaproxy - Connection Forwarder
A simple utility that forwards connections from a meta listener to a specified host and port. Part of the `go-i2p/go-meta-listener` toolset.
Automatically forwards a local service to a TLS Service, an I2P Eepsite, and a Tor Onion service at the same time.
## Installation
To install the metaproxy utility, use:
```bash
go install github.com/go-i2p/go-meta-listener/mirror/metaproxy@latest
```
## Usage
```bash
metaproxy [options]
```
### Options
- `-host`: Host to forward connections to (default: "localhost")
- `-port`: Port to forward connections to (default: 8080)
- `-domain`: Domain name for TLS listener (default: "i2pgit.org")
- `-email`: Email address for Let's Encrypt registration (default: "example@example.com")
- `-certdir`: Directory for storing certificates (default: "./certs")
- `-hidden-tls`: Enable hidden TLS (default: false)
## Description
metaproxy creates a meta listener that can accept connections from multiple transport types and forwards them to a specified destination (host:port).
It supports TLS with automatic certificate management through Let's Encrypt, I2P EepSites, and Tor Onion Services.
## Examples
Forward connections to a local web server:
```bash
metaproxy -host localhost -port 3000
```
Forward connections with custom TLS settings:
```bash
metaproxy -domain yourdomain.com -email you@example.com -certdir /etc/certs -port 8443
```

45
mirror/metaproxy/main.go Normal file
View File

@ -0,0 +1,45 @@
package main
import (
"flag"
"fmt"
"io"
"net"
"github.com/go-i2p/go-meta-listener/mirror"
)
// main function sets up a meta listener that forwards connections to a specified host and port.
// It listens for incoming connections and forwards them to the specified destination.
func main() {
host := flag.String("host", "localhost", "Host to forward connections to")
port := flag.Int("port", 8080, "Port to forward connections to")
domain := flag.String("domain", "i2pgit.org", "Domain name for TLS listener")
email := flag.String("email", "example@example.com", "Email address for Let's Encrypt registration")
certDir := flag.String("certdir", "./certs", "Directory for storing certificates")
hiddenTls := flag.Bool("hidden-tls", false, "Enable hidden TLS")
flag.Parse()
// Create a new meta listener
metaListener, err := mirror.Listen(*domain, *email, *certDir, *hiddenTls)
if err != nil {
panic(err)
}
defer metaListener.Close()
// forward all connections recieved on the meta listener to a local host:port
for {
conn, err := metaListener.Accept()
if err != nil {
panic(err)
}
go func() {
defer conn.Close()
localConn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", *host, *port))
if err != nil {
panic(err)
}
defer localConn.Close()
go io.Copy(localConn, conn)
io.Copy(conn, localConn)
}()
}
}