|
|
@ -17,7 +17,6 @@ type server struct {
|
|
|
|
cert string
|
|
|
|
cert string
|
|
|
|
key string
|
|
|
|
key string
|
|
|
|
upstreams []*url.URL
|
|
|
|
upstreams []*url.URL
|
|
|
|
bootstrap []*url.URL
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (srv *server) serve() {
|
|
|
|
func (srv *server) serve() {
|
|
|
@ -134,7 +133,7 @@ func (srv *server) serveHTTP() {
|
|
|
|
|
|
|
|
|
|
|
|
func makeServers(c *conf) {
|
|
|
|
func makeServers(c *conf) {
|
|
|
|
upstreams := []*url.URL{}
|
|
|
|
upstreams := []*url.URL{}
|
|
|
|
bootstraps := []*url.URL{}
|
|
|
|
|
|
|
|
for _, a := range c.UpstreamServers {
|
|
|
|
for _, a := range c.UpstreamServers {
|
|
|
|
u, err := url.Parse(a)
|
|
|
|
u, err := url.Parse(a)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -143,14 +142,6 @@ func makeServers(c *conf) {
|
|
|
|
upstreams = append(upstreams, u)
|
|
|
|
upstreams = append(upstreams, u)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, a := range c.BootstrapServers {
|
|
|
|
|
|
|
|
u, err := url.Parse(a)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bootstraps = append(bootstraps, u)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, l := range c.Listen {
|
|
|
|
for _, l := range c.Listen {
|
|
|
|
u, err := url.Parse(l.Addr)
|
|
|
|
u, err := url.Parse(l.Addr)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -161,7 +152,6 @@ func makeServers(c *conf) {
|
|
|
|
cert: l.Cert,
|
|
|
|
cert: l.Cert,
|
|
|
|
key: l.Key,
|
|
|
|
key: l.Key,
|
|
|
|
upstreams: upstreams,
|
|
|
|
upstreams: upstreams,
|
|
|
|
bootstrap: bootstraps,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
go srv.serve()
|
|
|
|
go srv.serve()
|
|
|
|
}
|
|
|
|
}
|
|
|
|