server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultListenAddr = ":12345"

默认监听地址

View Source
const PoweredBy = "tora/" + Version

X-Powered-By响应头

View Source
const Version = "1.1"

当前版本号

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Token     map[string]AuthItem // 允许指定token
	IP        map[string]AuthItem // 允许指定ip
	TokenList []string            // token列表
	IPList    []string            // ip列表
}

type AuthInfo

type AuthInfo struct {
	Type  string // 类型,如 token 或者 ip
	Token string // 对应的 token
	Ip    string // 对应的 ip
	AuthItem
}

type AuthItem

type AuthItem struct {
	Allow   bool     // 是否允许访问
	Modules []string // 允许访问的模块
}

type FileOptions

type FileOptions = file.ModuleFile

type Options

type Options struct {
	Log          *logrus.Logger    // 日志输出实例
	Addr         string            // 监听地址,格式:指定端口=:12345 指定地址和端口=127.0.0.1:12345 监听unix-socket=/path/to/sock
	Enable       []string          // 开启的模块,可选:file, shell, log
	FileOptions  file.ModuleFile   // 文件服务配置,如果开启了file模块,需要设置此项
	ShellOptions shell.ModuleShell // 执行命令服务配置,如果开启了shell模块,需要设置此项
	Auth         Auth              // 授权信息
}

type Server

type Server struct {
	Options Options
	// contains filtered or unexported fields
}

func NewServer

func NewServer(options Options) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Start

func (s *Server) Start() error

type ShellOptions added in v1.1.0

type ShellOptions = shell.ModuleShell

Jump to

Keyboard shortcuts

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