add new options for chain node

This commit is contained in:
ginuerzh 2023-01-29 20:45:13 +08:00
parent 1a8c1ccb1d
commit 1a643651c0

View File

@ -8,6 +8,16 @@ import (
"github.com/go-gost/core/selector"
)
type HTTPNodeSettings struct {
Host string
Header map[string]string
}
type TLSNodeSettings struct {
ServerName string
Secure bool
}
type NodeOptions struct {
Transport *Transport
Bypass bypass.Bypass
@ -16,6 +26,8 @@ type NodeOptions struct {
Metadata metadata.Metadata
Host string
Protocol string
HTTP *HTTPNodeSettings
TLS *TLSNodeSettings
}
type NodeOption func(*NodeOptions)
@ -62,6 +74,18 @@ func MetadataNodeOption(md metadata.Metadata) NodeOption {
}
}
func HTTPNodeOption(httpSettings *HTTPNodeSettings) NodeOption {
return func(o *NodeOptions) {
o.HTTP = httpSettings
}
}
func TLSNodeOption(tlsSettings *TLSNodeSettings) NodeOption {
return func(o *NodeOptions) {
o.TLS = tlsSettings
}
}
type Node struct {
Name string
Addr string