init
This commit is contained in:
24
libs/client.go
Normal file
24
libs/client.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package libs
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
This host.Host
|
||||
}
|
||||
|
||||
var once sync.Once
|
||||
|
||||
var clientObj *Client
|
||||
|
||||
func InitClient() *Client {
|
||||
once.Do(func() {
|
||||
|
||||
clientObj = &Client{}
|
||||
})
|
||||
|
||||
return clientObj
|
||||
}
|
||||
Reference in New Issue
Block a user