goload/main.go

35 lines
475 B
Go
Raw Permalink Normal View History

2025-01-12 20:07:58 -05:00
package main
2024-12-30 00:10:26 -05:00
import (
"fmt"
"net/http"
"net/http/httputil"
"os"
// "strconv"
"sync"
"time"
)
//
// 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)