mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt some
This commit is contained in:
parent
809b18abb7
commit
ea23392f7d
@ -41,13 +41,16 @@ func init() {
|
|||||||
m.Optionv(CMD_ERRPUT, p)
|
m.Optionv(CMD_ERRPUT, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
if p := m.Cmdx(nfs.CAT, m.Conf("gdb.signal", kit.Keym(nfs.PATH))); p != "" {
|
m.Cmd(FOREVER, STOP)
|
||||||
m.Cmd(SYSTEM, "kill", "-s", "QUIT", p)
|
|
||||||
}
|
|
||||||
|
|
||||||
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, kit.FileExists(ice.BIN_ICE_BIN)),
|
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, kit.FileExists(ice.BIN_ICE_BIN)),
|
||||||
SERVE, START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg)
|
SERVE, START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg)
|
||||||
}},
|
}},
|
||||||
|
STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if p := m.Cmdx(nfs.CAT, m.Conf("gdb.signal", kit.Keym(nfs.PATH))); p != "" {
|
||||||
|
m.Cmd(SYSTEM, "kill", "-s", "QUIT", p)
|
||||||
|
m.Echo(p)
|
||||||
|
}
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
for {
|
for {
|
||||||
println(kit.Format("%s run %s", kit.Now(), kit.Join(arg, ice.SP)))
|
println(kit.Format("%s run %s", kit.Now(), kit.Join(arg, ice.SP)))
|
||||||
|
@ -47,12 +47,12 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 用户地址
|
// 用户地址
|
||||||
if ip := r.Header.Get("X-Forwarded-For"); ip != "" {
|
if ip := r.Header.Get("X-Real-Ip"); ip != "" {
|
||||||
r.Header.Set(ice.MSG_USERIP, ip)
|
|
||||||
} else if ip := r.Header.Get("X-Real-Ip"); ip != "" {
|
|
||||||
if r.Header.Set(ice.MSG_USERIP, ip); r.Header.Get("X-Real-Port") != "" {
|
if r.Header.Set(ice.MSG_USERIP, ip); r.Header.Get("X-Real-Port") != "" {
|
||||||
r.Header.Set(ice.MSG_USERADDR, ip+":"+r.Header.Get("X-Real-Port"))
|
r.Header.Set(ice.MSG_USERADDR, ip+":"+r.Header.Get("X-Real-Port"))
|
||||||
}
|
}
|
||||||
|
} else if ip := r.Header.Get("X-Forwarded-For"); ip != "" {
|
||||||
|
r.Header.Set(ice.MSG_USERIP, kit.Split(ip)[0])
|
||||||
} else if strings.HasPrefix(r.RemoteAddr, "[") {
|
} else if strings.HasPrefix(r.RemoteAddr, "[") {
|
||||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, "]")[0][1:])
|
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, "]")[0][1:])
|
||||||
} else {
|
} else {
|
||||||
@ -299,6 +299,7 @@ func init() {
|
|||||||
if r.Method == SPIDE_GET {
|
if r.Method == SPIDE_GET {
|
||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case ice.PS:
|
case ice.PS:
|
||||||
|
m.Debug("what %v", 123)
|
||||||
msg := m.Spawn(SERVE, w, r)
|
msg := m.Spawn(SERVE, w, r)
|
||||||
if share := r.URL.Query().Get("share"); share != "" {
|
if share := r.URL.Query().Get("share"); share != "" {
|
||||||
switch msg := msg.Cmd(SHARE, share); msg.Append(mdb.TYPE) {
|
switch msg := msg.Cmd(SHARE, share); msg.Append(mdb.TYPE) {
|
||||||
@ -307,13 +308,16 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.Debug("what %v", 123)
|
||||||
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
|
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
|
||||||
if repos == ice.VOLCANOS {
|
if repos == ice.VOLCANOS {
|
||||||
if s := msg.Cmdx("web.chat.website", "show", "index.iml", "Header", "", "River", ""); s != "" {
|
if s := msg.Cmdx("web.chat.website", "show", "index.iml", "Header", "", "River", ""); s != "" {
|
||||||
|
m.Debug("what %v", 123)
|
||||||
Render(msg, ice.RENDER_RESULT, s)
|
Render(msg, ice.RENDER_RESULT, s)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m.Debug("what %v", 123)
|
||||||
Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
||||||
return true // 网站主页
|
return true // 网站主页
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
|||||||
if s, _, e := websocket.NewClient(s, u, nil, kit.Int(redial["r"]), kit.Int(redial["w"])); !msg.Warn(e) {
|
if s, _, e := websocket.NewClient(s, u, nil, kit.Int(redial["r"]), kit.Int(redial["w"])); !msg.Warn(e) {
|
||||||
msg.Rich(SPACE, nil, kit.Dict(SOCKET, s, kit.SimpleKV("", MASTER, dev, host)))
|
msg.Rich(SPACE, nil, kit.Dict(SOCKET, s, kit.SimpleKV("", MASTER, dev, host)))
|
||||||
msg.Log_CREATE(SPACE, dev, "retry", i, "uri", uri)
|
msg.Log_CREATE(SPACE, dev, "retry", i, "uri", uri)
|
||||||
|
defer msg.Conf(SPACE, kit.KeyHash(name), "")
|
||||||
|
|
||||||
// 连接成功
|
// 连接成功
|
||||||
if i = 0; _space_handle(msg, true, frame.send, s, dev) {
|
if i = 0; _space_handle(msg, true, frame.send, s, dev) {
|
||||||
@ -153,7 +154,11 @@ func _space_exec(msg *ice.Message, source, target []string, c *websocket.Conn, n
|
|||||||
func _space_echo(msg *ice.Message, source, target []string, c *websocket.Conn, name string) {
|
func _space_echo(msg *ice.Message, source, target []string, c *websocket.Conn, name string) {
|
||||||
msg.Optionv(ice.MSG_SOURCE, source)
|
msg.Optionv(ice.MSG_SOURCE, source)
|
||||||
msg.Optionv(ice.MSG_TARGET, target)
|
msg.Optionv(ice.MSG_TARGET, target)
|
||||||
msg.Assert(c.WriteMessage(1, []byte(msg.FormatMeta())))
|
if e := c.WriteMessage(1, []byte(msg.FormatMeta())); msg.Warn(e) {
|
||||||
|
msg.Cmd(mdb.DELETE, msg.PrefixKey(), "", mdb.HASH, mdb.NAME, name)
|
||||||
|
c.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
target = append([]string{name}, target...)
|
target = append([]string{name}, target...)
|
||||||
msg.Log("send", "%v->%v %v %v", source, target, msg.Detailv(), msg.FormatMeta())
|
msg.Log("send", "%v->%v %v %v", source, target, msg.Detailv(), msg.FormatMeta())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user