server

package
v0.0.0-...-cdfbdfc Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

README

z-console-server

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGlobalConfig = &Config{
	Log: Log{
		DisableTimestamp: false,
		Level:            "info",
		Format:           "text",
		FileName:         "/var/log/z-console-server/data.log",
		MaxSize:          200,
	},
	System: System{
		Port:     9090,
		CertsDir: "/var/run/z-console-server/certs",
	},
}

DefaultGlobalConfig 默认配置

Functions

func GenerateCertificate

func GenerateCertificate(caKey *rsa.PrivateKey, caCert *x509.Certificate, bits int, info *ApplicationInformation) ([]byte, []byte, error)

GenerateCertificate 生成证书(私钥,证书)

func Main

func Main()

Main main

func ReadCertificate

func ReadCertificate(path string) (*x509.Certificate, error)

ReadCertificate 读取证书

func ReadPKCS1PrivateKey

func ReadPKCS1PrivateKey(path string) (*rsa.PrivateKey, error)

ReadPKCS1PrivateKey 读取 PKCS1 私钥

func ReadPKCS8PrivateKey

func ReadPKCS8PrivateKey(path string) (*rsa.PrivateKey, error)

ReadPKCS8PrivateKey 读取 PKCS8 私钥

func StartupServer

func StartupServer() error

StartupServer startup server

func WriteCertificate

func WriteCertificate(path string, cert []byte) error

WriteCertificate 写出证书

func WritePKCS1PrivateKey

func WritePKCS1PrivateKey(path string, privKey []byte) error

WritePKCS1PrivateKey 写出 PKCS! 私钥

func WritePKCS8PrivateKey

func WritePKCS8PrivateKey(path string, privKey []byte) error

WritePKCS8PrivateKey 写出 PKCS8 私钥

Types

type ApplicationInformation

type ApplicationInformation struct {
	CertificateConfig    *CertificateConfig
	CommonName           string
	CountryName          string
	ProvinceName         string
	LocalityName         string
	OrganizationName     string
	OrganizationUnitName string
}

ApplicationInformation 申请信息

type CertificateConfig

type CertificateConfig struct {
	IsCA           bool
	IP             []net.IP
	DNS            []string
	ExpirationTime time.Duration
}

CertificateConfig 证书配置

type Config

type Config struct {
	System System `json:"system" toml:"system"`
	Log    Log    `json:"log" toml:"log"`
}

Config config

func (*Config) Load

func (cg *Config) Load(f func(*Config)) error

Load 加载配置文件

func (*Config) String

func (cg *Config) String() string

type Log

type Log struct {
	DisableTimestamp bool   `json:"disable-timestamp" toml:"disable-timestamp"`
	Level            string `json:"level" toml:"level"`
	Format           string `json:"format" toml:"format"`
	FileName         string `json:"filename" toml:"filename"`
	MaxSize          int    `json:"maxsize" toml:"maxsize"`
}

Log log

type System

type System struct {
	CertsDir string `json:"certs-dir" toml:"certs-dir"`
	Port     int    `json:"port" toml:"port"`
}

System system

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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