Skip to content

Commit

Permalink
Merge pull request #605 from LeeCenY/master
Browse files Browse the repository at this point in the history
Fix socks5 protocol can't connect without a user bug
  • Loading branch information
yanue authored Jun 10, 2020
2 parents a25ebf8 + 8c19c68 commit 01f41e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions V2rayU/ConfigWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
var sockUser = V2rayOutboundSockUser()
sockUser.user = self.socks5User.stringValue
sockUser.pass = self.socks5Pass.stringValue
v2rayConfig.serverSocks5.servers[0].users = [sockUser]
if self.socks5User.stringValue.count > 0 || self.socks5Pass.stringValue.count > 0 {
v2rayConfig.serverSocks5.servers[0].users = [sockUser]
} else {
v2rayConfig.serverSocks5.servers[0].users = nil
}
// ========================== server end =======================

// ========================== stream start =======================
Expand Down Expand Up @@ -368,9 +372,9 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
// socks5
self.socks5Addr.stringValue = v2rayConfig.serverSocks5.servers[0].address
self.socks5Port.stringValue = String(v2rayConfig.serverSocks5.servers[0].port)
if v2rayConfig.serverSocks5.servers[0].users.count > 0 {
self.socks5User.stringValue = v2rayConfig.serverSocks5.servers[0].users[0].user
self.socks5Pass.stringValue = v2rayConfig.serverSocks5.servers[0].users[0].pass
if let users = v2rayConfig.serverSocks5.servers[0].users, users.count > 0 {
self.socks5User.stringValue = users[0].user
self.socks5Pass.stringValue = users[0].pass
}
// ========================== server end =======================

Expand Down
2 changes: 1 addition & 1 deletion V2rayU/v2ray/v2rayOutbound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct V2rayOutboundSocks: Codable {
struct V2rayOutboundSockServer: Codable {
var address: String = ""
var port: Int = 0
var users: [V2rayOutboundSockUser] = [V2rayOutboundSockUser()]
var users: [V2rayOutboundSockUser]?
}

struct V2rayOutboundSockUser: Codable {
Expand Down

0 comments on commit 01f41e8

Please sign in to comment.