forked from x/icebergs
add some
This commit is contained in:
parent
c145f0cbc7
commit
ddf48abff8
@ -59,6 +59,7 @@ func _runtime_init(m *ice.Message) {
|
||||
aaa.UserRoot(ice.Pulse, "", ice.Info.Make.Username, aaa.TECH, ice.DEV)
|
||||
aaa.UserRoot(ice.Pulse, "", ice.Info.Username, aaa.ROOT, ice.OPS)
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.TIME), m.Time())
|
||||
ice.Info.Time = m.Time()
|
||||
if runtime.GOARCH != MIPSLE {
|
||||
msg := m.Cmd(nfs.DIR, _system_find(m, os.Args[0]), "time,path,size,hash")
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.HASH), msg.Append(mdb.HASH))
|
||||
@ -341,3 +342,10 @@ func ParseMake(str string) []string {
|
||||
"arch", kit.Format(kit.Value(res, "host.GOARCH")),
|
||||
)
|
||||
}
|
||||
func SimpleMake() []string {
|
||||
return []string{
|
||||
"bootTime", ice.Info.Time, "compileTime", ice.Info.Make.Time, "commitTime", ice.Info.Make.When,
|
||||
nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
|
||||
"kernel", runtime.GOOS, "arch", runtime.GOARCH,
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package web
|
||||
|
||||
import (
|
||||
"net"
|
||||
"runtime"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
@ -23,19 +23,14 @@ func _broad_send(m *ice.Message, to_host, to_port string, host, port string, arg
|
||||
func _broad_serve(m *ice.Message) {
|
||||
m.GoSleep300ms(func() {
|
||||
m.Cmd(tcp.HOST, func(value ice.Maps) {
|
||||
_broad_send(m, "", "", value[aaa.IP], m.Option(tcp.PORT),
|
||||
gdb.EVENT, tcp.LISTEN, mdb.NAME, ice.Info.Hostname, mdb.TYPE, ice.Info.NodeType, mdb.TIME, m.Time(),
|
||||
nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
|
||||
"kernel", runtime.GOOS, "arch", runtime.GOARCH,
|
||||
)
|
||||
_broad_send(m, "", "", value[aaa.IP], m.Option(tcp.PORT), kit.Simple(gdb.EVENT, tcp.LISTEN, mdb.NAME, ice.Info.Hostname, mdb.TYPE, ice.Info.NodeType, mdb.TIME, m.Time(), cli.SimpleMake())...)
|
||||
})
|
||||
})
|
||||
m.Cmd(tcp.SERVER, tcp.LISTEN, mdb.TYPE, tcp.UDP4, mdb.NAME, logs.FileLine(1), m.OptionSimple(tcp.HOST, tcp.PORT), func(from *net.UDPAddr, buf []byte) {
|
||||
msg := m.Spawn(buf).Logs(tcp.RECV, BROAD, string(buf), nfs.FROM, from)
|
||||
if m.Cmd(BROAD, mdb.CREATE, msg.OptionSimple(kit.Simple(msg.Optionv(ice.MSG_OPTION))...)); msg.Option(gdb.EVENT) == tcp.LISTEN {
|
||||
m.Cmds(BROAD, func(value ice.Maps) {
|
||||
_broad_send(m, msg.Option(tcp.HOST), msg.Option(tcp.PORT), value[tcp.HOST], value[tcp.PORT],
|
||||
mdb.TYPE, value[mdb.TYPE], mdb.NAME, value[mdb.NAME], mdb.TIME, value[mdb.TIME])
|
||||
_broad_send(m, msg.Option(tcp.HOST), msg.Option(tcp.PORT), value[tcp.HOST], value[tcp.PORT], kit.Simple(value)...)
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -61,9 +56,19 @@ func init() {
|
||||
}},
|
||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) { gdb.Go(m, _broad_serve) }},
|
||||
SERVE: {Name: "serve port=9020 host", Hand: func(m *ice.Message, arg ...string) { gdb.Go(m, _broad_serve) }},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(Domain(m.Option(tcp.HOST), m.Option(tcp.PORT))) }},
|
||||
ADMIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT)) + C(m.ActionKey()))
|
||||
}},
|
||||
DREAM: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT)) + C(m.ActionKey()))
|
||||
}},
|
||||
VIMER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT)) + C(m.ActionKey()))
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT))) }},
|
||||
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) { _broad_send(m, "", "", "", "", arg...) }},
|
||||
}, gdb.EventsAction(SERVE_START), mdb.HashAction(mdb.SHORT, "host,port",
|
||||
mdb.FIELD, "time,hash,type,name,host,port,module,version,kernel,arch", mdb.ACTION, OPEN, mdb.SORT, "type,name,host,port"), mdb.ClearOnExitHashAction())},
|
||||
mdb.FIELD, "time,hash,type,name,host,port,module,version,commitTime,compileTime,bootTime,kernel,arch",
|
||||
mdb.ACTION, "admin,dream,vimer,open", mdb.SORT, "type,name,host,port"), mdb.ClearOnExitHashAction())},
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user