Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tun
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
tun
Commits
e0f9949b
Commit
e0f9949b
authored
Dec 11, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bird
parent
b6618a05
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
19 deletions
+29
-19
ansible/ansible.cfg
ansible/ansible.cfg
+1
-0
ansible/bird.conf.j2
ansible/bird.conf.j2
+0
-1
ansible/configure.yaml
ansible/configure.yaml
+9
-0
ansible/protocols/wgfrp/configure.yaml
ansible/protocols/wgfrp/configure.yaml
+1
-1
ansible/scripts/switch-rules-down.sh.j2
ansible/scripts/switch-rules-down.sh.j2
+7
-7
ansible/scripts/switch-rules-up.sh.j2
ansible/scripts/switch-rules-up.sh.j2
+7
-7
src/inventory.ts
src/inventory.ts
+4
-3
No files found.
ansible/ansible.cfg
View file @
e0f9949b
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
host_key_checking = False
host_key_checking = False
strategy_plugins = mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy_plugins = mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy = mitogen_free
strategy = mitogen_free
inventory = ../result/inventory.yaml
ansible/bird.conf.j2
View file @
e0f9949b
...
@@ -43,7 +43,6 @@ protocol kernel {
...
@@ -43,7 +43,6 @@ protocol kernel {
};
};
kernel table {{plan.destMark}};
kernel table {{plan.destMark}};
}
}
{% endif %}
{% endfor %}
{% endfor %}
protocol ospf v2 {
protocol ospf v2 {
...
...
ansible/configure.yaml
View file @
e0f9949b
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
-
name
:
table pref 81 lookup main
-
name
:
table pref 81 lookup main
become
:
true
become
:
true
shell
:
'
ip
-4
rule
add
pref
81
to
{{item}}
lookup
main
||
true'
shell
:
'
ip
-4
rule
add
pref
81
to
{{item}}
lookup
main
||
true'
with_items
:
'
{{routeLists.mycard}}'
# 为了提高测试时候的性能,不改动wg的时候注释掉这段
# 为了提高测试时候的性能,不改动wg的时候注释掉这段
-
name
:
'
clean
up
null
connections
first'
-
name
:
'
clean
up
null
connections
first'
include_tasks
:
'
protocols/{{item.protocol}}/configure.yaml'
include_tasks
:
'
protocols/{{item.protocol}}/configure.yaml'
...
@@ -91,3 +92,11 @@
...
@@ -91,3 +92,11 @@
restarted
:
true
restarted
:
true
services
:
services
:
-
frps
-
frps
-
name
:
restart_frpc
docker_compose
:
project_src
:
'
{{ansible_user_dir}}/nextgen-network/services'
restarted
:
true
services
:
-
frpc_{{item}}
with_items
:
'
{{connections}}'
when
:
'
item.type
==
"wgfrp"
and
item.'
ansible/protocols/wgfrp/configure.yaml
View file @
e0f9949b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
-
name
:
'
{{conn.name}}:
frpc
template'
-
name
:
'
{{conn.name}}:
frpc
template'
template
:
template
:
src
:
'
frpc.ini.j2'
src
:
'
frpc.ini.j2'
dest
:
'
{{ansible_user_dir}}/nextgen-network/services/frpc
_
{{item.name}}.ini'
dest
:
'
{{ansible_user_dir}}/nextgen-network/services/frpc
-
{{item.name}}.ini'
when
:
'
conn.frpType
==
"frpc"'
when
:
'
conn.frpType
==
"frpc"'
notify
:
restart_frpc
notify
:
restart_frpc
...
...
ansible/scripts/switch-rules-down.sh.j2
View file @
e0f9949b
...
@@ -5,25 +5,25 @@ source {{ansible_user_dir}}/nextgen-network/scripts/utility.sh
...
@@ -5,25 +5,25 @@ source {{ansible_user_dir}}/nextgen-network/scripts/utility.sh
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
interface_switch_chnroute
-D
u_
{{
plan.name
}}
_chnroute
{{
plan.destMark
}}
interface_switch_chnroute
-D
u_
{{
plan.name
}}
_chnroute
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
interface_switch_chnroute
-D
u_
{{
g
ateway.isp
}}
_chnroute
{{
gateway
.selectionMark
}}
interface_switch_chnroute
-D
u_
{{
g
w.isp
}}
_chnroute
{{
gw
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
## all
## all
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
interface_switch
-D
u_
{{
plan.name
}}
_all
{{
plan.destMark
}}
interface_switch
-D
u_
{{
plan.name
}}
_all
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
interface_switch
-D
u_
{{
g
ateway.isp
}}
_all
{{
gateway
.selectionMark
}}
interface_switch
-D
u_
{{
g
w.isp
}}
_all
{{
gw
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
## restore mark
## restore mark
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
ip rule del pref 400 fwmark
{{
gateway.selection
Mark
}}
lookup
{{
plan.destMark
}}
ip rule del pref 400 fwmark
{{
plan.dest
Mark
}}
lookup
{{
plan.destMark
}}
restore_mark
-D
{{
plan.destMark
}}
restore_mark
-D
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
restore_mark
-D
{{
g
ateway
.selectionMark
}}
restore_mark
-D
{{
g
w
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
true
true
ansible/scripts/switch-rules-up.sh.j2
View file @
e0f9949b
...
@@ -5,25 +5,25 @@ source {{ansible_user_dir}}/nextgen-network/scripts/utility.sh
...
@@ -5,25 +5,25 @@ source {{ansible_user_dir}}/nextgen-network/scripts/utility.sh
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
interface_switch_chnroute
-A
u_
{{
plan.name
}}
_chnroute
{{
plan.destMark
}}
interface_switch_chnroute
-A
u_
{{
plan.name
}}
_chnroute
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
interface_switch_chnroute
-A
u_
{{
g
ateway.isp
}}
_chnroute
{{
gateway
.selectionMark
}}
interface_switch_chnroute
-A
u_
{{
g
w.isp
}}
_chnroute
{{
gw
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
## all
## all
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
interface_switch
-A
u_
{{
plan.name
}}
_all
{{
plan.destMark
}}
interface_switch
-A
u_
{{
plan.name
}}
_all
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
interface_switch
-A
u_
{{
g
ateway.isp
}}
_all
{{
gateway
.selectionMark
}}
interface_switch
-A
u_
{{
g
w.isp
}}
_all
{{
gw
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
## restore mark
## restore mark
{
%
for
plan
in
routePlans %
}
{
%
for
plan
in
routePlans %
}
ip rule add pref 400 fwmark
{{
gateway.selection
Mark
}}
lookup
{{
plan.destMark
}}
ip rule add pref 400 fwmark
{{
plan.dest
Mark
}}
lookup
{{
plan.destMark
}}
restore_mark
-A
{{
plan.destMark
}}
restore_mark
-A
{{
plan.destMark
}}
{
% endfor %
}
{
% endfor %
}
{
%
for
g
ateway
in
gateways %
}
{
%
for
g
w
in
gateways %
}
restore_mark
-A
{{
g
ateway
.selectionMark
}}
restore_mark
-A
{{
g
w
.selectionMark
}}
{
% endfor %
}
{
% endfor %
}
true
true
src/inventory.ts
View file @
e0f9949b
...
@@ -79,7 +79,7 @@ class InventoryBuilder {
...
@@ -79,7 +79,7 @@ class InventoryBuilder {
restart
:
"
always
"
,
restart
:
"
always
"
,
image
:
"
git-registry.mycard.moe/nanahira/docker-bird
"
,
image
:
"
git-registry.mycard.moe/nanahira/docker-bird
"
,
network_mode
:
"
host
"
,
network_mode
:
"
host
"
,
cap_add
:
[
"
NET_ADMIN
"
],
cap_add
:
[
"
NET_ADMIN
"
,
"
NET_BROADCAST
"
,
"
NET_RAW
"
],
volumes
:
[
"
./bird.conf:/etc/bird/bird.conf:ro
"
]
volumes
:
[
"
./bird.conf:/etc/bird/bird.conf:ro
"
]
}
}
}
}
...
@@ -116,6 +116,7 @@ class InventoryBuilder {
...
@@ -116,6 +116,7 @@ class InventoryBuilder {
return
{
return
{
ansible_ssh_user
:
host
.
user
,
ansible_ssh_user
:
host
.
user
,
ansible_python_interpreter
:
"
python3
"
,
address
:
host
.
address
,
address
:
host
.
address
,
isCN
:
host
.
location
.
startsWith
(
"
CN
"
),
isCN
:
host
.
location
.
startsWith
(
"
CN
"
),
key
:
host
.
wgPrivateKey
,
key
:
host
.
wgPrivateKey
,
...
@@ -172,12 +173,12 @@ class InventoryBuilder {
...
@@ -172,12 +173,12 @@ class InventoryBuilder {
}
}
if
(
frpType
===
"
frpc
"
)
{
if
(
frpType
===
"
frpc
"
)
{
local
.
dockerServices
.
services
[
`frpc
_
${
remote
.
name
}
`
]
=
{
local
.
dockerServices
.
services
[
`frpc
-
${
name
}
`
]
=
{
restart
:
"
always
"
,
restart
:
"
always
"
,
image
:
"
fatedier/frpc:v0.34.2
"
,
image
:
"
fatedier/frpc:v0.34.2
"
,
network_mode
:
"
host
"
,
network_mode
:
"
host
"
,
command
:
"
-c /frpc.ini
"
,
command
:
"
-c /frpc.ini
"
,
volumes
:
[
`./frpc
_
${
remote
.
name
}
.ini:/frpc.ini:ro`
]
volumes
:
[
`./frpc
-
${
name
}
.ini:/frpc.ini:ro`
]
}
}
}
}
...
...
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