// Autogenerated by Thrift Compiler (0.9.3) DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package main import ( flag"
fmtgit.apache.org/thrift.git/lib/go/thriftmathnetnet/urlosstrconvstringsvic/rpc" ) func Usage() { fmt.Fprintln(os.Stderr,Usage of ",os.Args[0],0); line-height:1.5!important"> [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") flag.PrintDefaults() fmt.Fprintln(os.Stderr,0); line-height:1.5!important">\nFunctions:") fmt.Fprintln(os.Stderr,0); line-height:1.5!important"> Video request(string vid,string cid,string platform,string url,string clientVersion)") fmt.Fprintln(os.Stderr) os.Exit(0) } func main() { flag.Usage = Usage var host string
var port int
var protocol var urlString var framed bool
var useHttp var parsedUrl url.URL var trans thrift.TTransport _ = strconv.Atoi _ = math.Abs flag.Usage = Usage flag.StringVar(&host,0); line-height:1.5!important">hlocalhostSpecify host and port") flag.IntVar(&port,0); line-height:1.5!important">p9090,0); line-height:1.5!important">Specify port") flag.StringVar(&protocol,0); line-height:1.5!important">PbinarySpecify the protocol (binary,compact,simplejson,json)") flag.StringVar(&urlString,0); line-height:1.5!important">u"",0); line-height:1.5!important">Specify the url") flag.BoolVar(&framed,0); line-height:1.5!important">framedfalse,0); line-height:1.5!important">Use framed transport") flag.BoolVar(&useHttp,0); line-height:1.5!important">httpUse http") flag.Parse() if len(urlString) > 0 { parsedUrl,err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr,0); line-height:1.5!important">Error parsing URL: parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == " } else if useHttp { _,err := url.Parse(fmt.Sprint(http://:= flag.Arg(0) var err error if useHttp { trans,err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host,0); line-height:1.5!important">") { host,portStr,err = net.SplitHostPort(host) error with host:1) } } trans,err = thrift.NewTSocket(net.JoinHostPort(host,portStr)) error resolving address:1) } if framed { trans = thrift.NewTFramedTransport(trans) } } Error creating transport1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case compact": protocolFactory = thrift.NewTCompactProtocolFactory() break
simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() json": protocolFactory = thrift.NewTJSONProtocolFactory() "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() default: fmt.Fprintln(os.Stderr,0); line-height:1.5!important">Invalid protocol specified: 1) } client := rpc.NewVideoServiceClientFactory(trans,protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr,0); line-height:1.5!important">Error opening socket to " switch cmd { request": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr,0); line-height:1.5!important">Request requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 argvalue1 := flag.Arg(2) value1 := argvalue1 argvalue2 := flag.Arg(3) value2 := argvalue2 argvalue3 := flag.Arg(4) value3 := argvalue3 argvalue4 := flag.Arg(5) value4 := argvalue4 fmt.Print(client.Request(value0,value1,value2,value3,value4)) fmt.Print(\n"": Usage() Invalid function