aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/net/server.d.tl
blob: bb61f677868a3b014a189f2385e816e632145526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local record server
	record LuaSocketTCP
	end
	record LuaSecCTX
	end

	record extra_settings
	end

	record interface
	end
	enum socket_type
		"tcp"
		"tcp6"
		"tcp4"
	end

	record listeners
		onconnect : function (interface)
		ondetach : function (interface)
		onattach : function (interface, string)
		onincoming : function (interface, string, string)
		ondrain : function (interface)
		onreadtimeout : function (interface)
		onstarttls : function (interface)
		onstatus : function (interface, string)
		ondisconnect : function (interface, string)
	end

	get_backend : function () : string

	type port = string | integer
	enum read_mode
		"*a"
		"*l"
	end
	type read_size = read_mode | integer
	addserver : function (string, port, listeners, read_size, LuaSecCTX) : interface
	addclient : function (string, port, listeners, read_size, LuaSecCTX, socket_type, extra_settings) : interface
	record listen_config
		read_size : read_size
		tls_ctx : LuaSecCTX
		tls_direct : boolean
		sni_hosts : { string : LuaSecCTX }
	end
	listen : function (string, port, listeners, listen_config) : interface
	enum quitting
		"quitting"
	end
	loop : function () : quitting
	closeall : function ()
	setquitting : function (boolean | quitting)

	wrapclient : function (LuaSocketTCP, string, port, listeners, read_size, LuaSecCTX, extra_settings) : interface
	wrapserver : function (LuaSocketTCP, string, port, listeners, listen_config) : interface
	watchfd : function (integer | LuaSocketTCP, function (interface), function (interface)) : interface
	link : function ()

	record config
	end
	set_config : function (config)

end

return server