pythia-0.1: A utility program for retrieving system information.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pythia.Services.GlobalIp

Description

This modules exports everything needed for retrieving global IP addresses.

Since: 0.1

Synopsis

Queries

queryGlobalIp :: (MonadCatch m, MonadTypedProcess m) => GlobalIpBothConfig -> m (IpAddress Ipv4, IpAddress Ipv6) Source #

Queries for IPv4 and IPv6 global IP address based on the configuration.

Since: 0.1

queryGlobalIpv4 :: (MonadCatch m, MonadTypedProcess m) => GlobalIpv4Config -> m (IpAddress Ipv4) Source #

queryGlobalIp restricted to IPv4 address only.

Since: 0.1

queryGlobalIpv6 :: (MonadCatch m, MonadTypedProcess m) => GlobalIpv6Config -> m (IpAddress Ipv6) Source #

queryGlobalIp restricted to IPv6 address only.

Since: 0.1

Types

data IpType Source #

IP types.

Since: 0.1

Constructors

Ipv4

Since: 0.1

Ipv6

Since: 0.1

Instances

Instances details
Generic IpType Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep IpType :: Type -> Type #

Methods

from :: IpType -> Rep IpType x #

to :: Rep IpType x -> IpType #

Show IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: IpType -> () #

Eq IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

(==) :: IpType -> IpType -> Bool #

(/=) :: IpType -> IpType -> Bool #

type Rep IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep IpType = D1 ('MetaData "IpType" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'False) (C1 ('MetaCons "Ipv4" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ipv6" 'PrefixI 'False) (U1 :: Type -> Type))

newtype IpAddress a Source #

Type for an IP address. The type family IpRefinement refines the underlying Text according to the spec.

  • Ipv4: All characters are digits or dots, and the length is 0 < l < 16.
  • Ipv6: All characters are hex digits or colons, and the length is 0 < l < 40.

Since: 0.1

Constructors

MkIpAddress (Refined (IpRefinement a) Text) 

Instances

Instances details
(k ~ An_Iso, a ~ Refined (IpRefinement s) Text, b ~ Refined (IpRefinement s) Text) => LabelOptic "unIpAddress" k (IpAddress s) (IpAddress s) a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

labelOptic :: Optic k NoIx (IpAddress s) (IpAddress s) a b Source #

Generic (IpAddress a) Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep (IpAddress a) :: Type -> Type #

Methods

from :: IpAddress a -> Rep (IpAddress a) x #

to :: Rep (IpAddress a) x -> IpAddress a #

Show (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: IpAddress a -> () #

Eq (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

(==) :: IpAddress a -> IpAddress a -> Bool #

(/=) :: IpAddress a -> IpAddress a -> Bool #

Ord (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Display (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep (IpAddress a) = D1 ('MetaData "IpAddress" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'True) (C1 ('MetaCons "MkIpAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "unIpAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Refined (IpRefinement a) Text))))

Configuration

data GlobalIpConfig a Source #

Complete configuration for querying global IP addresses.

Since: 0.1

Constructors

MkGlobalIpConfig 

Fields

Instances

Instances details
(k ~ A_Lens, a ~ GlobalIpApp, b ~ GlobalIpApp) => LabelOptic "app" k (GlobalIpConfig s) (GlobalIpConfig s) a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

(k ~ A_Lens, a ~ s, b ~ s) => LabelOptic "sources" k (GlobalIpConfig s) (GlobalIpConfig s) a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Generic (GlobalIpConfig a) Source # 
Instance details

Defined in Pythia.Services.GlobalIp.Types

Associated Types

type Rep (GlobalIpConfig a) :: Type -> Type #

Show a => Show (GlobalIpConfig a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

NFData a => NFData (GlobalIpConfig a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

rnf :: GlobalIpConfig a -> () #

Eq a => Eq (GlobalIpConfig a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep (GlobalIpConfig a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep (GlobalIpConfig a) = D1 ('MetaData "GlobalIpConfig" "Pythia.Services.GlobalIp.Types" "pythia-0.1-inplace" 'False) (C1 ('MetaCons "MkGlobalIpConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "app") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 GlobalIpApp) :*: S1 ('MetaSel ('Just "sources") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 a)))

data GlobalIpApp Source #

This type determines what program we use to lookup the ip address.

Since: 0.1

Constructors

GlobalIpAppCurl

Uses curl to lookup the ip addresses.

Since: 0.1

GlobalIpAppDig

Uses the dig command to perform a DNS lookup. This is generally the fastest and most reliable.

Since: 0.1

Instances

Instances details
Bounded GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Enum GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Generic GlobalIpApp Source # 
Instance details

Defined in Pythia.Services.GlobalIp.Types

Associated Types

type Rep GlobalIpApp :: Type -> Type #

Show GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

NFData GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

rnf :: GlobalIpApp -> () #

Eq GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Ord GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep GlobalIpApp Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep GlobalIpApp = D1 ('MetaData "GlobalIpApp" "Pythia.Services.GlobalIp.Types" "pythia-0.1-inplace" 'False) (C1 ('MetaCons "GlobalIpAppCurl" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GlobalIpAppDig" 'PrefixI 'False) (U1 :: Type -> Type))

newtype UrlSource a Source #

Additional URL source for retrieving IP information. The intended app should not be included (i.e. curl or dig), but any desired flags should be.

Examples

Expand
(dig): "resolver1.opendns.com myip.opendns.com"
(dig): -4 TXT o-o.myaddr.l.google.com ns1.google.com
(curl): "http://whatismyip.akamai.com/"
...

Since: 0.1

Constructors

MkUrlSource 

Fields

Instances

Instances details
(k ~ An_Iso, a ~ Text, b ~ Text) => LabelOptic "unUrlSource" k (UrlSource p) (UrlSource p) a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

labelOptic :: Optic k NoIx (UrlSource p) (UrlSource p) a b Source #

IsString (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

fromString :: String -> UrlSource a #

Generic (UrlSource a) Source # 
Instance details

Defined in Pythia.Services.GlobalIp.Types

Associated Types

type Rep (UrlSource a) :: Type -> Type #

Methods

from :: UrlSource a -> Rep (UrlSource a) x #

to :: Rep (UrlSource a) x -> UrlSource a #

Show (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

NFData (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

rnf :: UrlSource a -> () #

Eq (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

Methods

(==) :: UrlSource a -> UrlSource a -> Bool #

(/=) :: UrlSource a -> UrlSource a -> Bool #

Ord (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep (UrlSource a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.GlobalIp.Types

type Rep (UrlSource a) = D1 ('MetaData "UrlSource" "Pythia.Services.GlobalIp.Types" "pythia-0.1-inplace" 'True) (C1 ('MetaCons "MkUrlSource" 'PrefixI 'True) (S1 ('MetaSel ('Just "unUrlSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))