Tiny-HTTPS protocol implementation (experiment purpose.)

thttps

Basic TLS implementation in Go, written as a learning project. Most components are forked from Go version 1.7

tiny-HTTPS is not suitable for real-world use, but it may be useful to others who are trying to figure out what is TLS in the code level, with the features including:

  • Basic handshaking with no extentions (SNI, ALPN, Session ticket ...)
  • Data transfer and validate encrypted message with MAC for data integrity
  • Only support TLS version 1.2

Usage

Before installing package, you need to generate private key for your server.

openssl genrsa -out key.pem 2048

Then generate self-signed certificate for the test.

openssl req -new -x509 -sha256 -key key.pem -out cert.pem -days 3650 -subj "/C=KR/ST=Seoul/L=Seoul/O=Global Security/OU=IT Department/CN=*"

To install ttls package, you need to install Go and set your Go workspace first.

  1. The first need Go installed (version 1.12+ is required), then you can use the below Go command to install ttls.

    $ go get -u github.com/zeroFruit/thttps
    
  2. Configure your HTTPS server code on server.go (private key, certificate files must be on the same directory)

    package main
    
    import (
    	"log"
    	"net/http"
    
    	"github.com/zeroFruit/thttps"
    )
    
    func main() {
    	mux := http.NewServeMux()
    	mux.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
    		w.Header().Set("Content-Type", "text/plain")
    		w.Write([]byte("world\n"))
    	})
    
        log.Fatal(thttps.Listen(":8443", "cert.pem", "key.pem", mux))
    }
  3. Run your server

    $ go run server.go
    
  4. Using curl you can send HTTP request on your server (use --insecure option for we are using self-signed certificate).

    $ curl --insecure https://localhost:8443/hello
    world
    

Architecture

If you want to see how codes are sturctured or want to see bird-eye view of this package. You can find these on the ARCHITECTURE.md.

Blog Post

If you are not familiar with the SSL/TLS protocols "and" familiar with Korean, you can find the blog post here which shows how SSL/TLS protocol works.

Similar Resources

Bigfile -- a file transfer system that supports http, rpc and ftp protocol https://bigfile.site

Bigfile -- a file transfer system that supports http, rpc and ftp protocol   https://bigfile.site

Bigfile ———— a file transfer system that supports http, rpc and ftp protocol 简体中文 ∙ English Bigfile is a file transfer system, supports http, ftp and

Dec 31, 2022

Experiment - Sync files to S3, fast. Go package and CLI.

gosync I want to be the fastest way to concurrently sync files and directories to/from S3. Gosync will concurrently transfer your files to and from S3

Nov 3, 2022

Go dependency management tool experiment (deprecated)

Go dependency management tool experiment (deprecated)

Dep dep is a dependency management tool for Go. It requires Go 1.9 or newer to compile. NOTE: Dep was an official experiment to implement a package ma

Dec 23, 2022

An experiment in rendering images with Slack custom emojis.

An experiment in rendering images with Slack custom emojis.

emojimage An experiment in rendering images with Slack custom emojis. Example Usage 1. Initializing your workspace First, you'll need to upload 1,332

Mar 12, 2022

The test suite to demonstrate the chaos experiment behavior in different scenarios

Litmus-E2E The goal of litmus e2e is to provide the test suite to demonstrate the chaos experiment behavior in different scenarios. As the name sugges

Jul 7, 2022

tendermint private key provider experiment that wraps cosmovisor and passes the priv key via named pipe.

ssm-cosmovisor You probably don't want to use this and do so at your own risk. This is very experimental and completely untested. It will likely: set

Jul 3, 2022

Ml-mate service helper trainer record experiment, dataset and performance

ml-mate service helper trainer record experiment, dataset and performance trainmate-sdk(ml-mate-py) trainmate-fe(ml-mate-frontend) trainmate-server(ml

Nov 23, 2021

Advent of Code 2021, experiment in learning Go

aoc_2021 Advent of Code 2021, experiment in learning Go To run, open a terminal in the root folder of the project and run with go run . day to run

Mar 1, 2022

Basic Kubernetes operator that have multiple versions in CRD. This operator can be used to experiment and understand Operator/CRD behaviors.

add-operator Basic Kubernetes operator that have multiple versions in CRD. This operator can be used to experiment and understand Operator/CRD behavio

Dec 15, 2021

A simple chess engine for experiment, made in Golang

chess-engine A simple chess engine for experiment, made in Golang Build the engine Run the command make or make build Run the engine Run the command f

Dec 26, 2021

Color quantization experiment for golang

bitcrush Color quantization experiment, version 4 Build git clone https://github

Jun 15, 2022

InductiveDifferentiation - A Trading Experiment With The Crypto Market

A Trading Experiment With The Crypto Market The program was proposed and owned b

Apr 10, 2022

Chachaware - Educational ransomware experiment

Chachaware An educational ransomeware experiment. It doens't contact any servers

Nov 23, 2022

An experiment in software that has sovereignty over itself.

Sovereign An experiment in software that has sovereignty over itself. Why I Did This If you actually read through all of this, please let me know. You

Feb 11, 2022

An experiment which attempts to create streams similar to what is available in Java now that we have generics in Go.

go-streams An experiment which attempts to create streams similar to what is available in Java now that we have generics. Should I use this library? N

Aug 9, 2022

A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.

A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.

Mini-Blockchain Mini-Blockchain is a reference design for a blockchain system to demostate a full end2end flow in current blockchain technology. There

Nov 18, 2022

wire protocol for multiplexing connections or streams into a single connection, based on a subset of the SSH Connection Protocol

qmux qmux is a wire protocol for multiplexing connections or streams into a single connection. It is based on the SSH Connection Protocol, which is th

Dec 26, 2022

Eunomia is a distributed application framework that support Gossip protocol, QuorumNWR algorithm, PBFT algorithm, PoW algorithm, and ZAB protocol and so on.

Introduction Eunomia is a distributed application framework that facilitates developers to quickly develop distributed applications and supports distr

Sep 28, 2021

A simple tool to convert socket5 proxy protocol to http proxy protocol

Socket5 to HTTP 这是一个超简单的 Socket5 代理转换成 HTTP 代理的小工具。 如何安装? Golang 用户 # Required Go 1.17+ go install github.com/mritd/s2h@master Docker 用户 docker pull m

Jan 2, 2023
tiny Go library to normalize URLs

Purell Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell. Sanitizer and all. Yeah, I know... Based on the wikipedia paper

Dec 7, 2022
HTTP/HTTPS load testing and benchmarking tool

Introduction I wrote that code because: (the obvious reason::I love to write code in Go) We are working so hard to optimize our servers - why shouldn'

Dec 5, 2022
An HTTP/HTTPS intercept proxy written in Go.
An HTTP/HTTPS intercept proxy written in Go.

Broxy Broxy is an open source intercept proxy written in Go. It makes use of goproxy as core proxy implementation and the interface is implemented wit

Nov 29, 2022
Custom domain args exposing https settings for c#

xyz Pulumi Component Provider (TypeScript) This repo is a boilerplate showing how to create a Pulumi component provider written in TypeScript. You can

Nov 30, 2021
Open-source HTTP-based Representational State Transfer Configuration Protocol (RESTCONF)

RESTCONF RESTCONF is a network management protocol based on HTTP [RFC7230], for configuring data defined in YANG version 1 [RFC6020] or YANG version 1

Dec 1, 2021
IceFireDB-Proxy - IceFireDB proxy, easier to use IceFireDB, support resp protocol
IceFireDB-Proxy - IceFireDB proxy, easier to use IceFireDB, support resp protocol

IceFireDB-Proxy IceFireDB-Proxy is a high-performance, highly available, and use

Jun 8, 2022
An experiment building a custom binary protocol for a calculator

Overview Implementation of a calculator service built on a custom protocol on top of TCP Details The server is in main.go, and the client is in client

Nov 28, 2021
tiny linear interpolation library for go (factored out from https://github.com/sgreben/yeetgif)

piecewiselinear A tiny library for linear interpolation. O(log(N)) per evaluation for N control points. import "github.com/sgreben/piecewiselinear" Ge

Sep 27, 2022
Go language implementation of a blockchain based on the BDLS BFT protocol. The implementation was adapted from Ethereum and Sperax implementation

BDLS protocol based PoS Blockchain Most functionalities of this client is similar to the Ethereum golang implementation. If you do not find your quest

Oct 14, 2022
*DEPRECATED* Please use https://gopkg.in/redsync.v1 (https://github.com/go-redsync/redsync)

Redsync.go This package is being replaced with https://gopkg.in/redsync.v1. I will continue to maintain this package for a while so that its users do

Nov 20, 2022