sequenceDiagram title: hello autonumber participant B as Browser participant C as Controller participant M as Model participant V as View note left of C: 左note note right of C: 右note note over B, C: 共note B -> C: 实线 activate C C ->> B: 箭头实线 deactivate C %%加号等价于activate M,减号等价于deactivate M C -->+ M: 虚线 M -x+ V: 打叉箭头实线 V --x- M: 打叉箭头虚线 M -->>- C: 箭头虚线 %% 循环 loop 每5分钟 %% Highlight background rect rgba(0, 0, 255, 0.1) V ->> V: 自环 end end loop 每5分钟 B-->>C:汇报 end %% 可选条件 opt 心情好 M-->>V:唱歌 end %% 条件判断 alt Controller没睡 B-->>C:吃宵夜吗 else Model没睡 B-->>M:吃宵夜吗 end %% 并行发送 par Controller to Model C-->>+M:hello? and Controller to View C-->>+V:hello? end %% 并行接收 par Model to Controller M-->>-C:hi! and Model to Controller V-->>-C:hi! end
sequenceDiagram title: hello autonumber participant B as Browser participant C as Controller participant M as Model participant V as View note left of C: 左note note right of C: 右note note over B, C: 共note B -> C: 实线 activate C C ->> B: 箭头实线 deactivate C %%加号等价于activate M,减号等价于deactivate M C -->+ M: 虚线 M -x+ V: 打叉箭头实线 V --x- M: 打叉箭头虚线 M -->>- C: 箭头虚线 %% 循环 loop 每5分钟 %% Highlight background rect rgba(0, 0, 255, 0.1) V ->> V: 自环 end end loop 每5分钟 B-->>C:汇报 end %% 可选条件 opt 心情好 M-->>V:唱歌 end %% 条件判断 alt Controller没睡 B-->>C:吃宵夜吗 else Model没睡 B-->>M:吃宵夜吗 end %% 并行发送 par Controller to Model C-->>+M:hello? and Controller to View C-->>+V:hello? end %% 并行接收 par Model to Controller M-->>-C:hi! and Model to Controller V-->>-C:hi! end
1 2 3 4 5
sequenceDiagram actor Z as 张三 actor L as 李四 Z ->> L: 实线箭头 Z -) L: 实线开放箭头
1 2 3 4 5
sequenceDiagram actor Z as 张三 actor L as 李四 Z ->> L: 实线箭头 Z -) L: 实线开放箭头
甘特图(gantt)
1 2 3 4 5 6 7 8 9
gantt title 研发周期 dateFormat YYYY-MM-DD section 项目 A 项目: A1, 2022-01-01, 30d B 项目: after A1 , 20d section 子任务 子任务1: 2022-01-12 , 12d 子任务2: 24d
1 2 3 4 5 6 7 8 9
gantt title 研发周期 dateFormat YYYY-MM-DD section 项目 A 项目: A1, 2022-01-01, 30d B 项目: after A1 , 20d section 子任务 子任务1: 2022-01-12 , 12d 子任务2: 24d
# zh @ li in ~/li/tmp/hello [15:08:57] $ ls main.c
# zh @ li in ~/li/tmp/hello [15:08:58] $ cat main.c #include <stdio.h> int main(int argv,char **argc) { printf("Hello world\n"); return 0; }
# zh @ li in ~/li/tmp/hello [15:09:04] $ quilt new 0000-add_patched_first_line.patch # 创建一个patch Patch patches/0000-add_patched_first_line.patch is now on top
# zh @ li in ~/li/tmp/hello [15:09:05] $ tree . ├── main.c └── patches └── series
1 directory, 2 files
# zh @ li in ~/li/tmp/hello [15:09:16] $ quilt add main.c # 添加追踪文件 File main.c added to patch patches/0000-add_patched_first_line.patch
# zh @ li in ~/li/tmp/hello [15:09:18] $ quilt edit main.c # 修改代码 File main.c is already in patch patches/0000-add_patched_first_line.patch
# zh @ li in ~/li/tmp/hello [15:09:52] $ quilt diff # 查看代码改动内容 Index: hello/main.c =================================================================== --- hello.orig/main.c +++ hello/main.c @@ -1,5 +1,6 @@ #include <stdio.h> int main(int argv,char **argc) { printf("Hello world\n"); + printf("I am the first patched line\n"); return 0; }
# zh @ li in ~/li/tmp/hello [15:10:03] $ quilt refresh -pab # 把代码改动保存到patch文件 Refreshed patch patches/0000-add_patched_first_line.patch
# zh @ li in ~/li/tmp/hello [15:10:08] $ tree . ├── main.c └── patches ├── 0000-add_patched_first_line.patch └── series
1 directory, 3 files
# zh @ li in ~/li/tmp/hello [15:11:18] $ quilt new 0001-add_patched_second_line.patch # 创建第2个patch(建议先用quilt push -a应用所有已存在的patch,然后再执行这个) Patch patches/0001-add_patched_second_line.patch is now on top
# zh @ li in ~/li/tmp/hello [15:11:49] $ quilt edit main.c File main.c added to patch patches/0001-add_patched_second_line.patch
# zh @ li in ~/li/tmp/hello [15:11:56] $ quilt diff Index: hello/main.c =================================================================== --- hello.orig/main.c +++ hello/main.c @@ -2,5 +2,6 @@ int main(int argv,char **argc) { printf("Hello world\n"); printf("I am the first patched line\n"); + printf("I am the second patched line\n"); return 0; }
# zh @ li in ~/li/tmp/hello [15:12:07] $ quilt refresh -pab Refreshed patch patches/0001-add_patched_second_line.patch
# zh @ li in ~/li/tmp/hello [15:12:09] $ tree . ├── main.c └── patches ├── 0000-add_patched_first_line.patch ├── 0001-add_patched_second_line.patch └── series
1 directory, 4 files
# zh @ li in ~/li/tmp/hello [15:12:15] $ quilt series # 查看全部patch patches/0000-add_patched_first_line.patch patches/0001-add_patched_second_line.patch
# zh @ li in ~/tmp/hello [22:45:26] $ tree . ├── CMakeLists.txt └── subhello └── CMakeLists.txt
1 directory, 2 files
# zh @ li in ~/tmp/hello [22:45:27] $ cat CMakeLists.txt cmake_minimum_required(VERSION 3.9) project(hello VERSION 0.1.2.3 DESCRIPTION "an hello program" LANGUAGES C HOMEPAGE_URL “https://www.hello.com”)
add_subdirectory(subhello)
# zh @ li in ~/tmp/hello [22:45:34] $ cat subhello/CMakeLists.txt cmake_minimum_required(VERSION 3.9) project(subhello VERSION 3.2.1.0 DESCRIPTION "an subhello program" LANGUAGES C HOMEPAGE_URL “https://www.subhello.com”)
hello_DESCRIPTION # PROJECT_DESCRIPTION = an hello program subhello_DESCRIPTION # PROJECT_DESCRIPTION = an subhello program PROJECT_DESCRIPTION # PROJECT_DESCRIPTION = an subhello program CMAKE_PROJECT_DESCRIPTION # CMAKE_PROJECT_DESCRIPTION = an hello program # 顶层
# zh @ li in ~/li/tmp/hello [11:19:03] $ tree . └── CMakeLists.txt
0 directories, 1 file
# zh @ li in ~/li/tmp/hello [11:19:04] $ cat CMakeLists.txt cmake_minimum_required(VERSION 3.9) project(hello VERSION 0.1.2.3 DESCRIPTION "an hello program" LANGUAGES C)
# zh @ li in ~/li/tmp/hello [19:44:41] $ cat CMakeLists.txt cmake_minimum_required(VERSION 3.9) project(hello VERSION 0.1.2.3 DESCRIPTION "an hello program" LANGUAGES C)
FILE(GLOB SRC_FILES "src/*.c")
add_executable(${PROJECT_NAME}${SRC_FILES})
# zh @ li in ~/li/tmp/hello [19:44:43] $ cat src/main.c #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { printf("hello world\n"); return 0; }
# zh @ li in ~/li/tmp/hello [19:44:46] $ mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain_x86.cmake .. -- The C compiler identification is GNU 11.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/zh/li/tmp/hello/build
# zh @ li in ~/li/tmp/hello/build [19:44:53] $ make [ 50%] Building C object CMakeFiles/hello.dir/src/main.c.o [100%] Linking C executable hello [100%] Built target hello
# root @ routerB in / [17:00:36] $ ip r # 查看路由表 20.1.1.0/24 dev eth0 proto kernel scope link src 20.1.1.2 30.1.1.0/24 dev eth1 proto kernel scope link src 30.1.1.1
#routerA and routerC lsmod|grep ip_gre || modprobe ip_gre #ping -c1 ${remoteip} || { echo "make sure the network is ok plz"; exit 1; } ip addr show ${grename} && { echo"${grename} is already exist"; exit 1; }
ip tunnel add ${grename} mode gre remote ${remoteip}local${localip} ikey 1 okey 1 ttl 255; ip addr add ${greip} dev ${grename} peer ${grepeerip}; ip link set${grename} multicast on up; #mtu 1400; # 注意一定要multicast on ip addr show ${grename};
查看gre隧道接口
1 2 3 4 5 6 7 8
# root @ routerA in / [16:53:20] $ ip addr show gre1 7: gre1@NONE: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1472 qdisc noqueue state UNKNOWN group default qlen 1 link/gre 20.1.1.1 peer 30.1.1.2 inet 10.10.10.1 peer 10.10.10.2/32 scope global gre1 valid_lft forever preferred_lft forever inet6 fe80::200:5efe:1401:101/64 scope link valid_lft forever preferred_lft forever
1 2 3 4 5 6 7 8
# root @ routerC in / [16:54:38] $ ip addr show gre1 16: gre1@NONE: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1472 qdisc noqueue state UNKNOWN group default qlen 1 link/gre 30.1.1.2 peer 20.1.1.1 inet 10.10.10.2 peer 10.10.10.1/32 scope global gre1 valid_lft forever preferred_lft forever inet6 fe80::200:5efe:1e01:102/64 scope link valid_lft forever preferred_lft forever
# root @ routerA in / [17:05:10] $ ip r default via 20.1.1.2 dev eth1 10.1.1.0/24 dev eth0 proto kernel scope link src 10.1.1.1 10.2.1.0/24 via 10.10.10.2 dev gre1 proto zebra metric 20 # 这条由zebra生成的就是 10.10.10.2 dev gre1 proto kernel scope link src 10.10.10.1 20.1.1.0/24 dev eth1 proto kernel scope link src 20.1.1.1
1 2 3 4 5 6 7 8
# root @ routerC in / [17:06:24] $ ip r default via 30.1.1.1 dev eth1 10.1.1.0/24 via 10.10.10.1 dev gre1 proto zebra metric 20 # 这条由zebra生成的就是 10.2.1.0/24 dev eth0 proto kernel scope link src 10.2.1.1 10.10.10.1 dev gre1 proto kernel scope link src 10.10.10.2 30.1.1.0/24 dev eth1 proto kernel scope link src 30.1.1.2 192.168.255.0/24 dev eth3 proto kernel scope link src 192.168.255.1
1 2 3 4
# root @ routerB in / [17:00:38] $ ip r # routerB确实没有获取到gre相关路由 20.1.1.0/24 dev eth0 proto kernel scope link src 20.1.1.2 30.1.1.0/24 dev eth1 proto kernel scope link src 30.1.1.1
# By default, all non-loopback multicast capable interfaces are enabled. # If you want to use loopback, set the interface multicast flag on it. -#phyint eth0 disable +phyint eth3 disable# 关闭不想要进行组播的端口
# IGMP default query interval and querier timeout. The latter should # per RFC always be (robustness * interval) + (query-response / 2), for @@ -132,7 +134,7 @@ #group-prefix 224.0.0.0 masklen 4