utils

package
v0.0.0-...-817612b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadYAML

func LoadYAML(path string, out interface{}) error

LoadYAML config into out interface, with defaults and validates

func NewTLSConfigClient

func NewTLSConfigClient(c Certificate) (*tls.Config, error)

NewTLSConfigClient loads tls config for client

func NewTLSConfigServer

func NewTLSConfigServer(c Certificate) (*tls.Config, error)

NewTLSConfigServer loads tls config for server

func SetDefaults

func SetDefaults(ptr interface{}) error

SetDefaults set default values

func UnmarshalYAML

func UnmarshalYAML(in []byte, out interface{}) error

UnmarshalYAML unmarshals, defaults and validates

func Wrapper

func Wrapper(handler HandlerFunc) func(c *gin.Context)

Types

type Certificate

type Certificate struct {
	CA                 string `yaml:"ca" json:"ca"`
	Key                string `yaml:"key" json:"key"`
	Cert               string `yaml:"cert" json:"cert"`
	Name               string `yaml:"name" json:"name"`
	InsecureSkipVerify bool   `yaml:"insecureSkipVerify" json:"insecureSkipVerify"` // for client, for test purpose
	tls.ClientAuthType `yaml:"clientAuthType" json:"clientAuthType"`
}

Certificate certificate config for server Name : serverNameOverride, same to CommonName in server.pem if Name == "" , link would not verifies the server's certificate chain and host name AuthType : declares the policy the server will follow for TLS Client Authentication

type HandlerFunc

type HandlerFunc func(c *gin.Context) (interface{}, error)

Jump to

Keyboard shortcuts

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