Skip to content

Commit

Permalink
Merge pull request #145 from ipfs-force-community/docs/elvindu/add-de…
Browse files Browse the repository at this point in the history
…scription-for-config

update config description / 更新config注释
  • Loading branch information
Fatman13 committed Jul 17, 2023
2 parents ae3dbe4 + 3e403b3 commit 24b931a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 7 deletions.
42 changes: 42 additions & 0 deletions docs/zh/config-desc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 配置文件解析

默认在~/.sophon-gateway/config.toml。

```toml
[API]
ListenAddress = "/ip4/127.0.0.1/tcp/45132" # 本地组件wallet和damocles-manager通过长连接和gateway保持通信

[Auth]
Token = ""
URL = "http://127.0.0.1:8989"

[Metrics]
Enabled = false

[Metrics.Exporter]
Type = "prometheus" # 两种类型,Graphite或者Prometheus

[Metrics.Exporter.Graphite]
Host = "127.0.0.1"
Namespace = "gateway"
Port = 4569
ReportingPeriod = "10s"

[Metrics.Exporter.Prometheus]
EndPoint = "/ip4/0.0.0.0/tcp/4569"
Namespace = "gateway"
Path = "/debug/metrics"
RegistryType = "define"
ReportingPeriod = "10s"

[RateLimit]
#redis地址,用于记录用户访问的次数。如果要开启对某个user的访问限速,还需要`auth` 服务同时设置`sophon-auth user rate-limit`命令。
Redis = "27.0.0.1:6379"

[Trace]
JaegerEndpoint = "localhost:6831"
JaegerTracingEnabled = false
ProbabilitySampler = 1.0
ServerName = "sophon-gateway"

```
5 changes: 0 additions & 5 deletions docs/zh/快速启用.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,3 @@ t02082
./sophon-gateway wallet <wallet-account>
```

### 验证钱包地址是否真实存在

1. gateway 每次启动会生成一个随机的字符串(gateway_string)
2. 钱包注册时携带一个随机字符串(wallet_string)给到 gateway
3. gateway 逐个验证钱包注册的地址:gateway 会调用`sign`接口,签名的数据是 hash(gateway_string+wallet_string)后的新的字符串,并通过 `MsgMeta.Extra``gateway_string` 携带给钱包,最后gateway验证钱包签名后的结果
14 changes: 12 additions & 2 deletions docs/zh/组件设计.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gateway在孵化器中,其作用是桥接孵化器中其它组件的相互调用

1. 与消息生产者交互(包括sophon-miner,sophon-messager)

2. 与消息消费者交互(包括venus-wallet, venus-cluster)
2. 与消息消费者交互(包括venus-wallet, damocles)



Expand All @@ -58,7 +58,7 @@ gateway在孵化器中,其作用是桥接孵化器中其它组件的相互调用

​Gateway与消息消费者的交互的详细内容可以在[venus-wallet-系统设计](https://github.com/filecoin-project/venus-docs/blob/master/docs/zh/advanced/venus-wallet-architecture.md)中有详细的介绍, 这里不在赘述。特别说明的是:

- venus-cluster消费的消息是`ComputeProof`计算`WinningPoSt`证明数据。
- damocles消费的消息是`ComputeProof`计算`WinningPoSt`证明数据。

- venus体系中的账号管理是通过sophon-auth管理的,账号就是消息生产者和消费者之间的桥梁。sophon-gateway从sophon-auth获取对应 `miner``signer` 的账号,然后从维持的消费者列表中找到对应的消费者(`venus-wallet``venus-cluster`)处理消息。消费者在启动时将自身账号信息注册到 `sophon-gateway`

Expand Down Expand Up @@ -109,6 +109,16 @@ type IProofEvent interface {

对于安全性这一部分更多的信息可以参考:[sophon-auth]()

##### 验证钱包地址是否真实存在

wallet和gateway连接后,gateway会通过wallet的 `WalletList` rpc接口获取wallet的所有address,然后通过如下方法检查wallet是否真的具有address相对应的私钥。

1. gateway 每次启动会生成一个随机的字符串(gateway_string)
2. 钱包注册时携带一个随机字符串(wallet_string)给到 gateway
3. gateway 逐个验证钱包注册的地址:gateway 会调用`sign`接口,签名的数据是 hash(gateway_string+wallet_string)后的新的字符串,并通过 `MsgMeta.Extra``gateway_string` 携带给钱包,最后gateway验证钱包签名后的结果

验证过后,会把address信息调用auth的 `RegisterSigners` rpc方法,把address发送到`auth`服务,并记录起来。
address对应的user是`sophon-gateway`配置文件中的`token`对应的user和配置文件中`SupportAccounts`用户。

#### 总结

Expand Down

0 comments on commit 24b931a

Please sign in to comment.