-
Notifications
You must be signed in to change notification settings - Fork 211
/
p2p.go
20 lines (16 loc) · 941 Bytes
/
p2p.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Package p2p provides a networking api for creating p2p protocols by enabling sending direct messages to
// a set of provided neighbors or broadcasting a message to all of them. the discovery, connectivity and encryption is
// completely transparent to consumers. NOTE: gossip protocols must take care of their own message validation.
package p2p
import (
"context"
"github.com/spacemeshos/go-spacemesh/log"
"github.com/spacemeshos/go-spacemesh/p2p/config"
"github.com/spacemeshos/go-spacemesh/p2p/service"
)
// Service is a wrapper for service.Service to expose the Service interface to `p2p` package clients
type Service service.Service
// New creates a new P2P service a.k.a `Switch` it loads existing node information from the disk or creates a new one.
func New(ctx context.Context, config config.Config, logger log.Log, path string) (*Switch, error) {
return newSwarm(ctx, config, logger, path) // TODO: add persist param
}