mirror of
https://github.com/caddyserver/caddy.git
synced 2026-10-09 07:30:02 +00:00
Bringing in latest from master; refactoring under way
This commit is contained in:
parent
5f32f9b1c8
commit
995edf0566
26 changed files with 171 additions and 2428 deletions
|
|
@ -13,7 +13,6 @@ import (
|
|||
"os/signal"
|
||||
|
||||
"github.com/bradfitz/http2"
|
||||
"github.com/mholt/caddy/config"
|
||||
)
|
||||
|
||||
// Server represents an instance of a server, which serves
|
||||
|
|
@ -28,7 +27,7 @@ type Server struct {
|
|||
// New creates a new Server which will bind to addr and serve
|
||||
// the sites/hosts configured in configs. This function does
|
||||
// not start serving.
|
||||
func New(addr string, configs []config.Config, tls bool) (*Server, error) {
|
||||
func New(addr string, configs []Config, tls bool) (*Server, error) {
|
||||
s := &Server{
|
||||
address: addr,
|
||||
tls: tls,
|
||||
|
|
@ -93,7 +92,7 @@ func (s *Server) Serve() error {
|
|||
}
|
||||
|
||||
if s.tls {
|
||||
var tlsConfigs []config.TLSConfig
|
||||
var tlsConfigs []TLSConfig
|
||||
for _, vh := range s.vhosts {
|
||||
tlsConfigs = append(tlsConfigs, vh.config.TLS)
|
||||
}
|
||||
|
|
@ -107,7 +106,7 @@ func (s *Server) Serve() error {
|
|||
// multiple sites (different hostnames) to be served from the same address. This method is
|
||||
// adapted directly from the std lib's net/http ListenAndServeTLS function, which was
|
||||
// written by the Go Authors. It has been modified to support multiple certificate/key pairs.
|
||||
func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []config.TLSConfig) error {
|
||||
func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []TLSConfig) error {
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
addr = ":https"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package server
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/mholt/caddy/config"
|
||||
"github.com/mholt/caddy/middleware"
|
||||
)
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ import (
|
|||
// multiple sites on a single address, and this is what a
|
||||
// virtualHost allows us to do.
|
||||
type virtualHost struct {
|
||||
config config.Config
|
||||
config Config
|
||||
fileServer middleware.Handler
|
||||
stack middleware.Handler
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue