Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
railgun-routing-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
railgun-routing-client
Commits
1d8cd7b8
Commit
1d8cd7b8
authored
Sep 04, 2022
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
2ee90b76
Pipeline
#16361
passed with stages
in 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
config/config.json
config/config.json
+1
-1
src/RouteWriter.ts
src/RouteWriter.ts
+1
-0
src/Router.ts
src/Router.ts
+13
-6
No files found.
config/config.json
View file @
1d8cd7b8
...
@@ -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
}
}
src/RouteWriter.ts
View file @
1d8cd7b8
...
@@ -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
)
{
...
...
src/Router.ts
View file @
1d8cd7b8
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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment