Browse Source

swarm: rename SwarmNet to SimplePss

Signed-off-by: p4u <p4u@dabax.net>
feature/simplePss
p4u 5 years ago
parent
commit
3014931ec2
2 changed files with 9 additions and 9 deletions
  1. +1
    -1
      cmd/pssTest/psstest.go
  2. +8
    -8
      net/swarm/swarm.go

+ 1
- 1
cmd/pssTest/psstest.go

@ -15,7 +15,7 @@ func main() {
return
}
sn := new(swarm.SwarmNet)
sn := new(swarm.SimplePss)
err := sn.Init()
if err != nil {
fmt.Printf("%v\n", err)

+ 8
- 8
net/swarm/swarm.go

@ -125,7 +125,7 @@ type pssSub struct {
Address string
}
type SwarmNet struct {
type SimplePss struct {
Node *node.Node
NodeConfig *node.Config
EnodeID string
@ -139,7 +139,7 @@ type SwarmNet struct {
Ports *swarmPorts
}
func (sn *SwarmNet) SetLog(level string) error {
func (sn *SimplePss) SetLog(level string) error {
// ensure good log formats for terminal
// handle verbosity flag
loglevel, err := log.LvlFromString(level)
@ -153,7 +153,7 @@ func (sn *SwarmNet) SetLog(level string) error {
return nil
}
func (sn *SwarmNet) PrintStats() {
func (sn *SimplePss) PrintStats() {
// statistics thread
go func() {
for {
@ -169,15 +169,15 @@ func (sn *SwarmNet) PrintStats() {
}()
}
func (sn *SwarmNet) SetDatadir(datadir string) {
func (sn *SimplePss) SetDatadir(datadir string) {
sn.Datadir = datadir
}
func (sn *SwarmNet) SetKey(key *ecdsa.PrivateKey) {
func (sn *SimplePss) SetKey(key *ecdsa.PrivateKey) {
sn.Key = key
}
func (sn *SwarmNet) Init() error {
func (sn *SimplePss) Init() error {
var err error
if len(sn.Datadir) < 1 {
usr, err := user.Current()
@ -269,7 +269,7 @@ func strAddress(addr string) pss.PssAddress {
return pssAddress
}
func (sn *SwarmNet) PssSub(subType, key, topic, address string) error {
func (sn *SimplePss) PssSub(subType, key, topic, address string) error {
pssTopic := strTopic(topic)
pssAddress := strAddress(address)
if subType == "sym" {
@ -299,7 +299,7 @@ func (sn *SwarmNet) PssSub(subType, key, topic, address string) error {
return nil
}
func (sn *SwarmNet) PssPub(subType, key, topic, msg, address string) error {
func (sn *SimplePss) PssPub(subType, key, topic, msg, address string) error {
var err error
dstAddr := strAddress(address)
dstTopic := strTopic(topic)

Loading…
Cancel
Save