前言
frp可能是用的比较多的反向代理工具,一些时候需要自己修改并且进行跨平台编译
一直忙着工作,好久没写博客。。
步骤
安装golang和git
apt update -y
apt install golang git -y
git clone --depth=1 https://github.com/fatedier/frp
cd frp
go env -w GOPROXY=https://goproxy.cn,direct
go mod download
make frpc
make frps
这样就可以编译出当前平台下的可执行文件
当然也可以使用docker
https://github.com/fatedier/frp/blob/dev/dockerfiles/Dockerfile-for-frpc
FROM golang:1.18 AS building
COPY . /building
WORKDIR /building
RUN make frpc
FROM alpine:3
COPY --from=building /building/bin/frpc /usr/bin/frpc
ENTRYPOINT ["/usr/bin/frpc"]
想要跨平台编译的话,也自带了跨平台的makefile
https://github.com/fatedier/frp/blob/dev/Makefile.cross-compiles
只需要
make -f Makefile.cross-compiles
就会自动编译出
darwin:amd64 darwin:arm64 freebsd:386 freebsd:amd64 linux:386 linux:amd64 linux:arm linux:arm64 windows:386 windows:amd64 linux:mips64 linux:mips64le linux:mips:softfloat linux:mipsle:softfloat
平台的可执行文件
参考文章
https://github.com/fatedier/frp