Skip to content

Requirements

Xun Gong edited this page Jul 29, 2019 · 12 revisions

only use packages provided by offical-golang

Preparation

go get -u -v github.com/fatih/color

Implement interface in your file

一切以实物(具体代码)为准

  • interface.go (Details can be seen in code)
type dhtNode interface {
    	Get(k string) (bool, string)
	Put(k string, v string) bool
	Del(k string) bool
	Run()
	Create()
	Join(addr string) bool
	Quit()
	Ping(addr string) bool
}

Replace given function with your code

  • userdef.go
func NewNode(port int) dhtNode {
    // your code
}

TODO(never mind): dht-additive