jkbase

package
v0.0.0-...-a9e9222 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UIntMin :MIN VALUE of UINT
	UIntMin uint
	// UIntMax MAX VALUE OF UINT
	UIntMax = ^uint(0)
	// IntMax MAX VALUE of INT
	IntMax = int(^uint(0) >> 1)
	// IntMin MIN VALUE of INT
	IntMin = ^IntMax
)
View Source
var NetTypeBase = 1

Functions

func Base64Decode

func Base64Decode(data string) ([]byte, error)

func Base64Encode

func Base64Encode(data []byte) string

func CMConfigFile

func CMConfigFile(filepath string, ci interface{}) error

func CMHttpGet

func CMHttpGet(rurl string, params url.Values) ([]byte, error)

func CMHttpPost

func CMHttpPost(rurl string, params url.Values) ([]byte, error)

func GetConfigInfo

func GetConfigInfo(filepath string, ci interface{}) error

func InitDeamon

func InitDeamon(backrun bool)

func InitLog

func InitLog(logfile string, logsize int)

func JKOpenBrowser

func JKOpenBrowser(uri string) error

Open calls the OS default program for uri

Types

type Base64

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

func NewEncoding

func NewEncoding() *Base64

func (*Base64) Decode

func (b *Base64) Decode(data string) ([]byte, error)

func (*Base64) Encode

func (b *Base64) Encode(data []byte) string

type ConfigBaseArgs

type ConfigBaseArgs struct {
	Addr       string
	Port       int
	LogFile    string
	LogSize    int
	ClientAddr string
	ClientPort int
}

type JKNetBase

type JKNetBase struct {
	HandleMsg func(conn net.Conn, data string) error
	// contains filtered or unexported fields
}

func (*JKNetBase) Close

func (nb *JKNetBase) Close()

func (*JKNetBase) Dial

func (nb *JKNetBase) Dial() error

func (*JKNetBase) DoRecvCycle

func (nb *JKNetBase) DoRecvCycle() error

func (*JKNetBase) GetAddress

func (nb *JKNetBase) GetAddress() (string, int)

func (*JKNetBase) GetNettype

func (nb *JKNetBase) GetNettype() int

func (*JKNetBase) Listen

func (nb *JKNetBase) Listen() error

func (*JKNetBase) New

func (nb *JKNetBase) New(addr string, port int, nettype int) error

Set addr and port with nettype But listen or dial depends on what your operation next

func (*JKNetBase) RecvClient

func (nb *JKNetBase) RecvClient() ([]byte, error)

func (*JKNetBase) RecvClientTimeout

func (nb *JKNetBase) RecvClientTimeout(timeout int) ([]byte, error)

func (*JKNetBase) RecvClientTimeoutCount

func (nb *JKNetBase) RecvClientTimeoutCount(timeout int, c int) ([]byte, error)

func (*JKNetBase) Send

func (nb *JKNetBase) Send(data string) int

func (*JKNetBase) SendTimeout

func (nb *JKNetBase) SendTimeout(data string, timeout int) int

type JKNetBaseItem

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

type JKSuperBase

type JKSuperBase interface {
	HandleMsg(conn net.Conn, data string) error
}

go 实现类似 C++ 的虚拟继承,是一种假像,至少使用上是 通过一种特殊的方法,将子类的对像以接品的形式交给父类 父类再调用相同的方法,其实就是调用子类实现的方法,而非 父类的。但是这种方法也比使用回调稍微好一些,也不是很好理解 不如c++的虚函数来的简单,明了,是对语言的变相使用

type Program

type Program struct {
	Name        string
	DisplayName string
	Desc        string

	Runner func()
	// contains filtered or unexported fields
}

func InitProgramRun

func InitProgramRun(cmd, desc string, start func()) (*Program, error)

func NewProgram

func NewProgram(name, displayname, desc string) *Program

func (*Program) CreateService

func (p *Program) CreateService() error

func (*Program) Ctrl

func (p *Program) Ctrl(cmd string) error

func (*Program) Install

func (p *Program) Install() error

func (*Program) Run

func (p *Program) Run() error

func (*Program) Start

func (p *Program) Start(s service.Service) error

func (*Program) Stop

func (p *Program) Stop(s service.Service) error

func (*Program) Uninstall

func (p *Program) Uninstall() error

type SimpleParse

type SimpleParse struct {
}

func (*SimpleParse) Parse

func (sp *SimpleParse) Parse(out io.Writer, file string, data interface{}) error

func (*SimpleParse) ParseString

func (sp *SimpleParse) ParseString(out io.Writer, content string, data interface{}) error

func (*SimpleParse) Parses

func (sp *SimpleParse) Parses(out io.Writer, data interface{}, file ...string) error

type WebBaseHandle

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

func NewWebBaseHandle

func NewWebBaseHandle(port int, path string) (*WebBaseHandle, error)

func (*WebBaseHandle) BasePath

func (h *WebBaseHandle) BasePath() string

func (*WebBaseHandle) Listen

func (wbh *WebBaseHandle) Listen() error

Will Block

type WebBaseInfo

type WebBaseInfo struct {
	Handler *WebBaseHandle
	// contains filtered or unexported fields
}

func (*WebBaseInfo) GenerateResponse

func (b *WebBaseInfo) GenerateResponse(w http.ResponseWriter, data interface{}, status int)

func (*WebBaseInfo) Parse

func (b *WebBaseInfo) Parse(w http.ResponseWriter, filename string, data interface{}) error

deprecated

func (*WebBaseInfo) Parses

func (b *WebBaseInfo) Parses(w http.ResponseWriter, data interface{}, filename ...string) error

func (*WebBaseInfo) SetFunc

func (b *WebBaseInfo) SetFunc(url string, child interface{})

type WebResult

type WebResult struct {
	Desc string
}

func (*WebResult) NewWebResult

func (wr *WebResult) NewWebResult(desc string) *WebResult

func (*WebResult) NewWebResultNoPermission

func (wr *WebResult) NewWebResultNoPermission() *WebResult

func (*WebResult) NewWebResultNotExist

func (w *WebResult) NewWebResultNotExist() *WebResult

Jump to

Keyboard shortcuts

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