package
0.0.0-20240701071450-45e2431495c8
Repository: https://github.com/docker/go-plugins-helpers.git
Documentation: pkg.go.dev

# README

Docker network extension API

Go handler to create external network extensions for Docker.

Usage

This library is designed to be integrated in your program.

  1. Implement the network.Driver interface.
  2. Initialize a network.Handler with your implementation.
  3. Call either ServeTCP, ServeUnix or ServeWindows from the network.Handler.
  4. On Windows, docker daemon data dir must be provided for ServeTCP and ServeWindows functions. On Unix, this parameter is ignored.

Example using TCP sockets:

  import "github.com/docker/go-plugins-helpers/network"

  d := MyNetworkDriver{}
  h := network.NewHandler(d)
  h.ServeTCP("test_network", ":8080", "")
  // on windows:
  h.ServeTCP("test_network", ":8080", WindowsDefaultDaemonRootDir())

Example using Unix sockets:

  import "github.com/docker/go-plugins-helpers/network"

  d := MyNetworkDriver{}
  h := network.NewHandler(d)
  h.ServeUnix("test_network", 0)

Example using Windows named pipes:

import "github.com/docker/go-plugins-helpers/network"
import "github.com/docker/go-plugins-helpers/sdk"

d := MyNetworkDriver{}
h := network.NewHandler(d)

config := sdk.WindowsPipeConfig{
  // open, read, write permissions for everyone 
  // (uses Windows Security Descriptor Definition Language)
  SecurityDescriptor: AllowServiceSystemAdmin,
  InBufferSize:       4096,
  OutBufferSize:      4096,
}

h.ServeWindows("//./pipe/testpipe", "test_network", WindowsDefaultDaemonRootDir(), &config)

Full example plugins