diff --git a/router.go b/router.go index 8cd913a..e5f54b1 100644 --- a/router.go +++ b/router.go @@ -12,8 +12,8 @@ type Router struct { } // HostRouter associates a host with a mux.Router. -type HostRouter struct { - Host string +type DomainRouter struct { + Domain string *mux.Router } @@ -24,15 +24,15 @@ func NewRouter() *Router { return r } -func (r *HostRouter) Handler(handler http.Handler) *mux.Route { +func (r *DomainRouter) Handler(handler http.Handler) *mux.Route { return r.Router.NewRoute().Handler(handler) } -// NewHostRouter creates a new HostRouter for a specific host. -func (r *Router) NewHostRouter(host string) *HostRouter { - hostRouter := r.NewRoute().Host(host).Subrouter() - return &HostRouter{ - Host: host, - Router: hostRouter, +// NewDomainRouter creates a new DomainRouter for a specific host. +func (r *Router) NewDomainRouter(domain string) *DomainRouter { + domainRouter := r.NewRoute().Host(domain).Subrouter() + return &DomainRouter{ + Domain: domain, + Router: domainRouter, } }