-
Notifications
You must be signed in to change notification settings - Fork 15
/
http_plugin_impl.go
40 lines (32 loc) · 1012 Bytes
/
http_plugin_impl.go
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
package http_plugin
import (
"github.com/eosspark/eos-go/common"
"github.com/eosspark/eos-go/libraries/asio"
"net"
"net/http"
)
type NextFunction = func(interface{})
type UrlResponseCallback = func(int, []byte)
type UrlHandler = func(source string, body []byte, cb UrlResponseCallback)
type HttpPluginImpl struct {
UrlHandlers map[string]UrlHandler
AccessControlAllowOrigin string
AccessControlAllowHeaders string
AccessControlMaxAge string
AccessControlAllowCredentials bool //default false
MaxBodySize common.SizeT
httpsCeryChain string
httpsKey string
listenStr string
ListenEndpoint *http.ServeMux
HttpsListenEndpoint *http.ServeMux
Listener net.Listener
//Handlers *rpc.Server
self *HttpPlugin
}
func NewHttpPluginImpl(io *asio.IoContext) *HttpPluginImpl {
impl := new(HttpPluginImpl)
impl.UrlHandlers = make(map[string]UrlHandler)
impl.AccessControlAllowCredentials = false
return impl
}