Commit 1d8cd7b8 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent 2ee90b76
Pipeline #16361 passed with stages
in 24 seconds
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
"timeout": 10, "timeout": 10,
"history": 100, "history": 100,
"interval": 1000, "interval": 1000,
"table": 1, "table": 2000,
"proto": 250 "proto": 250
} }
...@@ -28,6 +28,7 @@ export class RouteWriter { ...@@ -28,6 +28,7 @@ export class RouteWriter {
const via = Router.all[viaId]; const via = Router.all[viaId];
for (const address of [to.address, ...to.subnets]) { for (const address of [to.address, ...to.subnets]) {
this.input.push(`route replace ${address} via ${via.linkAddress} table ${config.table} proto ${config.proto}`); this.input.push(`route replace ${address} via ${via.linkAddress} table ${config.table} proto ${config.proto}`);
this.input.push(`route replace default via ${via.linkAddress} table ${to.destMark + 1000} proto ${config.proto}`);
} }
for (const [table, to] of this.plan.entries()) { for (const [table, to] of this.plan.entries()) {
if (to === toId) { if (to === toId) {
......
import * as _ from 'lodash'; import * as _ from 'lodash';
import config from '../config/config.json'; import config from '../config/config.json';
import { Hello, PeerQuality } from '../protocol'; import { Hello, PeerQuality } from '../protocol';
import routers from '../import/data/Router.json'; import _routers from '../import/data/Router.json';
import subnets from '../import/data/Subnet.json'; import subnets from '../import/data/Subnet.json';
import { Router as RouterData } from '../import/scripts/Router';
export interface Router extends RouterData {
}
const routers = <RouterData[]>_routers;
export class Router implements Hello, PeerQuality { export class Router implements Hello, PeerQuality {
static all: Record<number, Router> = _.keyBy( static all: Record<number, Router> = _.keyBy(
routers.filter((r) => r.id !== parseInt(process.env.RAILGUN_ID)).map((r) => new Router(r.id, r)), routers.filter((r) => r.id !== parseInt(process.env.RAILGUN_ID)).map((r) => new Router(r)),
'id' 'id'
); );
...@@ -22,10 +29,10 @@ export class Router implements Hello, PeerQuality { ...@@ -22,10 +29,10 @@ export class Router implements Hello, PeerQuality {
history: (number | undefined)[] = []; history: (number | undefined)[] = [];
constructor(public id: number, r: any) { constructor(public data: RouterData) {
this.address = r.address; Object.assign(this, data);
this.linkAddress = `10.200.${id}.${parseInt(process.env.RAILGUN_ID)}`; this.linkAddress = `10.200.${data.id}.${parseInt(process.env.RAILGUN_ID)}`;
this.subnets = subnets.filter((s) => r.name).map((s) => s.subnet); this.subnets = subnets.filter((s) => data.name).map((s) => s.subnet);
} }
reset() { reset() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment