nap

package module
v0.0.0-...-85a6134 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 18 Imported by: 0

README

🚫 No Advertising Please 🚫

TODO

Blocking video advertisements
  • CNAME or A/AAA redirect to unspammer
  • CA with on-demand certificate vending
  • Send empty VAST/VMAP responses to block advertisements

When the ad server does not or cannot return an Ad, the VAST response should contain only the root <VAST> element with optional <Error> element, as shown below:

<VAST version="4.1">
    <Error>
        <![CDATA[http://adserver.com/noad.gif]]>
    </Error>
</VAST>

The VAST <Error> element is optional but if included, the media player must send a request to the URI provided when the VAST response returns an empty InLine response after a chain of one or more wrappers. If an [ERRORCODE] macro is included, the media player should substitute with error code 303.

Besides the VAST level <Error> resource file, no other tracking resource requests are required of the media player in a no-ad response in either the Inline Ad or any Wrappers.

View Pages as Googlebot
var googlebotHeaders = map[string]string{
	"User-Agent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
}

Documentation

Overview

Package nap implements the No Advertising Please (NAP) ad blocker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DNSQuery

func DNSQuery(w http.ResponseWriter, r *http.Request)

DNSQuery implements handler for DNS queries.

func Errorf

func Errorf(w http.ResponseWriter, code int, format string, a ...interface{})

Errorf returns an HTTP error.

func Fatalf

func Fatalf(format string, a ...interface{})

Fatalf prints a fatal error and exits the program.

func NAP

func NAP(w http.ResponseWriter, r *http.Request)

NAP implements the Google Cloud Functions entrypoint.

Types

type CIDs

type CIDs map[string]string

CIDs define known client IDs.

func ParseCIDs

func ParseCIDs(data []byte) (CIDs, error)

ParseCIDs parses the CID data.

Directories

Path Synopsis
Package acme implements Let's Encrypt ACME integration.
Package acme implements Let's Encrypt ACME integration.
Package blacklist implements the DNS handling logic.
Package blacklist implements the DNS handling logic.
cmd
decode command
unspammer command
Package handlers implement request handlers.
Package handlers implement request handlers.
Package pki implements the PKI Certificate Authority.
Package pki implements the PKI Certificate Authority.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL