diff --git a/src/eamuse/index.ts b/src/eamuse/index.ts index 839bc90..070b80c 100644 --- a/src/eamuse/index.ts +++ b/src/eamuse/index.ts @@ -5,6 +5,7 @@ import { core } from './Core'; import { EamusePlugin } from './EamusePlugin'; import { EamuseRootRouter } from './EamuseRootRouter'; import { Logger } from '../utils/Logger'; +import { CONFIG } from '../utils/ArgConfig'; export const ROOT_CONTAINER = new EamuseRootRouter(); let initialized = false; @@ -44,6 +45,8 @@ export const services = (port: number, plugins: EamusePlugin[]) => { /* - Service */ ROOT_CONTAINER.add('services.get', async (info, data, send) => { + const ping_ip = CONFIG.ping_ip; + const services = { '@attr': { expire: 10800, @@ -60,7 +63,7 @@ export const services = (port: number, plugins: EamusePlugin[]) => { { '@attr': { name: 'keepalive', - url: `http://127.0.0.1/keepalive?pa=127.0.0.1&ia=127.0.0.1&ga=127.0.0.1&ma=127.0.0.1&t1=2&t2=10`, + url: `http://${ping_ip}/core/keepalive?pa=${ping_ip}&ia=${ping_ip}&ga=${ping_ip}&ma=${ping_ip}&t1=2&t2=10`, }, }, ], diff --git a/src/utils/ArgConfig.ts b/src/utils/ArgConfig.ts index cfefb84..f03eb63 100644 --- a/src/utils/ArgConfig.ts +++ b/src/utils/ArgConfig.ts @@ -43,6 +43,12 @@ parser.addArgument(['--dev', '--console'], { action: 'storeTrue', }); +parser.addArgument(['-pa', '--ping-addr'], { + help: 'Use an ICMP pingable target to make your games think they are online', + metavar: 'IP', + dest: 'ping_addr', +}); + parser.addArgument(['--force-load-db'], { help: 'Force load savedata and discard corrupted messages', defaultValue: false, @@ -93,6 +99,13 @@ function CoreConfig() { needRestart: true, }); + CONFIG_MAP['core'].set('ping_ip', { + type: 'string', + default: '127.0.0.1', + needRestart: true, + desc: 'Use an ICMP pingable target to make your games think they are online', + }); + CONFIG_MAP['core'].set('matching_port', { type: 'integer', range: [0, 65535], diff --git a/src/utils/Consts.ts b/src/utils/Consts.ts index 9a7149d..b91a505 100644 --- a/src/utils/Consts.ts +++ b/src/utils/Consts.ts @@ -1,4 +1,4 @@ -export const VERSION = 'v1.31b'; +export const VERSION = 'v1.31c'; export const NAMES = [ 'Akehiro', 'Akihiro',