k8s.io/apiserver@v0.31.1/pkg/util/proxy/doc.go (about)

     1  /*
     2  Copyright 2024 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Among other files, this directory contains functionality for two
    18  // stream proxies: streamtranslator.go and streamtunnel.go. Both of
    19  // these proxies allow the inter-connection of WebSocket and SPDY
    20  // streaming connections.
    21  //
    22  // The stream translator proxy is used for the RemoteCommand
    23  // subprotocol (e.g. kubectl exec, cp, and attach), and it connects
    24  // the output streams of a WebSocket connection (e.g. STDIN, STDOUT,
    25  // STDERR, TTY resize, and error streams) to the input streams of a
    26  // SPDY connection.
    27  //
    28  // The stream tunnel proxy tunnels SPDY frames through a WebSocket
    29  // connection, and it is used for the PortForward subprotocol (e.g.
    30  // kubectl port-forward). This proxy implements tunneling by transparently
    31  // encoding and decoding SPDY framed data into and out of the payload of a
    32  // WebSocket data frame. The primary structure for this tunneling is
    33  // the TunnelingConnection. A lot of the other code in streamtunnel.go
    34  // is for properly upgrading both the upstream SPDY connection and the
    35  // downstream WebSocket connection before streaming begins.
    36  package proxy // import "k8s.io/apiserver/pkg/util/proxy"