modified README file

This commit is contained in:
2022-11-11 23:33:27 +00:00
parent 845c9346f3
commit 00b29c35f5

View File

@@ -6,7 +6,9 @@
- Simulate discovery and file transfer
The following library spawns peernet nodes automatically and runs
each Peernet instance as a go routine.
each Peernet instance as a go routine. The library also
automatically generates root nodes and regular nodes and also
automatically points the regular nodes to root node.
The setup is intended to be as simple as possible.
```
@@ -17,15 +19,39 @@ Run:
./Peernet-test-framework
```
Extend to your Go project (Instructions coming soon)
```
// import Test framework
Extend to your Go project (Sample Program to spawn Peernet nodes based on default settings)
```go
import (
testframework "github.com/PeernetOfficial/Peernet-test-framework"
"github.com/gorilla/mux"
)
// Control config through function calls
func main() {
// Generate network and return Configs as a list
r := mux.NewRouter()
// Manipulate each Peernet instance -> Reference WebAPI
(Using as a pointers as they can be updated)
// -> Soon replaced as abstractions
// Get Config information
config, err := testframework.ConfigInit()
if err != nil {
fmt.Println(err)
}
srv := &http.Server{
Handler: r,
Addr: config.MainServerAddress,
// Good practice: enforce timeouts for servers you create!
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
manager, err := config.RunManager()
if err != nil {
fmt.Println(err)
}
fmt.Println(len(*manager))
// Lister for the main server
log.Fatal(srv.ListenAndServe())
}
```