2019-05-14 14:48:31 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2019-05-17 03:57:41 +00:00
|
|
|
var lpt []peer
|
2019-05-14 14:48:31 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
if len(os.Args) <= 1 {
|
|
|
|
fmt.Fprintf(os.Stderr, "Usage: %s <local node port> <remote node port>\n", os.Args[0])
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configure this local node's listening port.
|
2019-05-17 03:57:41 +00:00
|
|
|
local := peer{}
|
2019-05-14 14:48:31 +00:00
|
|
|
local.SetAddr(os.Args[1])
|
|
|
|
|
|
|
|
// If a remote peer's port is specified, we want to connect and message it
|
|
|
|
if len(os.Args) == 3 {
|
2019-05-17 03:57:41 +00:00
|
|
|
remote := peer{}
|
2019-05-14 14:48:31 +00:00
|
|
|
remote.SetAddr(os.Args[2])
|
|
|
|
local.Connect(remote)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local.StartListening()
|
|
|
|
}
|