mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-29 20:24:11 +08:00
31 lines
486 B
Go
31 lines
486 B
Go
|
package push
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/mholt/caddy/caddyhttp/httpserver"
|
||
|
)
|
||
|
|
||
|
type (
|
||
|
// Rule describes conditions on which resources will be pushed
|
||
|
Rule struct {
|
||
|
Path string
|
||
|
Resources []Resource
|
||
|
}
|
||
|
|
||
|
// Resource describes resource to be pushed
|
||
|
Resource struct {
|
||
|
Path string
|
||
|
Method string
|
||
|
Header http.Header
|
||
|
}
|
||
|
|
||
|
// Middleware supports pushing resources to clients
|
||
|
Middleware struct {
|
||
|
Next httpserver.Handler
|
||
|
Rules []Rule
|
||
|
}
|
||
|
|
||
|
ruleOp func([]Resource)
|
||
|
)
|