derohe-proxy/derohe-proxy.go

53 lines
1.0 KiB
Go
Raw Normal View History

2022-05-03 21:08:36 +01:00
package main
import (
"derohe-proxy/proxy"
"fmt"
"net"
"time"
"github.com/docopt/docopt-go"
)
func main() {
var err error
Arguments, err = docopt.Parse(command_line, nil, true, "pre-alpha", false)
if err != nil {
return
}
if Arguments["--listen-address"] != nil {
addr, err := net.ResolveTCPAddr("tcp", Arguments["--listen-address"].(string))
if err != nil {
return
} else {
if addr.Port == 0 {
return
} else {
listen_addr = addr.String()
}
}
}
if Arguments["--daemon-address"] == nil {
return
} else {
daemon_address = Arguments["--daemon-address"].(string)
}
go proxy.Start_server(listen_addr)
2022-05-15 01:15:30 +01:00
// Wait for first miner connection to grab wallet address
2022-05-03 21:08:36 +01:00
for proxy.CountMiners() < 1 {
time.Sleep(time.Second * 1)
}
2022-05-15 01:15:30 +01:00
go proxy.Start_client(daemon_address, proxy.Address)
for {
2022-05-19 23:43:35 +01:00
time.Sleep(time.Minute * 5)
fmt.Printf("%v %4d miners connected\t\tBlocks:%4d\tMiniblocks:%4d\tRejected:%4d\n", time.Now().Format(time.Stamp), proxy.CountMiners(), proxy.Blocks, proxy.Minis, proxy.Rejected)
2022-05-15 01:15:30 +01:00
}
2022-05-03 21:08:36 +01:00
}