listener

package module
v0.0.0-...-6d237eb Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT Imports: 7 Imported by: 0

README

go-listener

Go Reference

Collection of listeners for TCP server

Features:

  • Connlimit listener - limits concurrent connections
  • TLS listener - updates certificate and key on the fly

Installation

To install the library use the following command in the project directory:

go get github.com/cesbo/go-listener

Quick Start

ln, _ := net.Listen("tcp", "127.0.0.1:0")
ln = listener.NewConnlimitListener(ln, 1000)
ln = listener.NewTlsListener(
    ln,
    "/etc/dehydrated/certs/example.com/fullchain.pem",
    "/etc/dehydrated/certs/example.com/privkey.pem",
)
_ = http.Serve(ln, http.NotFoundHandler())

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnlimitListener

func NewConnlimitListener(inner net.Listener, connlimit int) net.Listener

func NewTlsListener

func NewTlsListener(inner net.Listener, cert, key string) net.Listener

Types

This section is empty.

Jump to

Keyboard shortcuts

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