Skip to content

Commit

Permalink
Convert []byte to string directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Dec 6, 2012
1 parent 4bb7c4d commit 48d6ddd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/local/local.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package main

import (
"shadowsocks"
"net"
"bytes"
"log"
"fmt"
"log"
"net"
"shadowsocks"
)

func handleConnection(conn net.Conn, encryptTable, decryptTable []byte, server string) {
Expand Down Expand Up @@ -39,9 +38,8 @@ func handleConnection(conn net.Conn, encryptTable, decryptTable []byte, server s
addrToSend = buf[3:10]
} else if addrType == 3 {
addrLen := buf[4]
sb := bytes.NewBuffer(buf[5:5 + addrLen])
addr = sb.String()
addrToSend = buf[3:5 + addrLen + 2]
addr = string(buf[5 : 5+addrLen])
addrToSend = buf[3 : 5+addrLen+2]
} else {
hasError = true
log.Println("unsurpported addr type")
Expand Down

0 comments on commit 48d6ddd

Please sign in to comment.