package main

import (
	"fmt"
	"keksvpn/pkg/wgfunc"
	"time"
)

func main()  {
	serverConfig := wgfunc.ServerConfig{
		Name:       "sample-server",
		IPRanges:   []string{"10.0.1.0/24"},
		Port:       0,
		PrivateKey: "kDUIomFdDOW0VaOMS6Vu8+1rw/8SemeobSa7ZN66J38=\n",
	}
	server, err := wgfunc.NewServer(serverConfig)
	if err != nil {
		panic(err)
	}

	fmt.Println("Start Server")
	err = server.Up()
	if err != nil {
		server.Down()
		panic(err)
	}

	fmt.Println("Server online")
	time.Sleep(5 * time.Second)
	fmt.Println("Shoutdown server")
	err = server.Down()
	if err != nil {
		panic(err)
	}1
	fmt.Println("bye")
}