goload/main.go
2025-01-12 20:02:17 -05:00

37 lines
517 B
Go

package server
import (
"fmt"
"net/http"
"net/http/httputil"
"os"
// "strconv"
"sync"
"time"
_ "github.com/joho/godotenv/autoload"
)
//
// type Server struct {
// port int
// }
//
type Backend struct {
URL *url.URL
Alive bool
mux sync.RWMutex
ReverseProxy *httputil.ReverseProxy
}
type SeverPool struct {
backends []*Backend
current uint64
}
u, _ := url.Parse("http://localhost:8080")
rp := httputil.NewSingleHostReverseProxy(u)
http.HandlerFunc(rp.ServeHTTP)