From 1a643651c025d9fab1937924404e985bd9b24ad3 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sun, 29 Jan 2023 20:45:13 +0800 Subject: [PATCH] add new options for chain node --- chain/node.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/chain/node.go b/chain/node.go index 4bea0e3..ab216a0 100644 --- a/chain/node.go +++ b/chain/node.go @@ -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