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;
}
}