Skip to content

Commit

Permalink
rename to forwarder
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimShtein committed Mar 22, 2022
1 parent de436d9 commit d7e9346
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# vendor/

# Binary
ygg-poster-worker
ygg-forwarder-worker
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# ygg-poster-worker
A worker for yggdrasil daemon that forwards requests as simple POST
# ygg-forwarder-worker
A worker for yggdrasil daemon that forwards requests as simple POST
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/shimshtein/ygg-poster-worker
module github.com/shimshtein/ygg-forwarder-worker

go 1.17

Expand Down
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ func main() {
log.Fatal("Missing YGG_SOCKET_ADDR environment variable")
}

yggdHandler, ok = os.LookupEnv("YGG_POSTER_HANDLER")
yggdHandler, ok = os.LookupEnv("YGG_FORWARDER_HANDLER")
if !ok {
log.Fatal("Missing YGG_POSTER_HANDLER environment variable")
log.Fatal("Missing YGG_FORWARDER_HANDLER environment variable")
}

postUrl, ok := os.LookupEnv("YGG_POSTER_URL")
postUrl, ok := os.LookupEnv("YGG_FORWARDER_URL")
if !ok {
log.Fatal("Missing YGG_POSTER_URL environment variable")
log.Fatal("Missing YGG_FORWARDER_URL environment variable")
}

postUser, ok := os.LookupEnv("YGG_POSTER_USER")
postUser, ok := os.LookupEnv("YGG_FORWARDER_USER")
if !ok {
log.Fatal("Missing YGG_POSTER_USER environment variable")
log.Fatal("Missing YGG_FORWARDER_USER environment variable")
}

postPassword, ok := os.LookupEnv("YGG_POSTER_PASSWORD")
postPassword, ok := os.LookupEnv("YGG_FORWARDER_PASSWORD")
if !ok {
log.Fatal("Missing YGG_POSTER_PASSWORD environment variable")
log.Fatal("Missing YGG_FORWARDER_PASSWORD environment variable")
}

// Dial the dispatcher on its well-known address.
Expand Down Expand Up @@ -72,7 +72,7 @@ func main() {

// Register as a Worker service with gRPC and start accepting connections.
s := grpc.NewServer()
pb.RegisterWorkerServer(s, &posterServer{Url: postUrl, Username: postUser, Password: postPassword})
pb.RegisterWorkerServer(s, &forwarderServer{Url: postUrl, Username: postUser, Password: postPassword})
if err := s.Serve(l); err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"google.golang.org/grpc"
)

// posterServer implements the Worker gRPC service as defined by the yggdrasil
// forwarderServer implements the Worker gRPC service as defined by the yggdrasil
// gRPC protocol. It accepts Assignment messages, unmarshals the data into a
// string, and echoes the content back to the Dispatch service by calling the
// "Finish" method.
type posterServer struct {
type forwarderServer struct {
pb.UnimplementedWorkerServer
Url string
Username string
Expand All @@ -31,7 +31,7 @@ type httpMessage struct {
}

// Send implements the "Send" method of the Worker gRPC service.
func (s *posterServer) Send(ctx context.Context, d *pb.Data) (*pb.Receipt, error) {
func (s *forwarderServer) Send(ctx context.Context, d *pb.Data) (*pb.Receipt, error) {
go func() {
log.Tracef("received data: %#v", d)

Expand Down

0 comments on commit d7e9346

Please sign in to comment.