// exposeAssignedIPs sets up iptables forwarding rules for endpoints with
// assigned ips.
548730
func (a *HostAgent) exposeAssignedIPs(state *zkservice.ServiceState, ctr *docker.Container) {
	logger := plog.WithFields(log.Fields{
		"containerid":   state.ContainerID,
		"containername": ctr.Name,
	})

	protocols := map[string]struct{}{}

	if ip := state.AssignedIP; ip != "" {
		for _, exp := range state.Exports {
			if port := exp.AssignedPortNumber; port > 0 {
				explog := logger.WithFields(log.Fields{
					"application": exp.Application,
					"ipaddress":   ip,
					"portnumber":  port,
				})
				explog.Debug("Starting proxy for endpoint")
				public := iptables.NewAddress(ip, int(port))
				private := iptables.NewAddress(state.PrivateIP, int(exp.PortNumber))
				if a.conntrackFlush {
					if _, ok := protocols[exp.Protocol]; !ok {
						if err := flushConntrack(exp.Protocol); err != nil {
							plog.WithError(err).WithFields(log.Fields{
								"protocol": exp.Protocol,
							}).Warn("Unable to flush conntrack table")
						}
						protocols[exp.Protocol] = struct{}{}
					}
				}
				a.servicedChain.Forward(iptables.Add, exp.Protocol, public, private)
				defer a.servicedChain.Forward(iptables.Delete, exp.Protocol, public, private)
			}
		}

		ctr.Wait(time.Hour * 24 * 365)
	}
}
674673
func (s *Accelerator) SetIpAddressType(v string) *Accelerator {
	s.IpAddressType = &v
	return s
}
384640
func (api *API) AssignServerIp(server_id string, ip_type string) (*Server, error) {
	data := typeField{Type: ip_type}
	result := new(Server)
	url := createUrl(api, serverPathSegment, server_id, "ips")
	err := api.Client.Post(url, &data, &result, http.StatusCreated)
	if err != nil {
		return nil, err
	}
	result.api = api
	result.decodeRaws()
	return result, nil
}
1362388
func (se *ServiceEndpoint) SetAssignment(aa addressassignment.AddressAssignment) error {
	if se.AddressConfig.Port == 0 {
		return errors.New("cannot assign address to endpoint without AddressResourceConfig")
	}
	se.AddressAssignment = aa
	return nil
}
306045
func (s *Workspace) SetIpAddress(v string) *Workspace {
	s.IpAddress = &v
	return s
}
665986
func (s *StaticIp) SetIpAddress(v string) *StaticIp {
	s.IpAddress = &v
	return s
}
544499
func flattenNetworkInterfacesPrivateIPAddresses(dtos []*ec2.NetworkInterfacePrivateIpAddress) []string {
	ips := make([]string, 0, len(dtos))
	for _, v := range dtos {
		ip := *v.PrivateIpAddress
		ips = append(ips, ip)
	}
	return ips
}
851405
func (s *NetworkInterface) SetPrivateIpAddresses(v []*PrivateIp) *NetworkInterface {
	s.PrivateIpAddresses = v
	return s
}
535623
func (s *AgentNetworkInfo) SetIpAddress(v string) *AgentNetworkInfo {
	s.IpAddress = &v
	return s
}
1084803
func (s *AgentPreview) SetIpv4Address(v string) *AgentPreview {
	s.Ipv4Address = &v
	return s
}
1313764
func (r *PURuntime) IPAddresses() ExtendedMap {
	r.Lock()
	defer r.Unlock()

	return r.ips.Copy()
}
1177400
func (s *SetIpAddressTypeInput) SetIpAddressType(v string) *SetIpAddressTypeInput {
	s.IpAddressType = &v
	return s
}
1258704
func (c *Client) SetIPs(r addressassignment.AssignmentRequest) error {
	return c.call("SetIPs", r, new(string))
}
461779
func (s *IPSet) SetIPSetDescriptors(v []*IPSetDescriptor) *IPSet {
	s.IPSetDescriptors = v
	return s
}
808412
func (s *Instance) SetPrivateIpAddress(v string) *Instance {
	s.PrivateIpAddress = &v
	return s
}
448834
func (this *ControlPlaneDao) AssignIPs(assignmentRequest addressassignment.AssignmentRequest, _ *int) error {
	return this.facade.AssignIPs(datastore.Get(), assignmentRequest)
}
300726
func (a *api) AssignIP(config IPConfig) error {
	client, err := a.connectDAO()
	if err != nil {
		return err
	}

	req := addressassignment.AssignmentRequest{
		ServiceID:      config.ServiceID,
		IPAddress:      config.IPAddress,
		AutoAssignment: config.IPAddress == "",
	}

	if err := client.AssignIPs(req, nil); err != nil {
		return err
	}

	return nil
}