-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.go
33 lines (27 loc) · 938 Bytes
/
metadata.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
package mtcp
import (
"time"
mdata "github.com/dolfly/core/metadata"
mdutil "github.com/dolfly/core/metadata/util"
"github.com/dolfly/x/internal/util/mux"
)
type metadata struct {
handshakeTimeout time.Duration
muxCfg *mux.Config
}
func (d *mtcpDialer) parseMetadata(md mdata.Metadata) (err error) {
d.md.handshakeTimeout = mdutil.GetDuration(md, "handshakeTimeout")
d.md.muxCfg = &mux.Config{
Version: mdutil.GetInt(md, "mux.version"),
KeepAliveInterval: mdutil.GetDuration(md, "mux.keepaliveInterval"),
KeepAliveDisabled: mdutil.GetBool(md, "mux.keepaliveDisabled"),
KeepAliveTimeout: mdutil.GetDuration(md, "mux.keepaliveTimeout"),
MaxFrameSize: mdutil.GetInt(md, "mux.maxFrameSize"),
MaxReceiveBuffer: mdutil.GetInt(md, "mux.maxReceiveBuffer"),
MaxStreamBuffer: mdutil.GetInt(md, "mux.maxStreamBuffer"),
}
if d.md.muxCfg.Version == 0 {
d.md.muxCfg.Version = 2
}
return
}