Shun (Shun v1.0.2) View Source
Top-level module holding the Shun library, which provides URI, IPv4 and IPv6 address verification primitives.
Setup
The usual way to use Shun is by installing it in a custom module.
defmodule MyApp.Shun do
use Shun.Builder
handle Shun.Preset.IPv6.Embedded
reject Shun.Preset.AWS.InstanceMetadata
endAdditional Rules can be added using a simple DSL (provided by Shun.Rule and Shun.Builder):
defmodule MyApp.Shun do
use Shun.Builder
handle Shun.Preset.IPv6.Embedded
reject Shun.Preset.AWS.InstanceMetadata
reject "10.0.0.0/8"
reject %URI{scheme: scheme} when scheme != "https"
endSee:
Shun.Builderfor more information on usage;Shun.Rulefor information on the types of Rules you may use; andShun.Rule.Targeton how you can express targets.
Usage
Once a module has been set up, you can use it with Shun.verify/2 or Shun.verify/3.
For example:
Shun.verify(MyApp.Shun, "http://google.com")
Link to this section Summary
Types
Represents an IP Address which can be IPv4 or IPv6.
Represents the Target prior to verification.
Represents an URI which points to the Target.
Functions
Performs verification on the value using the provider specifies.
Link to this section Types
Specs
address() :: :inet.ip_address()
Represents an IP Address which can be IPv4 or IPv6.
Specs
name() :: String.t()
Represents the Target prior to verification.
Specs
uri() :: URI.t()
Represents an URI which points to the Target.
Link to this section Functions
Performs verification on the value using the provider specifies.
Implemented by Shun.Verifier.perform/2.