# Services

Source: https://tiltas.openpanel.sh/docs/concepts/services

> A program on a Device that the Network reaches by its own name, and opens to only the people you choose.

A **Service** is something running on a Device that your Network reaches by its own name, such as `gitea` for port 3000
on the Server `home`. Opening a Service to someone opens that one program, and nothing else on the Device.

> Diagram: a browser on an allowed Device opens http://gitea. The Device that hosts the Service checks who is asking, then passes the request to the target, such as localhost:3000. Nothing else on that Device is opened.

## Web and TCP

| | Web Service | TCP Service |
|---|---|---|
| For | websites and web apps | databases, game servers, SSH and other programs that want an IP address |
| Opens at | `http://gitea` | its own Service address, such as `100.96.0.7`, or `postgres:5432` |
| Who may open it | checked on every request | checked for every connection |
| Ports | 80 on the hosting Device | the ports you list (all when empty) |

## Where it runs

A Service is served by Tiltas on the Device that hosts it, not by a server in between, so traffic stays direct between
the two Devices.

- **A Web Service**: Tiltas on the hosting Device answers on the Device's address, port 80, picks the Service by the name
  in the request, checks that the caller may open that Service, and passes the request to the **target**, such as
  `localhost:3000`. An unknown name gets a plain "not found" page that names no other Service; a caller who is not
  allowed gets "forbidden".
- **A TCP Service**: the hosting Device takes connections to the Service address on the Service's ports and passes them
  to the target.

The target is `host:port` as seen from the hosting Device: a program on the Device itself, or another computer on its
LAN, such as `192.168.1.20:8123`. Addresses of cloud metadata services are refused. See
[What a target can be](/docs/services/targets).

## Who can open it

Each Service has its own **Who can open it**: everyone in the Network, or chosen Members, Groups and Devices. Everyone
else is refused, even other programs on the same Device. A new Service with nobody chosen stays closed. Access rules
can also name a Service as what may be reached; see [The access model](/docs/concepts/access-model).

## Who it is

With **Tell the program who is asking** on, a Web Service receives headers that say which Device, and for a Personal
device which Member, made the request. Tiltas sets them itself and removes any the visitor sent, so they cannot be
forged. See [Identity headers](/docs/services/identity-headers).

## Health

The hosting Device checks now and then that the target answers: a TCP connection within 2 seconds, or for a Web Service
a response to `GET /` that is not a server error. The console shows the result. See [Health checks](/docs/services/health).

## HTTPS

Web Services answer on `http://name` today. HTTPS names for Web Services are built but not switched on yet; see
[HTTPS for Web Services](/docs/services/https) for what is on and what is not.

## Who can add one

The Device's owner or an Owner or Admin can add Services to a Device, change them and remove them. Removing a Device
deletes its Services.

Create one: [Services](/docs/services).
