Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
6eca3fa5
Valider
6eca3fa5
rédigé
11 years ago
par
diosmosis
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Refs #4200, tweaked docs for core/IP.php.
parent
31fe0342
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
core/IP.php
+38
-34
38 ajouts, 34 suppressions
core/IP.php
avec
38 ajouts
et
34 suppressions
core/IP.php
+
38
−
34
Voir le fichier @
6eca3fa5
...
...
@@ -12,7 +12,7 @@
namespace
Piwik
;
/**
*
Handl
in
g
IP address
es (
both IPv4 and IPv6).
*
Conta
in
s
IP address
helper functions (for
both IPv4 and IPv6).
*
* As of Piwik 1.3, IP addresses are stored in the DB has VARBINARY(16),
* and passed around in network address format which has the advantage of
...
...
@@ -34,9 +34,9 @@ class IP
const
MAPPED_IPv4_START
=
'::ffff:'
;
/**
*
Sanitize human-readable
IP address.
*
Removes the port and the last portion of a CIDR
IP address.
*
* @param string $ipString IP address
* @param string $ipString
The
IP address
to sanitize.
* @return string
*/
public
static
function
sanitizeIp
(
$ipString
)
...
...
@@ -126,10 +126,10 @@ class IP
}
/**
* Convert presentation format IP address to network address format
* Convert presentation format IP address to network address format
.
*
* @param string $ipString IP address, either IPv4 or IPv6, e.g., "127.0.0.1"
* @return string
Binary-safe string, e.g., "\x7F\x00\x00\x01"
* @param string $ipString IP address, either IPv4 or IPv6, e.g.,
`
"127.0.0.1"
`.
* @return string Binary-safe string, e.g.,
`
"\x7F\x00\x00\x01"
`.
*/
public
static
function
P2N
(
$ipString
)
{
...
...
@@ -139,12 +139,12 @@ class IP
}
/**
* Convert network address format to presentation format
* Convert network address format to presentation format
.
*
*
@s
ee prettyPrint
()
*
S
ee
also [
prettyPr
e
int
](#prettyPrint).
*
* @param string $ip IP address in network address format
* @return string
IP address in presentation format
* @param string $ip IP address in network address format
.
* @return string IP address in presentation format
.
*/
public
static
function
N2P
(
$ip
)
{
...
...
@@ -154,10 +154,10 @@ class IP
}
/**
* Alias for N2P()
* Alias for
[
N2P()
](#N2P).
*
* @param string $ip IP address in network address format
* @return string
IP address in presentation format
* @param string $ip IP address in network address format
.
* @return string IP address in presentation format
.
*/
public
static
function
prettyPrint
(
$ip
)
{
...
...
@@ -165,10 +165,11 @@ class IP
}
/**
* Is this an IPv4, IPv4-compat, or IPv4-mapped address?
* Returns true if `$ip` is an IPv4, IPv4-compat, or IPv4-mapped address, false
* if otherwise.
*
* @param string $ip IP address in network address format
* @return bool
True if IPv4, else false
* @param string $ip IP address in network address format
.
* @return bool True if IPv4, else false
.
*/
public
static
function
isIPv4
(
$ip
)
{
...
...
@@ -201,8 +202,8 @@ class IP
* This function does not support the long (or its string representation)
* returned by the built-in ip2long() function, from Piwik 1.3 and earlier.
*
* @param string $ip IPv4 address in network address format
* @return string
IP address in presentation format
* @param string $ip IPv4 address in network address format
.
* @return string IP address in presentation format
.
*/
public
static
function
long2ip
(
$ip
)
{
...
...
@@ -248,7 +249,10 @@ class IP
}
/**
* Returns
* Returns an IPv4 address from a 'mapped' IPv6 address.
*
* @param string $ip eg, `'::ffff:192.0.2.128'`
* @return string eg, `'192.0.2.128'`
*/
public
static
function
getIPv4FromMappedIPv6
(
$ip
)
{
...
...
@@ -258,8 +262,8 @@ class IP
/**
* Get low and high IP addresses for a specified range.
*
* @param array $ipRange An IP address range in presentation format
* @return array|bool Array ($lowIp, $highIp) in network address format, or false
if
failure
* @param array $ipRange An IP address range in presentation format
.
* @return array|bool Array
`array
($lowIp, $highIp)
`
in network address format, or false
on
failure
.
*/
public
static
function
getIpsForRange
(
$ipRange
)
{
...
...
@@ -338,10 +342,10 @@ class IP
}
/**
* Returns the
be
st
possible IP of
the current user, in
the format A.B.C.D
*
For example, t
his could be the proxy client's IP address.
* Returns the
mo
st
accurate IP address availble for
the current user, in
*
IPv4 format. T
his could be the proxy client's IP address.
*
* @return string
IP address in presentation format
* @return string IP address in presentation format
.
*/
public
static
function
getIpFromHeader
()
{
...
...
@@ -360,10 +364,10 @@ class IP
}
/**
* Returns a non-proxy IP address from header
* Returns a non-proxy IP address from header
.
*
* @param string $default Default value to return if no matching proxy header
* @param array $proxyHeaders List of proxy headers
* @param string $default Default value to return if
there
no matching proxy header
.
* @param array $proxyHeaders List of proxy headers
.
* @return string
*/
public
static
function
getNonProxyIpFromHeader
(
$default
,
$proxyHeaders
)
...
...
@@ -395,9 +399,9 @@ class IP
/**
* Returns the last IP address in a comma separated list, subject to an optional exclusion list.
*
* @param string $csv Comma separated list of elements
* @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges)
* @return string
Last (non-excluded) IP address in the list
* @param string $csv Comma separated list of elements
.
* @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges)
.
* @return string Last (non-excluded) IP address in the list
.
*/
public
static
function
getLastIpFromList
(
$csv
,
$excludedIps
=
null
)
{
...
...
@@ -415,10 +419,10 @@ class IP
}
/**
* Get hostname for a given IP address
* Get hostname for a given IP address
.
*
* @param string $ipStr Human-readable IP address
* @return string
H
ostname or unmodified $ipStr
if
failure
* @param string $ipStr Human-readable IP address
.
* @return string
The h
ostname or unmodified $ipStr
on
failure
.
*/
public
static
function
getHostByAddr
(
$ipStr
)
{
...
...
@@ -427,4 +431,4 @@ class IP
$host
=
strtolower
(
@
gethostbyaddr
(
$ipStr
));
return
$host
===
''
?
$ipStr
:
$host
;
}
}
}
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter