-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pkg/socks5): socks5 proxy beta version
finish socks5 proxy mod function fix ca auto generate
- Loading branch information
DVKunion
committed
Sep 8, 2022
1 parent
3b41846
commit 20d586c
Showing
33 changed files
with
2,009 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# github.com/DVKunion/SeaMoon/pkg/consts.Version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#name: Release | ||
# | ||
#on: | ||
# push: | ||
# tags: | ||
# - 'v*' | ||
# | ||
#jobs: | ||
# binary: | ||
# name: release binary files | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Set up Go 1.x | ||
# uses: actions/setup-go@v2 | ||
# with: | ||
# go-version: ^1.18 | ||
# | ||
# - name: Checkout | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Build | ||
# run: | | ||
# bash build.sh ${GITHUB_REF##*/} | ||
# | ||
# - name: release | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: | | ||
# set -x | ||
# assets=() | ||
# for asset in targets/*; do | ||
# assets+=("-a" "$asset") | ||
# done | ||
# tag_name="${GITHUB_REF##*/}" | ||
# hub release create "${assets[@]}" -m "$tag_name" "$tag_name" | ||
# | ||
# docker: | ||
# name: Release Docker | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Dockerhub login | ||
# env: | ||
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
# run: | | ||
# echo "${DOCKER_PASSWORD}" | docker login --username luyuhuang --password-stdin | ||
# | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v1 | ||
# | ||
# - name: Set up Docker Buildx | ||
# id: buildx | ||
# uses: docker/setup-buildx-action@v1 | ||
# with: | ||
# version: latest | ||
# | ||
# - name: Build dockerfile (with push) | ||
# run: | | ||
# docker buildx build \ | ||
# --platform=linux/amd64,linux/arm/v7,linux/arm64 \ | ||
# --output "type=image,push=true" \ | ||
# --build-arg VERSION=${GITHUB_REF##*/} \ | ||
# --file ./mainfest/Dockerfile . \ | ||
# --tag dvkunion/seamoon:latest \ | ||
# --tag dvkunion/seamoon:${GITHUB_REF##*/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"SeaMoon/pkg/proxy" | ||
"github.com/aliyun/fc-runtime-go-sdk/fc" | ||
"github.com/DVKunion/SeaMoon/pkg/consts" | ||
"github.com/DVKunion/SeaMoon/pkg/server" | ||
"os" | ||
) | ||
|
||
var ( | ||
serverMod = os.Getenv("serverMod") | ||
) | ||
|
||
func main() { | ||
switch serverMod { | ||
case "http": | ||
fc.StartHttp(proxy.AliYunHttpHandler) | ||
return | ||
case "socks5": | ||
fc.StartHttp(proxy.AliYunSocks5Handler) | ||
return | ||
default: | ||
return | ||
if consts.Version == "dev" { | ||
server.NewServer("socks5", "0.0.0.0", "10000").Serve() | ||
} else { | ||
server.NewServer(os.Getenv("serverMod"), "0.0.0.0", "9000").Serve() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
"SeaMoon/pkg/proxy" | ||
"fmt" | ||
"github.com/DVKunion/SeaMoon/pkg/client" | ||
"github.com/DVKunion/SeaMoon/pkg/consts" | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
"os" | ||
) | ||
|
||
var ( | ||
proxyAddr string | ||
listenAddr string | ||
clientMod string | ||
verbose bool | ||
rootClientCommand = &cobra.Command{} | ||
proxyClientCommand = &cobra.Command{ | ||
Use: "proxy", | ||
Short: "SeaMoon Proxy Client", | ||
mod string | ||
debug bool | ||
verbose bool | ||
listenAddr string | ||
proxyAddr string | ||
|
||
clientMap = map[string]func(listenAddr string, proxyAddr string, verbose bool){ | ||
"http": client.NewHttpClient, | ||
"socks5": client.NewSocks5Client, | ||
} | ||
|
||
rootCommand = &cobra.Command{ | ||
Use: "client", | ||
Short: "SeaMoon Client", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Proxy() | ||
Client() | ||
}, | ||
} | ||
versionCommand = &cobra.Command{ | ||
Use: "version", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("V1.0.0-BETA") | ||
log.Info(consts.Version) | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
rootClientCommand.AddCommand(versionCommand) | ||
proxyClientCommand.Flags().StringVarP(&clientMod, "mod", "m", "http", "mod of SeaMoon client") | ||
proxyClientCommand.Flags().StringVarP(&listenAddr, "laddr", "l", ":9000", "local client address like : 0.0.0.0:9000") | ||
proxyClientCommand.Flags().StringVarP(&proxyAddr, "paddr", "p", "", "proxy server address") | ||
proxyClientCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "proxy detail log") | ||
|
||
rootClientCommand.AddCommand(proxyClientCommand) | ||
rootCommand.AddCommand(versionCommand) | ||
rootCommand.Flags().StringVarP(&mod, "mod", "m", "http", "mod of SeaMoon client") | ||
rootCommand.Flags().StringVarP(&listenAddr, "laddr", "l", ":9000", "local client address like : 0.0.0.0:9000") | ||
rootCommand.Flags().StringVarP(&proxyAddr, "paddr", "p", "", "proxy server address") | ||
rootCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "proxy detail log") | ||
rootCommand.Flags().BoolVarP(&debug, "debug", "d", false, "proxy detail log") | ||
} | ||
|
||
func Proxy() { | ||
switch clientMod { | ||
case "http": | ||
proxy.NewHttpClient(listenAddr, proxyAddr, verbose) | ||
break | ||
case "socks5": | ||
proxy.NewSocks5Client(listenAddr, proxyAddr, verbose) | ||
break | ||
} | ||
func Client() { | ||
handle := clientMap[mod] | ||
handle(listenAddr, proxyAddr, verbose) | ||
} | ||
|
||
func main() { | ||
if err := rootClientCommand.Execute(); err != nil { | ||
if err := rootCommand.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.