mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-26 10:13:39 +08:00
90921a9deb
The internal package has the special meaning in go (see https://golang.org/s/go14internal). So rename it to `inner`. Signed-off-by: Tw <tw19881113@gmail.com>
32 lines
620 B
Go
32 lines
620 B
Go
package setup
|
|
|
|
import (
|
|
"github.com/mholt/caddy/middleware"
|
|
"github.com/mholt/caddy/middleware/inner"
|
|
)
|
|
|
|
// Internal configures a new Internal middleware instance.
|
|
func Internal(c *Controller) (middleware.Middleware, error) {
|
|
paths, err := internalParse(c)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return func(next middleware.Handler) middleware.Handler {
|
|
return inner.Internal{Next: next, Paths: paths}
|
|
}, nil
|
|
}
|
|
|
|
func internalParse(c *Controller) ([]string, error) {
|
|
var paths []string
|
|
|
|
for c.Next() {
|
|
if !c.NextArg() {
|
|
return paths, c.ArgErr()
|
|
}
|
|
paths = append(paths, c.Val())
|
|
}
|
|
|
|
return paths, nil
|
|
}
|