mirror of
https://shylinux.com/x/icebergs
synced 2025-05-02 11:37:01 +08:00
add some
This commit is contained in:
parent
65697070f4
commit
b56063a183
@ -54,6 +54,19 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) {
|
||||||
|
switch kit.TrimPrefix(arg[0], "extra.") {
|
||||||
|
case TO:
|
||||||
|
if m.Option(ice.ACTION) != EMAIL {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case EMAIL:
|
||||||
|
m.Push(arg[0], "shy@shylinux.com", "shylinux@163.com")
|
||||||
|
case PASSWORD:
|
||||||
|
m.SetAppend()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
func SendEmail(m *ice.Message, from, to, cc string, arg ...string) {
|
func SendEmail(m *ice.Message, from, to, cc string, arg ...string) {
|
||||||
m.Option(ice.MSG_USERHOST, strings.Split(m.Option(ice.MSG_USERHOST), "://")[1])
|
m.Option(ice.MSG_USERHOST, strings.Split(m.Option(ice.MSG_USERHOST), "://")[1])
|
||||||
|
@ -18,7 +18,8 @@ func _command_list(m *ice.Message, name string) *ice.Message {
|
|||||||
return m.Push(mdb.INDEX, name).Push(mdb.NAME, name).Push(mdb.HELP, "").Push(mdb.META, "").Push(mdb.LIST, "")
|
return m.Push(mdb.INDEX, name).Push(mdb.NAME, name).Push(mdb.HELP, "").Push(mdb.META, "").Push(mdb.LIST, "")
|
||||||
}
|
}
|
||||||
m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||||
m.Push(mdb.INDEX, kit.Keys(s.Prefix(), key)).Push(mdb.ICONS, kit.Format(cmd.Icon))
|
m.Push(mdb.INDEX, kit.Keys(s.Prefix(), key))
|
||||||
|
m.Push(mdb.ICONS, kit.Select(cmd.Icon, kit.Value(cmd.Meta, kit.Keys(ice.CTX_ICONS, key))))
|
||||||
m.Push(mdb.NAME, kit.Format(cmd.Name)).Push(mdb.HELP, kit.Format(cmd.Help))
|
m.Push(mdb.NAME, kit.Format(cmd.Name)).Push(mdb.HELP, kit.Format(cmd.Help))
|
||||||
m.Push(mdb.LIST, kit.Format(cmd.List)).Push(mdb.META, kit.Format(cmd.Meta))
|
m.Push(mdb.LIST, kit.Format(cmd.List)).Push(mdb.META, kit.Format(cmd.Meta))
|
||||||
m.Push("_command", ShortCmd(kit.Keys(s.Prefix(), key)))
|
m.Push("_command", ShortCmd(kit.Keys(s.Prefix(), key)))
|
||||||
|
@ -3,6 +3,7 @@ package tcp
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -61,6 +62,15 @@ func init() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
case PORT:
|
case PORT:
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
ls := kit.SplitLine(m.Cmd("system", "sh", "-c", `lsof -nP -i4TCP | grep LISTEN | awk '{print $1 " " $9 }'`).Result())
|
||||||
|
kit.For(ls, func(p string) {
|
||||||
|
ls := kit.SplitWord(p)
|
||||||
|
m.Push(arg[0], kit.Split(ls[1], ":")[1]).Push(SERVER, ls[0])
|
||||||
|
})
|
||||||
|
m.Sort(arg[0], ice.INT)
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Cmd(PORT, SOCKET, func(value ice.Maps) {
|
m.Cmd(PORT, SOCKET, func(value ice.Maps) {
|
||||||
switch value[mdb.STATUS] {
|
switch value[mdb.STATUS] {
|
||||||
case "LISTEN":
|
case "LISTEN":
|
||||||
@ -132,6 +142,12 @@ func init() {
|
|||||||
m.StatusTimeCount(mdb.ConfigSimple(m, BEGIN, CURRENT, END)).SortInt(PORT)
|
m.StatusTimeCount(mdb.ConfigSimple(m, BEGIN, CURRENT, END)).SortInt(PORT)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case PORT:
|
||||||
|
m.SetAppend().Cmdy(PORT, mdb.INPUTS, arg)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
func PortRight(m *ice.Message, arg ...string) string {
|
func PortRight(m *ice.Message, arg ...string) string {
|
||||||
current, begin, end := kit.Select("20000", mdb.Config(m, CURRENT)), kit.Select("20000", mdb.Config(m, BEGIN)), kit.Select("30000", mdb.Config(m, END))
|
current, begin, end := kit.Select("20000", mdb.Config(m, CURRENT)), kit.Select("20000", mdb.Config(m, BEGIN)), kit.Select("30000", mdb.Config(m, END))
|
||||||
|
@ -458,20 +458,11 @@ func init() {
|
|||||||
} else {
|
} else {
|
||||||
m.Cmdy(ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
m.Cmdy(ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
||||||
}
|
}
|
||||||
case aaa.TO:
|
|
||||||
if m.Option(ctx.ACTION) != aaa.EMAIL {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
fallthrough
|
|
||||||
case aaa.EMAIL:
|
|
||||||
m.Push(arg[0], "shy@shylinux.com", "shylinux@163.com")
|
|
||||||
case aaa.PASSWORD:
|
|
||||||
m.SetAppend()
|
|
||||||
case tcp.WIFI:
|
case tcp.WIFI:
|
||||||
m.Cmdy(tcp.WIFI).CutTo(tcp.SSID, arg[0])
|
m.Cmdy(tcp.WIFI).CutTo(tcp.SSID, arg[0])
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
m.Cmdy(MESSAGE).Cut(mdb.HASH, mdb.ZONE, mdb.ICONS)
|
m.Cmdy(MESSAGE).Cut(mdb.HASH, mdb.ZONE, mdb.ICONS)
|
||||||
case "target":
|
case TARGET:
|
||||||
m.AdminCmd(MATRIX).Table(func(value ice.Maps) {
|
m.AdminCmd(MATRIX).Table(func(value ice.Maps) {
|
||||||
m.Push(arg[0], kit.Keys(kit.Select("", ice.OPS, ice.Info.NodeType == WORKER), value[DOMAIN], value[mdb.NAME]))
|
m.Push(arg[0], kit.Keys(kit.Select("", ice.OPS, ice.Info.NodeType == WORKER), value[DOMAIN], value[mdb.NAME]))
|
||||||
m.Push(mdb.TYPE, value[mdb.TYPE])
|
m.Push(mdb.TYPE, value[mdb.TYPE])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user