added scripts
This commit is contained in:
parent
42d9c3125f
commit
39643f6466
@ -19,6 +19,11 @@ rsa = "0.9.6"
|
|||||||
serde = { version = "1.0.196", features = ["derive"] }
|
serde = { version = "1.0.196", features = ["derive"] }
|
||||||
serde_json = "1.0.113"
|
serde_json = "1.0.113"
|
||||||
serde_repr = "0.1.18"
|
serde_repr = "0.1.18"
|
||||||
|
sqlx = { version = "0.7.3", features = [
|
||||||
|
"sqlx-sqlite",
|
||||||
|
"sqlite",
|
||||||
|
"runtime-tokio",
|
||||||
|
] }
|
||||||
structopt = "0.3.26"
|
structopt = "0.3.26"
|
||||||
tokio = { version = "1.36.0", features = ["full"] }
|
tokio = { version = "1.36.0", features = ["full"] }
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
|
|||||||
@ -2,3 +2,4 @@
|
|||||||
rust版本的sdlan。
|
rust版本的sdlan。
|
||||||
|
|
||||||
* [protocol](./docs/protocol.md)
|
* [protocol](./docs/protocol.md)
|
||||||
|
* [design](./docs/design.md)
|
||||||
17
docs/design.md
Normal file
17
docs/design.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# sdlan-sn设计
|
||||||
|
服务端为单体应用,多个服务端可以同时启动,后面的服务端启动时,可以指定`--fedration x.x.x.x:7655,y.y.y.y:7656`命令行参数来指定其他的服务端,服务端将其他服务端的信息保存在`fedration`这个network里面。
|
||||||
|
|
||||||
|
比如有如下的结构:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
A[服务端1]
|
||||||
|
B[服务端2]
|
||||||
|
C[节点1]
|
||||||
|
D[节点2]
|
||||||
|
A .- B
|
||||||
|
A --- C
|
||||||
|
B --- D
|
||||||
|
```
|
||||||
|
|
||||||
|
服务端1和服务端2通过udp连接,现在分别有个节点连接到对应的服务端,
|
||||||
11
scripts/mysql.md
Normal file
11
scripts/mysql.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# mysql操作记录
|
||||||
|
```shell
|
||||||
|
# 添加用户
|
||||||
|
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
|
||||||
|
|
||||||
|
# 授权
|
||||||
|
GRANT ALL PRIVILEGES ON db.* TO 'username'@'host';
|
||||||
|
|
||||||
|
# 刷新权限
|
||||||
|
FLUSH ALL PRIVILEGES;
|
||||||
|
```
|
||||||
@ -36,7 +36,7 @@ pub struct SuperNode {
|
|||||||
pub daemon: bool,
|
pub daemon: bool,
|
||||||
|
|
||||||
// 本地监听的udp端口号
|
// 本地监听的udp端口号
|
||||||
pub local_port: i16,
|
pub local_port: u16,
|
||||||
|
|
||||||
// 该SuperNode包含的所有的网络
|
// 该SuperNode包含的所有的网络
|
||||||
// 在云端创建或者删除网络的时候,需要通知sn修改这个网络信息
|
// 在云端创建或者删除网络的时候,需要通知sn修改这个网络信息
|
||||||
@ -61,7 +61,7 @@ pub struct SuperNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SuperNode {
|
impl SuperNode {
|
||||||
pub fn new(sock: UdpSocket) -> Self {
|
pub fn new(sock: UdpSocket, localport: u16) -> Self {
|
||||||
let now = SystemTime::now();
|
let now = SystemTime::now();
|
||||||
println!("now: {:?}", now);
|
println!("now: {:?}", now);
|
||||||
let start_time = now
|
let start_time = now
|
||||||
@ -80,7 +80,7 @@ impl SuperNode {
|
|||||||
Self {
|
Self {
|
||||||
start_time,
|
start_time,
|
||||||
daemon: false,
|
daemon: false,
|
||||||
local_port: 7655,
|
local_port: localport,
|
||||||
networks: MyDashMap::new(),
|
networks: MyDashMap::new(),
|
||||||
fedration: Network::new("*fedration", gen_uuid(), true, 0, 0),
|
fedration: Network::new("*fedration", gen_uuid(), true, 0, 0),
|
||||||
pending: Network::new("*pending", gen_uuid(), false, 0, 0),
|
pending: Network::new("*pending", gen_uuid(), false, 0, 0),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user