Exemplo n.º 1
0
// remote: remote address, url: HTTP request URL
func (l *Lua) FlvAccessCheck(remote, url, path string, form url.Values, cookies []*http.Cookie) bool {
	fms := lua.NewTalbe()
	for k, rs := range form {
		slice := lua.NewTalbe()
		slice.Append(rs)
		fms.Set(k, slice)
	}
	cs := lua.NewTalbe()
	for n, cookie := range cookies {
		c := lua.NewTalbe()
		c.Set("name", cookie.Name)
		c.Set("value", cookie.Value)
		cs.SetInt(n, c)
	}
	rets, err := l.gl.Call(l.flvAccessCheck, remote, url, path, fms, cs)
	if err != nil {
		panic(err)
	}
	return lua.GetBool(rets[0])
}
Exemplo n.º 2
0
// remote: remote address, url: HTTP request URL
func (l *Lua) IMAccessCheck(remote, url, path string, form url.Values, cookies []*http.Cookie) (string, byte, bool) {
	fms := lua.NewTalbe()
	for k, rs := range form {
		slice := lua.NewTalbe()
		slice.Append(rs)
		fms.Set(k, slice)
	}
	cs := lua.NewTalbe()
	for n, cookie := range cookies {
		c := lua.NewTalbe()
		c.Set("name", cookie.Name)
		c.Set("value", cookie.Value)
		cs.SetInt(n, c)
	}
	rets, err := l.gl.Call(l.imAccessCheck, remote, url, path, fms, cs)
	if err != nil {
		return "", 0, false
	}
	return lua.GetString(rets[0]), byte(lua.GetNumber(rets[1])), lua.GetBool(rets[2])
}