mirror of
https://2025-dev.shylinux.com/x/20250211-service
synced 2025-04-25 04:38:06 +08:00
opt some
This commit is contained in:
parent
59c5a89325
commit
29b58614cc
8
go.mod
8
go.mod
@ -2,10 +2,10 @@ module 2025-dev.shylinux.com/x/20250211-service
|
||||
|
||||
go 1.13
|
||||
|
||||
require 2025-dev.shylinux.com/x/20250215-cluster v0.0.4
|
||||
require 2025-dev.shylinux.com/x/20250215-cluster v0.0.5
|
||||
|
||||
require (
|
||||
shylinux.com/x/ice v1.5.68
|
||||
shylinux.com/x/icebergs v1.9.70
|
||||
shylinux.com/x/toolkits v1.0.18
|
||||
shylinux.com/x/ice v1.5.71
|
||||
shylinux.com/x/icebergs v1.9.72
|
||||
shylinux.com/x/toolkits v1.0.19
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@ -1,15 +1,15 @@
|
||||
2025-dev.shylinux.com/x/20250215-cluster v0.0.4 h1:Fv6MbAQAAK0ILpswo1yotdp1dqvmHb/gsIr6UsEMU9o=
|
||||
2025-dev.shylinux.com/x/20250215-cluster v0.0.4/go.mod h1:Y/WAz+0Tc5mg8wdUJ2REorcVPN0cI7IDkab2m01hzNQ=
|
||||
2025-dev.shylinux.com/x/20250215-cluster v0.0.5 h1:vZDKGh+RFMRDWNuPkRvIsO2iTvEa5lM5IDq0Tp+Nt4k=
|
||||
2025-dev.shylinux.com/x/20250215-cluster v0.0.5/go.mod h1:a/cnjm6D6vkzZ2rvK8uvU3lSsWUs/NWOWl1uBb+LXLM=
|
||||
shylinux.com/x/go-git/v5 v5.6.7 h1:WD5QSco7m3QooPCgdvQ6/GyGIFPun8C+hex5N41LYlk=
|
||||
shylinux.com/x/go-git/v5 v5.6.7/go.mod h1:Qb0lA+uIrofZg8NQerhYcJHgGWixFqvS6p3aJ/L5Nlk=
|
||||
shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U=
|
||||
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
||||
shylinux.com/x/ice v1.5.68 h1:oFUpwJS3ER6pAmdpHAyQrVdc4YozcHPuRn2UJmUtpFo=
|
||||
shylinux.com/x/ice v1.5.68/go.mod h1:LjHSkg3o+kT3k6lSFJVreez6qiI9ghpnr9Ql94k3+Iw=
|
||||
shylinux.com/x/icebergs v1.9.70 h1:NyoMrTX1Dtf0HosB7GNAO8NODZabdcNw1ZZLSfbhUDw=
|
||||
shylinux.com/x/icebergs v1.9.70/go.mod h1:+4bl7yJRMFtlTQRDLd+xh6b0hwXkqWaHLmx63Jeewwk=
|
||||
shylinux.com/x/ice v1.5.71 h1:5yrs+9uj3xNjsQuuLed/3lfF10syjbHhUT8LJAJqClo=
|
||||
shylinux.com/x/ice v1.5.71/go.mod h1:2KKKi+Jridkkg+NWUrSX9S7Pe5zuwihBaVJ0nNY/FmY=
|
||||
shylinux.com/x/icebergs v1.9.72 h1:y3oVuMZtsI6hX0HLdfgzeDZNSbyoLrVSWl81JQcV+fA=
|
||||
shylinux.com/x/icebergs v1.9.72/go.mod h1:3Bdp3tjzw+hUKJF+kR8pfsrbjAf72DVZmCaE8/MPFtk=
|
||||
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/toolkits v1.0.18 h1:jtQZhmvU10Ajegc87tU0cYFUBSviaODo5TsCXpYb2O4=
|
||||
shylinux.com/x/toolkits v1.0.18/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/toolkits v1.0.19 h1:Nrx0xYRc5ph1WS66EZ1hJUCe+2FdSWQ4QP6tBlguikQ=
|
||||
shylinux.com/x/toolkits v1.0.19/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
||||
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
||||
|
@ -1,8 +1,6 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -11,27 +9,61 @@ import (
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/code"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
"shylinux.com/x/toolkits/task"
|
||||
|
||||
"2025-dev.shylinux.com/x/20250215-cluster/src/travel"
|
||||
)
|
||||
|
||||
type gateway struct {
|
||||
type Gateway struct {
|
||||
travel.Travel
|
||||
list string `name:"list space auto" help:"服务网关"`
|
||||
script string `name:"script dev nodename port" help:"脚本"`
|
||||
list string `name:"list space auto" help:"服务网关"`
|
||||
}
|
||||
|
||||
func (s gateway) List(m *ice.Message, arg ...string) {
|
||||
func (s Gateway) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case ice.DEV:
|
||||
m.SpaceListServer().Table(func(value ice.Maps) {
|
||||
m.Push(arg[0], value[mdb.TEXT])
|
||||
})
|
||||
case web.SPACE:
|
||||
m.Cmd("", s.Foreach).Table(func(value ice.Maps) {
|
||||
m.Push(arg[0], value[web.SPACE])
|
||||
})
|
||||
}
|
||||
}
|
||||
func (s Gateway) Script(m *ice.Message, arg ...string) {
|
||||
m.Option(cli.CTX_ARG, kit.JoinCmdArgs(
|
||||
ice.DEV, m.OptionDefault(ice.DEV, m.Option(ice.MSG_USERHOST)),
|
||||
tcp.NODENAME, m.OptionDefault(tcp.NODENAME, "$(hostname)-service"),
|
||||
tcp.PORT, m.OptionDefault(tcp.PORT, "9032"),
|
||||
))
|
||||
m.Cmdy(code.PUBLISH, nfs.CONTEXTS, nfs.BINARY)
|
||||
}
|
||||
func (s Gateway) List(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Push(cli.GOOS, runtime.GOOS)
|
||||
m.Push(cli.GOARCH, runtime.GOARCH)
|
||||
info := web.Info
|
||||
stat := map[string]int{}
|
||||
m.Cmd(web.DREAM).Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++ })
|
||||
m.PushRecord(stat)
|
||||
m.PushRecord(task.Info())
|
||||
m.Push("main", info.ServeMainCount)
|
||||
m.Push("get", info.ServeGetCount)
|
||||
m.Push("put", info.ServePutCount)
|
||||
m.Push("post", info.ServePostCount)
|
||||
m.Push("delete", info.ServeDeleteCount)
|
||||
m.Push("exec", info.SpaceCmdCount)
|
||||
m.Push("recv", info.SpaceReadCount)
|
||||
m.Push("read", kit.FmtSize(info.SpaceReadByte))
|
||||
m.Push("send", info.SpaceWriteCount)
|
||||
m.Push("write", kit.FmtSize(info.SpaceWriteByte))
|
||||
m.Push(nfs.VERSION, ice.Info.Make.Version)
|
||||
m.Push(mdb.TIME, ice.Info.Make.Time)
|
||||
m.Action(s.Foreach)
|
||||
m.Option(cli.CTX_ARG, kit.JoinCmdArgs(tcp.NODENAME, m.Option(ice.MSG_USERPOD)))
|
||||
m.Cmdy(code.PUBLISH, nfs.CONTEXTS, ice.APP)
|
||||
m.Action(s.Foreach, s.Script)
|
||||
m.Cmdy("", s.Script)
|
||||
} else {
|
||||
m.Cmdy(web.SPACE, arg[0], m.PrefixKey())
|
||||
}
|
||||
}
|
||||
|
||||
func init() { ice.Cmd("web.chat.dev.service.gateway", gateway{}) }
|
||||
func init() { ice.Cmd("web.chat.dev.service.gateway", Gateway{}) }
|
||||
|
36
src/gateway/process.go
Normal file
36
src/gateway/process.go
Normal file
@ -0,0 +1,36 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
type Process struct {
|
||||
Gateway
|
||||
list string `name:"list index auto" help:"功能模块"`
|
||||
}
|
||||
|
||||
func (s Process) Weight(m *ice.Message, arg ...string) {
|
||||
m.Cmdy("").DisplayStoryWeight().Action(s.Weight)
|
||||
}
|
||||
func (s Process) List(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
func() {
|
||||
defer web.InfoLock.Lock()()
|
||||
kit.For(web.Info.Commands, func(key string, value int) {
|
||||
m.Push(ctx.INDEX, key).Push(mdb.COUNT, value)
|
||||
})
|
||||
}()
|
||||
m.PushAction(s.Preview).Action(s.Foreach, s.Weight).SortIntR(mdb.COUNT)
|
||||
} else {
|
||||
m.ProcessField(arg[0], nil)
|
||||
}
|
||||
}
|
||||
func (s Process) Preview(m *ice.Message, arg ...string) {
|
||||
m.ProcessPodCmd(m.Option(web.SPACE), m.Option(ctx.INDEX), nil, arg...)
|
||||
}
|
||||
|
||||
func init() { ice.Cmd("web.chat.dev.service.process", Process{}) }
|
@ -4,4 +4,5 @@ refer `
|
||||
源码 https://git.shylinux.com/dev/service
|
||||
后台 https://dev.shylinux.com/s/20250211-service
|
||||
`
|
||||
field web.chat.dev.service.gateway
|
||||
field web.chat.dev.service.gateway
|
||||
field web.chat.dev.service.process
|
1
src/template/web.code.publish/binary.sh
Normal file
1
src/template/web.code.publish/binary.sh
Normal file
@ -0,0 +1 @@
|
||||
export ctx_dev={{.Option "domain"}}{{.Option "ctx_env"}}; {{.Option "ctx_cli"}} binary {{.Option "ctx_arg"}}
|
Loading…
x
Reference in New Issue
Block a user