/DNS-aggregators-golang-fastly-compute

DNS-aggregators-golang-fastly-compute

Primary LanguageGoMulan Permissive Software License, Version 2MulanPSL-2.0

DNS-aggregators-golang-fastly-compute

介绍

DNS-aggregators-golang-fastly-compute

软件架构

软件架构说明

对于dns请求使用了fastly compute的cdn缓存.

使用说明

  1. fastly compute serve

  2. fastly compute deploy

Default Starter Kit for Go

Deploy to Fastly

Get to know the Fastly Compute environment with a basic starter that demonstrates routing, simple synthetic responses and code comments that cover common patterns.

For more details about other starter kits for Compute, see the Fastly Documentation Hub

Features

  • Allow only requests with particular HTTP methods
  • Match request URL path and methods for routing
  • Build synthetic responses at the edge

Understanding the code

This starter is intentionally lightweight, and requires no dependencies aside from the "github.com/fastly/compute-sdk-go/fsthttp" repo. It will help you understand the basics of processing requests at the edge using Fastly. This starter includes implementations of common patterns explained in our using Compute and VCL migration guides.

The starter doesn't require the use of any backends. Once deployed, you will have a Fastly service running on Compute that can generate synthetic responses at the edge.

It is recommended to use the Fastly CLI for this template. The template uses the fastly.toml scripts, to allow for building the project using your installed Go compiler. The Fastly CLI should also be used for serving and testing your build output, as well as deploying your finalized package!

Security issues

Please see our SECURITY.md for guidance on reporting security-related issues.

设置上游服务器的地址

在resources的secret-stores里面设置名称为"DNS-aggregators-golang-fastly-compute"的secret stores里面的"DOH_ENDPOINT"为"https://doh.pub/dns-query",也可以是多个上游服务器的地址的json数组.

设置doh服务的路径

在resources的secret-stores里面设置名称为"DNS-aggregators-golang-fastly-compute"的secret stores里面的"DOH_PATHNAME"为"/dns-query".

访问 "http://127.0.0.1:7676/dns-query" 使用doh服务

在控制台的里面添加源站

设置源站的名称为上游服务器的域名

设置网站的Certificate hostname,SNI hostname,Override host为上游服务器的域名

设置doh服务的最小ttl(秒)

在resources的secret-stores里面设置名称为"DNS-aggregators-golang-fastly-compute"的secret stores里面的"DOH_MINTTL"为"600".

关于浏览器对于cname记录的兼容性问题

为了解决浏览器对于cname记录重复的不兼容问题,需要把cname记录进行展平.还要把cname记录放在其他记录前面,不允许出现相同名字的cname记录.

如果只有一个或者以上的cname记录,则把cname记录放在其他记录前面,不允许出现相同名字的cname记录.把其他记录的名字都改成同一个