Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
0d98dd3d
Commit
0d98dd3d
authored
Jun 10, 2015
by
rui.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix, connect failed when no forward proxy
parent
253b18dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
main.go
main.go
+17
-0
No files found.
main.go
View file @
0d98dd3d
...
...
@@ -18,8 +18,10 @@ var (
Method
,
Password
string
CertFile
,
KeyFile
string
PrintVersion
bool
Filter
string
proxyURL
*
url
.
URL
filters
[]
string
)
func
init
()
{
...
...
@@ -35,12 +37,14 @@ func init() {
flag
.
BoolVar
(
&
UseHttp
,
"http"
,
false
,
"use http tunnel"
)
flag
.
StringVar
(
&
SMethod
,
"sm"
,
"rc4-md5"
,
"shadowsocks cipher method"
)
flag
.
StringVar
(
&
SPassword
,
"sp"
,
"ginuerzh@gmail.com"
,
"shadowsocks cipher password"
)
flag
.
StringVar
(
&
Filter
,
"f"
,
""
,
"comma separated host/url wildcard not go through tunnel"
)
flag
.
BoolVar
(
&
PrintVersion
,
"v"
,
false
,
"print version"
)
flag
.
Parse
()
log
.
SetFlags
(
log
.
LstdFlags
|
log
.
Lshortfile
)
proxyURL
,
_
=
parseURL
(
Proxy
)
filters
=
parseFilter
(
Filter
)
}
var
(
...
...
@@ -72,9 +76,22 @@ func main() {
}
func
parseURL
(
rawurl
string
)
(
*
url
.
URL
,
error
)
{
if
len
(
rawurl
)
==
0
{
return
nil
,
nil
}
if
!
strings
.
HasPrefix
(
rawurl
,
"http://"
)
&&
!
strings
.
HasPrefix
(
rawurl
,
"socks://"
)
{
rawurl
=
"http://"
+
rawurl
}
return
url
.
Parse
(
rawurl
)
}
func
parseFilter
(
rawfilter
string
)
(
filters
[]
string
)
{
for
_
,
s
:=
range
strings
.
Split
(
rawfilter
,
","
)
{
s
=
strings
.
TrimSpace
(
s
)
if
len
(
s
)
>
0
{
filters
=
append
(
filters
)
}
}
return
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment