From 861ff94e5ed3d1820c9589682ca96916865b7574 Mon Sep 17 00:00:00 2001 From: Jinqiu Yu Date: Mon, 26 Feb 2018 09:06:27 +0800 Subject: [PATCH] Fix sniff typo --- app/dispatcher/default.go | 10 +++++----- app/dispatcher/sniffer.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index 16079bf6b..738fbb539 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -55,12 +55,12 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin ctx = proxy.ContextWithTarget(ctx, destination) outbound := ray.NewRay(ctx) - sniferList := proxyman.ProtocoSniffersFromContext(ctx) - if destination.Address.Family().IsDomain() || len(sniferList) == 0 { + snifferList := proxyman.ProtocoSniffersFromContext(ctx) + if destination.Address.Family().IsDomain() || len(snifferList) == 0 { go d.routedDispatch(ctx, outbound, destination) } else { go func() { - domain, err := snifer(ctx, sniferList, outbound) + domain, err := sniffer(ctx, snifferList, outbound) if err == nil { newError("sniffed domain: ", domain).WithContext(ctx).WriteToLog() destination.Address = net.ParseAddress(domain) @@ -72,11 +72,11 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin return outbound, nil } -func snifer(ctx context.Context, sniferList []proxyman.KnownProtocols, outbound ray.OutboundRay) (string, error) { +func sniffer(ctx context.Context, snifferList []proxyman.KnownProtocols, outbound ray.OutboundRay) (string, error) { payload := buf.New() defer payload.Release() - sniffer := NewSniffer(sniferList) + sniffer := NewSniffer(snifferList) totalAttempt := 0 for { select { diff --git a/app/dispatcher/sniffer.go b/app/dispatcher/sniffer.go index a02d81054..f81ba9a02 100644 --- a/app/dispatcher/sniffer.go +++ b/app/dispatcher/sniffer.go @@ -173,10 +173,10 @@ type Sniffer struct { err []error } -func NewSniffer(sniferList []proxyman.KnownProtocols) *Sniffer { +func NewSniffer(snifferList []proxyman.KnownProtocols) *Sniffer { s := new(Sniffer) - for _, protocol := range sniferList { + for _, protocol := range snifferList { var f func([]byte) (string, error) switch protocol { case proxyman.KnownProtocols_HTTP: