Skip to content

Commit

Permalink
add type desc
Browse files Browse the repository at this point in the history
  • Loading branch information
printfcoder committed Oct 11, 2020
1 parent 792dd4f commit 2137d1c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

P2P communication lib in Go and based on IPFS. It supports Sub/Pub msg and file.

Why I create this?
Why we create this?

We need to build a world without AI, BigData. Human in this world respect each other's private info. No man analyze our data in the place we don't know.
We need to build a world without AI, BigData. Human in this world should respect each other's private info. No man analyzes our data in the place we don't know.

No one can pry into our personal life and trace any private things.

So now you know, I hate the big companies hold all data of ours.
So now you know, We hate the big companies hold all data of ours.

## Structure

Expand All @@ -30,7 +30,21 @@ Inspired by Go-Micro and Orbit-db.

### Node

Node is the smallest indivisible unit for exchanging data in Peers. It includes `Transport`, `Broker`, `Store`, `Registry` for the outside and `Config`, `Logger` for the inside.
Node is the smallest indivisible unit for exchanging data in peers-net. It includes `Transport`, `Broker`, `Store`, `Registry` for the outside and `Config`, `Logger` for the inside.

See architecture as below:

[todo]

#### Types of Node

- Relay Node: Gateway, nodes in public network logically. Helps other types nodes communicate within the bad network.

- Terminal Node: Users' nodes.

- Registry Node: Registry Center. Helps nodes look for others. 'Center' doesn't mean this kind of node is necessary. We use this for easy discovery.

Types can be init at one node which means a node could have tree types. Those types run in one or multi-process.

# 中文

Expand All @@ -40,8 +54,8 @@ Node is the smallest indivisible unit for exchanging data in Peers. It includes

- 节点类型
- 中继节点:网关,公网节点,用于NAT节点之间的通信中继,不干涉与不猜测消息内容,透明但有条件(如安全、验证等)过桥传输
- 注册节点:公网节点,用于NAT节点的与中继节点的注册
- 终端节点:不限网络的节点,数据的来源与最终去向
- 注册节点:公网节点,用于NAT节点中继节点的注册

部分参考Go-Micro及Orbit-db的设计

8 changes: 6 additions & 2 deletions node/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import (
)

const (
TypeEnd Type = iota + 1
TypeRegistry
TypeEnd = 1
TypeRegistry = iota * 2
TypeRelaying
)

const (
TypeAll = TypeEnd + TypeRegistry + TypeRelaying
)

var (
TypeDefault = TypeEnd
)

Expand Down

0 comments on commit 2137d1c

Please sign in to comment.