Documentation ¶
Index ¶
- Variables
- func AddBridge(bridgeName string) error
- func AddDefaultRoute(ppp string, gatewayIp string, tableId int) error
- func AddDns(src string, tableID int, fref int) error
- func AddIpToEth(eth string, ip string) error
- func AddMacVLan(devName string, parentDevName string, macAddr string) error
- func AddRule(src string, tableID int, fref int) error
- func ArrayMap(data interface{}, fc func(i int, row interface{}) interface{}) error
- func BatchSetMacVlanAndPromisc(cmdString string) error
- func BeachCheckPort(ip string, port int, useFulPort *chan int)
- func CheckPid(pid interface{}) bool
- func CheckPort(ip string, port string) bool
- func Cors() gin.HandlerFunc
- func CreateDb(conn *sql.DB, dbName string) error
- func CtrlC(fc func(signalTag string))
- func CurrentFile() string
- func Daemon() int
- func DelRuleByTableId(tableID int)
- func DeleteDev(name string) error
- func ExpFind(rule string, srcString string) string
- func ExpFindLast(rule string, srcString string) string
- func GetConn(config string) (conn *sql.DB, err error)
- func GetFileByPath(path string) string
- func GetIpByEth(eth string) (string, error)
- func GetMacByEth(eth string) (string, error)
- func GetRandMac() (mac string, err error)
- func GetRandomString(l int) string
- func GetUsablePpp() string
- func GetUsefulPort(ip string, startPort int, endPort int) int
- func HasDb(conn *sql.DB, dbName string) error
- func InSlice(slice []interface{}, value interface{}) bool
- func KillPid(pid string) error
- func Rand() string
- func RemoveRepeated(arr *[]string)
- func RemoveRepeatedElement(arr []string) (newArr []string)
- func RunCmd(cmdString string, runFc RunFunc)
- func STRUCToString(iFace interface{}) string
- func SetBridgeAddr(name string, ip string, tryTimes int) error
- func SetDeviceIP(name string, ip string) error
- func SetDeviceUP(devName string) error
- func SetPPPOE(eth string, ruleTableID int) error
- func SliceMap(slice []interface{}, cb func(interface{}) interface{}) []interface{}
- func Start(address string, debug string, route func(router *gin.Engine) gin.IRoutes)
- func StartWatch(path string, fs FsNotifyInterface)
- func StopDaemon() error
- func StructureToString(iFace interface{}) string
- func SyncDb(conn *sql.DB, dbName string)
- func Uuid() string
- func WriteRtTable(rtTables []RtTables) error
- type BlackListStructure
- type ConfFile
- type ConfFileMap
- type Config
- type DanteStructure
- func (d *DanteStructure) GetContent() (string, error)
- func (d *DanteStructure) Save(account ...string) error
- func (d *DanteStructure) SetBlackIp(ip ...string) *DanteStructure
- func (d *DanteStructure) SetBlackLimit(fromIp string, toIp string) *DanteStructure
- func (d *DanteStructure) SetClientMethod(clientMethod string) *DanteStructure
- func (d *DanteStructure) SetExternal(external string) *DanteStructure
- func (d *DanteStructure) SetInteral(interal string) *DanteStructure
- func (d *DanteStructure) SetLogoutput(logoutput string) *DanteStructure
- func (d *DanteStructure) SetPort(port string) *DanteStructure
- func (d *DanteStructure) SetPrivileged(privileged string) *DanteStructure
- func (d *DanteStructure) SetSavePath(path string) *DanteStructure
- func (d *DanteStructure) SetSocksMethod(socksMethod string) *DanteStructure
- func (d *DanteStructure) SetUnprivileged(unPrivileged string) *DanteStructure
- func (d *DanteStructure) SetWhiteIp(ip ...string) *DanteStructure
- func (d *DanteStructure) SetWhiteLimit(fromIp string, toIp string) *DanteStructure
- func (d *DanteStructure) StartDante(danteConf string, host string, port int, userId int, mac string, times float64, ...) *DanteStructure
- func (d *DanteStructure) StopDante(host interface{}, mac interface{}) error
- type FieldsAttr
- type FsNotifyInterface
- type Index
- type MigrateStructure
- type MysqlStructure
- func (mysql *MysqlStructure) AutoMigrate(data ...interface{}) error
- func (mysql *MysqlStructure) Begin() (err error)
- func (mysql *MysqlStructure) ClearData()
- func (mysql *MysqlStructure) Commit() error
- func (mysql *MysqlStructure) Delete() (affected int64, err error)
- func (mysql *MysqlStructure) Exec() (result int64, err error)
- func (mysql *MysqlStructure) Find(data interface{}) error
- func (mysql *MysqlStructure) GetIndexMap() map[string][]string
- func (mysql *MysqlStructure) GetStructureFields(data interface{}) error
- func (mysql *MysqlStructure) GetUniqueIndexMap() map[string][]string
- func (mysql *MysqlStructure) Insert() (lastId int64, err error)
- func (mysql *MysqlStructure) MigrateOne(data interface{}) error
- func (mysql *MysqlStructure) RollBack() error
- func (mysql *MysqlStructure) SaveAll(data interface{}, fields ...interface{}) error
- func (mysql *MysqlStructure) Select(data interface{}) error
- func (mysql *MysqlStructure) Sql(sql string, param ...interface{}) *MysqlStructure
- func (mysql *MysqlStructure) Update() (affected int64, err error)
- type PppLogInfo
- type RtTables
- type RunFunc
- type TableAttr
- type UniqueIndex
- type WhiteListStructure
Constants ¶
This section is empty.
Variables ¶
View Source
var PrimaryIndex string
主索引
Functions ¶
func AddDefaultRoute ¶ added in v1.0.5
添加默认路由
func AddMacVLan ¶ added in v1.0.5
添加macVLan
func BatchSetMacVlanAndPromisc ¶ added in v1.0.8
func BeachCheckPort ¶ added in v1.1.9
检测端口并写入数据到channel
func CurrentFile ¶ added in v1.1.8
func CurrentFile() string
func ExpFindLast ¶ added in v1.2.5
func GetFileByPath ¶ added in v1.1.0
func GetIpByEth ¶ added in v1.1.3
func GetRandomString ¶ added in v1.0.8
func GetUsefulPort ¶ added in v1.1.9
获取一个 指定范围内的可用端口
func RemoveRepeated ¶ added in v1.3.8
func RemoveRepeated(arr *[]string)
效率更高的去重函数 用法:RemoveRepeated(&noPassAccount)
func RemoveRepeatedElement ¶ added in v1.0.8
func STRUCToString ¶ added in v1.1.1
func STRUCToString(iFace interface{}) string
func SetBridgeAddr ¶ added in v1.0.5
设置网桥地址并启用
func SliceMap ¶ added in v1.0.5
func SliceMap(slice []interface{}, cb func(interface{}) interface{}) []interface{}
func StartWatch ¶ added in v1.0.9
func StartWatch(path string, fs FsNotifyInterface)
func StructureToString ¶ added in v1.0.5
func StructureToString(iFace interface{}) string
通过反射 结构体转字符串
func WriteRtTable ¶ added in v1.0.5
Types ¶
type BlackListStructure ¶ added in v1.1.6
type BlackListStructure struct {
ClientBlock string
}
type ConfFile ¶ added in v1.0.7
type ConfFile struct { FileName string ConfFileArray []ConfFileMap }
func (*ConfFile) BatchWriteAccount ¶ added in v1.0.7
批量写入账户
func (*ConfFile) ReadAccount ¶ added in v1.0.7
读取某个指定账户
type ConfFileMap ¶ added in v1.0.7
此包用于读取/设置宽带帐号密码 * demo myConfig := new(lib.ConfFile) myConfig.InitFile("./config.conf") account :=myConfig.ReadAccount("07557550897705@163.gd") myConfig.WriteAccount("07557550897705@163.gd","testPP") fmt.Println(account)
type Config ¶
func (*Config) InitConfig ¶
type DanteStructure ¶ added in v1.1.6
type DanteStructure struct { TemplatePath string `description:模板路径` SavePath string `description:设置的配置文件路径` Logoutput string Privileged string Unprivileged string Interal string Port string External string SocksMethod string ClientMethod string ClientPassSlice []WhiteListStructure `description:白名单` ClientBlockSlice []BlackListStructure `description:黑名单` }
func NewDante ¶ added in v1.1.6
func NewDante(templatePath ...string) *DanteStructure
初始化dante类,可以选择传递templatePath,也可以选择不传递
func (*DanteStructure) GetContent ¶ added in v1.1.6
func (d *DanteStructure) GetContent() (string, error)
返回配置文件的所有字符串
func (*DanteStructure) Save ¶ added in v1.1.6
func (d *DanteStructure) Save(account ...string) error
保存设置
func (*DanteStructure) SetBlackIp ¶ added in v1.1.6
func (d *DanteStructure) SetBlackIp(ip ...string) *DanteStructure
设置黑名单
func (*DanteStructure) SetBlackLimit ¶ added in v1.1.6
func (d *DanteStructure) SetBlackLimit(fromIp string, toIp string) *DanteStructure
限制用户访问特定的IP
func (*DanteStructure) SetClientMethod ¶ added in v1.1.6
func (d *DanteStructure) SetClientMethod(clientMethod string) *DanteStructure
设置客户端访问方法
func (*DanteStructure) SetExternal ¶ added in v1.1.6
func (d *DanteStructure) SetExternal(external string) *DanteStructure
设置外部IP或则对外的网卡
func (*DanteStructure) SetInteral ¶ added in v1.1.6
func (d *DanteStructure) SetInteral(interal string) *DanteStructure
设置拨号成功后的内部IP
func (*DanteStructure) SetLogoutput ¶ added in v1.1.6
func (d *DanteStructure) SetLogoutput(logoutput string) *DanteStructure
设置注销参数
func (*DanteStructure) SetPort ¶ added in v1.1.6
func (d *DanteStructure) SetPort(port string) *DanteStructure
设置拨号成功后的Port
func (*DanteStructure) SetPrivileged ¶ added in v1.1.6
func (d *DanteStructure) SetPrivileged(privileged string) *DanteStructure
设置特权账户,如:root
func (*DanteStructure) SetSavePath ¶ added in v1.1.6
func (d *DanteStructure) SetSavePath(path string) *DanteStructure
设置用户配置文件保存路径
func (*DanteStructure) SetSocksMethod ¶ added in v1.1.6
func (d *DanteStructure) SetSocksMethod(socksMethod string) *DanteStructure
设置socket对外访问限制方法
func (*DanteStructure) SetUnprivileged ¶ added in v1.1.6
func (d *DanteStructure) SetUnprivileged(unPrivileged string) *DanteStructure
设置没有特权的账户,如:nobody
func (*DanteStructure) SetWhiteIp ¶ added in v1.1.6
func (d *DanteStructure) SetWhiteIp(ip ...string) *DanteStructure
设置白名单
func (*DanteStructure) SetWhiteLimit ¶ added in v1.1.6
func (d *DanteStructure) SetWhiteLimit(fromIp string, toIp string) *DanteStructure
允许用户访问特定的IP
func (*DanteStructure) StartDante ¶ added in v1.1.6
func (d *DanteStructure) StartDante( danteConf string, host string, port int, userId int, mac string, times float64, fc func(host string, mac string, status string, resetUserId int) error, danteFc func(host string, port int, userId int, status string, macVLanMac string, pid string) error, reDialFc func(host string, macVLanOrMac string) (data struct { Pid string MacVLan string Ppp string PppLocalIp string PppRemoteIp string Dns1 string Dns2 string PppError string }, err error)) *DanteStructure
启动dante服务
func (*DanteStructure) StopDante ¶ added in v1.1.6
func (d *DanteStructure) StopDante(host interface{}, mac interface{}) error
type FieldsAttr ¶ added in v1.0.4
type FieldsAttr struct { Type string Json string Auto string Null string Default string Hidden string UniqueIndex string Index string Comment string }
数据迁移 字段属性
type FsNotifyInterface ¶ added in v1.0.9
type MigrateStructure ¶ added in v1.0.4
type MigrateStructure struct { Field string FieldsAttr }
数据迁移 数据行结构体
type MysqlStructure ¶ added in v1.0.4
type MysqlStructure struct { *sql.DB Host string Port string User string Password string Database string SqlString string Param []interface{} Rows *sql.Rows Err error Transaction *sql.Tx Fields MigrateStructure TableAttr TableAttr PrimaryIndex string UniqueIndex []UniqueIndex Index []Index Migrate []MigrateStructure }
var Mysql *MysqlStructure
func (*MysqlStructure) AutoMigrate ¶ added in v1.0.4
func (mysql *MysqlStructure) AutoMigrate(data ...interface{}) error
批量迁移数据表
func (*MysqlStructure) Begin ¶ added in v1.0.4
func (mysql *MysqlStructure) Begin() (err error)
开启事务
func (*MysqlStructure) ClearData ¶ added in v1.0.6
func (mysql *MysqlStructure) ClearData()
func (*MysqlStructure) Delete ¶ added in v1.0.4
func (mysql *MysqlStructure) Delete() (affected int64, err error)
func (*MysqlStructure) Exec ¶ added in v1.0.6
func (mysql *MysqlStructure) Exec() (result int64, err error)
func (*MysqlStructure) Find ¶ added in v1.0.4
func (mysql *MysqlStructure) Find(data interface{}) error
func (*MysqlStructure) GetIndexMap ¶ added in v1.0.6
func (mysql *MysqlStructure) GetIndexMap() map[string][]string
获取索引MAP
func (*MysqlStructure) GetStructureFields ¶ added in v1.0.4
func (mysql *MysqlStructure) GetStructureFields(data interface{}) error
处理结构体的字段 属性 TAG
func (*MysqlStructure) GetUniqueIndexMap ¶ added in v1.0.6
func (mysql *MysqlStructure) GetUniqueIndexMap() map[string][]string
获取索引MAP
func (*MysqlStructure) Insert ¶ added in v1.0.4
func (mysql *MysqlStructure) Insert() (lastId int64, err error)
func (*MysqlStructure) MigrateOne ¶ added in v1.0.6
func (mysql *MysqlStructure) MigrateOne(data interface{}) error
迁移单个数据表
func (*MysqlStructure) RollBack ¶ added in v1.0.4
func (mysql *MysqlStructure) RollBack() error
回滚事务
func (*MysqlStructure) SaveAll ¶ added in v1.0.6
func (mysql *MysqlStructure) SaveAll(data interface{}, fields ...interface{}) error
func (*MysqlStructure) Select ¶ added in v1.0.4
func (mysql *MysqlStructure) Select(data interface{}) error
func (*MysqlStructure) Sql ¶ added in v1.0.4
func (mysql *MysqlStructure) Sql(sql string, param ...interface{}) *MysqlStructure
func (*MysqlStructure) Update ¶ added in v1.0.4
func (mysql *MysqlStructure) Update() (affected int64, err error)
type PppLogInfo ¶ added in v1.1.0
type PppLogInfo struct { PppError string Ppp string Local string Remote string Dns1 string Dns2 string }
func GetLogIp ¶ added in v1.1.0
func GetLogIp(path string) (result PppLogInfo, err error)
func GetLogIp2 ¶ added in v1.2.4
func GetLogIp2(f string) (result PppLogInfo, err error)
type RtTables ¶ added in v1.1.1
func DeleteRtTableItem ¶ added in v1.1.1
func GetRtTableAll ¶ added in v1.1.1
type WhiteListStructure ¶ added in v1.1.6
type WhiteListStructure struct {
ClientPass string
}
Click to show internal directories.
Click to hide internal directories.