<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nimit Aggarwal</title>
    <description>The latest articles on DEV Community by Nimit Aggarwal (@nimit95).</description>
    <link>https://dev.to/nimit95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F318374%2Fddf9f61e-a9f8-490d-b4ea-6161cabc0181.jpeg</url>
      <title>DEV Community: Nimit Aggarwal</title>
      <link>https://dev.to/nimit95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nimit95"/>
    <language>en</language>
    <item>
      <title>Hello, 2020!</title>
      <dc:creator>Nimit Aggarwal</dc:creator>
      <pubDate>Thu, 02 Jan 2020 07:28:56 +0000</pubDate>
      <link>https://dev.to/nimit95/hello-2020-1ng2</link>
      <guid>https://dev.to/nimit95/hello-2020-1ng2</guid>
      <description>&lt;p&gt;I started my 2019 by ordering a hot chocolate fudge, hoping this year would be as sweet to me as my dessert and bring me as much happiness. 2019 was my first year away from home, living in an unknown city(Mumbai) while pursuing my first job at BrowserStack. As you can expect, I had all kinds of doubts, how am I going to survive, how can I stay away from home. So it was a year where I answered my question, learned a lot, and laid a strong foundation for the years to come.&lt;/p&gt;

&lt;h3&gt;
  
  
  Highlights of the year
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Traveling
&lt;/h4&gt;

&lt;p&gt;I started my travel journey this year and figured out how much I love it. Most of my plans were impromptu. Deciding at 1 am to catch a 4 am train. Finalizing hotels just a day before. Things like these got me hooked. I visited seven cities this year, including my first international trip to Dubai. Coincidentally I visited Dubai twice this year, first with my family and then in a company outing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eMINvtuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8_4YujpEvEhu66mShHOmzg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eMINvtuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8_4YujpEvEhu66mShHOmzg.jpeg" alt=""&gt;&lt;/a&gt;Lonavala&lt;/p&gt;

&lt;h4&gt;
  
  
  Leadership/Responsibility
&lt;/h4&gt;

&lt;p&gt;My company decided to promote me to a senior position in March this year. It was huge. For me, leadership had always been synonymous with responsibility. But I had never experienced the same in real life. It taught me a lot of things, technically and other dimensions of being a leader. I was now in a mentoring position. My decisions not only affected me but my team. Helping others and ensuring everyone else is unblocked to complete their work. I also learned a crucial lesson “To get things done and that too in time.”&lt;/p&gt;

&lt;p&gt;Another thing was seeing things from a uber high level and the ability to make mental models fast. And all these things, for sure takes a lot out of you. But I had the best colleagues to guide me at each step. Special Shoutout to &lt;a href="https://medium.com/u/a93434a590d4"&gt;Bipul Jain&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Health and Fitness
&lt;/h4&gt;

&lt;p&gt;Before the latter half of this year, I had never paid much attention to my health and fitness. I would often go swimming, gymming or walking but nothing too serious. But then around September realized this is not sustainable, I could feel myself getting more and more lethargic. Around the same time, I saw a video of Virat Kohli, who was so passionate about his health and diet. That was my trigger I did a complete 360 turn of my habits. I started hitting the gym regularly, playing basketball.&lt;/p&gt;

&lt;p&gt;I began to cook my food, allowing me to take care of my nutrition. I started eating healthy, included green vegetables into my diet. This overall affected me a lot. Now, my energy levels are higher. I can concentrate better.&lt;/p&gt;

&lt;p&gt;I would suggest everyone to think about their health. BTW I am entering 2020 with sore leg muscles.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technical
&lt;/h4&gt;

&lt;p&gt;Technical things that I learned can be a separate blog post altogether. I would try to keep this as short as possible here. I realized my opinions were too set in stone to let me learn new technologies. So I got out of my comfort zone and learned frontend. I learned ReactJS and loved its ecosystem. Created a library on NPM, developed 2 of my side project, started blogging here @medium. I made my first contribution to Node. Got google scholarship for mobile web specialist and even managed to get Google certificate for the same. We also won an internal hackathon. I got interested in system design then from there into microservices and distributed systems. Maybe I will write a separate blog, having more and a detailed explanation of each 😂&lt;/p&gt;

&lt;h4&gt;
  
  
  Reading
&lt;/h4&gt;

&lt;p&gt;Although I planned on reading a book every month, I read five books. I know it is too less, but in my defense, some were thick and heavy(to grasp). E.g., microservices, data-driven applications. So reading less is fine until I am able to grasp everything. Better be slow than irresponsible 😛&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V62XdXQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/356/1%2A91kcwanQdzWHSxbgd4yTTg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V62XdXQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/356/1%2A91kcwanQdzWHSxbgd4yTTg.jpeg" alt=""&gt;&lt;/a&gt;Building Microservices by &lt;a href="https://medium.com/u/de19973d94b6"&gt;Sam Newman&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2020 Plans
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Travel More
&lt;/h4&gt;

&lt;p&gt;I want to travel more in 2020. I have plans to visit all the cities around Mumbai. Explore more hill stations in the Himalayas. Mostly it is about taking out the time and let yourself enjoy the moment.&lt;/p&gt;

&lt;h4&gt;
  
  
  Concentrate/Focus
&lt;/h4&gt;

&lt;p&gt;One place where I still find myself lacking is to focus for longer periods. I easily get distracted by things happening around me and losing my focus. I will make constant effort to sit for longer periods. Decrease my mobile screen time. Focus on one task at a time, not filling my plate with everything, and then gasping to complete everything.&lt;/p&gt;

&lt;h4&gt;
  
  
  Read More
&lt;/h4&gt;

&lt;p&gt;Every year I guess everyone has this in their bucket list. If there is a time crunch, reading-time takes the worst hit. I feel if I can get more disciplined with time and I can squeeze more time for reading. Also, keeping a constant track of books I want to read will motivate me to read more. My target would be 15 books.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technical
&lt;/h4&gt;

&lt;p&gt;Technically I would like to improve the side projects that I have been building. Now I know ReactJS so I can finally cross out my long-standing wish of having a personal website. Look out for it guys :p. One of the most challenging tasks in the Software field is to give an estimate. I want to be better at it. Also better at prioritizing the tasks. And maybe try my hand at Rust. And at last writing more blogs!&lt;/p&gt;

&lt;p&gt;I would be able to complete these 2020 goals and put my best foot forward. If you believe in yourself, you can achieve any goals.&lt;/p&gt;

&lt;p&gt;Wishing you guys a Happy New Year 2020, have a wonderful year. May all of you achieve all your dreams and this year brings you all the happiness.&lt;/p&gt;

&lt;p&gt;Npm Package — &lt;a href="https://www.npmjs.com/package/socks5-stream"&gt;https://www.npmjs.com/package/socks5-stream&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basic React TodoList — &lt;a href="https://github.com/nimit95/React-todo"&gt;https://github.com/nimit95/React-todo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MWS Certificate — &lt;a href="https://github.com/nimit95/Mobile-web-specialist-certificate"&gt;https://github.com/nimit95/Mobile-web-specialist-certificate&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>writing</category>
      <category>selfimprovement</category>
      <category>blog</category>
    </item>
    <item>
      <title>How to fix app failures on Mac OS Catalina — Notarization</title>
      <dc:creator>Nimit Aggarwal</dc:creator>
      <pubDate>Sat, 26 Oct 2019 13:03:11 +0000</pubDate>
      <link>https://dev.to/nimit95/how-to-fix-app-failures-on-mac-os-catalina-notarization-oc8</link>
      <guid>https://dev.to/nimit95/how-to-fix-app-failures-on-mac-os-catalina-notarization-oc8</guid>
      <description>&lt;h3&gt;
  
  
  How to fix app failures on Mac OS Catalina — Notarization
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6bvFzlwm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/736/1%2AhUcBtR8DOcsyj5FjhdD_fw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6bvFzlwm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/736/1%2AhUcBtR8DOcsyj5FjhdD_fw.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the release of macOS Catalina in October, Apple has mandated gatekeeper check for all applications. Applications with non-existent notarization would result in a warning at the start of the application and the message would prompt as “Cannot check it for malicious software”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GrK8ntXk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/786/1%2ALZWoaCmzb656HCVDyfSWBw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GrK8ntXk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/786/1%2ALZWoaCmzb656HCVDyfSWBw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One way to bypass such a message would be to right-click on the application and click on “open”. But, this method would not work for command-line applications/executables. In order to safely pass through the apple’s gatekeeper check, one would require to notarize the application ( for more details refer &lt;a href="https://developer.apple.com/documentation/xcode/notarizing_your_app_before_distribution/"&gt;here&lt;/a&gt;), and another would be to ask the user to allow such apps in the security setting. As a developer, it is much easier to notarize the app rather than have the user take such security steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Notarization
&lt;/h3&gt;

&lt;p&gt;Notarization gives users more confidence that the software you distribute has been checked by Apple for malicious components. Notarization is not App Review. The Apple notary service is an automated system that scans your software for malicious content, checks for code-signing issues, and returns the results to you quickly. If there are no issues, the notary service generates a ticket for you to staple to your software; the notary service also publishes that ticket online where Gatekeeper can find it.&lt;/p&gt;

&lt;p&gt;Notarization produces a ticket that tells Gatekeeper that your app is notarized. After notarization completes successfully, the next time any user attempts to run your app on macOS 10.14 or later, Gatekeeper finds the ticket online. This includes users who downloaded your app before notarization.&lt;/p&gt;

&lt;p&gt;You should also attach the ticket to your software using the stapler tool, so that future distributions include the ticket. This ensures that Gatekeeper can find the ticket even when a network connection isn’t available.&lt;/p&gt;

&lt;h4&gt;
  
  
  Notarization Process
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Make Xcode 10 your active Xcode installation. (If you’re not sure whether Xcode 10 is the active installation, use the xcode-select command-line to make it active. For information about how to use this tool, see the man page for it, as described in &lt;a href="https://developer.apple.com/documentation/os/reading_unix_manual_pages"&gt;Reading UNIX Manual Pages&lt;/a&gt;.).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo xcode-select -s /path/to/Xcode10.app
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to your &lt;a href="https://appleid.apple.com/account/home"&gt;Apple ID account page&lt;/a&gt;. In the Security section, click. Generate Password below App-Specific Passwords. Save this password.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You upload your app for notarization using altool. To upload using the following command:-&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcrun altool --notarize-app --primary-bundle-id "com.any.id"
--username "email\_id" --password "password\_generated\_in\_step2"
--file file\_in\_zip\_pkg\_dmg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This would return a request ID for the request. You can check the status of the request by using the following command:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ xcrun altool --notarization-info request\_id -u "AC\_USERNAME"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Staple the returned ticket to your existing software. While you can notarize a ZIP archive, you can’t staple to it directly. Instead, run stapler against each individual item that you originally added to the archive. Then create a new ZIP file containing the stapled items for distribution. Although tickets are created for standalone binaries, it’s not currently possible to staple tickets to them. To staple, the following commands need to be executed:-
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcrun stapler staple "file.app"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can read about common issues encountered &lt;a href="https://developer.apple.com/documentation/xcode/notarizing_your_app_before_distribution/resolving_common_notarization_issues"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>apple</category>
      <category>apps</category>
      <category>mac</category>
    </item>
    <item>
      <title>SOCKS 5 — A Proxy Protocol</title>
      <dc:creator>Nimit Aggarwal</dc:creator>
      <pubDate>Mon, 22 Jul 2019 20:37:41 +0000</pubDate>
      <link>https://dev.to/nimit95/socks-5-a-proxy-protocol-5hcd</link>
      <guid>https://dev.to/nimit95/socks-5-a-proxy-protocol-5hcd</guid>
      <description>&lt;h3&gt;
  
  
  SOCKS 5 — A Proxy Protocol
&lt;/h3&gt;

&lt;p&gt;Before reading this article it is highly recommended to be familiar with the basic proxy concepts. To brush up on the proxy concepts and to know how to make a Simple HTTP/HTTPS proxy in node, read &lt;a href="https://dev.to/nimit95/a-simple-http-https-proxy-in-node-js-18ce-temp-slug-8079253"&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;SOCKS 5 basically is a &lt;strong&gt;Framework for a General Proxy Protocol&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What I mean by a general proxy protocol is that for each application layer protocol like HTTP, HTTPS(controversial), FTP and many more, you would need to set up a different proxy server. For example, for HTTP you would have something like squid, for HTTPS Browsermob proxy and so on so forth. Now a SOCKS 5 proxy provides a general framework for these protocols to transparently and securely traverse the data.&lt;/p&gt;

&lt;p&gt;Another use of &lt;em&gt;SOCKS&lt;/em&gt; is as a &lt;strong&gt;circumvention tool&lt;/strong&gt; , allowing traffic to bypass Internet filtering to access content otherwise blocked, e.g., by governments, workplaces, schools, and country-specific web service&lt;/p&gt;

&lt;p&gt;SOCKS 5 additionally provides &lt;strong&gt;authentication&lt;/strong&gt; so only authorized users may access a server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-World Application
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Mostly all torrent clients have an option to configure a SOCKS 5 proxy to bypass the firewall if any.&lt;/li&gt;
&lt;li&gt;It is faster than VPN, so in many places where the speed matter it is used over VPN.&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://en.wikipedia.org/wiki/Tor_(anonymity_network)"&gt;Tor&lt;/a&gt; onion proxy software presents a SOCKS interface to its clients.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Basic Working
&lt;/h3&gt;

&lt;p&gt;A wishes to communicate to B over the internet, but a &lt;a href="https://en.wikipedia.org/wiki/Firewall_(computing)"&gt;firewall&lt;/a&gt; exists between those two, so A cannot connect to B directly. So, A connects to a SOCKS 5 proxy, informing it to connect to B. The proxy sets up a connection to B on A’s behalf sending the confirmation back. Now A can send whatever he wishes to send to B. For more information on the technical specifics of the SOCKS 5 protocol, see below section.&lt;/p&gt;

&lt;p&gt;The SOCKS5 protocol is defined in &lt;a href="https://tools.ietf.org/html/rfc1928"&gt;RFC 1928&lt;/a&gt;. Here is a brief introduction of the protocol in the diagram. For detailed protocol features please refer to &lt;a href="https://tools.ietf.org/html/rfc1928"&gt;RFC 1928&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o_85TJl8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/630/1%2AoxeKCXN5oVH-J-ntMzVjtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o_85TJl8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/630/1%2AoxeKCXN5oVH-J-ntMzVjtw.png" alt=""&gt;&lt;/a&gt;SOCKS 5 HANDSHAKE[NOTE: 5, 1, 0 are actual bytes (0x05, 0x01, 0x00)]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handshake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A(Client) sends the initiation packet( &lt;strong&gt;0x05, 0x01, 0x00&lt;/strong&gt; ) to the SOCKS5 proxy. The breakdown of the first packet is : -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;First Byte&lt;/strong&gt;  &lt;strong&gt;0x05&lt;/strong&gt; is for the version of the SOCKS, in this case, it is SOCKS 5. This remains common for all the SOCKS 5 packets. Won’t mention this byte in next sections.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Second Byte 0x01&lt;/strong&gt; is for authentication purposes. Precisely, the number of authentication methods supported by the client. Here 0x01 means one method is supported.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Third Byte 0x00&lt;/strong&gt; is for the authentication methods. There are authentication methods, variable length, 1 byte per method supported. The authentication methods supported are numbered as follows:&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;0x00: No authentication&lt;/p&gt;

&lt;p&gt;0x01: GSSAPI&lt;/p&gt;

&lt;p&gt;0x02: Username/password&lt;/p&gt;

&lt;p&gt;0x03–0x7F: methods assigned by IANA&lt;/p&gt;

&lt;p&gt;0x80–0xFE: methods reserved for private use&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;SOCKS Proxy sends back to A( &lt;strong&gt;0x05, 0x00&lt;/strong&gt; ). :-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Second Byte 0x00&lt;/strong&gt; is the chosen authentication method by the proxy. In this case, it was the only method provided by the client hence this. The subsequent authentication is method-dependent. Username and password authentication(method 0x02) is described in &lt;a href="https://tools.ietf.org/html/rfc1929"&gt;RFC 1929&lt;/a&gt;. Here no authentication dependent steps need to take place further. If the negotiated method includes encapsulation for purposes of integrity checking and/or confidentiality, further requests &lt;strong&gt;MUST&lt;/strong&gt; be encapsulated in the method-dependent encapsulation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A(Client) sends the request packet ( &lt;strong&gt;0x05, 0x01, 0x00, 0x03, &amp;lt;B_HOST&amp;gt;, &amp;lt;B_PORT&amp;gt;&lt;/strong&gt; ). Once the method-dependent subnegotiation has completed, the client sends the request details to SOCKS proxy:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Second Byte 0x01&lt;/strong&gt; is for the command code. It is one byte&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;0x01: establish a TCP/IP stream connection&lt;/p&gt;

&lt;p&gt;0x02: establish a TCP/IP port binding&lt;/p&gt;

&lt;p&gt;0x03: associate a UDP port&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;Third Byte 0x00&lt;/strong&gt; is a reserved byte. It &lt;strong&gt;must&lt;/strong&gt; be 0x00 and 1 byte.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;Fourth Byte 0x03&lt;/strong&gt; is the address type of desired HOST and 1 byte. The options are as below.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;0x01: IPv4 address, followed by 4 bytes IP&lt;/p&gt;

&lt;p&gt;0x03: Domain name, 1 byte for name length, followed by host name&lt;/p&gt;

&lt;p&gt;0x04: IPv6 address, followed by 16 bytes IP&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;The last Byte is port number in a &lt;a href="https://en.wikipedia.org/wiki/Network_byte_order"&gt;network byte order&lt;/a&gt;, 2 bytes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SOCKS proxy sends back the request packet ( &lt;strong&gt;0x05, 0x00, 0x00, 0x01, &amp;lt;B_HOST&amp;gt;, &amp;lt;B_PORT&amp;gt;&lt;/strong&gt; ). This is for the status of the request by the client to the proxy:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Second Byte 0x00&lt;/strong&gt; is the status field. It is one byte. Meaning the request was granted.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Third Byte 0x00&lt;/strong&gt; is a reserved byte. It &lt;strong&gt;must&lt;/strong&gt; be 0x00 and 1 byte.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Fourth Byte 0x01&lt;/strong&gt; is the address type of desired HOST and 1 byte. In case of CONNECT, this is followed by the binded IP address for the desired HOST, to give the client the detail of the DNS resolution.&lt;/li&gt;
&lt;li&gt;The last Byte is port number in a &lt;a href="https://en.wikipedia.org/wiki/Network_byte_order"&gt;network byte order&lt;/a&gt;, 2 bytes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After this, the connection takes place all the coming data from client A is transferred to client B and vice versa. This way the SOCKS proxy works as a general framework proxy and handle most PROTOCOL with its security features.&lt;/p&gt;

&lt;p&gt;There is a great node library which can handle all the details for a socks server. It transforms the incoming SOCKS5 stream into its respective protocol stream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/socks5-stream"&gt;https://www.npmjs.com/package/socks5-stream&lt;/a&gt;&lt;/p&gt;

</description>
      <category>networking</category>
      <category>https</category>
      <category>internet</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>How I Increased my Productivity 10x!!</title>
      <dc:creator>Nimit Aggarwal</dc:creator>
      <pubDate>Tue, 25 Jun 2019 18:33:16 +0000</pubDate>
      <link>https://dev.to/nimit95/how-i-increased-my-productivity-10x-2521</link>
      <guid>https://dev.to/nimit95/how-i-increased-my-productivity-10x-2521</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I don’t want to tell you X number of ways to improve productivity. I am sure you guys would have already read a tonne of them online. One of a great article is &lt;a href="https://link.medium.com/HW8yNLuyOX"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For me, the top priority of being productive was time management. It required me to &lt;strong&gt;organize&lt;/strong&gt; and &lt;strong&gt;prioritize&lt;/strong&gt; my stuff. One of the best ways was to keep a todo list. I tried keeping it on Google Keep, Google Tasks etc. But I was never able to complete the tasks. In between tasks, I always lost the motivation or forgot the reason to complete them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One day I read about a concept called &lt;a href="https://en.wikipedia.org/wiki/OKR"&gt;&lt;strong&gt;OKR&lt;/strong&gt;&lt;/a&gt;. It stands for Objective and Key Results. Basically, you define your &lt;strong&gt;Objective&lt;/strong&gt; , a clearly defined goal. &lt;strong&gt;Key Results&lt;/strong&gt; are a set of metrics that measure your progress towards that Objective. Various organisations including Google, Uber, Linkedin use them at their workplace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of OKR —&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Objective:&lt;/strong&gt; Create an Awesome Customer Experience&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Results:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improve Net Promoter Score from X to Y.&lt;/li&gt;
&lt;li&gt;Increase Repurchase Rate from X to Y.&lt;/li&gt;
&lt;li&gt;Maintain Customer Acquisition cost under Y.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This what I exactly needed for my todo list —&lt;/p&gt;

&lt;p&gt;There would be various &lt;strong&gt;Tasks&lt;/strong&gt; under a &lt;strong&gt;Key Result&lt;/strong&gt; and these &lt;strong&gt;Key Results&lt;/strong&gt; aligning to my &lt;strong&gt;Objective&lt;/strong&gt;. These can be written on papers or managed via the Google Docs. But I found a great online resource called &lt;a href="https://okrtodo.com"&gt;&lt;strong&gt;www.okrtodo.com&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt; I use it to fill in my OKRs and task.&lt;/p&gt;

&lt;p&gt;This helped me categorise my tasks in a much better way. I always have the reason and motivation for a task in the form of a Key Result and Objective. And I could see my objectives being completed if I am able to complete all Key Results associated with it. I am always aligned with my goals in a much better way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On this site, I could put my objectives, key results and tasks. I moved my whole task list here. Here is a screenshot of an early version of my list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aMbNkcBn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AujhhjmKAHIB_xcDgeHSC-g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aMbNkcBn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AujhhjmKAHIB_xcDgeHSC-g.png" alt=""&gt;&lt;/a&gt;These are my objectives and key results while learning Node. &lt;a href="https://okrtodo.com"&gt;okrtodo.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---WNdfN_5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1ZGvRbhCPgubwiMWJURdXg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---WNdfN_5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1ZGvRbhCPgubwiMWJURdXg.png" alt=""&gt;&lt;/a&gt;These are the task associated with it. &lt;a href="https://okrtodo.com"&gt;okrtodo.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see I have my tasks so clearly aligned with my KRs. And the objective is quite clear “Become an Awesome Node Developer”. I can better visualise my tasks. I can mark these tasks completed. And I really suggest trying it for 21 days to make it a habit and you will see the change.&lt;/p&gt;

&lt;p&gt;Another feature I wanted to see was to see the completed task. I contacted the guy and he said he would be willing to add if he sees more traffic. I really hope he adds it in the near future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks for reading! :)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to read more articles by me, here is the full list&lt;/strong&gt; &lt;a href="https://medium.com/@nimit95"&gt;https://medium.com/@nimit95&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can follow me on twitter&lt;/strong&gt; &lt;a class="comment-mentioned-user" href="https://dev.to/nimit95"&gt;@nimit95&lt;/a&gt;
.&lt;/p&gt;

</description>
      <category>success</category>
      <category>okr</category>
      <category>goals</category>
      <category>habitbuilding</category>
    </item>
    <item>
      <title>A Simple HTTP/HTTPS Proxy in Node Js</title>
      <dc:creator>Nimit Aggarwal</dc:creator>
      <pubDate>Sat, 20 Oct 2018 19:34:28 +0000</pubDate>
      <link>https://dev.to/nimit95/a-simple-http-https-proxy-in-node-js-3810</link>
      <guid>https://dev.to/nimit95/a-simple-http-https-proxy-in-node-js-3810</guid>
      <description>&lt;p&gt;A proxy is a simple server between you and your intended host on the internet. There are mainly two types of proxy, &lt;strong&gt;Forward proxy&lt;/strong&gt; and &lt;strong&gt;Reverse proxy.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forward Proxy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mostly, the simple term “proxy” refers to a Forward Proxy. It simply sits between a client and a server and acts as a relaying agent. They are usually placed by the clients or the internal network from the client side. There can be various use cases for using a forward proxy like keeping track of requests, responses, deny access to some domains, modifying the headers, changing the location etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9eVR9yku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/539/1%2AB390-BMZ4Tqcc7l6YUgX7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9eVR9yku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/539/1%2AB390-BMZ4Tqcc7l6YUgX7g.png" alt=""&gt;&lt;/a&gt;Forward Proxy&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reverse Proxy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These type of proxies are employed by the servers, mostly for security and load balancing purposes. Clients hit these reverse proxy servers instead of the actual servers, then these proxy serves the request to the actual server. For a web server, there are several benefits associated with such architecture. It can keep malicious users out, load balance between the servers and can reduce the load on its origin servers by caching static content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cA_2B30V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/506/1%2AlfyfY68D1wayyIS1qRk8WA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cA_2B30V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/506/1%2AlfyfY68D1wayyIS1qRk8WA.png" alt=""&gt;&lt;/a&gt;Reverse Proxy&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting started
&lt;/h3&gt;

&lt;p&gt;Enough of the theory and let us get our hands dirty and make an HTTP/HTTPS &lt;strong&gt;forward proxy&lt;/strong&gt; in Node.&lt;/p&gt;

&lt;p&gt;We will be using the net module in the Node. I assume a basic knowledge of NodeJS and net module. For references, check out the official documentation &lt;a href="https://nodejs.org/api/net.html"&gt;https://nodejs.org/api/net.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We create a simple net server first which listens on Port 8124 , this server will act as a proxy server for the clients to connect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const net = require('net');
const server = net.createServer();

server.on('connection', (clientToProxySocket) =\&amp;gt; {
 console.log('Client Connected To Proxy');
});

server.on('error', (err) =\&amp;gt; {
 console.log('SERVER ERROR');
 console.log(err);
});

server.on('close', () =\&amp;gt; {
 console.log('Client Disconnected');
});

server.listen(8124, () =\&amp;gt; {
 console.log('Server runnig at [http://localhost:'](http://localhost:') + 8124);
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When a client is connected to our server, we get a socket in our callback which is the socket between the Client and the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parsing HTTP/HTTPS
&lt;/h3&gt;

&lt;p&gt;Now both HTTP and HTTPS are different Protocols so we will be handling the cases separately. After the connection, we will only need the first packet data to get the host details. So we use once on the data callback to get the first data.&lt;/p&gt;

&lt;p&gt;In the case of HTTP, the request contains a Host parameter and port for HTTP is 80. You can read more about it on &lt;a href="https://hpbn.co/brief-history-of-http/#http11-internet-standard"&gt;https://hpbn.co/brief-history-of-http/#http11-internet-standard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the case of HTTPS, we can’t read the packet due to the SSL encryption, so it impossible to read host from the packets. But before the actual request, there is a CONNECT request which contains the host and port will be 443. To read more check out RFC &lt;a href="https://tools.ietf.org/html/rfc7231#section-4.3.6"&gt;https://tools.ietf.org/html/rfc7231#section-4.3.6&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Server Connection
&lt;/h3&gt;

&lt;p&gt;After getting the hostname, we connect to the server using net.createConnection() . It takes two parameters, the host and port to connect and the second is the connected callback. After the connection, we simply pipe the clientToProxySocket to proxyToServerSocket. Sockets are derived from the streams so they can be piped. To read more about streams and piping refer &lt;a href="https://medium.freecodecamp.org/node-js-streams-everything-you-need-to-know-c9141306be93"&gt;this&lt;/a&gt;. TL;DR piping is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**readableSrc**.pipe( **writableDest** )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The final code looks like in the after the connection to our proxy —&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**server.on** ('connection', (clientToProxySocket) =\&amp;gt; {
 console.log('Client Connected To Proxy');
 // We need only the data once, the starting packet
**clientToProxySocket.once** ('data', (data) =\&amp;gt; {
 let isTLSConnection = data.toString().indexOf('CONNECT') !== -1;

 //Considering Port as 80 by default 
 let serverPort = 80;
 let serverAddress;
 if (isTLSConnection) {
 // Port changed to 443, parsing the host from CONNECT 
 serverPort = 443;
 serverAddress = data.toString()
 .split(' **CONNECT**')[1]
 .split(' ')[0].split(':')[0];
 } else {
 // Parsing HOST from HTTP
 serverAddress = data.toString()
 .split('Host: ')[1].split('\r\n')[0];
 }

let proxyToServerSocket = **net.createConnection** ({
 host: serverAddress,
 port: serverPort
 }, () =\&amp;gt; {
 console.log('PROXY TO SERVER SET UP');

 if (isTLSConnection) {
 //Send Back OK to HTTPS CONNECT Request
 clientToProxySocket.write('HTTP/1.1 200 OK\r\n\n');
 } else {
 proxyToServerSocket.write(data);
 }
 // Piping the sockets
**clientToProxySocket.pipe(proxyToServerSocket);  
 proxyToServerSocket.pipe(clientToProxySocket);** proxyToServerSocket.on('error', (err) =\&amp;gt; {
 console.log('PROXY TO SERVER ERROR');
 console.log(err);
 });
 });
 clientToProxySocket.on('error', err =\&amp;gt; {
 console.log('CLIENT TO PROXY ERROR');
 console.log(err);
 });
 });
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Testing Proxy&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The proxy is started as a normal node server - node server.js&lt;/p&gt;

&lt;p&gt;Now you can set up your system or browser proxy to 127.0.0.1 (localhost) and port 8124 . On Firefox you can set proxy in the Network setting, in case of Chrome you will need to set up a system-wide Proxy. After the proxy set up if you try opening some site on your browser you would be able to see the host and other logging that you would have enabled in the logs. You can try playing around with the proxy.&lt;/p&gt;

&lt;p&gt;The final repo of the code can be seen below —&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/nimit95/Forward-Proxy"&gt;nimit95/Forward-Proxy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For any queries, you can connect with me on twitter &lt;a class="comment-mentioned-user" href="https://dev.to/nimit95"&gt;@nimit95&lt;/a&gt;
.&lt;/p&gt;

</description>
      <category>engineering</category>
      <category>node</category>
      <category>computerscience</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
