mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
run: mkdir dist && go build -o dist
|
||||
run: mkdir dist && go build -tags "full" -o dist
|
||||
- name: Upload Binary
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ for PLATFORM in $PLATFORMS; do
|
||||
GOOS=${PLATFORM%/*}
|
||||
GOARCH=${PLATFORM#*/}
|
||||
ZIP_FILENAME="trojan-go-${GOOS}-${GOARCH}.zip"
|
||||
CMD="CGO_ENABLE=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -o temp $@ -ldflags=\"-s -w\""
|
||||
CMD="CGO_ENABLE=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -tags \"full\" -o temp $@ -ldflags=\"-s -w\""
|
||||
echo "${CMD}"
|
||||
eval $CMD || FAILURES="${FAILURES} ${PLATFORM}"
|
||||
zip -j release/$ZIP_FILENAME temp/* ./*.dat
|
||||
|
||||
@@ -1 +1 @@
|
||||
CGO_ENABLE=0 go build -ldflags="-s -w"
|
||||
CGO_ENABLE=0 go build -tags "full" -ldflags="-s -w"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build api full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/api"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build cert full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/cert"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build client full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/client"
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
// +build full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/daemon"
|
||||
_ "github.com/p4gefau1t/trojan-go/easy"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build mysql full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/stat/mysql"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build relay full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/relay"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build router full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/router/mixed"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build server full
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/server"
|
||||
)
|
||||
@@ -5,22 +5,13 @@ import (
|
||||
|
||||
"github.com/p4gefau1t/trojan-go/common"
|
||||
"github.com/p4gefau1t/trojan-go/log"
|
||||
|
||||
//the following modules are optional
|
||||
//you can comment some of them if you don't need them
|
||||
_ "github.com/p4gefau1t/trojan-go/api"
|
||||
_ "github.com/p4gefau1t/trojan-go/cert"
|
||||
_ "github.com/p4gefau1t/trojan-go/daemon"
|
||||
_ "github.com/p4gefau1t/trojan-go/easy"
|
||||
_ "github.com/p4gefau1t/trojan-go/log/golog"
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/client"
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/relay"
|
||||
_ "github.com/p4gefau1t/trojan-go/proxy/server"
|
||||
_ "github.com/p4gefau1t/trojan-go/router/mixed"
|
||||
_ "github.com/p4gefau1t/trojan-go/stat/db"
|
||||
|
||||
_ "github.com/p4gefau1t/trojan-go/stat/memory"
|
||||
_ "github.com/p4gefau1t/trojan-go/log/golog"
|
||||
_ "github.com/p4gefau1t/trojan-go/version"
|
||||
//_ "github.com/p4gefau1t/trojan-go/log/simplelog"
|
||||
|
||||
_ "github.com/p4gefau1t/trojan-go/build"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package db
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package db
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,50 +0,0 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/p4gefau1t/trojan-go/common"
|
||||
)
|
||||
|
||||
func downloadFile(url string, filepath string) error {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
out, err := os.Create(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
_, err = io.Copy(out, resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func downloadGeoSite() error {
|
||||
filename := "geosite.dat"
|
||||
url := "https://github.com/v2ray/domain-list-community/raw/release/dlc.dat"
|
||||
return downloadFile(url, filename)
|
||||
}
|
||||
|
||||
func downloadGeoIP() error {
|
||||
filename := "geoip.dat"
|
||||
url := "https://raw.githubusercontent.com/v2ray/geoip/release/geoip.dat"
|
||||
return downloadFile(url, filename)
|
||||
}
|
||||
|
||||
type updateOption struct {
|
||||
args *string
|
||||
common.OptionHandler
|
||||
}
|
||||
|
||||
func init() {
|
||||
// TODO auto updating
|
||||
}
|
||||
Reference in New Issue
Block a user