package proxy
import "k8s.io/kubectl/pkg/proxy"
Index ¶
- Constants
- func MakeRegexpArray(str string) ([]*regexp.Regexp, error)
- func MakeRegexpArrayOrDie(str string) []*regexp.Regexp
- func NewProxyHandler(apiProxyPrefix string, filter *FilterServer, cfg *rest.Config, keepalive time.Duration, appendLocationPath bool) (http.Handler, error)
- type FilterServer
- func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer
- func (f *FilterServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- type Server
- func NewServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *rest.Config, keepalive time.Duration, appendLocationPath bool) (*Server, error)
- func (s *Server) Listen(address string, port int) (net.Listener, error)
- func (s *Server) ListenUnix(path string) (net.Listener, error)
- func (s *Server) ServeOnListener(l net.Listener) error
Constants ¶
const ( // DefaultHostAcceptRE is the default value for which hosts to accept. DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$" // DefaultPathAcceptRE is the default path to accept. DefaultPathAcceptRE = "^.*" // DefaultPathRejectRE is the default set of paths to reject. DefaultPathRejectRE = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach" // DefaultMethodRejectRE is the set of HTTP methods to reject by default. DefaultMethodRejectRE = "^$" )
Functions ¶
func MakeRegexpArray ¶
MakeRegexpArray splits a comma separated list of regexps into an array of Regexp objects.
func MakeRegexpArrayOrDie ¶
MakeRegexpArrayOrDie creates an array of regular expression objects from a string or exits.
func NewProxyHandler ¶
func NewProxyHandler(apiProxyPrefix string, filter *FilterServer, cfg *rest.Config, keepalive time.Duration, appendLocationPath bool) (http.Handler, error)
NewProxyHandler creates an api proxy handler for the cluster
Types ¶
type FilterServer ¶
type FilterServer struct { // Only paths that match this regexp will be accepted AcceptPaths []*regexp.Regexp // Paths that match this regexp will be rejected, even if they match the above RejectPaths []*regexp.Regexp // Hosts are required to match this list of regexp AcceptHosts []*regexp.Regexp // Methods that match this regexp are rejected RejectMethods []*regexp.Regexp // contains filtered or unexported fields }
FilterServer rejects requests which don't match one of the specified regular expressions
func (*FilterServer) HandlerFor ¶
func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer
HandlerFor makes a shallow copy of f which passes its requests along to the new delegate.
func (*FilterServer) ServeHTTP ¶
func (f *FilterServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a http.Handler which proxies Kubernetes APIs to remote API server.
func NewServer ¶
func NewServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *rest.Config, keepalive time.Duration, appendLocationPath bool) (*Server, error)
NewServer creates and installs a new Server. 'filter', if non-nil, protects requests to the api only.
func (*Server) Listen ¶
Listen is a simple wrapper around net.Listen.
func (*Server) ListenUnix ¶
ListenUnix does net.Listen for a unix socket
func (*Server) ServeOnListener ¶
ServeOnListener starts the server using given listener, loops forever.
Source Files ¶
proxy_server.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 1 month ago –
Tools for package owners.