-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/ft: add method 'seednodes' into sub-cmd 'p2p' (#497)
* cmd/ft: add method 'seednodes' into sub-cmd 'p2p' * cmd/ftfinder: add seednodes rpc
- Loading branch information
1 parent
f2d694c
commit aed8b8a
Showing
6 changed files
with
178 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/fractalplatform/fractal/p2p/enode" | ||
) | ||
|
||
type Backend interface { | ||
SeedNodes() []*enode.Node | ||
} | ||
|
||
type FinderRPC struct { | ||
b Backend | ||
} | ||
|
||
// SeedNodes returns all seed nodes. | ||
func (fr *FinderRPC) SeedNodes() []string { | ||
nodes := fr.b.SeedNodes() | ||
ns := make([]string, len(nodes)) | ||
for i, node := range nodes { | ||
ns[i] = node.String() | ||
} | ||
return ns | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters