[macOS] macOS Monterey无法使用钉钉内网穿透工具

按照钉钉官方文档: https://open.dingtalk.com/document/tutorial/dingtalk-logon-free-third-party-websites

把内网穿透工具拉到本地之后,运行,会报以下错误

fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x14bd408, 0x21)
	/usr/local/go/src/runtime/panic.go:619 +0x81 fp=0x7ff7bfeff1c8 sp=0x7ff7bfeff1a8 pc=0x102a911
runtime.goenvs()
	/usr/local/go/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff1f8 sp=0x7ff7bfeff1c8 pc=0x1028493
runtime.schedinit()
	/usr/local/go/src/runtime/proc.go:496 +0xa4 fp=0x7ff7bfeff250 sp=0x7ff7bfeff1f8 pc=0x102d1d4
runtime.rt0_go(0x7ff7bfeff288, 0x4, 0x7ff7bfeff288, 0x0, 0x1000000, 0x4, 0x7ff7bfeff460, 0x7ff7bfeff467, 0x7ff7bfeff47a, 0x7ff7bfeff48e, ...)
	/usr/local/go/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff258 sp=0x7ff7bfeff250 pc=0x10540d4

查了很久,是因为go某些版本对于macOS Monterey支持有问题。而钉钉内网穿透工具官方已经很久不更新了!

不过在网友强大的力量下,终于解决了这个问题

 

安装docker

请自行Google! 

 

添加代码

参考这位网友的pr,到pierced目录新建对应的文件: https://github.com/open-dingtalk/pierced/pull/49/files

比如,pierced在摆放在 /System/Volumes/Data/Software/Project/test/pierced

当前目录文件如下

▾ linux/                                                                                                                                                   
    ding*
    ding.cfg
▸ mac_64/
▸ windows_64/
  README.md

Dockerfile

touch Dockerfile
vim Dockerfile

内容如下

FROM ubuntu:latest
MAINTAINER dirname
WORKDIR /pierced
COPY linux .
RUN chmod a+x run.sh
ARG subdomain
ENV DOMAIN=${subdomain}
ARG addr
ENV ADDRESS=${addr}

CMD ["/pierced/run.sh"]

 

Makefile

touch Makefile
vim Makefile

内容如下

build:
	docker build -t pierced:1.0 --build-arg subdomain=$(subdomain) --build-arg addr=$(addr) .

run:
	docker run --name pierced -d pierced:1.0

 

linux/run.sh

touch linux/run.sh
vim linux/run.sh

内容如下

#!/bin/bash

echo "start server: $ADDRESS -> $DOMAIN"
/pierced/ding --config=/pierced/ding.cfg --subdomain=$DOMAIN $ADDRESS

 

构建镜像

make build subdomain={subdomain} addr={宿主机IP:端口}

{subdomain}就是你的子域名

{宿主机IP:端口}是你本机的ip和项目运行端口,注意一定要加上ip

比如如下命令

make build subdomain=abcdef addr=192.168.10.11:9999

 

启动

make run

 

这个时候,就可以通过http://abcdef.vaiwan.com/ 访问到你本机啦!

 

Have fun with docker!

 

posted @ 2022-01-01 17:27  DavidHHuan  阅读(1722)  评论(0编辑  收藏  举报