forked from x/icebergs
add some
This commit is contained in:
parent
644e80d040
commit
8099e5893c
@ -17,7 +17,7 @@ import (
|
|||||||
func _matrix_list(m *ice.Message, domain string, fields ...string) (server []string) {
|
func _matrix_list(m *ice.Message, domain string, fields ...string) (server []string) {
|
||||||
value := kit.Dict(cli.ParseMake(m.Cmdx(Space(m, domain), cli.RUNTIME)))
|
value := kit.Dict(cli.ParseMake(m.Cmdx(Space(m, domain), cli.RUNTIME)))
|
||||||
value[DOMAIN], value[mdb.TYPE], value[mdb.ICONS] = domain, SERVER, kit.Select(nfs.USR_ICONS_ICEBERGS, ice.SRC_MAIN_ICO, domain == "")
|
value[DOMAIN], value[mdb.TYPE], value[mdb.ICONS] = domain, SERVER, kit.Select(nfs.USR_ICONS_ICEBERGS, ice.SRC_MAIN_ICO, domain == "")
|
||||||
button := []ice.Any{PORTAL, ADMIN, DESKTOP, XTERM, UPGRADE, cli.RUNTIME, WORD, STATUS, VIMER, OPEN}
|
button := []ice.Any{PORTAL, ADMIN, DESKTOP, OPEN, UPGRADE, cli.RUNTIME, WORD, STATUS, VIMER, XTERM}
|
||||||
if domain == "" {
|
if domain == "" {
|
||||||
button = []ice.Any{PORTAL, WORD, STATUS, VIMER, COMPILE, cli.RUNTIME, XTERM, ADMIN, DESKTOP, OPEN}
|
button = []ice.Any{PORTAL, WORD, STATUS, VIMER, COMPILE, cli.RUNTIME, XTERM, ADMIN, DESKTOP, OPEN}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
@ -38,5 +40,5 @@ func ProcessHashPodCmd(m *ice.Message, arg ...string) (msg *ice.Message) {
|
|||||||
func processSpace(m *ice.Message, pod string, arg ...string) {
|
func processSpace(m *ice.Message, pod string, arg ...string) {
|
||||||
m.ProcessField(ctx.ACTION, m.ActionKey(), ctx.RUN, arg)
|
m.ProcessField(ctx.ACTION, m.ActionKey(), ctx.RUN, arg)
|
||||||
m.RewriteAppend(func(value, key string, index int) string { return kit.Select("", value, key != SPACE) })
|
m.RewriteAppend(func(value, key string, index int) string { return kit.Select("", value, key != SPACE) })
|
||||||
m.Push(ice.MSG_SPACE, pod)
|
m.Push(ice.MSG_SPACE, strings.TrimPrefix(pod, "ops."))
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,8 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
|||||||
ice.MSG_LANGUAGE, ice.MSG_THEME, ice.MSG_BG, ice.MSG_FG,
|
ice.MSG_LANGUAGE, ice.MSG_THEME, ice.MSG_BG, ice.MSG_FG,
|
||||||
ice.MSG_RIVER, ice.MSG_STORM, ice.MSG_INDEX, ice.MSG_FIELDS,
|
ice.MSG_RIVER, ice.MSG_STORM, ice.MSG_INDEX, ice.MSG_FIELDS,
|
||||||
ice.MSG_SOURCE, ice.MSG_TARGET,
|
ice.MSG_SOURCE, ice.MSG_TARGET,
|
||||||
|
"task.id", "work.id", "space.timeout",
|
||||||
|
ice.MSG_USERWEB0, ice.MSG_USERPOD0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
m.Render(ice.RENDER_VOID)
|
m.Render(ice.RENDER_VOID)
|
||||||
|
@ -141,8 +141,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
|||||||
switch c := value[mdb.TARGET].(type) {
|
switch c := value[mdb.TARGET].(type) {
|
||||||
case (*websocket.Conn): // 转发报文
|
case (*websocket.Conn): // 转发报文
|
||||||
kit.If(value[mdb.TYPE] == MASTER, func() {
|
kit.If(value[mdb.TYPE] == MASTER, func() {
|
||||||
msg.Option(ice.MSG_USERWEB, value[mdb.TEXT])
|
msg.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, kit.Keys(target[1:]))
|
||||||
msg.Option(ice.MSG_USERPOD, kit.Keys(target[1:]))
|
|
||||||
})
|
})
|
||||||
_space_echo(msg, source, target, c)
|
_space_echo(msg, source, target, c)
|
||||||
case ice.Handler: // 接收响应
|
case ice.Handler: // 接收响应
|
||||||
@ -212,14 +211,15 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
|
|||||||
}
|
}
|
||||||
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
||||||
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.WarnNotValid(!ok, mdb.TARGET) {
|
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.WarnNotValid(!ok, mdb.TARGET) {
|
||||||
kit.If(kit.Format(value[mdb.TYPE]) == MASTER, func() {
|
kit.If(kit.Format(value[mdb.TYPE]) == MASTER && value[mdb.NAME] != ice.OPS, func() {
|
||||||
m.Options(
|
m.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, "", ice.MSG_USERHOST, "", ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name)
|
||||||
ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name,
|
|
||||||
ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, "", ice.MSG_USERHOST, "",
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
kit.For([]string{ice.MSG_USERROLE, ice.LOG_TRACEID}, func(k string) { m.Optionv(k, m.Optionv(k)) })
|
kit.For([]string{ice.MSG_USERROLE, ice.LOG_TRACEID}, func(k string) { m.Optionv(k, m.Optionv(k)) })
|
||||||
kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { m.Optionv(k, m.Optionv(k)) })
|
kit.For(m.Optionv(ice.MSG_OPTS), func(k string) {
|
||||||
|
kit.If(!kit.IsIn(k, "task.id", "work.id"), func() {
|
||||||
|
m.Optionv(k, m.Optionv(k))
|
||||||
|
})
|
||||||
|
})
|
||||||
if withecho {
|
if withecho {
|
||||||
_space_echo(m.Set(ice.MSG_DETAIL, arg...), []string{h}, target, c)
|
_space_echo(m.Set(ice.MSG_DETAIL, arg...), []string{h}, target, c)
|
||||||
} else {
|
} else {
|
||||||
@ -339,7 +339,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, MASTER))
|
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, MASTER))
|
||||||
} else {
|
} else {
|
||||||
m.OptionDefault(ice.MSG_USERPOD, arg[0])
|
// m.OptionDefault(ice.MSG_USERPOD, arg[0])
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
if _space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...); !m.IsErrNotFound() {
|
if _space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...); !m.IsErrNotFound() {
|
||||||
break
|
break
|
||||||
|
@ -21,23 +21,25 @@ type matrix struct {
|
|||||||
|
|
||||||
func (s matrix) List(m *ice.Message, arg ...string) {
|
func (s matrix) List(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(SSH_RELAY, web.DREAM).Table(func(value ice.Maps) {
|
m.Cmdy(SSH_RELAY, web.DREAM).Table(func(value ice.Maps) {
|
||||||
if value[MACHINE] == tcp.LOCALHOST {
|
if value[web.SPACE] == ice.CONTEXTS {
|
||||||
|
m.PushButton(s.Portal, s.Desktop, s.Admin, s.Open, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm)
|
||||||
|
} else if value[MACHINE] == tcp.LOCALHOST {
|
||||||
m.PushButton(s.Portal, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open)
|
m.PushButton(s.Portal, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open)
|
||||||
} else {
|
} else {
|
||||||
m.PushButton(s.Portal, s.Xterm, s.Vimer, s.Runtime, s.Desktop, s.Admin, s.Open)
|
m.PushButton(s.Portal, s.Vimer, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open)
|
||||||
}
|
}
|
||||||
}).Action(html.FILTER).Display("").Sort("type,status,space,machine", []string{web.SERVER, web.WORKER, ""}, []string{cli.START, cli.STOP, ""}, "str_r", "str")
|
}).Action(html.FILTER).Display("").Sort("type,status,space,machine", []string{web.SERVER, web.WORKER, ""}, []string{cli.START, cli.STOP, ""}, "str_r", "str")
|
||||||
}
|
}
|
||||||
func (s matrix) Portal(m *ice.Message, arg ...string) { s.iframe(m, arg...) }
|
func (s matrix) Portal(m *ice.Message, arg ...string) { s.iframe(m, arg...) }
|
||||||
|
func (s matrix) Desktop(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
|
func (s matrix) Admin(m *ice.Message, arg ...string) { s.open(m, arg...) }
|
||||||
|
func (s matrix) Open(m *ice.Message, arg ...string) { s.open(m, arg...) }
|
||||||
func (s matrix) Word(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
func (s matrix) Word(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
func (s matrix) Status(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
func (s matrix) Status(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
func (s matrix) Vimer(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
func (s matrix) Vimer(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
func (s matrix) Compile(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
func (s matrix) Compile(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
func (s matrix) Runtime(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
func (s matrix) Runtime(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
||||||
func (s matrix) Xterm(m *ice.Message, arg ...string) { s.xterm(m, arg...) }
|
func (s matrix) Xterm(m *ice.Message, arg ...string) { s.xterm(m, arg...) }
|
||||||
func (s matrix) Desktop(m *ice.Message, arg ...string) { s.plug(m, arg...) }
|
|
||||||
func (s matrix) Admin(m *ice.Message, arg ...string) { s.open(m, arg...) }
|
|
||||||
func (s matrix) Open(m *ice.Message, arg ...string) { s.open(m, arg...) }
|
|
||||||
|
|
||||||
func init() { ice.Cmd("ssh.matrix", matrix{}) }
|
func init() { ice.Cmd("ssh.matrix", matrix{}) }
|
||||||
|
|
||||||
@ -45,21 +47,17 @@ func (s matrix) plug(m *ice.Message, arg ...string) {
|
|||||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||||
defer m.Push(web.TITLE, s.title(m))
|
defer m.Push(web.TITLE, s.title(m))
|
||||||
}
|
}
|
||||||
m.ProcessPodCmd(kit.Keys(
|
m.ProcessPodCmd(kit.Keys(kit.Select("", ice.OPS, ice.Info.NodeType == web.WORKER), m.Option(MACHINE), m.Option(web.SPACE)), m.ActionKey(), arg, arg...)
|
||||||
kit.Select("", ice.OPS, ice.Info.NodeType == web.WORKER),
|
|
||||||
kit.Select("", m.Option(MACHINE), m.Option(MACHINE) != tcp.LOCALHOST),
|
|
||||||
kit.Select("", m.Option(web.SPACE), m.Option(web.SPACE) != ice.CONTEXTS),
|
|
||||||
), m.ActionKey(), arg, arg...)
|
|
||||||
}
|
}
|
||||||
func (s matrix) xterm(m *ice.Message, arg ...string) {
|
func (s matrix) xterm(m *ice.Message, arg ...string) {
|
||||||
m.ProcessXterm(func() []string {
|
m.ProcessXterm(func() []string {
|
||||||
cmd, dir := cli.SH, ice.CONTEXTS
|
cmd, dir := cli.SH, ice.CONTEXTS
|
||||||
if m.Option(MACHINE) == tcp.LOCALHOST {
|
if m.Option(MACHINE) == "" {
|
||||||
cmd = cli.Shell(m.Message)
|
cmd = cli.Shell(m.Message)
|
||||||
} else {
|
} else {
|
||||||
cmd, dir = m.Option(MACHINE), kit.Select(dir, m.Cmd(SSH_RELAY, m.Option(MACHINE)).Append(web.DREAM))
|
cmd, dir = m.Option(MACHINE), kit.Select(dir, m.Cmd(SSH_RELAY, m.Option(MACHINE)).Append(web.DREAM))
|
||||||
}
|
}
|
||||||
kit.If(m.Option(web.SPACE) != ice.CONTEXTS, func() { dir = path.Join(dir, nfs.USR_LOCAL_WORK+m.Option(web.SPACE)) })
|
kit.If(m.Option(web.SPACE), func() { dir = path.Join(dir, nfs.USR_LOCAL_WORK+m.Option(web.SPACE)) })
|
||||||
return []string{cmd, "", kit.Format("cd ~/%s", dir)}
|
return []string{cmd, "", kit.Format("cd ~/%s", dir)}
|
||||||
}, arg...)
|
}, arg...)
|
||||||
kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push(web.STYLE, html.FLOAT).Push(web.TITLE, s.title(m)) })
|
kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push(web.STYLE, html.FLOAT).Push(web.TITLE, s.title(m)) })
|
||||||
@ -68,22 +66,18 @@ func (s matrix) iframe(m *ice.Message, arg ...string) {
|
|||||||
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
||||||
}
|
}
|
||||||
func (s matrix) open(m *ice.Message, arg ...string) {
|
func (s matrix) open(m *ice.Message, arg ...string) {
|
||||||
if kit.HasPrefixList(arg, ctx.RUN) || m.Option(MACHINE) == tcp.LOCALHOST {
|
if kit.HasPrefixList(arg, ctx.RUN) || m.Option(MACHINE) == "" {
|
||||||
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
||||||
} else {
|
} else {
|
||||||
m.ProcessOpen(s.link(m))
|
m.ProcessOpen(s.link(m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s matrix) link(m *ice.Message, arg ...string) (res string) {
|
func (s matrix) link(m *ice.Message, arg ...string) (res string) {
|
||||||
kit.If(m.Option(MACHINE) != tcp.LOCALHOST, func() { res = m.Cmd(SSH_RELAY, m.Option(MACHINE)).Append(mdb.LINK) })
|
kit.If(m.Option(MACHINE), func(p string) { res = m.Cmd(SSH_RELAY, p).Append(mdb.LINK) })
|
||||||
kit.If(m.Option(web.SPACE) != ice.CONTEXTS, func() { res += web.S(m.Option(web.SPACE)) })
|
kit.If(m.Option(web.SPACE), func(p string) { res += web.S(p) })
|
||||||
kit.If(m.ActionKey() != web.OPEN, func() { res += web.C(m.ActionKey()) })
|
kit.If(m.ActionKey() != web.OPEN, func() { res += web.C(m.ActionKey()) })
|
||||||
return kit.Select(nfs.PS, res)
|
return kit.Select(nfs.PS, res)
|
||||||
}
|
}
|
||||||
func (s matrix) title(m *ice.Message) string {
|
func (s matrix) title(m *ice.Message) string {
|
||||||
return kit.Select(ice.CONTEXTS, kit.Keys(
|
return kit.Select(ice.CONTEXTS, kit.Keys(m.Option(MACHINE), m.Option(web.SPACE), kit.Select("", m.ActionKey(), m.ActionKey() != web.OPEN)))
|
||||||
kit.Select("", m.Option(MACHINE), m.Option(MACHINE) != tcp.LOCALHOST),
|
|
||||||
kit.Select("", m.Option(web.SPACE), m.Option(web.SPACE) != ice.CONTEXTS),
|
|
||||||
kit.Select("", m.ActionKey(), m.ActionKey() != web.OPEN),
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,24 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { var list = {"contexts": {}}, machine = ["localhost"]
|
_init: function(can, msg) { var list = {"": {}}, machine = [""]
|
||||||
msg.Table(function(value) { var space = value.space, _machine = value.machine;
|
msg.Table(function(value) {
|
||||||
|
if (value.space == ice.CONTEXTS) { value.space = "" }
|
||||||
|
if (value.machine == tcp.LOCALHOST) { value.machine = "" }
|
||||||
|
var space = value.space, _machine = value.machine;
|
||||||
machine.indexOf(_machine) == -1 && (machine.push(_machine))
|
machine.indexOf(_machine) == -1 && (machine.push(_machine))
|
||||||
list[space] = list[space]||{}, list[space][_machine] = value })
|
list[space] = list[space]||{}, list[space][_machine] = value
|
||||||
|
})
|
||||||
can.ui = can.page.Appends(can, can._output, [{view: [wiki.CONTENT, html.TABLE], list: [
|
can.ui = can.page.Appends(can, can._output, [{view: [wiki.CONTENT, html.TABLE], list: [
|
||||||
{type: html.THEAD, list: [{type: html.TR, list: can.core.List(machine, function(machine) {
|
{type: html.THEAD, list: [{type: html.TR, list: can.core.List(machine, function(machine) {
|
||||||
return {type: html.TH, list: [can.onimport.item(can, list["contexts"][machine], list)]}
|
return {type: html.TH, list: [can.onimport.item(can, list[""][machine], list)]}
|
||||||
}) }]},
|
}) }]},
|
||||||
{type: html.TBODY, list: can.core.Item(list, function(space, value) { if (space == "contexts") { return }
|
{type: html.TBODY, list: can.core.Item(list, function(space, value) { if (space == "") { return }
|
||||||
return {type: html.TR, list: can.core.List(machine, function(machine) { var item = value[machine]
|
return {type: html.TR, list: can.core.List(machine, function(machine) { var item = value[machine]
|
||||||
return {type: html.TD, list: [item? can.onimport.item(can, item, list): can.onimport.void(can, space, machine, list)]}
|
return {type: html.TD, list: [item? can.onimport.item(can, item, list): can.onimport.void(can, space, machine, list)]}
|
||||||
})}
|
})}
|
||||||
})},
|
})},
|
||||||
] }]), can.onmotion.delay(can, function() { can.Status(mdb.COUNT, can.core.Item(list).length+"x"+can.core.Item(machine).length) })
|
] }]), can.onmotion.delay(can, function() { can.Status(mdb.COUNT, can.core.Item(list).length+"x"+can.core.Item(machine).length) })
|
||||||
},
|
},
|
||||||
void: function(can, space, machine, list) {
|
void: function(can, space, machine, list) {},
|
||||||
return
|
|
||||||
return {view: html.ACTION, _init: function(target) { var worker = list[space]["localhost"], server = list["contexts"][machine]
|
|
||||||
worker && can.onappend.input(can, {type: html.BUTTON, name: code.INSTALL, onclick: function(event) {
|
|
||||||
can.Update(can.request(event, {space: space, machine: machine}, worker), [ctx.ACTION, code.INSTALL])
|
|
||||||
}}, "", target)
|
|
||||||
}}
|
|
||||||
},
|
|
||||||
item: function(can, item, list) {
|
item: function(can, item, list) {
|
||||||
function cb(action) { return function(event) { can.Update(can.request(event, item), [ctx.ACTION, action]) } }
|
function cb(action) { return function(event) { can.Update(can.request(event, item), [ctx.ACTION, action]) } }
|
||||||
return {view: [[html.ITEM, item.type, item.status, can.onimport.style(can, item, list)]], list: [
|
return {view: [[html.ITEM, item.type, item.status, can.onimport.style(can, item, list)]], list: [
|
||||||
@ -32,7 +29,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
]},
|
]},
|
||||||
]}
|
]}
|
||||||
},
|
},
|
||||||
style: function(can, item, list) { var space = item.space, machine = item.machine, worker = list[space]["localhost"]
|
style: function(can, item, list) { var space = item.space, machine = item.machine, worker = list[space][""]
|
||||||
return !worker? html.NOTICE: (worker.status != cli.STOP && item.status != cli.STOP && (item.version != worker.version || item.time < worker.time))? html.DANGER: ""
|
return !worker? html.NOTICE: (worker.status != cli.STOP && item.status != cli.STOP && (item.version != worker.version || item.time < worker.time))? html.DANGER: ""
|
||||||
},
|
},
|
||||||
}, [""])
|
}, [""])
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"shylinux.com/x/websocket"
|
"shylinux.com/x/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const bufs = 10 * ice.MOD_BUFS
|
||||||
|
|
||||||
type Conn struct {
|
type Conn struct {
|
||||||
*websocket.Conn
|
*websocket.Conn
|
||||||
lock task.Lock
|
lock task.Lock
|
||||||
@ -20,10 +22,10 @@ func (c *Conn) WriteMessage(messageType int, data []byte) error {
|
|||||||
return c.Conn.WriteMessage(messageType, data)
|
return c.Conn.WriteMessage(messageType, data)
|
||||||
}
|
}
|
||||||
func Upgrade(w http.ResponseWriter, r *http.Request) (*Conn, error) {
|
func Upgrade(w http.ResponseWriter, r *http.Request) (*Conn, error) {
|
||||||
conn, e := websocket.Upgrade(w, r, nil, ice.MOD_BUFS, ice.MOD_BUFS)
|
conn, e := websocket.Upgrade(w, r, nil, bufs, bufs)
|
||||||
return &Conn{Conn: conn}, e
|
return &Conn{Conn: conn}, e
|
||||||
}
|
}
|
||||||
func NewClient(c net.Conn, u *url.URL) (*Conn, error) {
|
func NewClient(c net.Conn, u *url.URL) (*Conn, error) {
|
||||||
conn, _, e := websocket.NewClient(c, u, nil, ice.MOD_BUFS, ice.MOD_BUFS)
|
conn, _, e := websocket.NewClient(c, u, nil, bufs, bufs)
|
||||||
return &Conn{Conn: conn}, e
|
return &Conn{Conn: conn}, e
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user