fixed infinite init loop and module name

This commit is contained in:
Jake Hillion 2020-10-24 18:27:31 +01:00
parent 41351aaa9d
commit eef63a09b8
8 changed files with 25 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
config.ini
Makefile
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,go
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,go

View File

@ -2,9 +2,9 @@ package config
import (
"fmt"
"mbpl3p/proxy"
"mbpl3p/tcp"
"mbpl3p/tun"
"mpbl3p/proxy"
"mpbl3p/tcp"
"mpbl3p/tun"
)
// TODO: Delete this code as soon as an alternative is available

2
go.mod
View File

@ -1,4 +1,4 @@
module mbpl3p
module mpbl3p
go 1.15

10
main.go
View File

@ -1,24 +1,32 @@
package main
import (
"mbpl3p/config"
"fmt"
"mpbl3p/config"
"os"
"os/signal"
"syscall"
)
func main() {
fmt.Println("loading config...")
c, err := config.LoadConfig("config.ini")
if err != nil {
panic(err)
}
fmt.Println("building config...")
p, err := c.Build()
if err != nil {
panic(err)
}
fmt.Println("starting...")
p.Start()
fmt.Println("running")
signals := make(chan os.Signal)
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT)

View File

@ -4,7 +4,7 @@ import (
"encoding/binary"
"errors"
"io"
"mbpl3p/proxy"
"mpbl3p/proxy"
"net"
)

View File

@ -2,8 +2,8 @@ package tcp
import (
"fmt"
"mbpl3p/proxy"
"mbpl3p/utils"
"mpbl3p/proxy"
"mpbl3p/utils"
"net"
)

View File

@ -3,7 +3,7 @@ package tun
import (
"github.com/pkg/taptun"
"io"
"mbpl3p/proxy"
"mpbl3p/proxy"
)
type SourceSink struct {

View File

@ -3,9 +3,11 @@ package utils
var NextId = make(chan int)
func init() {
i := 0
for {
NextId <- i
i += 1
}
go func() {
i := 0
for {
NextId <- i
i += 1
}
}()
}