net

package
v0.6.14 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 12 Imported by: 17 modules, 19 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

Package net contains some helper wrapping functions for the http and net golang libraries that meet Packer-specific needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpClientWithEnvironmentProxy

func HttpClientWithEnvironmentProxy() *http.Client

Types

type ErrPortBusy

type ErrPortBusy struct {
	Port int
	Err  error
}

func (*ErrPortBusy) Error

func (err *ErrPortBusy) Error() string

type ErrPortFileLocked

type ErrPortFileLocked int

func (ErrPortFileLocked) Error

func (port ErrPortFileLocked) Error() string

type ListenRangeConfig

type ListenRangeConfig struct {
	// like "tcp" or "udp". defaults to "tcp".
	Network  string
	Addr     string
	Min, Max int
	net.ListenConfig
}

ListenRangeConfig contains options for listening to a free address [Min,Max) range. ListenRangeConfig wraps a net.ListenConfig.

func (ListenRangeConfig) Listen

func (lc ListenRangeConfig) Listen(ctx context.Context) (*Listener, error)

Listen tries to Listen to a random open TCP port in the [min, max) range until ctx is canceled. Listen uses net.ListenConfig.Listen internally.

type Listener

type Listener struct {
	// Listener can be closed but Port will be file locked by packer until
	// Close is called.
	net.Listener
	Port    int
	Address string
	// contains filtered or unexported fields
}

Listener wraps a net.Lister with some Packer-specific capabilies. For example, until you call Listener.Close, any call to ListenRangeConfig.Listen cannot bind to a Port. Packer tries to tell moving parts which port they can use, but often the port has to be released before a 3rd party is started, like a VNC server.

func (*Listener) Close

func (l *Listener) Close() error

Jump to

Keyboard shortcuts

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