// CanForwardAgents returns true if role set allows forwarding agents.
502385
func (set RoleSet) CanForwardAgents() bool {
	for _, role := range set {
		if role.GetOptions().ForwardAgent.Value() {
			return true
		}
	}
	return false
}
674077
func (c *Client) ListPortForwardingRules(p *ListPortForwardingRulesParameter) ([]*PortForwardingRule, error) {
	obj, err := c.Request("listPortForwardingRules", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*PortForwardingRule), err
}
496312
func (g *Cloud) ListRegionForwardingRules(region string) ([]*compute.ForwardingRule, error) {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContext("list", region)
	v, err := g.c.ForwardingRules().List(ctx, region, filter.None)
	return v, mc.Observe(err)
}
548412
func NewForwarder(s *stack.Stack, handler func(*ForwarderRequest)) *Forwarder {
	return &Forwarder{
		stack:   s,
		handler: handler,
	}
}
733869
func NewForwarder(cfg ForwarderConfig) (*Forwarder, error) {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	diskLogger, err := NewDiskSessionLogger(DiskSessionLoggerConfig{
		SessionID:      cfg.SessionID,
		DataDir:        cfg.DataDir,
		RecordSessions: cfg.RecordSessions,
		Namespace:      cfg.Namespace,
		ServerID:       cfg.ServerID,
		Clock:          cfg.Clock,
	})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return &Forwarder{
		ForwarderConfig: cfg,
		sessionLogger:   diskLogger,
	}, nil
}
1083856
func (l *Limiter) GetForwardedForIndexFromBehind() int {
	l.RLock()
	defer l.RUnlock()
	return l.forwardedForIndex
}
570790
func NewForwarder(conf *ForwarderConfig) (ret *Forwarder, err error) {
	conf = pointer.FillDefaultFrom(conf, defaultForwarderConfig).(*ForwarderConfig)
	tr := &http.Transport{
		Proxy:                 http.ProxyFromEnvironment,
		MaxIdleConnsPerHost:   int(*conf.MaxIdleConns * 2),
		ResponseHeaderTimeout: *conf.Timeout,
		Dial: func(network, addr string) (net.Conn, error) {
			return net.DialTimeout(network, addr, *conf.Timeout)
		},
		TLSHandshakeTimeout: *conf.Timeout,
	}
	sendingSink := sfxclient.NewHTTPSink()
	sendingSink.DisableCompression = *conf.DisableCompression
	sendingSink.Client = &http.Client{
		Transport: tr,
		Timeout:   *conf.Timeout,
	}
	sendingSink.AuthToken = *conf.AuthToken
	sendingSink.UserAgent = fmt.Sprintf("SignalfxGateway/%s (gover %s)", *conf.GatewayVersion, runtime.Version())
	sendingSink.DatapointEndpoint = *conf.DatapointURL
	sendingSink.EventEndpoint = *conf.EventURL
	sendingSink.TraceEndpoint = *conf.TraceURL
	ret = &Forwarder{
		defaultAuthToken: sendingSink.AuthToken,
		userAgent:        sendingSink.UserAgent,
		tr:               tr,
		client:           sendingSink.Client,
		jsonMarshal:      conf.JSONMarshal,
		sink:             sendingSink,
		Logger:           conf.Logger,
		stats: stats{
			requests: sfxclient.NewRollingBucket("request_time.ns", map[string]string{
				"direction":   "forwarder",
				"destination": "signalfx",
			}),
			drainSize: sfxclient.NewRollingBucket("drain_size", map[string]string{
				"direction":   "forwarder",
				"destination": "signalfx",
			}),
		},
	}
	err = ret.Setup(conf.Filters)
	if err == nil {
		if conf.TraceSample != nil {
			ret.sampler, err = sampling.New(conf.TraceSample, conf.Logger, sendingSink)
			ret.sampler.ConfigureHTTPSink(sendingSink)
		}
		return ret, err
	}
	return nil, err
}
22994
func (o *Domain) CreateForwardingPathList(child *ForwardingPathList) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
1013597
func (l *Loader) Forwarder(conf *ForwardTo) (protocol.Forwarder, error) {
	if conf.Type == "" {
		return nil, errors.New("type required to load config")
	}
	if l, exists := l.forwarders[conf.Type]; exists {
		return l.Forwarder(conf)
	}
	return nil, errors.Errorf("cannot find config %s", conf.Type)
}
576778
func (g *Cloud) GetRegionForwardingRule(name, region string) (*compute.ForwardingRule, error) {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContext("get", region)
	v, err := g.c.ForwardingRules().Get(ctx, meta.RegionalKey(name, region))
	return v, mc.Observe(err)
}
725998
func (s *PutEmailIdentityFeedbackAttributesInput) SetEmailForwardingEnabled(v bool) *PutEmailIdentityFeedbackAttributesInput {
	s.EmailForwardingEnabled = &v
	return s
}
320264
func (c *Client) ListIpForwardingRules(p *ListIpForwardingRulesParameter) ([]*IpForwardingRule, error) {
	obj, err := c.Request("listIpForwardingRules", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*IpForwardingRule), err
}
474869
func (bow *Browser) shouldRedirect(req *http.Request, _ []*http.Request) error {
	if bow.attributes[FollowRedirects] {
		req.Header.Set("User-Agent", bow.userAgent)
		return nil
	}
	return errors.NewLocation(
		"Redirects are disabled. Cannot follow '%s'.", req.URL.String())
}
1369076
func (r *rpcHandler) forwardLeader(server *serverParts, method string, args interface{}, reply interface{}) error {
	// Handle a missing server
	if server == nil {
		return structs.ErrNoLeader
	}
	return r.connPool.RPC(r.config.Region, server.Addr, server.MajorVersion, method, args, reply)
}
567825
func (s *DomainsService) CreateEmailForward(accountID string, domainIdentifier string, forwardAttributes EmailForward) (*emailForwardResponse, error) {
	path := versioned(emailForwardPath(accountID, domainIdentifier, 0))
	forwardResponse := &emailForwardResponse{}

	resp, err := s.client.post(path, forwardAttributes, forwardResponse)
	if err != nil {
		return nil, err
	}

	forwardResponse.HttpResponse = resp
	return forwardResponse, nil
}
449286
func RequestAgentForwarding(session *ssh.Session) error {
	ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
	if err != nil {
		return err
	}
	if !ok {
		return errors.New("forwarding request denied")
	}
	return nil
}
779436
func NewForward(ctx context.Context, next http.Handler, config config.ForwardAuth, name string) (http.Handler, error) {
	middlewares.GetLogger(ctx, name, forwardedTypeName).Debug("Creating middleware")

	fa := &forwardAuth{
		address:             config.Address,
		authResponseHeaders: config.AuthResponseHeaders,
		next:                next,
		name:                name,
		trustForwardHeader:  config.TrustForwardHeader,
	}

	if config.TLS != nil {
		tlsConfig, err := config.TLS.CreateTLSConfig()
		if err != nil {
			return nil, err
		}

		fa.tlsConfig = tlsConfig
	}

	return fa, nil
}