git clone https://github.com/iotaledger/goshimmer
cd goshimmer/
go build -o shimmer
./shimmer -node-disable-plugins statusscreen -node-enable-plugins "dashboard"
tcp 0 0 0.0.0.0:14626 0.0.0.0:* LISTEN 6093/shimmer
tcp 0 0 0.0.0.0:14666 0.0.0.0:* LISTEN 6093/shimmer
tcp6 0 0 :::8080 :::* LISTEN 6093/shimmer
tcp6 0 0 :::8081 :::* LISTEN 6093/shimmer
[Unit]
Description=Goshimmer FullNode
After=network-online.target
[Service]
WorkingDirectory=/{hide}/goshimmer
EnvironmentFile=-/{hide}
ExecStart=/{hide}/shimmer -node-disable-plugins statusscreen
KillMode=process
Type=simple
User={hide}
Group={hide}
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier={hide}
[Install]
WantedBy=multi-user.target
func main() {
node.Run(
cli.PLUGIN,
autopeering.PLUGIN,
gossip.PLUGIN,
gossip_on_solidification.PLUGIN,
tangle.PLUGIN,
bundleprocessor.PLUGIN,
analysis.PLUGIN,
gracefulshutdown.PLUGIN,
tipselection.PLUGIN,
zeromq.PLUGIN,
dashboard.PLUGIN,
metrics.PLUGIN,
statusscreen.PLUGIN,
statusscreen_tps.PLUGIN,
webapi.PLUGIN,
webapi_gtta.PLUGIN,
webapi_spammer.PLUGIN,
)
}
在 [node] package , 有兩處要注意
func Run(plugins ...*Plugin) *Node {
node := New(plugins...)
node.Run()
return node
}
執行順序是 Run -> New -> configure -> 每個插件的 run 函數
configure會初始化全部插件的初始化
另外無法理解 node.Run() , node的結構似乎沒有run函數
// Creates a new plugin with the given name, default status and callbacks.
// The last specified callback is the mandatory run callback, while all other callbacks are configure callbacks.
func NewPlugin(name string, status int, callback Callback, callbacks ...Callback) *Plugin {
plugin := &Plugin{
Name: name,
Status: status,
Events: pluginEvents{
Configure: events.NewEvent(pluginCaller),
Run: events.NewEvent(pluginCaller),
},
}
// make the plugin known to the parameters
parameter.AddPlugin(name, status)
if len(callbacks) >= 1 {
plugin.Events.Configure.Attach(events.NewClosure(callback))
for _, callback = range callbacks[:len(callbacks)-1] {
plugin.Events.Configure.Attach(events.NewClosure(callback))
}
plugin.Events.Run.Attach(events.NewClosure(callbacks[len(callbacks)-1]))
} else {
plugin.Events.Run.Attach(events.NewClosure(callback))
}
return plugin
}
每個packages或plugin , 都會有plugin.go
裡面都有 configure 與 run 函數 , configure用來初始化packages或plugin ; run用來註冊event對應的callback函數 , 或對 daemon 的backgroundWorker 註冊 callback函數
並透過NewPlugin在main.go去執行configure與run , configure先 , run後(Main.go 的 PLUGIN是個變數 , 在 plugin.go 中由NewPlugin賦值)
從以上可以得知 , 要trace某個package和plugin , 先去看對應目錄下的plugin.go
func configure(plugin *node.Plugin) {
saltmanager.Configure(plugin)
instances.Configure(plugin)
server.Configure(plugin)
protocol.Configure(plugin)
peerstorage.Configure(plugin)
daemon.Events.Shutdown.Attach(events.NewClosure(func() {
server.Shutdown(plugin)
}))
configureLogging(plugin)
}
func run(plugin *node.Plugin) {
instances.Run(plugin)
server.Run(plugin)
protocol.Run(plugin)
}
According the chapter 4.2 Choosing neighbors
of coordecide whitepaper, neighbor can be divided into Chosen neighbors and Accepted Neighbors the definition as below:
Chosen neighbors. The neighbors that the node proactively choose from
his list.
Accepted Neighbors. The neighbors that choose the node as their peer.
Accept neighbors:
Chosen neighbors:
Gossip duration
EntryNode
Private Tangle
EntryNode
from A, Bor
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing