add new options for chain node
This commit is contained in:
parent
1a8c1ccb1d
commit
1a643651c0
@ -8,6 +8,16 @@ import (
|
|||||||
"github.com/go-gost/core/selector"
|
"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 {
|
type NodeOptions struct {
|
||||||
Transport *Transport
|
Transport *Transport
|
||||||
Bypass bypass.Bypass
|
Bypass bypass.Bypass
|
||||||
@ -16,6 +26,8 @@ type NodeOptions struct {
|
|||||||
Metadata metadata.Metadata
|
Metadata metadata.Metadata
|
||||||
Host string
|
Host string
|
||||||
Protocol string
|
Protocol string
|
||||||
|
HTTP *HTTPNodeSettings
|
||||||
|
TLS *TLSNodeSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeOption func(*NodeOptions)
|
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 {
|
type Node struct {
|
||||||
Name string
|
Name string
|
||||||
Addr string
|
Addr string
|
||||||
|
Loading…
Reference in New Issue
Block a user