NutzCN Logo
问答 ngrok的服务器地址好像修改不了
发布于 1978天前 作者 yuffo 1451 次浏览 复制 上一个帖子 下一个帖子
标签:

NgrokStarter这里是不是写错了
ngrokClient.hostname = conf.get(PROP_SRV_HOST);
ngrokClient.hostname是不是应该是ngrokClient.srv_host
想自建ngrok服务器 发现改不了服务器地址

@IocBean
public class NgrokClientStarter implements ServerFace {
	
	public static final String PRE = "ngrok.client.";

	@PropDoc(value="服务器域名", defaultValue="wendal.cn")
	public static final String PROP_SRV_HOST = PRE + "srv_host";
	
	@PropDoc(value="服务器端口", defaultValue="4443", type="int")
	public static final String PROP_SRV_PORT = PRE + "srv_port";
	
	@PropDoc(value="目标端口", defaultValue="8080", type="int")
	public static final String PROP_TO_PORT = PRE + "to_port";
	
	@PropDoc(value="秘钥", need=true)
	public static final String PROP_AUTH_TOKEN = PRE + "auth_token";
	
	@PropDoc(value="开关", defaultValue="true", type="boolean")
	public static final String PROP_ENABLE = PRE + "enable";
	
	@Inject("refer:$ioc")
	protected Ioc ioc;
	
	@Inject
	protected PropertiesProxy conf;
	
	protected NgrokClient ngrokClient;
	
	@IocBean(name="ngrokClient")
	public NgrokClient createNgrokClient() {
		NgrokClient ngrokClient = new NgrokClient();
		ngrokClient.auth_token = conf.check(PROP_AUTH_TOKEN);
		if (conf.has(PROP_SRV_HOST)) {
			ngrokClient.hostname = conf.get(PROP_SRV_HOST);
		}
		if (conf.has(PROP_SRV_PORT)) {
			ngrokClient.srv_port = conf.getInt(PROP_SRV_PORT);
		}
		if (conf.has(PROP_TO_PORT)) {
			ngrokClient.to_port = conf.getInt(PROP_TO_PORT);
		}
		return ngrokClient;
	}

	public void start() throws Exception {
		if(conf.getBoolean(PROP_ENABLE, true)) {
			ngrokClient = ioc.get(NgrokClient.class);
			ngrokClient.start();
		}
	}

	@Override
	public void stop() throws Exception {
		if (ngrokClient != null)
			ngrokClient.stop();
	}

	@Override
	public boolean isRunning() {
		return ngrokClient != null && ngrokClient.status == 1;
	}

	@Override
	public boolean failsafe() {
		return false;
	}
}
10 回复

稍等,我检查一下哦

来自炫酷的 NutzCN

是有问题, 你来改? 我来改?

额, 那我来吧

你来,我git不太行..

好的,快照版本maven引用就可以了吗

是的,大概10分钟

ngrok的https协议怎么开,我搭了个ngrok服务器,只有http可以连通

加个nginx,配https证书,转发一下吧

来自炫酷的 NutzCN

好的,谢谢

添加回复
请先登陆
回到顶部