server

package module
v0.0.0-...-3e04474 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 11 Imported by: 2

README

Server Go Report Card GoDoc

Motivations

Building a server whenever write a app is getting very tedious. This package is just here to save me time.

Golang version

server is currently compatible with golang version from 1.12+.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetListener

func GetListener(c *ServerConfig) (net.Listener, error)

GetListener get the listener from server config

func Inbytes

func Inbytes(in InbytesForm) error

Inbytes The function only useful if you have a SuperCA server up and running and understand what it does.

func Server

func Server(c *ServerConfig) error

Server This is to start the server

Types

type InbytesForm

type InbytesForm struct {
	Ca           string        // the hostname of the SuperCa server
	Caport       string        // the port that SuperCA is being hosted on.
	Trustcert    string        // the cert you want to trust, most likely an intermediate cert definitely not rootca.
	ServerConfig *ServerConfig // the server config that will get modified.
	Org          string        // the org name for csr
	Rootca       string        // the rootca, for SuperCA its default as rootca.crt
}

InbytesForm The form to modify ServerConfig so it will take everything in bytes, this form is only useful when you have a SuperCA server up and running.

type Keycrt

type Keycrt struct {
	Cb, Kb []byte
}

Keycrt the key and cert struct that stores the bytes

type ServerConfig

type ServerConfig struct {
	BindAddr     string            // This is the bind address
	BindPort     string            // this is the bind port
	Cert         string            //the location of the .crt for https
	Key          string            // the location of the .key for https
	CertBytes    [][]byte          // the .crt in bytes will take preceding over Cert
	KeyBytes     [][]byte          // the .key in bytes will take preceding over key
	Trust        string            // trust cert location
	TrustBytes   [][]byte          // trust cert in  bytes will take preceding over Trust
	Https        bool              // whether to host in https or not
	Verify       bool              // whether to do http verify or not
	ReadTimeout  int               // read timeout
	WriteTimeout int               // write timeout
	IdleTimeout  int               // idle timeout
	ServeMux     http.Handler      // the http.ServeMux
	Name2cert    map[string]Keycrt // key == hostname, value == cert in bytes
	SNIoverride  bool              // whether to override the sni from name2cert.
}

ServerConfig is the configuration for the server

Jump to

Keyboard shortcuts

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