====== Hostmasks ======
===== Introduction =====
One of the first skills new people on IRC learn, no matter if they are learning how to ignore an abusive person, add bans to a channel, or configure auto-op scripts is how to create and understand hostmasks. In order to get the most out of this guide, you may want to have an understanding of [[help:irc:identify|How to identify someone on IRC]].
===== What is Hostmask? =====
A hostmask is how scripts, bans, ignores, and some bots, determine someone's identity on IRC. Everyone who logs onto IRC has a nickname, a UserID (or `ident'), and a host. If you are on a Unix system, your UserID is likely your login name. On a Windows machine, you likely are able to set your UserID yourself.
===== Components =====
Your nickname is the main identifier used on IRC, but you can change nicks easily during your session, thus, it is a poor identifier. Likewise, because Windows users often set their own UserID, it is only a semi-reliable identifier. Your host is the Internet IP address or hostname you are connecting from. Most people can only change it by logging in with a different ISP. It is a strong identifier, although parts of it may change every time you log in, and a group of people share the same domain name.
The nickname, UserID, and host are often represented as:
nickname!UserID@Host
You are probably familiar with the format `userid@host' for e-mail addresses. Although usually a host on IRC is not exactly the same as a person's e-mail address, the concept is similar. To get a mask, simply take the nickname!UserID@Host string, and replace the parts which you expect may change with wild cards. Two wild cards, "*" (asterisk) and "?" (question mark) are understood. The "*" means "match any number of characters", and the "?" means "match exactly one character."
===== Masks in practice =====
For example, my user@host string is Krobar!krobar@kro.bar, but if I added myself to the userlist that way and I didn't use the nickname Krobar one day, I wouldn't be recognized. On the flip side, if I added myself as *!*@*, then everyone would match. A typical mask is *!*UserID@*.Host This way any nickname used, from any machine in the domain is matched. The * in front of a UserID is usually a good idea, because some servers will add a ~ in front if identd (a nameserver of sorts) isn't working or is too slow. I typically add myself as *!*krobar@kro.bar
===== IP Addresses =====
Sometimes when DNS is slow or broken, someone might show up with only their IP address as a host. In this case, it's the end that changes, so a mask like this might be what you want: *!*UserID@Host.* My mask, in this case would be: *!*krobar@128.193.14?.* Note the use of "?" in the IP portion. Sometimes my IP is 128.193.141.* and sometimes its 128.193.142.*. Adding a ? ensures I will be recognized, but without too much chance of accidentally recognizing someone else.
EXAMPLES:
To match everyone with a .br country ending:
*!*@*.br
To match everyone with nick "warez":
warez!*@*
To match your friend John (John!jdoe@d-32.alaska.dialamerica.com):
*!*jdoe@*.alaska.dialamerica.com
When John complains that he's not recognized when he dials in from Florida:
*!*jdoe@*.dialamerica.com
To match John when his IP shows up instead:
*!*jdoe@132.31.206.*
To match people with the tell-tale "typehere" userid:
*!*typehere@*