terasu

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

README

TeRaSu (TRS)

よの光遍く空へ照しつつ

土棲むものは孰れか見ゆや

counter

Usage

tls.Client(terasu.NewConn(conn), &tls.Config{
    ServerName: host,
}).Handshake()

Custom Plugin

Custom plugin code is located in the ext/custom directory. You can write and build your own plugin.

  1. Write your plugin code in the ext/custom directory
  2. Build the plugin:
go build -o terasu.plugin.so -buildmode=plugin -ldflags="-s -w" -trimpath ./ext/custom
Example 1. Build for OpenWrt arm64
sudo apt-get update
sudo apt-get install -y build-essential module-assistant gcc-9-multilib-i686-linux-gnu g++-9-multilib-i686-linux-gnu
wget -nv https://downloads.openwrt.org/releases/23.05.3/targets/ipq807x/generic/openwrt-sdk-23.05.3-ipq807x-generic_gcc-12.3.0_musl.Linux-x86_64.tar.xz
tar -xJf openwrt-sdk-23.05.3-ipq807x-generic_gcc-12.3.0_musl.Linux-x86_64.tar.xz
mv openwrt-sdk-23.05.3-ipq807x-generic_gcc-12.3.0_musl.Linux-x86_64 op23053-ipq807x
rm openwrt-sdk-23.05.3-ipq807x-generic_gcc-12.3.0_musl.Linux-x86_64.tar.xz

PATH=$PATH:`pwd`/op23053-ipq807x/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.3.0_musl/bin/
export PATH
export STAGING_DIR=`pwd`/op23053-ipq807x/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.3.0_musl/
export CGO_CFLAGS=$CGO_CFLAGS" -fuse-ld=bfd"
echo $CGO_CFLAGS
export CGO_LDFLAGS=$CGO_LDFLAGS" -fuse-ld=bfd"
echo $CGO_LDFLAGS
export GOGCCFLAGS=$GOGCCFLAGS" -fuse-ld=bfd"
echo $GOGCCFLAGS
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 GOARM=8 CC=aarch64-openwrt-linux-gcc CXX=aarch64-openwrt-linux-g++ AR=aarch64-openwrt-linux-ar go build -o terasu.plugin.so -buildmode=plugin -ldflags="-s -w" -trimpath ./ext/custom

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFirstFragmentLen = 4

DefaultFirstFragmentLen ...

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn remote: real server; local: relay

func NewConn added in v1.0.1

func NewConn(conn net.Conn) *Conn

NewConn wraps *net.TCPConn (net.Conn must be *net.TCPConn)

func (*Conn) Close added in v1.0.1

func (conn *Conn) Close() error

Close closes the connection.

func (*Conn) LocalAddr added in v1.0.1

func (conn *Conn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Conn) Read added in v1.0.1

func (conn *Conn) Read(b []byte) (int, error)

Read is recv

func (*Conn) ReadFrom added in v1.0.1

func (conn *Conn) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom when client want to send to server, detect and split.

func (*Conn) RemoteAddr added in v1.0.1

func (conn *Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Conn) SetDeadline added in v1.0.1

func (conn *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection.

func (*Conn) SetReadDeadline added in v1.0.1

func (conn *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls.

func (*Conn) SetWriteDeadline added in v1.0.1

func (conn *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls.

func (*Conn) Write added in v1.0.1

func (conn *Conn) Write(b []byte) (int, error)

Write is send

func (*Conn) WriteTo added in v1.0.1

func (conn *Conn) WriteTo(w io.Writer) (int64, error)

WriteTo remote response and releay it to local client without any change.

Directories

Path Synopsis
Package main provides the main entry point for terasu.
Package main provides the main entry point for terasu.
Package dns with DoT/DoH supports
Package dns with DoT/DoH supports
Package http is a wrapper around the standard http library with enhanced DNS resolution and TLS handling capabilities.
Package http is a wrapper around the standard http library with enhanced DNS resolution and TLS handling capabilities.
Package http2 is the same as the standard http lib with HTTP2 client support
Package http2 is the same as the standard http lib with HTTP2 client support
Package http3 is the same as the standard http lib with HTTP3 client support
Package http3 is the same as the standard http lib with HTTP3 client support
Package ip contains IP-related configs
Package ip contains IP-related configs

Jump to

Keyboard shortcuts

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