Skip to content

Commit

Permalink
v1.3.200619
Browse files Browse the repository at this point in the history
  • Loading branch information
aztecrabbit committed Jun 19, 2020
1 parent b228abf commit 492a575
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Requirements
Install
-------

**AUR**

$ yay -S brainfuck-psiphon-pro-go-bin

**Brainfuck Psiphon Pro Go**

$ go get -v -u -d github.com/aztecrabbit/brainfuck-psiphon-pro-go
Expand Down
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
const (
appName = "Brainfuck Tunnel"
appVersionName = "Psiphon Pro Go"
appVersionCode = "1.3.200512"
appVersionCode = "1.3.200619"

copyrightYear = "2020"
copyrightAuthor = "Aztec Rabbit"
Expand All @@ -46,6 +46,10 @@ func init() {
InterruptHandler.Start()
}

func GetConfigPath(filename string) string {
return libutils.GetConfigPath("brainfuck-psiphon-pro-go", filename)
}

func main() {
liblog.Header(
[]string{
Expand Down Expand Up @@ -81,7 +85,7 @@ func main() {
defaultConfig.Psiphon.CoreName += ".exe"
}

libutils.JsonReadWrite(libutils.RealPath("config.json"), config, defaultConfig)
libutils.JsonReadWrite(GetConfigPath("config.json"), config, defaultConfig)

var flagPro = true
var flagRefresh = false
Expand Down Expand Up @@ -153,6 +157,8 @@ func main() {
}

Redsocks.Config = libredsocks.DefaultConfig
Redsocks.Config.LogOutput = GetConfigPath("redsocks.log")
Redsocks.Config.ConfigOutput = GetConfigPath("redsocks.conf")
Redsocks.Start()

for i := 1; i <= config.PsiphonCore; i++ {
Expand Down
20 changes: 10 additions & 10 deletions src/libpsiphon/libpsiphon.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ var (
Port: make(map[int]map[string]float64),
All: 0,
}
PsiphonDirectory = libutils.RealPath("storage/psiphon")
ConfigPathPsiphon = libutils.GetConfigPath("brainfuck-psiphon-pro-go", "storage/psiphon")
)

func Stop() {
Loop = false
}

func RemoveData() {
os.RemoveAll(PsiphonDirectory + "/data")
os.RemoveAll(ConfigPathPsiphon + "/data")
}

type Config struct {
Expand Down Expand Up @@ -119,7 +119,7 @@ func (p *Psiphon) CheckKuotaDataLimit(sent float64, received float64) bool {

func (p *Psiphon) Start() {
PsiphonData := &Data{
MigrateDataStoreDirectory: PsiphonDirectory + "/data/" + strconv.Itoa(p.ListenPort),
MigrateDataStoreDirectory: ConfigPathPsiphon + "/data/" + strconv.Itoa(p.ListenPort),
UpstreamProxyURL: "http://127.0.0.1:" + p.ProxyPort,
LocalSocksProxyPort: p.ListenPort,
SponsorId: "0000000000000000",
Expand All @@ -139,7 +139,7 @@ func (p *Psiphon) Start() {
PsiphonFileBoltdb := PsiphonData.MigrateDataStoreDirectory + "/ca.psiphon.PsiphonTunnel.tunnel-core/datastore/psiphon.boltdb"
if _, err := os.Stat(PsiphonFileBoltdb); os.IsNotExist(err) {
libutils.CopyFile(
PsiphonDirectory+"/database/psiphon.boltdb", PsiphonFileBoltdb,
libutils.RealPath("/storage/psiphon/database/psiphon.boltdb"), PsiphonFileBoltdb,
)
}

Expand Down Expand Up @@ -172,11 +172,11 @@ func (p *Psiphon) Start() {

if noticeType == "BytesTransferred" {
data := line["data"].(map[string]interface{})
diagnosticId := data["diagnosticID"].(string)
diagnosticID := data["diagnosticID"].(string)
sent := data["sent"].(float64)
received := data["received"].(float64)

p.KuotaData.Port[p.ListenPort][diagnosticId] += sent + received
p.KuotaData.Port[p.ListenPort][diagnosticID] += sent + received
p.KuotaData.Port[p.ListenPort]["all"] += sent + received
p.KuotaData.All += sent + received

Expand All @@ -188,8 +188,8 @@ func (p *Psiphon) Start() {
fmt.Sprintf(
"%v (%v) (%v) (%v)",
p.ListenPort,
diagnosticId,
libutils.BytesToSize(p.KuotaData.Port[p.ListenPort][diagnosticId]),
diagnosticID,
libutils.BytesToSize(p.KuotaData.Port[p.ListenPort][diagnosticID]),
libutils.BytesToSize(p.KuotaData.All),
),
liblog.Colors["G1"],
Expand All @@ -199,8 +199,8 @@ func (p *Psiphon) Start() {
p.ProxyRotator.AddProxy("0.0.0.0:" + strconv.Itoa(p.ListenPort))
p.TunnelConnected++
if p.Config.Tunnel > 1 {
diagnosticId := line["data"].(map[string]interface{})["diagnosticID"].(string)
p.LogInfo(fmt.Sprintf("Connected (%s)", diagnosticId), liblog.Colors["Y1"])
diagnosticID := line["data"].(map[string]interface{})["diagnosticID"].(string)
p.LogInfo(fmt.Sprintf("Connected (%s)", diagnosticID), liblog.Colors["Y1"])
}
if p.TunnelConnected == p.Config.Tunnel {
p.LogInfo("Connected", liblog.Colors["Y1"])
Expand Down

0 comments on commit 492a575

Please sign in to comment.