This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
#!/bin/bash | |
OUTDIR=. | |
while read -r db ; do | |
while read -r table ; do | |
if [ "$db" == "system" ]; then | |
echo "skip system db" | |
continue 2; |
func ip2int(ip net.IP) uint32 { | |
if len(ip) == 16 { | |
return binary.BigEndian.Uint32(ip[12:16]) | |
} | |
return binary.BigEndian.Uint32(ip) | |
} | |
func int2ip(nn uint32) net.IP { | |
ip := make(net.IP, 4) | |
binary.BigEndian.PutUint32(ip, nn) |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"strings" | |
) |
package main | |
import ( | |
"fmt" | |
"syscall" | |
"unsafe" | |
) | |
const ( | |
SCHED_NORMAL = iota |
// Author : Sandesh Bhusal | |
// Date Feb 23, 2021 | |
// You may copy, download and modify the source code according to your requirements :) | |
// Happy Spoofing! | |
// Original Code Lives at https://gist.github.com/sandeshbhusal/c8fa09546ffc076e5103456dd4e3742d | |
package main | |
import ( | |
"flag" |
package main | |
import ( | |
"bufio" | |
"bytes" | |
"encoding/binary" | |
"flag" | |
"fmt" | |
"net" | |
"os" |
// +build linux | |
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"syscall" |
package main | |
// Simple, single-threaded server using system calls instead of the net library. | |
// | |
// Omitted features from the go net package: | |
// | |
// - TLS | |
// - Most error checking | |
// - Only supports bodies that close, no persistent or chunked connections | |
// - Redirects |
package main | |
import ( | |
"fmt" | |
"sort" | |
"sync" | |
"testing" | |
"time" | |
) |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project: