Implementing mTLS in Go

development golang microservices

Introduction Mutual authentication with Transport Layer Security (mTLS) is a method for mutual authentication. It is often used in securing network communication between two services and ensures that the parties at each end of this communication are who they claim to be by verifying that they both have the correct private key. It has been a standard security and authentication mechanism in a service mesh like Istio, Linkerd, AWS App Mesh and others.

Union Find in Python

alogrithms python

Introduction According to Wikipedia, dynamic connectivity structure is a data structure that dynamically maintains information about the connected components of a tree. Once the the dynamic connectivity structure is built, it should adapt itself such that it can give quick answers to queries of the form “is there a path between x and y?”. The Union-Find algorithm is one approach build this connectivity structure. There are multiple approaches the Union-Find algorithm, the most optimal approach is the Weighted Quick Union algorithm.

Background Tasks in Go

development golang workers

When you design a software system or REST API, there are times when you would want to process large amounts of data or do time consuming computations that cannot be completed within a decent amount of time. You cannot expect your users to make an HTTP call that takes several seconds or minutes to respond while the backend server handles the request by doing some time consuming task. Often the load balancer or the HTTP server will enforce a timeout for a request after which the connection is terminated and results in a gateway timeout error.

Implement tail command in Python

alogrithms python

Introduction In this article, we will write a simple implementation of the tail command from Linux. This program will take a file and an integer n as input and print the last n lines from the file. Also, the goal of the program is to not read the entire file into memory at once. This will make the program memory efficient when dealing with very large files. Implementation Details In order to implement this program, we will use queue data structure.

Read More




Context Cancellation in Go

development golang context

In Go, we can use context to send cancellation signals to goroutines that is doing some work. The Done method in context returns a channel that acts as a cancellation signal to goroutines using the given context. When the channel is closed, it indicates to the goroutines that they should stop the work they are doing. We can use WithCancel context function to obtain a new context along with the cancel function that can be used to close the channel.

Delete Files From AWS S3 using Go

development golang aws

In order to work with AWS S3 using Go, we will use github.com/aws/aws-sdk-go/aws. In this gist, we will use the aws-sdk-go package to delete all files under a given directory in a given bucket. The complete source code for the snippet is available here https://github.com/abvarun226/blog-source-code/tree/master/delete-files-in-aws-s3-using-go

In order to test the snippet, we will use localstack to run s3 emulator in a docker container on the laptop. The container exposes s3 endpoint on port 4566. The snippet will then create a new bucket work-with-s3 in s3. The snippet will then delete all files from blog directory under work-with-s3 bucket.

Listing Files in AWS S3 using Go

development golang aws

In order to work with AWS S3 using Go, we will use github.com/aws/aws-sdk-go/aws. In this gist, we will use the aws-sdk-go package to list files under a given directory in a given bucket. The complete source code for the snippet is available here https://github.com/abvarun226/blog-source-code/tree/master/listing-files-in-aws-s3-using-go

In order to test the snippet, we will use localstack to run s3 emulator in a docker container on the laptop. The container exposes s3 endpoint on port 4566. The snippet will then create a new bucket work-with-s3 in s3. The snippet will then list all files in blog directory under work-with-s3 bucket.

Uploading Files to AWS S3 using Go

development golang aws

In order to work with AWS S3 using Go, we will use github.com/aws/aws-sdk-go/aws. In this gist, we will use the aws-sdk-go package to upload files under a given directory. The complete source code for the snippet is available here https://github.com/abvarun226/blog-source-code/tree/master/uploading-files-to-aws-s3-using-go

In order to test the snippet, we will use localstack to run s3 emulator in a docker container on the laptop. The container exposes s3 endpoint on port 4566. The snippet will then create a new bucket work-with-s3 in s3. The snippet will then upload couple of files to blog directory under work-with-s3 bucket.

Read More


About

Bharghava Varun Ayada is a Staff Software Engineer at Twilio Segment, living in Bangalore, India. This blog is about software engineering, system design, distributed systems and DevOps.


Github / Twitter / LinkedIn / Dev.to / Stackoverflow

Get new posts by email