示例#1
0
文件: app.go 项目: Alienero/IamServer
func initLua(luapath string) *callback.Lua {
	cl := callback.NewLua(lua.NewGolua())
	cl.SetLuaPath(luapath)
	// load lua callback module
	cl.InitCallBackModule()
	// load lua callback functions.
	cl.SetAddrMappingFn()
	cl.SetRtmpAccessCheck()
	cl.SetFlvAccessCheck()
	cl.SetIMAccessCheck()

	return cl
}
示例#2
0
//	    / _\ | |/ _ \ \/ / | '_ \| |/ _ \
//	   / /   | |  __/>  <| | |_) | |  __/
//	   \/    |_|\___/_/\_\_|_.__/|_|\___|

package callback

import (
	"fmt"
	"os"
	"path/filepath"
	"testing"

	"github.com/Alienero/IamServer/lua"
)

var L = NewLua(lua.NewGolua())

func TestLuaInit(t *testing.T) {
	gopath := os.Getenv("GOPATH")
	t.Logf("GOPATH:%v", gopath)
	L.SetLuaPath(filepath.Join(gopath, "/src/github.com/Alienero/IamServer/test/lua/"))
	L.InitCallBackModule()

	// load callback method
	L.SetAddrMappingFn()
	L.SetRtmpAccessCheck()
	L.SetFlvAccessCheck()
	L.SetIMAccessCheck()
}

func TestMapping(t *testing.T) {