mirror of
https://codeberg.org/tiff/goload.git
synced 2025-01-30 21:49:15 +00:00
35 lines
475 B
Go
35 lines
475 B
Go
package main
|
|
|
|
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)
|
|
|
|
|