code: func (a *Agent) segmentConfig() ([]consul.NetworkSegment, error) {
  	var segments []consul.NetworkSegment
  	config := a.config
  
  	for _, s := range config.Segments {
  		serfConf := consul.DefaultConfig().SerfLANConfig
  
  		serfConf.MemberlistConfig.BindAddr = s.Bind.IP.String()
  		serfConf.MemberlistConfig.BindPort = s.Bind.Port
  		serfConf.MemberlistConfig.AdvertiseAddr = s.Advertise.IP.String()
  		serfConf.MemberlistConfig.AdvertisePort = s.Advertise.Port
  
  		if config.ReconnectTimeoutLAN != 0 {
  			serfConf.ReconnectTimeout = config.ReconnectTimeoutLAN
  		}
  		if config.EncryptVerifyIncoming {
  			serfConf.MemberlistConfig.GossipVerifyIncoming = config.EncryptVerifyIncoming
  		}
  		if config.EncryptVerifyOutgoing {
  			serfConf.MemberlistConfig.GossipVerifyOutgoing = config.EncryptVerifyOutgoing
  		}
  
  		var rpcAddr *net.TCPAddr
  		if s.RPCListener {
  			rpcAddr = &net.TCPAddr{
  				IP:   s.Bind.IP,
  				Port: a.config.ServerPort,
  			}
  		}
  
  		segments = append(segments, consul.NetworkSegment{
  			Name:       s.Name,
  			Bind:       serfConf.MemberlistConfig.BindAddr,
  			Advertise:  serfConf.MemberlistConfig.AdvertiseAddr,
  			Port:       s.Bind.Port,
  			RPCAddr:    rpcAddr,
  			SerfConfig: serfConf,
  		})
  	}
  
  	return segments, nil
  }
docs: // Setup the serf and memberlist config for any defined network segments.