This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rsa" | |
"crypto/tls" | |
"crypto/x509" | |
"fmt" | |
"net/http" | |
"net/url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handler is AES Handler | |
type Handler struct { | |
aesgcm cipher.AEAD | |
salt []byte | |
} | |
func New(aesPwd string) (*Handler, error) { | |
if len(aesPwd) != 72 { | |
return nil, fmt.Errorf("AESSecret: Invalid length: %d, should be 72", len(aesPwd)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
set -x | |
# Add a namespace named con1 | |
ip netns add con1 | |
# Add a veth pair | |
ip link add veth11 type veth peer name veth10 | |
# Assign one of the pair to con1 | |
ip link set veth10 netns con1 | |
# Add an ip address (notice the /24 subnet) | |
ip netns exec con1 ip addr add 10.0.0.2/24 dev veth10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CON=containerns1 | |
IP=10.0.0.3 | |
echo "Creating the namespace" | |
sudo ip netns add $CON | |
echo "Creating the veth pair" | |
sudo ip link add veth10 type veth peer name veth11 | |
echo "Adding one end of the veth pair to the namespace" | |
sudo ip link set veth10 netns $CON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CON="containerns" | |
IP="10.0.0.2" | |
echo "Configuring the interface in the network namespace with an IP address" | |
sudo ip netns exec $CON ip addr add $IP dev veth0 | |
echo "Enabling the interface inside the network namespace" | |
sudo ip netns exec $CON ip link set dev veth0 up | |
echo "Enabling the interface on the node" | |
sudo ip link set dev veth1 up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CON="containerns" | |
echo "Creating the namespace" | |
sudo ip netns add $CON | |
echo "Creating the veth pair" | |
sudo ip link add veth0 type veth peer name veth1 | |
echo "Adding one end of the veth pair to the namespace" | |
sudo ip link set veth0 netns $CON |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.