From 8e4fc06cf1b7f87db24b04712b990baddfb53082 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Thu, 9 Nov 2023 20:33:12 +0800 Subject: [PATCH] add more node options --- chain/node.go | 12 ++++++++++++ hop/hop.go | 13 ++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/chain/node.go b/chain/node.go index 4389de8..f2d7f20 100644 --- a/chain/node.go +++ b/chain/node.go @@ -17,6 +17,11 @@ type HTTPNodeSettings struct { type TLSNodeSettings struct { ServerName string Secure bool + Options struct { + MinVersion string + MaxVersion string + CipherSuites []string + } } type NodeOptions struct { @@ -28,6 +33,7 @@ type NodeOptions struct { Host string Network string Protocol string + Path string HTTP *HTTPNodeSettings TLS *TLSNodeSettings Auther auth.Authenticator @@ -77,6 +83,12 @@ func ProtocolNodeOption(protocol string) NodeOption { } } +func PathNodeOption(path string) NodeOption { + return func(o *NodeOptions) { + o.Path = path + } +} + func MetadataNodeOption(md metadata.Metadata) NodeOption { return func(o *NodeOptions) { o.Metadata = md diff --git a/hop/hop.go b/hop/hop.go index 026d0c2..0442813 100644 --- a/hop/hop.go +++ b/hop/hop.go @@ -9,8 +9,9 @@ import ( type SelectOptions struct { Network string Addr string - Host string Protocol string + Host string + Path string } type SelectOption func(*SelectOptions) @@ -27,15 +28,21 @@ func AddrSelectOption(addr string) SelectOption { } } +func ProtocolSelectOption(protocol string) SelectOption { + return func(o *SelectOptions) { + o.Protocol = protocol + } +} + func HostSelectOption(host string) SelectOption { return func(o *SelectOptions) { o.Host = host } } -func ProtocolSelectOption(protocol string) SelectOption { +func PathSelectOption(path string) SelectOption { return func(o *SelectOptions) { - o.Protocol = protocol + o.Path = path } }