lint: fix warning by removing reference to deprecated interface

pull/10161/head
Daniel Nephin 4 years ago
parent 9a7fb48dcb
commit 6713afdff3

@ -21,7 +21,6 @@ import (
connlimit "github.com/hashicorp/go-connlimit"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-memdb"
"github.com/hashicorp/memberlist"
"github.com/hashicorp/raft"
autopilot "github.com/hashicorp/raft-autopilot"
raftboltdb "github.com/hashicorp/raft-boltdb"
@ -35,6 +34,7 @@ import (
"github.com/hashicorp/consul/agent/consul/fsm"
"github.com/hashicorp/consul/agent/consul/state"
"github.com/hashicorp/consul/agent/consul/usagemetrics"
"github.com/hashicorp/consul/agent/consul/wanfed"
agentgrpc "github.com/hashicorp/consul/agent/grpc"
"github.com/hashicorp/consul/agent/metadata"
"github.com/hashicorp/consul/agent/pool"
@ -251,7 +251,7 @@ type Server struct {
// serfWAN is the Serf cluster maintained between DC's
// which SHOULD only consist of Consul servers
serfWAN *serf.Serf
memberlistTransportWAN memberlist.IngestionAwareTransport
memberlistTransportWAN wanfed.IngestionAwareTransport
gatewayLocator *GatewayLocator
// serverLookup tracks server consuls in the local datacenter.
@ -500,7 +500,7 @@ func NewServer(config *Config, flat Deps) (*Server, error) {
// This is always a *memberlist.NetTransport or something which wraps
// it which satisfies this interface.
s.memberlistTransportWAN = config.SerfWANConfig.MemberlistConfig.Transport.(memberlist.IngestionAwareTransport)
s.memberlistTransportWAN = config.SerfWANConfig.MemberlistConfig.Transport.(wanfed.IngestionAwareTransport)
// See big comment above why we are doing this.
if serfBindPortWAN == 0 {

@ -8,10 +8,11 @@ import (
"strings"
"time"
"github.com/hashicorp/memberlist"
"github.com/hashicorp/consul/agent/pool"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/tlsutil"
"github.com/hashicorp/memberlist"
)
const (
@ -29,9 +30,15 @@ const (
type MeshGatewayResolver func(datacenter string) string
type IngestionAwareTransport interface {
memberlist.NodeAwareTransport
IngestPacket(conn net.Conn, addr net.Addr, now time.Time, shouldClose bool) error
IngestStream(conn net.Conn) error
}
func NewTransport(
tlsConfigurator *tlsutil.Configurator,
transport memberlist.NodeAwareTransport,
transport IngestionAwareTransport,
datacenter string,
gwResolver MeshGatewayResolver,
) (*Transport, error) {
@ -48,7 +55,7 @@ func NewTransport(
}
t := &Transport{
NodeAwareTransport: transport,
IngestionAwareTransport: transport,
tlsConfigurator: tlsConfigurator,
datacenter: datacenter,
gwResolver: gwResolver,
@ -58,7 +65,7 @@ func NewTransport(
}
type Transport struct {
memberlist.NodeAwareTransport
IngestionAwareTransport
tlsConfigurator *tlsutil.Configurator
datacenter string
@ -71,7 +78,7 @@ var _ memberlist.NodeAwareTransport = (*Transport)(nil)
// Shutdown implements memberlist.Transport.
func (t *Transport) Shutdown() error {
err1 := t.pool.Close()
err2 := t.NodeAwareTransport.Shutdown()
err2 := t.IngestionAwareTransport.Shutdown()
if err2 != nil {
// the more important error is err2
return err2
@ -118,7 +125,7 @@ func (t *Transport) WriteToAddress(b []byte, addr memberlist.Address) (time.Time
return time.Now(), nil
}
return t.NodeAwareTransport.WriteToAddress(b, addr)
return t.IngestionAwareTransport.WriteToAddress(b, addr)
}
// DialAddressTimeout implements memberlist.NodeAwareTransport.
@ -137,7 +144,7 @@ func (t *Transport) DialAddressTimeout(addr memberlist.Address, timeout time.Dur
return t.dial(dc, node, pool.ALPN_WANGossipStream, gwAddr)
}
return t.NodeAwareTransport.DialAddressTimeout(addr, timeout)
return t.IngestionAwareTransport.DialAddressTimeout(addr, timeout)
}
// NOTE: There is a close mirror of this method in agent/pool/pool.go:DialTimeoutWithRPCType

Loading…
Cancel
Save