Documentation ¶
Index ¶
- Constants
- func CertHasExpired(cert *x509.Certificate) bool
- func CopyFile(sourceFile, destinationFile string) error
- func DeleteSliceElement(slice []string, element string) []string
- func DisableEscapeJson(data interface{}) (string, error)
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func GenerateCA(organization string) (caBundle string, caCert *x509.Certificate, caPrivKey *rsa.PrivateKey, ...)
- func GenerateCertAndKeyConfig(caCert *x509.Certificate, caKey *rsa.PrivateKey, config *cert.Config) (*x509.Certificate, *rsa.PrivateKey, error)
- func GenerateClientCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, clientCN string) (*x509.Certificate, *rsa.PrivateKey, error)
- func GetHostAllIPs() (map[string]string, error)
- func GetHostPublicIP() (string, error)
- func GetIPByInterfaceName(name string) (ip string, err error)
- func GetLocalAddrByInterface(name string) (net.Addr, error)
- func GetLocalIP() (string, error)
- func GetRandToken(n int) string
- func GetServiceCertByRootca(commonName, organization string, dns []string, rootCA *x509.Certificate, ...) ([]byte, []byte, error)
- func GetStringInBetween(str string, start string, end string) (result string)
- func IsFileExist(path string) bool
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSignedCert(cfg *cert.Config, key crypto.Signer, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func OutPutMessage(msg string)
- func OutSuccessMessage(msg string)
- func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
- func ParsePrivateKeyPEMRSA(keyData []byte) (*rsa.PrivateKey, error)
- func PodToYaml(pod *corev1.Pod) ([]byte, error)
- func PrintFlags(flags *pflag.FlagSet)
- func ReadFile(path string) ([]byte, error)
- func RemoveDuplicateElement(slice []string) []string
- func RemoveFile(filePath string) error
- func RunLinuxCommand(command string) (string, string, error)
- func RunLinuxShellFile(filename string) (string, string, error)
- func SetFileContent(file, pattern, content string) string
- func SetupSignalHandler() <-chan struct{}
- func SplitHostPortIgnoreMissingPort(v string) (addr string, port string, err error)
- func SplitHostPortWithDefaultPort(v string, defaultPort string) (addr string, port string, err error)
- func ToJson(v interface{}) string
- func ToJsonForm(v interface{}) string
- func UpdateLogLevel(w http.ResponseWriter, r *http.Request)
- func WriteFile(file, ctx string) error
- func WriteWithAppend(name, content string) error
- func WriteWithBufio(name, content string) error
Constants ¶
View Source
const ( CertificateBlockType = "CERTIFICATE" // ECPrivateKeyBlockType is a possible value for pem.Block.Type. ECPrivateKeyBlockType = "EC PRIVATE KEY" // RSAPrivateKeyBlockType is a possible value for pem.Block.Type. RSAPrivateKeyBlockType = "RSA PRIVATE KEY" // PrivateKeyBlockType is a possible value for pem.Block.Type. PrivateKeyBlockType = "PRIVATE KEY" // PublicKeyBlockType is a possible value for pem.Block.Type. PublicKeyBlockType = "PUBLIC KEY" )
Variables ¶
This section is empty.
Functions ¶
func CertHasExpired ¶
func CertHasExpired(cert *x509.Certificate) bool
func DeleteSliceElement ¶
func DisableEscapeJson ¶
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-endcoded certificate data
func GenerateCA ¶
func GenerateCA(organization string) (caBundle string, caCert *x509.Certificate, caPrivKey *rsa.PrivateKey, err error)
func GenerateCertAndKeyConfig ¶
func GenerateCertAndKeyConfig(caCert *x509.Certificate, caKey *rsa.PrivateKey, config *cert.Config) (*x509.Certificate, *rsa.PrivateKey, error)
Tobe optimized
func GenerateClientCertAndKey ¶
func GenerateClientCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, clientCN string) (*x509.Certificate, *rsa.PrivateKey, error)
func GetHostAllIPs ¶
func GetHostPublicIP ¶
func GetIPByInterfaceName ¶
func GetLocalIP ¶
func GetRandToken ¶
func GetServiceCertByRootca ¶
func GetServiceCertByRootca(commonName, organization string, dns []string, rootCA *x509.Certificate, key *rsa.PrivateKey) ([]byte, []byte, error)
func GetStringInBetween ¶
func IsFileExist ¶
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key change fa
func NewSignedCert ¶
func NewSignedCert(cfg *cert.Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)
NewSignedCert creates a signed certificate using the given CA certificate and key
func OutPutMessage ¶
func OutPutMessage(msg string)
func OutSuccessMessage ¶
func OutSuccessMessage(msg string)
func ParseCertsPEM ¶
func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
ParseCertsPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates
func ParsePrivateKeyPEMRSA ¶
func ParsePrivateKeyPEMRSA(keyData []byte) (*rsa.PrivateKey, error)
func RemoveDuplicateElement ¶
func RemoveFile ¶
func SetFileContent ¶
SetFileContent generates cmd for set file content.
func SetupSignalHandler ¶
func SetupSignalHandler() <-chan struct{}
SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.
func ToJsonForm ¶
func ToJsonForm(v interface{}) string
func UpdateLogLevel ¶
func UpdateLogLevel(w http.ResponseWriter, r *http.Request)
func WriteWithAppend ¶
func WriteWithBufio ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.