-
Notifications
You must be signed in to change notification settings - Fork 5
Building a new application
Abhishek Upperwal edited this page Sep 9, 2019
·
1 revision
Below code shows how to create a new application with a bootstrap service.
package main
import (
"context"
"time"
application "github.com/pravahio/go-mesh/application"
bootstrap "github.com/pravahio/go-mesh/service/bootstrap"
)
// BootstrapPeers is a list of IPFS Bootstrap peers
var BootstrapPeers = []string{
"/ip4/127.0.0.1/udp/4000/quic/p2p/QmVbcMycaK8ni5CeiM7JRjBRAdmwky6dQ6KcoxLesZDPk9",
}
func main() {
ctx := context.Background()
app, err := application.NewApplication(ctx, nil, nil, "0.0.0.0", "0", false)
if err != nil {
panic(err)
}
bootstrapSrv := bootstrap.NewBootstrapService(true, "<MEETING_POINT>", BootstrapPeers, 5 * time.Minute)
app.InjectService(bootstrapSrv)
app.Start()
}