core

package
v0.0.0-...-8875cac Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AesCrypto

type AesCrypto struct {
	// contains filtered or unexported fields
}

func NewAesCrypto

func NewAesCrypto(bit int, key string) *AesCrypto

func (*AesCrypto) Decrypt

func (aesCrypto *AesCrypto) Decrypt(ciphertext []byte) ([]byte, error)

func (*AesCrypto) Encrypt

func (aesCrypto *AesCrypto) Encrypt(plaintext []byte) ([]byte, error)

CBC

func (*AesCrypto) GetAlgorithm

func (aesCrypto *AesCrypto) GetAlgorithm() int32

type Cache

type Cache interface {
	Put(key uint64, value net.Conn)

	Get(key uint64) net.Conn

	Delete(key uint64)
}

type Cmd

type Cmd struct {
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd(logger Logger) *Cmd

func (*Cmd) RunCommand

func (cmd *Cmd) RunCommand(script string, args ...interface{})

type ColorLogger

type ColorLogger struct {
}

ColorLogger - A Logger that logs to stdout in color

func (ColorLogger) Debug

func (l ColorLogger) Debug(f string, args ...interface{})

Debug - Log a debug message

func (ColorLogger) Error

func (l ColorLogger) Error(f string, args ...interface{})

func (ColorLogger) Info

func (l ColorLogger) Info(f string, args ...interface{})

Info - Log a general message

func (ColorLogger) Trace

func (l ColorLogger) Trace(f string, args ...interface{})

Trace - Log a very verbose trace message

func (ColorLogger) Warn

func (l ColorLogger) Warn(f string, args ...interface{})

Warn - Log a warning

type ConnMapCache

type ConnMapCache struct {
	// contains filtered or unexported fields
}

func NewMapCache

func NewMapCache() *ConnMapCache

func (*ConnMapCache) Delete

func (mc *ConnMapCache) Delete(key uint64)

func (*ConnMapCache) Get

func (mc *ConnMapCache) Get(key uint64) net.Conn

func (*ConnMapCache) Put

func (mc *ConnMapCache) Put(key uint64, value net.Conn)

type Crypto

type Crypto interface {

	/**
	 * Encrypt
	 */
	Encrypt(plaintext []byte) (ciphertext []byte, err error)

	/**
	 * Decrypt
	 */
	Decrypt(ciphertext []byte) (plaintext []byte, err error)

	/**
	 *
	 */
	GetAlgorithm() int32
}

type DnsResolver

type DnsResolver struct {
	Servers    []string
	RetryTimes int

	// OnCacheMiss is executed if the host or address is not included in
	// the cache and the default lookup is executed.
	OnCacheMiss func()
	// contains filtered or unexported fields
}

DnsResolver represents a dns resolver

func NewDnsResolver

func NewDnsResolver(servers []string) *DnsResolver

New initializes DnsResolver.

func NewDnsResolverFromConf

func NewDnsResolverFromConf(path string) (*DnsResolver, error)

NewDnsResolverFromConf initializes DnsResolver from resolv.conf like file.

func (*DnsResolver) LookupHost

func (r *DnsResolver) LookupHost(host string) ([]net.IP, error)

LookupHost returns IP addresses of provide host. In case of timeout retries query RetryTimes times.

func (*DnsResolver) Refresh

func (r *DnsResolver) Refresh(clearUnused bool)

Refresh refreshes cached entries which has been used at least once since the last Refresh. If clearUnused is true, entries which hasn't be used since the last Refresh are removed from the cache.

type FileLogger

type FileLogger struct {
	// contains filtered or unexported fields
}

func NewFileLogger

func NewFileLogger(logFileName, errorLogFileName string) *FileLogger

func (*FileLogger) Debug

func (fileLogger *FileLogger) Debug(f string, args ...interface{})

Debug - no-op

func (*FileLogger) Error

func (fileLogger *FileLogger) Error(f string, args ...interface{})

func (*FileLogger) Info

func (fileLogger *FileLogger) Info(f string, args ...interface{})

Info - no-op

func (*FileLogger) Trace

func (fileLogger *FileLogger) Trace(f string, args ...interface{})

Trace - no-op

func (*FileLogger) Warn

func (fileLogger *FileLogger) Warn(f string, args ...interface{})

Warn - no-op

type Logger

type Logger interface {
	Trace(f string, args ...interface{})
	Debug(f string, args ...interface{})
	Info(f string, args ...interface{})
	Warn(f string, args ...interface{})
	Error(f string, args ...interface{})
}

type NullLogger

type NullLogger struct{}

NullLogger - An empty logger that ignores everything

func (NullLogger) Debug

func (l NullLogger) Debug(f string, args ...interface{})

Debug - no-op

func (NullLogger) Error

func (l NullLogger) Error(f string, args ...interface{})

func (NullLogger) Info

func (l NullLogger) Info(f string, args ...interface{})

Info - no-op

func (NullLogger) Trace

func (l NullLogger) Trace(f string, args ...interface{})

Trace - no-op

func (NullLogger) Warn

func (l NullLogger) Warn(f string, args ...interface{})

Warn - no-op

type Plain

type Plain struct {
}

func NewPlain

func NewPlain() *Plain

func (*Plain) Decrypt

func (p *Plain) Decrypt(ciphertext []byte) ([]byte, error)

func (*Plain) Encrypt

func (p *Plain) Encrypt(plaintext []byte) ([]byte, error)

func (*Plain) GetAlgorithm

func (p *Plain) GetAlgorithm() int32

Jump to

Keyboard shortcuts

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