项目作者: t13a

项目描述 :
Time dependent URL redirect generator
高级语言: Go
项目地址: git://github.com/t13a/tdurl.git
创建时间: 2018-07-04T12:11:04Z
项目社区:https://github.com/t13a/tdurl

开源协议:MIT License

下载


tdurl

tdurl is a time-dependent URL redirect generator.

Getting Started

Start server:

  1. $ docker run --rm -p 8991:8991 t13a/tdurl

Request URL:

  1. $ curl -D - http://localhost:8991/?f=http://example.com/%25Y/%25m/%25d

Then generate a redirection:

  1. HTTP/1.1 302 Found
  2. Content-Type: text/html; charset=utf-8
  3. Location: https://example.com/2018/07/04
  4. Date: Wed, 04 Jul 2018 07:40:56 GMT
  5. Content-Length: 53
  6. <a href="https://example.com/2018/07/04">Found</a>.

It is possible to specify the time zone and offset time:

  1. $ curl -D - http://localhost:8991/Asia/Tokyo?f=http://example.com/%25Y/%25m/%25d&o=1h

By default, the time zone is assumed as UTC.

Query parameters

Name Description Default value
f Format string N/A
o Offset time in Duration 0s

Format syntax

Similar to date UNIX command. Percent-encoding is needed.

Placeholder Description
%d Day of month (01 .. 31)
%H Hour (00 .. 23)
%m Month (01 .. 12)
%M Minute (00 .. 59)
%s Seconds since 1970-01-01 00:00:00 UTC
%S Second (00 .. 60)
%Y Year (eg: 2018)