go links provide short, memorable links for the websites you and your team use most.
Creating go links
All go links have a short name and a destination link that the go link points to. Some notes on short names:
- names must start with a letter or number
- names may contain letters, numbers, hyphens, and periods
- names are not case-sensitive (go/foo is the same as go/FOO)
- hyphens are ignored when resolving links (go/meetingnotes is the same as go/meeting-notes)
In simple cases, the destination link is an absolute URL, such as https://www.google.com/.
Resolving links
When logged in to your Tailscale network, go links can be entered directly into any browser or command line utility such as curl. You do not need any additional browser extensions.
Any additional path provided after the short name will be added to the end of the destination link. For example, if go/who goes to your company directory at http://directory/, then go/who/amelie will go to http://directory/amelie.
Advanced destination links allow you to further customize this behavior.
Advanced destination links
To have more control over how go links are resolved, destination links can use Go template syntax. Templates are provided a data structure with the following fields:
.Pathis the remaining path value after the short name (without a leading slash). For the link go/who/amelie, the value of.Pathisamelie..Nowis a time.Time value representing the current date and time..Useris the current user resolving the link. This is the email address of the user or{username}@githubfor tailnets that use GitHub authentication.
PathEscapeis the url.PathEscape function for escaping values inside a URL path.QueryEscapeis the url.QueryEscape function for escaping values inside a URL query.TrimPrefixis the strings.TrimPrefix function for removing a leading prefix.TrimSuffixis the strings.TrimSuffix function for removing a trailing suffix.ToLoweris the strings.ToLower function for mapping all Unicode letters to their lower case.ToUpperis the strings.ToUpper function for mapping all Unicode letters to their upper case.Matchis the regexp.MatchString function for matching a regular expression pattern.
The most common use of advanced destination links is to put the additional path in a custom location in the destination link. For example, you might set the destination for go/search to:
https://www.google.com/{{if .Path}}search?q={{QueryEscape .Path}}{{end}}
When a user visits go/search with no additional path, they will be directed to https://www.google.com/.
If they include an additional path like go/search/pangolins, they will be directed to https://www.google.com/search?q=pangolins.
Examples
| Include path in query | go/search | https://cloudsearch.google.com/{{if .Path}}cloudsearch/search?q={{QueryEscape .Path}}{{end}} |
| Include path in destination path | go/slack | https://company.slack.com/{{if .Path}}channels/{{PathEscape .Path}}{{end}} |
| Include path in hostname | go/varz | http://{{if .Path}}{{.Path}}{{else}}host{{end}}.example/debug/varz |
| Include today's date in wiki page | go/today | http://wiki/{{.Now.Format "01-02-2006"}} |
Application Programming Interface (API)
There is no formal API, but many endpoints lend themselves to programmatic access.
Include a "+" after a link to get information about a link without resolving it:
$ curl -L go/search+
{
"Short": "search",
"Long": "https://cloudsearch.google.com/{{if .Path}}cloudsearch/search?q={{QueryEscape .Path}}{{end}}",
"Created": "2022-06-08T04:27:32.829906577Z",
"LastEdit": "2022-06-13T04:42:08.396702416Z",
"Owner": "amelie@company.com",
"Clicks": 8
}
Visit go/.export to export all saved links and their metadata in JSON Lines format. This is useful to create data snapshots that can be restored later.
$ curl -L go/.export
{"Short":"go","Long":"http://go","Created":"2022-05-31T13:04:44.741457796-07:00","LastEdit":"2022-05-31T13:04:44.741457796-07:00","Owner":"amelie@example.com","Clicks":1}
{"Short":"slack","Long":"https://company.slack.com/{{if .Path}}channels/{{PathEscape .Path}}{{end}}","Created":"2022-06-17T18:05:43.562948451Z","LastEdit":"2022-06-17T18:06:35.811398Z","Owner":"amelie@example.com","Clicks":4}
Create a new link by sending a POST request with a short and long value:
$ curl -L -H Sec-Golink:1 -d short=cs -d long=https://cs.github.com/ go
{"Short":"cs","Long":"https://cs.github.com/","Created":"2022-06-03T22:15:29.993978392Z","LastEdit":"2022-06-03T22:15:29.993978392Z","Owner":"amelie@example.com"}