tcp

package
v1.78.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright 2026 Flant JSC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package tcp serves the API over a TCP address. The deckhouse pod runs with hostNetwork, so the listener lives in the node's network namespace: every process on the node and every hostNetwork pod reaches it, and so does `kubectl port-forward`. Loopback is not a trust boundary here — secret-bearing endpoints must not be registered on this transport.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPort = errors.New("no port configured")

ErrNoPort is returned when the server is started without a port.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves the given handler on its TCP address.

func NewServer

func NewServer(address, port string, handler http.Handler, logger *log.Logger) *Server

NewServer creates a server for the given address and port. An empty address binds every interface, which publishes the routes cluster-wide. Nothing is bound until Start.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown stops serving and closes the listener. Safe to call when Start was never reached, which happens when the other transport failed to bind.

func (*Server) Start

func (s *Server) Start() error

Start binds the address and serves the handler on it.

An empty port is refused rather than passed to net.Listen, which would bind an arbitrary free port on every interface.

func (*Server) Wait

func (s *Server) Wait() error

Wait blocks until serving ends and reports why: nil after Shutdown, the serve error otherwise. Call it once, after Start.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL