Skip to content

Commit

Permalink
modify: use node port from arg url
Browse files Browse the repository at this point in the history
  • Loading branch information
anniemon committed Aug 19, 2024
1 parent 990f9e4 commit 249f2a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"math/rand"
"net/http"
"net/url"
"strings"
)

func startBackendServer(id int, targetURL string) {
Expand All @@ -27,7 +28,7 @@ func startBackendServer(id int, targetURL string) {
w.WriteHeader(http.StatusOK)
})
server := &http.Server{
Addr: fmt.Sprintf(":%d", 8080+id),
Addr: fmt.Sprintf(":%s", strings.Split(targetURL, ":")[2]),
Handler: mux,
}
log.Printf("Starting node %d on port %d", id, 8080+id)
Expand Down
Binary file modified goLoadBalancer
Binary file not shown.

0 comments on commit 249f2a4

Please sign in to comment.