mirror of
https://github.com/LBRYFoundation/herald.go.git
synced 2025-08-23 17:47:27 +00:00
cleanup and formatting
This commit is contained in:
parent
fdbd7ec509
commit
4f7d3b20c8
2 changed files with 13 additions and 13 deletions
3
main.go
3
main.go
|
@ -55,7 +55,7 @@ func makeServeCmd(parser *argparse.Parser) *argparse.Command {
|
||||||
|
|
||||||
return serveCmd
|
return serveCmd
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func parseArgs(searchRequest *pb.SearchRequest) *server.Args {
|
func parseArgs(searchRequest *pb.SearchRequest) *server.Args {
|
||||||
|
|
||||||
|
@ -151,7 +151,6 @@ func parseArgs(searchRequest *pb.SearchRequest) *server.Args {
|
||||||
searchRequest.ChannelId = &pb.InvertibleField{Invert: false, Value: *channelIds}
|
searchRequest.ChannelId = &pb.InvertibleField{Invert: false, Value: *channelIds}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
pb "github.com/lbryio/hub/protobuf/go"
|
pb "github.com/lbryio/hub/protobuf/go"
|
||||||
"github.com/olivere/elastic/v7"
|
"github.com/olivere/elastic/v7"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
@ -27,15 +28,15 @@ type Server struct {
|
||||||
|
|
||||||
type FederatedServer struct {
|
type FederatedServer struct {
|
||||||
Address string
|
Address string
|
||||||
Port string
|
Port string
|
||||||
Ts time.Time
|
Ts time.Time
|
||||||
Ping int //?
|
Ping int //?
|
||||||
}
|
}
|
||||||
|
|
||||||
const majorVersion = 0
|
const majorVersion = 0
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ServeCmd = iota
|
ServeCmd = iota
|
||||||
SearchCmd = iota
|
SearchCmd = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,9 +113,9 @@ func MakeHubServer(args *Args) *Server {
|
||||||
}
|
}
|
||||||
self := &FederatedServer{
|
self := &FederatedServer{
|
||||||
Address: "127.0.0.1",
|
Address: "127.0.0.1",
|
||||||
Port: args.Port,
|
Port: args.Port,
|
||||||
Ts: time.Now(),
|
Ts: time.Now(),
|
||||||
Ping: 0,
|
Ping: 0,
|
||||||
}
|
}
|
||||||
servers := make([]*FederatedServer, 10)
|
servers := make([]*FederatedServer, 10)
|
||||||
servers = append(servers, self)
|
servers = append(servers, self)
|
||||||
|
@ -140,9 +141,9 @@ func MakeHubServer(args *Args) *Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) PromethusEndpoint(port string, endpoint string) error {
|
func (s *Server) PromethusEndpoint(port string, endpoint string) error {
|
||||||
http.Handle("/" + endpoint, promhttp.Handler())
|
http.Handle("/"+endpoint, promhttp.Handler())
|
||||||
log.Println(fmt.Sprintf("listening on :%s /%s", port, endpoint))
|
log.Println(fmt.Sprintf("listening on :%s /%s", port, endpoint))
|
||||||
err := http.ListenAndServe(":" + port, nil)
|
err := http.ListenAndServe(":"+port, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue