This file contains hidden or 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
| package main | |
| import ( | |
| "crypto/rand" | |
| "fmt" | |
| "net" | |
| "sync" | |
| "time" | |
| "encoding/binary" | |
| "github.com/clouway/tools/listener/bincodec" |
This file contains hidden or 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
| package main | |
| import ( | |
| "crypto/rand" | |
| "fmt" | |
| "net" | |
| "sync" | |
| "time" | |
| "encoding/binary" | |
| "github.com/clouway/tools/listener/bincodec" |
This file contains hidden or 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
| func (s *session) Send(req listener.CmdRequest) listener.CmdResponse { | |
| bytes := req.Bytes() | |
| _, err := s.conn.Write(bytes) | |
| if err != nil { | |
| return listener.CmdResponse{} | |
| } | |
| p := packet{bytes} | |
| s.addCMD(p.command()) |
This file contains hidden or 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
| static String sha1(String input) { | |
| MessageDigest mDigest = null; | |
| try { | |
| mDigest = MessageDigest.getInstance("SHA1"); | |
| } catch (NoSuchAlgorithmException e) { | |
| return ""; | |
| } | |
| byte[] result = mDigest.digest(input.getBytes()); | |
| StringBuffer sb = new StringBuffer(); | |
| for (int i = 0; i < result.length; i++) { |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "bufio" | |
| "os" | |
| "path/filepath" | |
| "strings" | |
| "gopkg.in/mgo.v2" | |
| "time" |
OlderNewer