# Google API Common Protos Client - Class Peer (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class Peer.

This message defines attributes for a node that handles a network request.

The node can be either a service or an application that sends, forwards,
or receives the request. Service peers should fill in
`principal` and `labels` as appropriate.

Generated from protobuf message `google.rpc.context.AttributeContext.Peer`

## Namespace

Google \\ Rpc \\ Context \\ AttributeContext

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ ip` | `string` The IP address of the peer. |
| `↳ port` | `int|string` The network port of the peer. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` The labels associated with the peer. |
| `↳ principal` | `string` The identity of this peer. Similar to `Request.auth.principal`, but relative to the peer instead of the request. For example, the identity associated with a load balancer that forwarded the request. |
| `↳ region_code` | `string` The CLDR country/region code associated with the above IP address. If the IP address is private, the `region_code` should reflect the physical location where this peer is running. |

### getIp

The IP address of the peer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setIp

The IP address of the peer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPort

The network port of the peer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int|string` |   |

### setPort

The network port of the peer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int|string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

The labels associated with the peer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

The labels associated with the peer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPrincipal

The identity of this peer. Similar to `Request.auth.principal`, but
relative to the peer instead of the request. For example, the
identity associated with a load balancer that forwarded the request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setPrincipal

The identity of this peer. Similar to `Request.auth.principal`, but
relative to the peer instead of the request. For example, the
identity associated with a load balancer that forwarded the request.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRegionCode

The CLDR country/region code associated with the above IP address.

If the IP address is private, the `region_code` should reflect the
physical location where this peer is running.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setRegionCode

The CLDR country/region code associated with the above IP address.

If the IP address is private, the `region_code` should reflect the
physical location where this peer is running.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |