mirror of
https://github.com/fumiama/terasu.git
synced 2026-06-22 05:20:25 +08:00
doc: add more ex
This commit is contained in:
25
README.md
25
README.md
@@ -20,7 +20,7 @@ tls.Client(terasu.NewConn(conn), &tls.Config{
|
|||||||
}).Handshake()
|
}).Handshake()
|
||||||
```
|
```
|
||||||
|
|
||||||
## Custom Plugin (Linux Only)
|
## Custom Plugin
|
||||||
|
|
||||||
Custom plugin code is located in the `ext/custom` directory. You can write and build your own plugin.
|
Custom plugin code is located in the `ext/custom` directory. You can write and build your own plugin.
|
||||||
|
|
||||||
@@ -28,5 +28,26 @@ Custom plugin code is located in the `ext/custom` directory. You can write and b
|
|||||||
2. Build the plugin:
|
2. Build the plugin:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
GOOS=linux go build -o terasu.plugin.so -buildmode=plugin -ldflags="-s -w" -trimpath ./ext/custom
|
go build -o terasu.plugin.so -buildmode=plugin -ldflags="-s -w" -trimpath ./ext/custom
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example 1. Build for OpenWrt arm64
|
||||||
|
```bash
|
||||||
|
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
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user