add tun/tap
This commit is contained in:
@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
tls_util "github.com/go-gost/gost/pkg/common/util/tls"
|
||||
md "github.com/go-gost/gost/pkg/metadata"
|
||||
mdata "github.com/go-gost/gost/pkg/metadata"
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
@ -14,7 +14,7 @@ type metadata struct {
|
||||
handshakeTimeout time.Duration
|
||||
}
|
||||
|
||||
func (d *tlsDialer) parseMetadata(md md.Metadata) (err error) {
|
||||
func (d *tlsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
const (
|
||||
certFile = "certFile"
|
||||
keyFile = "keyFile"
|
||||
@ -25,19 +25,19 @@ func (d *tlsDialer) parseMetadata(md md.Metadata) (err error) {
|
||||
handshakeTimeout = "handshakeTimeout"
|
||||
)
|
||||
|
||||
sn, _, _ := net.SplitHostPort(md.GetString(serverName))
|
||||
sn, _, _ := net.SplitHostPort(mdata.GetString(md, serverName))
|
||||
if sn == "" {
|
||||
sn = "localhost"
|
||||
}
|
||||
d.md.tlsConfig, err = tls_util.LoadClientConfig(
|
||||
md.GetString(certFile),
|
||||
md.GetString(keyFile),
|
||||
md.GetString(caFile),
|
||||
md.GetBool(secure),
|
||||
mdata.GetString(md, certFile),
|
||||
mdata.GetString(md, keyFile),
|
||||
mdata.GetString(md, caFile),
|
||||
mdata.GetBool(md, secure),
|
||||
sn,
|
||||
)
|
||||
|
||||
d.md.handshakeTimeout = md.GetDuration(handshakeTimeout)
|
||||
d.md.handshakeTimeout = mdata.GetDuration(md, handshakeTimeout)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
tls_util "github.com/go-gost/gost/pkg/common/util/tls"
|
||||
md "github.com/go-gost/gost/pkg/metadata"
|
||||
mdata "github.com/go-gost/gost/pkg/metadata"
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
@ -21,7 +21,7 @@ type metadata struct {
|
||||
muxMaxStreamBuffer int
|
||||
}
|
||||
|
||||
func (d *mtlsDialer) parseMetadata(md md.Metadata) (err error) {
|
||||
func (d *mtlsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
const (
|
||||
certFile = "certFile"
|
||||
keyFile = "keyFile"
|
||||
@ -39,25 +39,25 @@ func (d *mtlsDialer) parseMetadata(md md.Metadata) (err error) {
|
||||
muxMaxStreamBuffer = "muxMaxStreamBuffer"
|
||||
)
|
||||
|
||||
sn, _, _ := net.SplitHostPort(md.GetString(serverName))
|
||||
sn, _, _ := net.SplitHostPort(mdata.GetString(md, serverName))
|
||||
if sn == "" {
|
||||
sn = "localhost"
|
||||
}
|
||||
d.md.tlsConfig, err = tls_util.LoadClientConfig(
|
||||
md.GetString(certFile),
|
||||
md.GetString(keyFile),
|
||||
md.GetString(caFile),
|
||||
md.GetBool(secure),
|
||||
mdata.GetString(md, certFile),
|
||||
mdata.GetString(md, keyFile),
|
||||
mdata.GetString(md, caFile),
|
||||
mdata.GetBool(md, secure),
|
||||
sn,
|
||||
)
|
||||
d.md.handshakeTimeout = md.GetDuration(handshakeTimeout)
|
||||
d.md.handshakeTimeout = mdata.GetDuration(md, handshakeTimeout)
|
||||
|
||||
d.md.muxKeepAliveDisabled = md.GetBool(muxKeepAliveDisabled)
|
||||
d.md.muxKeepAliveInterval = md.GetDuration(muxKeepAliveInterval)
|
||||
d.md.muxKeepAliveTimeout = md.GetDuration(muxKeepAliveTimeout)
|
||||
d.md.muxMaxFrameSize = md.GetInt(muxMaxFrameSize)
|
||||
d.md.muxMaxReceiveBuffer = md.GetInt(muxMaxReceiveBuffer)
|
||||
d.md.muxMaxStreamBuffer = md.GetInt(muxMaxStreamBuffer)
|
||||
d.md.muxKeepAliveDisabled = mdata.GetBool(md, muxKeepAliveDisabled)
|
||||
d.md.muxKeepAliveInterval = mdata.GetDuration(md, muxKeepAliveInterval)
|
||||
d.md.muxKeepAliveTimeout = mdata.GetDuration(md, muxKeepAliveTimeout)
|
||||
d.md.muxMaxFrameSize = mdata.GetInt(md, muxMaxFrameSize)
|
||||
d.md.muxMaxReceiveBuffer = mdata.GetInt(md, muxMaxReceiveBuffer)
|
||||
d.md.muxMaxStreamBuffer = mdata.GetInt(md, muxMaxStreamBuffer)
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user