fixed infinite init loop and module name
This commit is contained in:
parent
41351aaa9d
commit
eef63a09b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||
|
@ -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
|
||||
|
10
main.go
10
main.go
@ -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)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"mbpl3p/proxy"
|
||||
"mpbl3p/proxy"
|
||||
"net"
|
||||
)
|
||||
|
||||
|
@ -2,8 +2,8 @@ package tcp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mbpl3p/proxy"
|
||||
"mbpl3p/utils"
|
||||
"mpbl3p/proxy"
|
||||
"mpbl3p/utils"
|
||||
"net"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package tun
|
||||
import (
|
||||
"github.com/pkg/taptun"
|
||||
"io"
|
||||
"mbpl3p/proxy"
|
||||
"mpbl3p/proxy"
|
||||
)
|
||||
|
||||
type SourceSink struct {
|
||||
|
@ -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
|
||||
}
|
||||
}()
|
||||
}
|
Loading…
Reference in New Issue
Block a user