title: What is the difference between Endpoint and AllowedIPs fields in Wireguard config file?
body: <p>My understanding of Wireguard is that the interface for the server and client (although seemingly indiscernible?) each have their own <code>.conf</code> file. For example consider the following <code>.conf</code> file.</p>
  <pre><code>[Interface]
  PrivateKey = some_key_1
  Address = 10.193.130.174/16
  
  
  [Peer]
  PublicKey = some_key_2
  PresharedKey = some_key_3
  AllowedIPs = 10.129.130.1/32
  Endpoint = 54.91.5.130:1952
  </code></pre>
  <p>How can one tell if this is a client or server <code>.conf</code> file (if at all possible)? This may be a really simple question but what is the difference between the <code>Endpoint</code> and <code>AllowedIPs</code> fields for the <code>[Peer]</code>? I infer from the <a href="https://www.wireguard.com/" rel="noreferrer">CryptoKey Routing</a> that once the <code>interface</code> receives a packet it decrypts it with the <code>interface</code> private key and checks the sender IP against the <code>AllowedIPs</code> of all <code>peers</code> and if the credentials in fact match with the <code>peer</code> it accepts it. On the other hand, if the <code>interface</code> wants to send a packet it encrypts it with the <code>peer</code> public key but does it send it to the <code>Endpoint</code> or one of the <code>AllowedIPs</code>?</p>
  <p><strong>EDIT 1:</strong> I did use <code>man wg</code> and the definition of <code>Endpoint</code> still seemed vague to me. Nevertheless, the <code>AllowedIPs</code> field seems easier to grasp.</p>
  <p><strong>EDIT 2:</strong> After further research I think that <code>AllowedIPs</code> field specifies the IP addresses the peer can use to either receive traffic from or send traffic to. I'll appreciate it if someone can confirm or correct this.</p>