├── .gitattributes ├── .gitignore ├── README.md ├── aws ├── aws-python-sample-master.zip ├── boto3-develop.zip ├── close.py ├── close_ec2.py ├── close_vpc.py ├── create.py ├── create_ec2.py ├── create_vpc.py ├── package │ └── boto │ │ ├── __init__.py │ │ ├── auth.py │ │ ├── auth_handler.py │ │ ├── awslambda │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── beanstalk │ │ ├── __init__.py │ │ ├── exception.py │ │ ├── layer1.py │ │ ├── response.py │ │ └── wrapper.py │ │ ├── cacerts │ │ ├── __init__.py │ │ └── cacerts.txt │ │ ├── cloudformation │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── stack.py │ │ └── template.py │ │ ├── cloudfront │ │ ├── __init__.py │ │ ├── distribution.py │ │ ├── exception.py │ │ ├── identity.py │ │ ├── invalidation.py │ │ ├── logging.py │ │ ├── object.py │ │ ├── origin.py │ │ └── signers.py │ │ ├── cloudhsm │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── cloudsearch │ │ ├── __init__.py │ │ ├── document.py │ │ ├── domain.py │ │ ├── layer1.py │ │ ├── layer2.py │ │ ├── optionstatus.py │ │ ├── search.py │ │ └── sourceattribute.py │ │ ├── cloudsearch2 │ │ ├── __init__.py │ │ ├── document.py │ │ ├── domain.py │ │ ├── exceptions.py │ │ ├── layer1.py │ │ ├── layer2.py │ │ ├── optionstatus.py │ │ └── search.py │ │ ├── cloudsearchdomain │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── cloudtrail │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── codedeploy │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── cognito │ │ ├── __init__.py │ │ ├── identity │ │ │ ├── __init__.py │ │ │ ├── exceptions.py │ │ │ └── layer1.py │ │ └── sync │ │ │ ├── __init__.py │ │ │ ├── exceptions.py │ │ │ └── layer1.py │ │ ├── compat.py │ │ ├── configservice │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── connection.py │ │ ├── contrib │ │ ├── __init__.py │ │ └── ymlmessage.py │ │ ├── datapipeline │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── directconnect │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── dynamodb │ │ ├── __init__.py │ │ ├── batch.py │ │ ├── condition.py │ │ ├── exceptions.py │ │ ├── item.py │ │ ├── layer1.py │ │ ├── layer2.py │ │ ├── schema.py │ │ ├── table.py │ │ └── types.py │ │ ├── dynamodb2 │ │ ├── __init__.py │ │ ├── exceptions.py │ │ ├── fields.py │ │ ├── items.py │ │ ├── layer1.py │ │ ├── results.py │ │ ├── table.py │ │ └── types.py │ │ ├── ec2 │ │ ├── __init__.py │ │ ├── address.py │ │ ├── attributes.py │ │ ├── autoscale │ │ │ ├── __init__.py │ │ │ ├── activity.py │ │ │ ├── group.py │ │ │ ├── instance.py │ │ │ ├── launchconfig.py │ │ │ ├── limits.py │ │ │ ├── policy.py │ │ │ ├── request.py │ │ │ ├── scheduled.py │ │ │ └── tag.py │ │ ├── blockdevicemapping.py │ │ ├── bundleinstance.py │ │ ├── buyreservation.py │ │ ├── cloudwatch │ │ │ ├── __init__.py │ │ │ ├── alarm.py │ │ │ ├── datapoint.py │ │ │ ├── dimension.py │ │ │ ├── listelement.py │ │ │ └── metric.py │ │ ├── connection.py │ │ ├── ec2object.py │ │ ├── elb │ │ │ ├── __init__.py │ │ │ ├── attributes.py │ │ │ ├── healthcheck.py │ │ │ ├── instancestate.py │ │ │ ├── listelement.py │ │ │ ├── listener.py │ │ │ ├── loadbalancer.py │ │ │ ├── policies.py │ │ │ └── securitygroup.py │ │ ├── group.py │ │ ├── image.py │ │ ├── instance.py │ │ ├── instanceinfo.py │ │ ├── instancestatus.py │ │ ├── instancetype.py │ │ ├── keypair.py │ │ ├── launchspecification.py │ │ ├── networkinterface.py │ │ ├── placementgroup.py │ │ ├── regioninfo.py │ │ ├── reservedinstance.py │ │ ├── securitygroup.py │ │ ├── snapshot.py │ │ ├── spotdatafeedsubscription.py │ │ ├── spotinstancerequest.py │ │ ├── spotpricehistory.py │ │ ├── tag.py │ │ ├── volume.py │ │ ├── volumestatus.py │ │ └── zone.py │ │ ├── ec2containerservice │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── ecs │ │ ├── __init__.py │ │ └── item.py │ │ ├── elasticache │ │ ├── __init__.py │ │ └── layer1.py │ │ ├── elastictranscoder │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── emr │ │ ├── __init__.py │ │ ├── bootstrap_action.py │ │ ├── connection.py │ │ ├── emrobject.py │ │ ├── instance_group.py │ │ └── step.py │ │ ├── endpoints.json │ │ ├── exception.py │ │ ├── file │ │ ├── README │ │ ├── __init__.py │ │ ├── bucket.py │ │ ├── connection.py │ │ ├── key.py │ │ └── simpleresultset.py │ │ ├── fps │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── exception.py │ │ └── response.py │ │ ├── glacier │ │ ├── __init__.py │ │ ├── concurrent.py │ │ ├── exceptions.py │ │ ├── job.py │ │ ├── layer1.py │ │ ├── layer2.py │ │ ├── response.py │ │ ├── utils.py │ │ ├── vault.py │ │ └── writer.py │ │ ├── gs │ │ ├── __init__.py │ │ ├── acl.py │ │ ├── bucket.py │ │ ├── bucketlistresultset.py │ │ ├── connection.py │ │ ├── cors.py │ │ ├── key.py │ │ ├── lifecycle.py │ │ ├── resumable_upload_handler.py │ │ └── user.py │ │ ├── handler.py │ │ ├── https_connection.py │ │ ├── iam │ │ ├── __init__.py │ │ ├── connection.py │ │ └── summarymap.py │ │ ├── jsonresponse.py │ │ ├── kinesis │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── kms │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── logs │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── machinelearning │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── manage │ │ ├── __init__.py │ │ ├── cmdshell.py │ │ ├── propget.py │ │ ├── server.py │ │ ├── task.py │ │ ├── test_manage.py │ │ └── volume.py │ │ ├── mashups │ │ ├── __init__.py │ │ ├── interactive.py │ │ ├── iobject.py │ │ ├── order.py │ │ └── server.py │ │ ├── mturk │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── layoutparam.py │ │ ├── notification.py │ │ ├── price.py │ │ ├── qualification.py │ │ └── question.py │ │ ├── mws │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── exception.py │ │ └── response.py │ │ ├── opsworks │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── plugin.py │ │ ├── provider.py │ │ ├── pyami │ │ ├── __init__.py │ │ ├── bootstrap.py │ │ ├── config.py │ │ ├── copybot.cfg │ │ ├── copybot.py │ │ ├── helloworld.py │ │ ├── installers │ │ │ ├── __init__.py │ │ │ └── ubuntu │ │ │ │ ├── __init__.py │ │ │ │ ├── apache.py │ │ │ │ ├── ebs.py │ │ │ │ ├── installer.py │ │ │ │ ├── mysql.py │ │ │ │ └── trac.py │ │ ├── launch_ami.py │ │ ├── scriptbase.py │ │ └── startup.py │ │ ├── rds │ │ ├── __init__.py │ │ ├── dbinstance.py │ │ ├── dbsecuritygroup.py │ │ ├── dbsnapshot.py │ │ ├── dbsubnetgroup.py │ │ ├── event.py │ │ ├── logfile.py │ │ ├── optiongroup.py │ │ ├── parametergroup.py │ │ ├── regioninfo.py │ │ ├── statusinfo.py │ │ └── vpcsecuritygroupmembership.py │ │ ├── rds2 │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── redshift │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── regioninfo.py │ │ ├── requestlog.py │ │ ├── resultset.py │ │ ├── roboto │ │ ├── __init__.py │ │ ├── awsqueryrequest.py │ │ ├── awsqueryservice.py │ │ └── param.py │ │ ├── route53 │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── domains │ │ │ ├── __init__.py │ │ │ ├── exceptions.py │ │ │ └── layer1.py │ │ ├── exception.py │ │ ├── healthcheck.py │ │ ├── hostedzone.py │ │ ├── record.py │ │ ├── status.py │ │ └── zone.py │ │ ├── s3 │ │ ├── __init__.py │ │ ├── acl.py │ │ ├── bucket.py │ │ ├── bucketlistresultset.py │ │ ├── bucketlogging.py │ │ ├── connection.py │ │ ├── cors.py │ │ ├── deletemarker.py │ │ ├── key.py │ │ ├── keyfile.py │ │ ├── lifecycle.py │ │ ├── multidelete.py │ │ ├── multipart.py │ │ ├── prefix.py │ │ ├── resumable_download_handler.py │ │ ├── tagging.py │ │ ├── user.py │ │ └── website.py │ │ ├── sdb │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── db │ │ │ ├── __init__.py │ │ │ ├── blob.py │ │ │ ├── key.py │ │ │ ├── manager │ │ │ │ ├── __init__.py │ │ │ │ ├── sdbmanager.py │ │ │ │ └── xmlmanager.py │ │ │ ├── model.py │ │ │ ├── property.py │ │ │ ├── query.py │ │ │ ├── sequence.py │ │ │ └── test_db.py │ │ ├── domain.py │ │ ├── item.py │ │ ├── queryresultset.py │ │ └── regioninfo.py │ │ ├── services │ │ ├── __init__.py │ │ ├── bs.py │ │ ├── message.py │ │ ├── result.py │ │ ├── service.py │ │ ├── servicedef.py │ │ ├── sonofmmm.cfg │ │ ├── sonofmmm.py │ │ └── submit.py │ │ ├── ses │ │ ├── __init__.py │ │ ├── connection.py │ │ └── exceptions.py │ │ ├── sns │ │ ├── __init__.py │ │ └── connection.py │ │ ├── sqs │ │ ├── __init__.py │ │ ├── attributes.py │ │ ├── batchresults.py │ │ ├── bigmessage.py │ │ ├── connection.py │ │ ├── jsonmessage.py │ │ ├── message.py │ │ ├── messageattributes.py │ │ ├── queue.py │ │ └── regioninfo.py │ │ ├── storage_uri.py │ │ ├── sts │ │ ├── __init__.py │ │ ├── connection.py │ │ └── credentials.py │ │ ├── support │ │ ├── __init__.py │ │ ├── exceptions.py │ │ └── layer1.py │ │ ├── swf │ │ ├── __init__.py │ │ ├── exceptions.py │ │ ├── layer1.py │ │ ├── layer1_decisions.py │ │ └── layer2.py │ │ ├── utils.py │ │ ├── vendored │ │ ├── __init__.py │ │ └── six.py │ │ └── vpc │ │ ├── __init__.py │ │ ├── customergateway.py │ │ ├── dhcpoptions.py │ │ ├── internetgateway.py │ │ ├── networkacl.py │ │ ├── routetable.py │ │ ├── subnet.py │ │ ├── vpc.py │ │ ├── vpc_peering_connection.py │ │ ├── vpnconnection.py │ │ └── vpngateway.py └── readini.py ├── bench ├── mysql_bench │ └── mysql_bench_test.go └── pb_bench │ └── pb_bench_test.go ├── bin ├── build.sh ├── checkdb.py ├── clean.sh ├── cmd │ ├── client │ │ └── log.txt │ └── server │ │ └── log.txt ├── deploy.sh ├── kill.sh ├── listcm.py ├── message_pb2.py ├── redis.conf ├── redis_qps.py ├── savetoredis.py └── start.sh ├── cacheserver └── cacheserver.go ├── client └── client.go ├── doc └── cn │ ├── aws.md │ ├── aws.pdf │ ├── doc.md │ ├── doc.pdf │ └── websequencediagrams.txt ├── gateway └── gateway.go ├── goredis └── goredis.go ├── images ├── 1000k │ ├── chatmessage.png │ ├── db.png │ ├── gateway.png │ ├── localposter.png │ └── poster.png ├── 100k │ ├── chatmessage.png │ ├── db.png │ ├── gateway.png │ ├── localposter.png │ └── poster.png ├── 1_server │ ├── chatmessage.png │ ├── db.png │ ├── gateway.png │ ├── localposter.png │ └── poster.png ├── 2_servers │ ├── chatmessage.png │ ├── db.png │ ├── gateway.png │ ├── localposter.png │ └── poster.png ├── doc │ ├── 001.jpg │ ├── 002.jpg │ ├── 003.jpg │ ├── 004.jpg │ ├── 005.jpg │ ├── 006.jpg │ ├── 007.jpg │ ├── 008.jpg │ ├── 009.jpg │ ├── 010.jpg │ ├── 011.jpg │ ├── 012.jpg │ ├── 013.jpg │ ├── 014.jpg │ ├── 015.jpg │ ├── 016.jpg │ ├── 017.jpg │ ├── 018.jpg │ ├── 019.jpg │ └── 020.jpg └── testing │ ├── aws │ ├── aws1.png │ ├── aws10.png │ ├── aws11.png │ ├── aws12.png │ ├── aws2.png │ ├── aws5.png │ ├── close_vpc.png │ └── create_vpc.png │ ├── billing │ ├── billing0.png │ ├── billing1.png │ ├── billing2.png │ ├── billing3.png │ ├── billing4.png │ ├── billing5.png │ └── billing7.png │ ├── comparison │ ├── chat.png │ ├── db.png │ ├── gw.png │ ├── localpost.png │ └── po.png │ ├── donate │ ├── 0.01.png │ └── 1.00.png │ ├── security │ ├── key0.png │ ├── key1.png │ ├── key2.png │ ├── key4.png │ ├── key5.png │ ├── key6.png │ └── key7.png │ ├── setup │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 3.png │ ├── 6.png │ └── 7.png │ ├── signup │ ├── signup1.png │ ├── signup2.png │ ├── signup3.png │ └── signup4.png │ ├── system │ ├── network.png │ ├── process.png │ └── test.png │ └── tryit │ ├── 0.png │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ └── 6.png ├── lib ├── clientpool │ └── clientpool.go ├── config │ └── config.go ├── contstant │ └── contstant.go ├── flags │ └── flags.go ├── monitor │ ├── monitor.go │ └── monitor_test.go ├── net │ ├── cgo_bsd.go │ ├── cgo_linux.go │ ├── cgo_netbsd.go │ ├── cgo_openbsd.go │ ├── cgo_stub.go │ ├── cgo_unix.go │ ├── cgo_unix_test.go │ ├── conn_test.go │ ├── dial.go │ ├── dial_gen.go │ ├── dial_gen_test.go │ ├── dial_test.go │ ├── dialgoogle_test.go │ ├── dnsclient.go │ ├── dnsclient_test.go │ ├── dnsclient_unix.go │ ├── dnsclient_unix_test.go │ ├── dnsconfig_unix.go │ ├── dnsconfig_unix_test.go │ ├── dnsmsg.go │ ├── dnsmsg_test.go │ ├── dnsname_test.go │ ├── empty.c │ ├── example_test.go │ ├── fd_mutex.go │ ├── fd_mutex_test.go │ ├── fd_plan9.go │ ├── fd_poll_nacl.go │ ├── fd_poll_runtime.go │ ├── fd_unix.go │ ├── fd_unix_test.go │ ├── fd_windows.go │ ├── file_plan9.go │ ├── file_test.go │ ├── file_unix.go │ ├── file_windows.go │ ├── hosts.go │ ├── hosts_test.go │ ├── http │ │ ├── cgi │ │ │ ├── child.go │ │ │ ├── child_test.go │ │ │ ├── host.go │ │ │ ├── host_test.go │ │ │ ├── matryoshka_test.go │ │ │ ├── plan9_test.go │ │ │ ├── posix_test.go │ │ │ └── testdata │ │ │ │ └── test.cgi │ │ ├── chunked.go │ │ ├── chunked_test.go │ │ ├── client.go │ │ ├── client_test.go │ │ ├── cookie.go │ │ ├── cookie_test.go │ │ ├── cookiejar │ │ │ ├── jar.go │ │ │ ├── jar_test.go │ │ │ ├── punycode.go │ │ │ └── punycode_test.go │ │ ├── doc.go │ │ ├── example_test.go │ │ ├── export_test.go │ │ ├── fcgi │ │ │ ├── child.go │ │ │ ├── fcgi.go │ │ │ └── fcgi_test.go │ │ ├── filetransport.go │ │ ├── filetransport_test.go │ │ ├── fs.go │ │ ├── fs_test.go │ │ ├── header.go │ │ ├── header_test.go │ │ ├── httptest │ │ │ ├── example_test.go │ │ │ ├── recorder.go │ │ │ ├── recorder_test.go │ │ │ ├── server.go │ │ │ └── server_test.go │ │ ├── httputil │ │ │ ├── chunked.go │ │ │ ├── chunked_test.go │ │ │ ├── dump.go │ │ │ ├── dump_test.go │ │ │ ├── httputil.go │ │ │ ├── persist.go │ │ │ ├── reverseproxy.go │ │ │ └── reverseproxy_test.go │ │ ├── jar.go │ │ ├── lex.go │ │ ├── lex_test.go │ │ ├── npn_test.go │ │ ├── pprof │ │ │ └── pprof.go │ │ ├── proxy_test.go │ │ ├── race.go │ │ ├── range_test.go │ │ ├── readrequest_test.go │ │ ├── request.go │ │ ├── request_test.go │ │ ├── requestwrite_test.go │ │ ├── response.go │ │ ├── response_test.go │ │ ├── responsewrite_test.go │ │ ├── serve_test.go │ │ ├── server.go │ │ ├── server.go_bak │ │ ├── sniff.go │ │ ├── sniff_test.go │ │ ├── status.go │ │ ├── testdata │ │ │ ├── file │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── transfer.go │ │ ├── transfer_test.go │ │ ├── transport.go │ │ ├── transport_test.go │ │ ├── triv.go │ │ └── z_last_test.go │ ├── interface.go │ ├── interface_bsd.go │ ├── interface_bsd_test.go │ ├── interface_darwin.go │ ├── interface_dragonfly.go │ ├── interface_freebsd.go │ ├── interface_linux.go │ ├── interface_linux_test.go │ ├── interface_netbsd.go │ ├── interface_openbsd.go │ ├── interface_stub.go │ ├── interface_test.go │ ├── interface_unix_test.go │ ├── interface_windows.go │ ├── ip.go │ ├── ip_test.go │ ├── ipraw_test.go │ ├── iprawsock.go │ ├── iprawsock_plan9.go │ ├── iprawsock_posix.go │ ├── ipsock.go │ ├── ipsock_plan9.go │ ├── ipsock_posix.go │ ├── ipsock_test.go │ ├── lookup.go │ ├── lookup_plan9.go │ ├── lookup_test.go │ ├── lookup_unix.go │ ├── lookup_windows.go │ ├── mac.go │ ├── mac_test.go │ ├── mail │ │ ├── message.go │ │ └── message_test.go │ ├── mockicmp_test.go │ ├── mockserver_test.go │ ├── multicast_test.go │ ├── net.go │ ├── net_test.go │ ├── net_windows_test.go │ ├── netgo_unix_test.go │ ├── packetconn_test.go │ ├── parse.go │ ├── parse_test.go │ ├── pipe.go │ ├── pipe_test.go │ ├── port.go │ ├── port_test.go │ ├── port_unix.go │ ├── protoconn_test.go │ ├── race.go │ ├── race0.go │ ├── rpc │ │ ├── client.go │ │ ├── client_test.go │ │ ├── debug.go │ │ ├── jsonrpc │ │ │ ├── all_test.go │ │ │ ├── client.go │ │ │ └── server.go │ │ ├── server.go │ │ └── server_test.go │ ├── sendfile_dragonfly.go │ ├── sendfile_freebsd.go │ ├── sendfile_linux.go │ ├── sendfile_stub.go │ ├── sendfile_windows.go │ ├── server_test.go │ ├── singleflight.go │ ├── smtp │ │ ├── auth.go │ │ ├── example_test.go │ │ ├── smtp.go │ │ └── smtp_test.go │ ├── sock_bsd.go │ ├── sock_cloexec.go │ ├── sock_linux.go │ ├── sock_plan9.go │ ├── sock_posix.go │ ├── sock_solaris.go │ ├── sock_windows.go │ ├── sockopt_bsd.go │ ├── sockopt_linux.go │ ├── sockopt_plan9.go │ ├── sockopt_posix.go │ ├── sockopt_solaris.go │ ├── sockopt_windows.go │ ├── sockoptip_bsd.go │ ├── sockoptip_linux.go │ ├── sockoptip_posix.go │ ├── sockoptip_stub.go │ ├── sockoptip_windows.go │ ├── sys_cloexec.go │ ├── tcp_test.go │ ├── tcpsock.go │ ├── tcpsock_plan9.go │ ├── tcpsock_posix.go │ ├── tcpsockopt_darwin.go │ ├── tcpsockopt_dragonfly.go │ ├── tcpsockopt_openbsd.go │ ├── tcpsockopt_plan9.go │ ├── tcpsockopt_posix.go │ ├── tcpsockopt_solaris.go │ ├── tcpsockopt_unix.go │ ├── tcpsockopt_windows.go │ ├── testdata │ │ ├── hosts │ │ ├── hosts_singleline │ │ ├── igmp │ │ ├── igmp6 │ │ └── resolv.conf │ ├── textproto │ │ ├── header.go │ │ ├── pipeline.go │ │ ├── reader.go │ │ ├── reader_test.go │ │ ├── textproto.go │ │ ├── writer.go │ │ └── writer_test.go │ ├── timeout_test.go │ ├── udp_test.go │ ├── udpsock.go │ ├── udpsock_plan9.go │ ├── udpsock_posix.go │ ├── unicast_posix_test.go │ ├── unix_test.go │ ├── unixsock.go │ ├── unixsock_plan9.go │ ├── unixsock_posix.go │ ├── url │ │ ├── example_test.go │ │ ├── url.go │ │ └── url_test.go │ └── z_last_test.go ├── postrequest │ └── postrequest.go ├── rg │ └── rg.go ├── serverstatus │ └── serverstatus.go ├── sid │ └── sid.go ├── storage │ └── storage.go ├── transfer │ └── transfer.go ├── updateserverstatus │ └── updateserverstatus.go ├── utils │ ├── utils.go │ └── utils_test.go └── version │ └── version.go ├── localposter ├── chatmessage │ ├── client_to_local.go │ ├── client_to_local_test.go │ ├── local_ack.go │ ├── local_ack_test.go │ ├── local_to_local.go │ └── local_to_local_test.go ├── core │ ├── core.go │ └── core_test.go ├── handler │ ├── localposterhandler.go │ └── mockhandler.go ├── localposter.go └── utils │ ├── utils.go │ └── utils_test.go ├── log ├── 1_server │ └── log_only3.txt └── 2_servers │ └── log_3_7.txt ├── make └── build.sh ├── message ├── .swp ├── message.pb.go ├── message.proto └── message_pb2.py ├── monitorsystem ├── clientdemo │ └── clientdemo.go ├── monitorclient │ └── monitorclient.go ├── monitorsender │ └── monitorsender.go └── monitorserver │ └── monitorserver.go ├── package ├── install.sh ├── install_dev.sh ├── protobuf-master.tar.gz ├── redis-2.8.24.tar.gz └── sysctl.conf ├── parselog └── parselog.go ├── plot └── draw.plt ├── poster └── poster.go ├── python ├── gen.py ├── genName.py ├── genRelationship.py ├── genUser.py ├── gen_10w.py ├── gen_300w.py ├── gen_50w.py ├── gen_600w.py ├── inputrp.py ├── message_pb2.py ├── mySQL_test.py ├── resort.sh ├── rg.py ├── saveredis.py ├── split.py └── todolist ├── redisconf ├── redis1.conf ├── redis2.conf ├── redis3.conf ├── redis4.conf └── redis5.conf ├── router └── router.go ├── rpm ├── rpmbuild │ └── SPECS │ │ └── fakewechat.spec └── yum.repos.d │ └── test.repo ├── vendor ├── github.com │ ├── bradfitz │ │ └── gomemcache │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── memcache │ │ │ ├── memcache.go │ │ │ ├── memcache_test.go │ │ │ ├── selector.go │ │ │ └── selector_test.go │ ├── garyburd │ │ └── redigo │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.markdown │ │ │ ├── internal │ │ │ ├── commandinfo.go │ │ │ ├── commandinfo_test.go │ │ │ └── redistest │ │ │ │ └── testdb.go │ │ │ ├── redis │ │ │ ├── conn.go │ │ │ ├── conn_test.go │ │ │ ├── doc.go │ │ │ ├── log.go │ │ │ ├── pool.go │ │ │ ├── pool_test.go │ │ │ ├── pubsub.go │ │ │ ├── pubsub_test.go │ │ │ ├── redis.go │ │ │ ├── reply.go │ │ │ ├── reply_test.go │ │ │ ├── scan.go │ │ │ ├── scan_test.go │ │ │ ├── script.go │ │ │ ├── script_test.go │ │ │ ├── test_test.go │ │ │ └── zpop_example_test.go │ │ │ └── redisx │ │ │ ├── connmux.go │ │ │ ├── connmux_test.go │ │ │ └── doc.go │ ├── go-redis │ │ └── redis │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── cluster.go │ │ │ ├── cluster_client_test.go │ │ │ ├── cluster_pipeline.go │ │ │ ├── cluster_test.go │ │ │ ├── command.go │ │ │ ├── command_test.go │ │ │ ├── commands.go │ │ │ ├── commands_test.go │ │ │ ├── conn.go │ │ │ ├── conn_test.go │ │ │ ├── doc.go │ │ │ ├── error.go │ │ │ ├── example_test.go │ │ │ ├── export_test.go │ │ │ ├── internal │ │ │ ├── consistenthash │ │ │ │ ├── consistenthash.go │ │ │ │ └── consistenthash_test.go │ │ │ └── hashtag │ │ │ │ ├── hashtag.go │ │ │ │ └── hashtag_test.go │ │ │ ├── main_test.go │ │ │ ├── multi.go │ │ │ ├── multi_test.go │ │ │ ├── parser.go │ │ │ ├── parser_test.go │ │ │ ├── pipeline.go │ │ │ ├── pipeline_test.go │ │ │ ├── pool.go │ │ │ ├── pool_test.go │ │ │ ├── pubsub.go │ │ │ ├── pubsub_test.go │ │ │ ├── redis.go │ │ │ ├── redis_test.go │ │ │ ├── ring.go │ │ │ ├── ring_test.go │ │ │ ├── safe.go │ │ │ ├── script.go │ │ │ ├── sentinel.go │ │ │ ├── sentinel_test.go │ │ │ └── unsafe.go │ ├── golang │ │ ├── glog-master.zip │ │ ├── glog │ │ │ ├── LICENSE │ │ │ ├── README │ │ │ ├── glog.go │ │ │ ├── glog_file.go │ │ │ └── glog_test.go │ │ ├── groupcache-master.zip │ │ ├── groupcache │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── byteview.go │ │ │ ├── byteview_test.go │ │ │ ├── consistenthash │ │ │ │ ├── consistenthash.go │ │ │ │ └── consistenthash_test.go │ │ │ ├── groupcache.go │ │ │ ├── groupcache_test.go │ │ │ ├── groupcachepb │ │ │ │ ├── groupcache.pb.go │ │ │ │ └── groupcache.proto │ │ │ ├── http.go │ │ │ ├── http_test.go │ │ │ ├── lru │ │ │ │ ├── lru.go │ │ │ │ └── lru_test.go │ │ │ ├── peers.go │ │ │ ├── singleflight │ │ │ │ ├── singleflight.go │ │ │ │ └── singleflight_test.go │ │ │ ├── sinks.go │ │ │ └── testpb │ │ │ │ ├── test.pb.go │ │ │ │ └── test.proto │ │ ├── protobuf │ │ │ ├── .gitignore │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── Make.protobuf │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── jsonpb │ │ │ │ ├── jsonpb.go │ │ │ │ ├── jsonpb_test.go │ │ │ │ └── jsonpb_test_proto │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── more_test_objects.proto │ │ │ │ │ └── test_objects.proto │ │ │ ├── proto │ │ │ │ ├── Makefile │ │ │ │ ├── all_test.go │ │ │ │ ├── clone.go │ │ │ │ ├── clone_test.go │ │ │ │ ├── decode.go │ │ │ │ ├── encode.go │ │ │ │ ├── equal.go │ │ │ │ ├── equal_test.go │ │ │ │ ├── extensions.go │ │ │ │ ├── extensions_test.go │ │ │ │ ├── lib.go │ │ │ │ ├── message_set.go │ │ │ │ ├── message_set_test.go │ │ │ │ ├── pointer_reflect.go │ │ │ │ ├── pointer_unsafe.go │ │ │ │ ├── properties.go │ │ │ │ ├── proto3_proto │ │ │ │ │ └── proto3.proto │ │ │ │ ├── proto3_test.go │ │ │ │ ├── size2_test.go │ │ │ │ ├── size_test.go │ │ │ │ ├── testdata │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── golden_test.go │ │ │ │ │ └── test.proto │ │ │ │ ├── text.go │ │ │ │ ├── text_parser.go │ │ │ │ ├── text_parser_test.go │ │ │ │ └── text_test.go │ │ │ └── protoc-gen-go │ │ │ │ ├── Makefile │ │ │ │ ├── descriptor │ │ │ │ └── Makefile │ │ │ │ ├── doc.go │ │ │ │ ├── generator │ │ │ │ ├── Makefile │ │ │ │ ├── generator.go │ │ │ │ └── name_test.go │ │ │ │ ├── internal │ │ │ │ └── grpc │ │ │ │ │ └── grpc.go │ │ │ │ ├── link_grpc.go │ │ │ │ ├── main.go │ │ │ │ ├── plugin │ │ │ │ ├── Makefile │ │ │ │ └── plugin.pb.golden │ │ │ │ ├── protoc-gen-go │ │ │ │ └── testdata │ │ │ │ ├── Makefile │ │ │ │ ├── extension_base.proto │ │ │ │ ├── extension_extra.proto │ │ │ │ ├── extension_test.go │ │ │ │ ├── extension_user.proto │ │ │ │ ├── grpc.proto │ │ │ │ ├── imp.pb.go.golden │ │ │ │ ├── imp.proto │ │ │ │ ├── imp2.proto │ │ │ │ ├── imp3.proto │ │ │ │ ├── main_test.go │ │ │ │ ├── multi │ │ │ │ ├── multi1.proto │ │ │ │ ├── multi2.proto │ │ │ │ └── multi3.proto │ │ │ │ ├── my_test │ │ │ │ ├── test.pb.go.golden │ │ │ │ └── test.proto │ │ │ │ └── proto3.proto │ │ └── protobuf_bak │ │ │ ├── .gitignore │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── Make.protobuf │ │ │ ├── Makefile │ │ │ ├── README │ │ │ ├── proto │ │ │ ├── Makefile │ │ │ ├── all_test.go │ │ │ ├── clone.go │ │ │ ├── clone_test.go │ │ │ ├── decode.go │ │ │ ├── encode.go │ │ │ ├── equal.go │ │ │ ├── equal_test.go │ │ │ ├── extensions.go │ │ │ ├── extensions_test.go │ │ │ ├── lib.go │ │ │ ├── message_set.go │ │ │ ├── message_set_test.go │ │ │ ├── pointer_reflect.go │ │ │ ├── pointer_unsafe.go │ │ │ ├── properties.go │ │ │ ├── proto3_proto │ │ │ │ └── proto3.proto │ │ │ ├── proto3_test.go │ │ │ ├── size2_test.go │ │ │ ├── size_test.go │ │ │ ├── testdata │ │ │ │ ├── Makefile │ │ │ │ ├── golden_test.go │ │ │ │ └── test.proto │ │ │ ├── text.go │ │ │ ├── text_parser.go │ │ │ ├── text_parser_test.go │ │ │ └── text_test.go │ │ │ └── protoc-gen-go │ │ │ ├── Makefile │ │ │ ├── descriptor │ │ │ ├── Makefile │ │ │ └── descriptor.pb.golden │ │ │ ├── doc.go │ │ │ ├── generator │ │ │ ├── Makefile │ │ │ ├── generator.go │ │ │ └── name_test.go │ │ │ ├── internal │ │ │ └── grpc │ │ │ │ └── grpc.go │ │ │ ├── link_grpc.go │ │ │ ├── main.go │ │ │ ├── plugin │ │ │ ├── Makefile │ │ │ └── plugin.pb.golden │ │ │ ├── protoc-gen-go │ │ │ └── testdata │ │ │ ├── Makefile │ │ │ ├── extension_base.proto │ │ │ ├── extension_extra.proto │ │ │ ├── extension_test.go │ │ │ ├── extension_user.proto │ │ │ ├── golden_test.go │ │ │ ├── grpc.proto │ │ │ ├── imp.pb.go.golden │ │ │ ├── imp.proto │ │ │ ├── imp2.proto │ │ │ ├── imp3.proto │ │ │ ├── main_test.go │ │ │ ├── multi │ │ │ ├── multi1.proto │ │ │ ├── multi2.proto │ │ │ └── multi3.proto │ │ │ ├── my_test │ │ │ ├── test.pb.go.golden │ │ │ └── test.proto │ │ │ └── proto3.proto │ ├── hoisie │ │ └── redis │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── Readme.md │ │ │ ├── redis.go │ │ │ ├── redis_test.go │ │ │ └── tools │ │ │ ├── redis-dump.go │ │ │ └── redis-load.go │ └── nsf │ │ └── gocode │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _gccgo │ │ └── package.go │ │ ├── _goremote │ │ └── goremote.go │ │ ├── _testing │ │ ├── DESC │ │ ├── README │ │ ├── all.bash │ │ ├── run.py │ │ ├── run.rb │ │ ├── run.tcl │ │ ├── test.0001 │ │ │ ├── cursor.47 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0002 │ │ │ ├── cursor.105 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0003 │ │ │ ├── cursor.552 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0004 │ │ │ ├── cursor.1348 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0005 │ │ │ ├── b.go │ │ │ ├── cursor.327 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0006 │ │ │ ├── b.go │ │ │ ├── cursor.286 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0007 │ │ │ ├── cursor.58 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0008 │ │ │ ├── cursor.120 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0009 │ │ │ ├── cursor.126 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0010 │ │ │ ├── cursor.104 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0011 │ │ │ ├── cursor.76 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0012 │ │ │ ├── cursor.114 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0013 │ │ │ ├── cursor.359 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0014 │ │ │ ├── cursor.191 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0015 │ │ │ ├── cursor.130 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0016 │ │ │ ├── cursor.122 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0017 │ │ │ ├── cursor.70 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0018 │ │ │ ├── cursor.355 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0019 │ │ │ ├── cursor.72 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0020 │ │ │ ├── cursor.174 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0021 │ │ │ ├── cursor.82 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0022 │ │ │ ├── cursor.79 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0023 │ │ │ ├── cursor.88 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0024 │ │ │ ├── cursor.71 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0025 │ │ │ ├── cursor.53 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0026 │ │ │ ├── cursor.164 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0027 │ │ │ ├── cursor.84 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0028 │ │ │ ├── cursor.129 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0029 │ │ │ ├── cursor.62 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0030 │ │ │ ├── cursor.85 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0031 │ │ │ ├── cursor.80 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0032 │ │ │ ├── cursor.1835 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0033 │ │ │ ├── cursor.138 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0034 │ │ │ ├── cursor.82 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0035 │ │ │ ├── cursor.91 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0036 │ │ │ ├── cursor.67 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0037 │ │ │ ├── cursor.139 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0038 │ │ │ ├── cursor.87 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0039 │ │ │ ├── cursor.88 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0040 │ │ │ ├── cursor.96 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0041 │ │ │ ├── cursor.140 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0042 │ │ │ ├── cursor.126 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0043 │ │ │ ├── cursor.182 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0044 │ │ │ ├── cursor.105 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0045 │ │ │ ├── cursor.51 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0046 │ │ │ ├── cursor.53 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0047 │ │ │ ├── cursor.43 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0048 │ │ │ ├── cursor.53 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0049 │ │ │ ├── cursor.44 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── test.0050 │ │ │ ├── cursor.45 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ └── test.0051 │ │ │ ├── cursor.247 │ │ │ ├── out.expected │ │ │ └── test.go.in │ │ ├── autocompletecontext.go │ │ ├── autocompletefile.go │ │ ├── client.go │ │ ├── config.go │ │ ├── cursorcontext.go │ │ ├── debian │ │ ├── changelog │ │ ├── compat │ │ ├── control │ │ ├── copyright │ │ ├── docs │ │ ├── gocode.default │ │ ├── rules │ │ └── source │ │ │ └── format │ │ ├── decl.go │ │ ├── declcache.go │ │ ├── docs │ │ ├── IDE_integration.md │ │ └── autocomplete_formats.md │ │ ├── emacs-company │ │ ├── README.md │ │ └── company-go.el │ │ ├── emacs │ │ └── go-autocomplete.el │ │ ├── formatters.go │ │ ├── gocode.go │ │ ├── nvim │ │ ├── autoload │ │ │ └── gocomplete.vim │ │ ├── ftplugin │ │ │ └── go │ │ │ │ └── gocomplete.vim │ │ ├── pathogen_update.sh │ │ ├── symlink.sh │ │ └── update.sh │ │ ├── os_posix.go │ │ ├── os_windows.go │ │ ├── package.go │ │ ├── ripper.go │ │ ├── rpc.go │ │ ├── scope.go │ │ ├── server.go │ │ ├── utils.go │ │ └── vim │ │ ├── autoload │ │ └── gocomplete.vim │ │ ├── ftplugin │ │ └── go │ │ │ └── gocomplete.vim │ │ ├── pathogen_update.sh │ │ ├── symlink.sh │ │ └── update.sh └── gopkg.in │ ├── bsm │ └── ratelimit.v1 │ │ ├── .travis.yml │ │ ├── Makefile │ │ ├── README.md │ │ ├── ratelimit.go │ │ └── ratelimit_test.go │ └── redis.v3 │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── cluster.go │ ├── cluster_client_test.go │ ├── cluster_pipeline.go │ ├── cluster_test.go │ ├── command.go │ ├── command_test.go │ ├── commands.go │ ├── commands_test.go │ ├── conn.go │ ├── conn_test.go │ ├── doc.go │ ├── error.go │ ├── example_test.go │ ├── export_test.go │ ├── internal │ ├── consistenthash │ │ ├── consistenthash.go │ │ └── consistenthash_test.go │ └── hashtag │ │ ├── hashtag.go │ │ └── hashtag_test.go │ ├── main_test.go │ ├── multi.go │ ├── multi_test.go │ ├── parser.go │ ├── parser_test.go │ ├── pipeline.go │ ├── pipeline_test.go │ ├── pool.go │ ├── pool_test.go │ ├── pubsub.go │ ├── pubsub_test.go │ ├── redis.go │ ├── redis_test.go │ ├── ring.go │ ├── ring_test.go │ ├── safe.go │ ├── script.go │ ├── sentinel.go │ ├── sentinel_test.go │ └── unsafe.go └── zabbix ├── send.sh └── zabbix_init.py /.gitattributes: -------------------------------------------------------------------------------- 1 | *.py linguist-language=Go 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.pyc 3 | .DS_Store 4 | *.bak 5 | .project 6 | .idea 7 | bin/cacheserver 8 | bin/client 9 | bin/gateway 10 | bin/localposter 11 | bin/monitorserver 12 | bin/parselog 13 | bin/poster 14 | bin/router 15 | bin/*.txt 16 | redisconf/*.log 17 | redisconf/*/*.log 18 | redisconf/*/*.rdb 19 | redisconf/*/*.pid 20 | python/*.txt 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A fake wechat service 2 | 3 | have fun 4 | 5 | 6 | Design: https://github.com/xiaojiaqi/fakewechat/wiki/Design 7 | 8 | Stress Testing: https://github.com/xiaojiaqi/fakewechat/wiki/Stress-Testing-in-the-Cloud 9 | -------------------------------------------------------------------------------- /aws/aws-python-sample-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/aws/aws-python-sample-master.zip -------------------------------------------------------------------------------- /aws/boto3-develop.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/aws/boto3-develop.zip -------------------------------------------------------------------------------- /aws/close.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import boto.ec2 4 | 5 | ec2 = boto.ec2.connect_to_region('ap-northeast-1') 6 | t = ec2.get_all_instances() 7 | for i in t: 8 | print i.instances 9 | for k in i.instances: 10 | print k.id 11 | ec2.terminate_instances(k.id) -------------------------------------------------------------------------------- /aws/close_ec2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import boto.ec2 4 | aws_access_key = 'xxxx' 5 | aws_secret_key = 'xxxx' 6 | region = 'ap-northeast-1' 7 | 8 | 9 | ec2 = boto.ec2.connect_to_region(region, aws_access_key_id= aws_access_key, aws_secret_access_key =aws_secret_key) 10 | t = ec2.get_all_instances() 11 | for i in t: 12 | print i.instances 13 | for k in i.instances: 14 | print k.id 15 | ec2.terminate_instances(k.id) -------------------------------------------------------------------------------- /aws/package/boto/beanstalk/wrapper.py: -------------------------------------------------------------------------------- 1 | """Wraps layer1 api methods and converts layer1 dict responses to objects.""" 2 | from boto.beanstalk.layer1 import Layer1 3 | import boto.beanstalk.response 4 | from boto.exception import BotoServerError 5 | import boto.beanstalk.exception as exception 6 | 7 | 8 | def beanstalk_wrapper(func, name): 9 | def _wrapped_low_level_api(*args, **kwargs): 10 | try: 11 | response = func(*args, **kwargs) 12 | except BotoServerError as e: 13 | raise exception.simple(e) 14 | # Turn 'this_is_a_function_name' into 'ThisIsAFunctionNameResponse'. 15 | cls_name = ''.join([part.capitalize() for part in name.split('_')]) + 'Response' 16 | cls = getattr(boto.beanstalk.response, cls_name) 17 | return cls(response) 18 | return _wrapped_low_level_api 19 | 20 | 21 | class Layer1Wrapper(object): 22 | def __init__(self, *args, **kwargs): 23 | self.api = Layer1(*args, **kwargs) 24 | 25 | def __getattr__(self, name): 26 | try: 27 | return beanstalk_wrapper(getattr(self.api, name), name) 28 | except AttributeError: 29 | raise AttributeError("%s has no attribute %r" % (self, name)) 30 | -------------------------------------------------------------------------------- /aws/package/boto/cacerts/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Google Inc. 2 | # All rights reserved. 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the 6 | # "Software"), to deal in the Software without restriction, including 7 | # without limitation the rights to use, copy, modify, merge, publish, dis- 8 | # tribute, sublicense, and/or sell copies of the Software, and to permit 9 | # persons to whom the Software is furnished to do so, subject to the fol- 10 | # lowing conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included 13 | # in all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 17 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 18 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | # IN THE SOFTWARE. 22 | # 23 | -------------------------------------------------------------------------------- /aws/package/boto/cloudfront/exception.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | 22 | from boto.exception import BotoServerError 23 | 24 | class CloudFrontServerError(BotoServerError): 25 | 26 | pass 27 | -------------------------------------------------------------------------------- /aws/package/boto/cloudsearch2/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Exceptions that are specific to the cloudsearch2 module. 3 | """ 4 | from boto.exception import BotoServerError 5 | 6 | 7 | class InvalidTypeException(BotoServerError): 8 | """ 9 | Raised when an invalid record type is passed to CloudSearch. 10 | """ 11 | pass 12 | 13 | 14 | class LimitExceededException(BotoServerError): 15 | """ 16 | Raised when a limit has been exceeded. 17 | """ 18 | pass 19 | 20 | 21 | class InternalException(BotoServerError): 22 | """ 23 | A generic server-side error. 24 | """ 25 | pass 26 | 27 | 28 | class DisabledOperationException(BotoServerError): 29 | """ 30 | Raised when an operation has been disabled. 31 | """ 32 | pass 33 | 34 | 35 | class ResourceNotFoundException(BotoServerError): 36 | """ 37 | Raised when a requested resource does not exist. 38 | """ 39 | pass 40 | 41 | 42 | class BaseException(BotoServerError): 43 | """ 44 | A generic server-side error. 45 | """ 46 | pass 47 | -------------------------------------------------------------------------------- /aws/package/boto/cognito/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | -------------------------------------------------------------------------------- /aws/package/boto/cognito/identity/exceptions.py: -------------------------------------------------------------------------------- 1 | # The above copyright notice and this permission notice shall be included 2 | # in all copies or substantial portions of the Software. 3 | # 4 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 5 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 6 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 7 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 8 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 10 | # IN THE SOFTWARE. 11 | # 12 | from boto.exception import BotoServerError 13 | 14 | 15 | class LimitExceededException(BotoServerError): 16 | pass 17 | 18 | 19 | class ResourceConflictException(BotoServerError): 20 | pass 21 | 22 | 23 | class DeveloperUserAlreadyRegisteredException(BotoServerError): 24 | pass 25 | 26 | 27 | class TooManyRequestsException(BotoServerError): 28 | pass 29 | 30 | 31 | class InvalidParameterException(BotoServerError): 32 | pass 33 | 34 | 35 | class ResourceNotFoundException(BotoServerError): 36 | pass 37 | 38 | 39 | class InternalErrorException(BotoServerError): 40 | pass 41 | 42 | 43 | class NotAuthorizedException(BotoServerError): 44 | pass 45 | -------------------------------------------------------------------------------- /aws/package/boto/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | -------------------------------------------------------------------------------- /aws/package/boto/directconnect/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | 24 | class DirectConnectClientException(Exception): 25 | pass 26 | 27 | 28 | class DirectConnectServerException(Exception): 29 | pass 30 | -------------------------------------------------------------------------------- /aws/package/boto/dynamodb2/types.py: -------------------------------------------------------------------------------- 1 | # Shadow the DynamoDB v1 bits. 2 | # This way, no end user should have to cross-import between versions & we 3 | # reserve the namespace to extend v2 if it's ever needed. 4 | from boto.dynamodb.types import NonBooleanDynamizer, Dynamizer 5 | 6 | 7 | # Some constants for our use. 8 | STRING = 'S' 9 | NUMBER = 'N' 10 | BINARY = 'B' 11 | STRING_SET = 'SS' 12 | NUMBER_SET = 'NS' 13 | BINARY_SET = 'BS' 14 | NULL = 'NULL' 15 | BOOLEAN = 'BOOL' 16 | MAP = 'M' 17 | LIST = 'L' 18 | 19 | QUERY_OPERATORS = { 20 | 'eq': 'EQ', 21 | 'lte': 'LE', 22 | 'lt': 'LT', 23 | 'gte': 'GE', 24 | 'gt': 'GT', 25 | 'beginswith': 'BEGINS_WITH', 26 | 'between': 'BETWEEN', 27 | } 28 | 29 | FILTER_OPERATORS = { 30 | 'eq': 'EQ', 31 | 'ne': 'NE', 32 | 'lte': 'LE', 33 | 'lt': 'LT', 34 | 'gte': 'GE', 35 | 'gt': 'GT', 36 | # FIXME: Is this necessary? i.e. ``whatever__null=False`` 37 | 'nnull': 'NOT_NULL', 38 | 'null': 'NULL', 39 | 'contains': 'CONTAINS', 40 | 'ncontains': 'NOT_CONTAINS', 41 | 'beginswith': 'BEGINS_WITH', 42 | 'in': 'IN', 43 | 'between': 'BETWEEN', 44 | } 45 | -------------------------------------------------------------------------------- /aws/package/boto/file/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Google Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | 22 | import boto 23 | 24 | from boto.file.connection import FileConnection as Connection 25 | from boto.file.key import Key 26 | from boto.file.bucket import Bucket 27 | 28 | __all__ = ['Connection', 'Key', 'Bucket'] 29 | -------------------------------------------------------------------------------- /aws/package/boto/fps/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008, Chris Moyer http://coredumped.org 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | -------------------------------------------------------------------------------- /aws/package/boto/gs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Google Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | -------------------------------------------------------------------------------- /aws/package/boto/manage/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | 24 | -------------------------------------------------------------------------------- /aws/package/boto/manage/test_manage.py: -------------------------------------------------------------------------------- 1 | from boto.manage.server import Server 2 | from boto.manage.volume import Volume 3 | import time 4 | 5 | print('--> Creating New Volume') 6 | volume = Volume.create() 7 | print(volume) 8 | 9 | print('--> Creating New Server') 10 | server_list = Server.create() 11 | server = server_list[0] 12 | print(server) 13 | 14 | print('----> Waiting for Server to start up') 15 | while server.status != 'running': 16 | print('*') 17 | time.sleep(10) 18 | print('----> Server is running') 19 | 20 | print('--> Run "df -k" on Server') 21 | status = server.run('df -k') 22 | print(status[1]) 23 | 24 | print('--> Now run volume.make_ready to make the volume ready to use on server') 25 | volume.make_ready(server) 26 | 27 | print('--> Run "df -k" on Server') 28 | status = server.run('df -k') 29 | print(status[1]) 30 | 31 | print('--> Do an "ls -al" on the new filesystem') 32 | status = server.run('ls -al %s' % volume.mount_point) 33 | print(status[1]) 34 | 35 | -------------------------------------------------------------------------------- /aws/package/boto/mashups/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | 24 | -------------------------------------------------------------------------------- /aws/package/boto/mturk/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | 24 | -------------------------------------------------------------------------------- /aws/package/boto/mws/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2008, Chris Moyer http://coredumped.org 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | -------------------------------------------------------------------------------- /aws/package/boto/pyami/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | -------------------------------------------------------------------------------- /aws/package/boto/pyami/helloworld.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | from boto.pyami.scriptbase import ScriptBase 23 | 24 | class HelloWorld(ScriptBase): 25 | 26 | def main(self): 27 | self.log('Hello World!!!') 28 | -------------------------------------------------------------------------------- /aws/package/boto/pyami/installers/ubuntu/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | -------------------------------------------------------------------------------- /aws/package/boto/roboto/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /aws/package/boto/route53/exception.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ 2 | # Copyright (c) 2010, Eucalyptus Systems, Inc. 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the 6 | # "Software"), to deal in the Software without restriction, including 7 | # without limitation the rights to use, copy, modify, merge, publish, dis- 8 | # tribute, sublicense, and/or sell copies of the Software, and to permit 9 | # persons to whom the Software is furnished to do so, subject to the fol- 10 | # lowing conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included 13 | # in all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 17 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 18 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | # IN THE SOFTWARE. 22 | 23 | from boto.exception import BotoServerError 24 | 25 | 26 | class DNSServerError(BotoServerError): 27 | pass 28 | -------------------------------------------------------------------------------- /aws/package/boto/sdb/db/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /aws/package/boto/services/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the 5 | # "Software"), to deal in the Software without restriction, including 6 | # without limitation the rights to use, copy, modify, merge, publish, dis- 7 | # tribute, sublicense, and/or sell copies of the Software, and to permit 8 | # persons to whom the Software is furnished to do so, subject to the fol- 9 | # lowing conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included 12 | # in all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 | # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | 23 | 24 | -------------------------------------------------------------------------------- /aws/package/boto/swf/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Exceptions that are specific to the swf module. 3 | 4 | This module subclasses the base SWF response exception, 5 | boto.exceptions.SWFResponseError, for some of the SWF specific faults. 6 | """ 7 | from boto.exception import SWFResponseError 8 | 9 | 10 | class SWFDomainAlreadyExistsError(SWFResponseError): 11 | """ 12 | Raised when when the domain already exists. 13 | """ 14 | pass 15 | 16 | 17 | class SWFLimitExceededError(SWFResponseError): 18 | """ 19 | Raised when when a system imposed limitation has been reached. 20 | """ 21 | pass 22 | 23 | 24 | class SWFOperationNotPermittedError(SWFResponseError): 25 | """ 26 | Raised when (reserved for future use). 27 | """ 28 | 29 | 30 | class SWFTypeAlreadyExistsError(SWFResponseError): 31 | """ 32 | Raised when when the workflow type or activity type already exists. 33 | """ 34 | pass 35 | 36 | 37 | class SWFWorkflowExecutionAlreadyStartedError(SWFResponseError): 38 | """ 39 | Raised when an open execution with the same workflow_id is already running 40 | in the specified domain. 41 | """ 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /aws/package/boto/vendored/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/aws/package/boto/vendored/__init__.py -------------------------------------------------------------------------------- /aws/readini.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | import sys,os 5 | import ConfigParser 6 | 7 | _aws_access_key = 'xxxx' 8 | _aws_secret_key = 'xxxx' 9 | 10 | class readini: 11 | def __init__(self, file_path): 12 | cf = ConfigParser.ConfigParser() 13 | cf.read(file_path) 14 | global _aws_secret_key 15 | global _aws_access_key 16 | _aws_secret_key = cf.get("aws", "aws_secret_key") 17 | _aws_access_key = cf.get("aws", "aws_access_key") 18 | #print _aws_secret_key, _aws_access_key 19 | 20 | def get_aws_access_key(): 21 | global _aws_access_key 22 | return _aws_access_key 23 | 24 | 25 | def get_aws_secret_key(): 26 | global _aws_secret_key 27 | return _aws_secret_key 28 | 29 | f = readini("config.ini") 30 | 31 | pwd = os.path.split(os.path.realpath(__file__))[0] 32 | 33 | pwd += "/package" 34 | sys.path.append(pwd) 35 | -------------------------------------------------------------------------------- /bin/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | set -o 5 | set -e 6 | 7 | for i in ../gateway/gateway.go ../router/router.go ../poster/poster.go ../goredis/goredis.go ../localposter/localposter.go ../cacheserver/cacheserver.go ../cacheserver/cacheserver.go ../monitorsystem/monitorclient/monitorclient.go ../monitorsystem/monitorserver/monitorserver.go ../client/client.go ../parselog/parselog.go; 8 | do 9 | go build -ldflags "-X github.com/fakewechat/lib/version.Buildstamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X github.com/fakewechat/lib/version.Githash=`git rev-parse HEAD` -X github.com/fakewechat/lib/version.ProgramVersion=0.1 " $i 10 | done 11 | -------------------------------------------------------------------------------- /bin/clean.sh: -------------------------------------------------------------------------------- 1 | rm -f monitorserver cacheserver gateway localposter poster router parselog client 2 | -------------------------------------------------------------------------------- /bin/cmd/client/log.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/bin/cmd/client/log.txt -------------------------------------------------------------------------------- /bin/cmd/server/log.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/bin/cmd/server/log.txt -------------------------------------------------------------------------------- /bin/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o -e 3 | 4 | 5 | cd $HOME/gopath/src/github.com/fakewechat/bin 6 | 7 | ./listcm.py 8 | 9 | cp cmd/*.* . 10 | 11 | chmod +x *.sh 12 | 13 | 14 | sudo chmod 777 /etc/ansible/hosts 15 | 16 | cat cmd/hosts >> /etc/ansible/hosts 17 | 18 | ./genData.sh 19 | 20 | ./ansible.sh 21 | 22 | #ansible all -a "sh $HOME/bin/kill.sh" 23 | 24 | ansible all -a "sh $HOME/bin/stopredis.sh" 25 | ansible all -a "sh $HOME/bin/startredis.sh" 26 | 27 | ansible all -a "sh $HOME/bin/gosaveDb.sh" 28 | 29 | ansible 10.0.2.20 -a "sh $HOME/bin/monitor.sh" 30 | 31 | ./resign.sh 32 | 33 | ansible all -a "sh $HOME/bin/server.sh" 34 | 35 | 36 | -------------------------------------------------------------------------------- /bin/kill.sh: -------------------------------------------------------------------------------- 1 | killall client 2 | killall gateway 3 | killall poster 4 | killall localposter 5 | killall cacheserver 6 | killall router 7 | killall monitorserver 8 | 9 | -------------------------------------------------------------------------------- /doc/cn/aws.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/doc/cn/aws.pdf -------------------------------------------------------------------------------- /doc/cn/doc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/doc/cn/doc.pdf -------------------------------------------------------------------------------- /doc/cn/websequencediagrams.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/doc/cn/websequencediagrams.txt -------------------------------------------------------------------------------- /images/1000k/chatmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1000k/chatmessage.png -------------------------------------------------------------------------------- /images/1000k/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1000k/db.png -------------------------------------------------------------------------------- /images/1000k/gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1000k/gateway.png -------------------------------------------------------------------------------- /images/1000k/localposter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1000k/localposter.png -------------------------------------------------------------------------------- /images/1000k/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1000k/poster.png -------------------------------------------------------------------------------- /images/100k/chatmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/100k/chatmessage.png -------------------------------------------------------------------------------- /images/100k/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/100k/db.png -------------------------------------------------------------------------------- /images/100k/gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/100k/gateway.png -------------------------------------------------------------------------------- /images/100k/localposter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/100k/localposter.png -------------------------------------------------------------------------------- /images/100k/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/100k/poster.png -------------------------------------------------------------------------------- /images/1_server/chatmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1_server/chatmessage.png -------------------------------------------------------------------------------- /images/1_server/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1_server/db.png -------------------------------------------------------------------------------- /images/1_server/gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1_server/gateway.png -------------------------------------------------------------------------------- /images/1_server/localposter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1_server/localposter.png -------------------------------------------------------------------------------- /images/1_server/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/1_server/poster.png -------------------------------------------------------------------------------- /images/2_servers/chatmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/2_servers/chatmessage.png -------------------------------------------------------------------------------- /images/2_servers/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/2_servers/db.png -------------------------------------------------------------------------------- /images/2_servers/gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/2_servers/gateway.png -------------------------------------------------------------------------------- /images/2_servers/localposter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/2_servers/localposter.png -------------------------------------------------------------------------------- /images/2_servers/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/2_servers/poster.png -------------------------------------------------------------------------------- /images/doc/001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/001.jpg -------------------------------------------------------------------------------- /images/doc/002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/002.jpg -------------------------------------------------------------------------------- /images/doc/003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/003.jpg -------------------------------------------------------------------------------- /images/doc/004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/004.jpg -------------------------------------------------------------------------------- /images/doc/005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/005.jpg -------------------------------------------------------------------------------- /images/doc/006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/006.jpg -------------------------------------------------------------------------------- /images/doc/007.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/007.jpg -------------------------------------------------------------------------------- /images/doc/008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/008.jpg -------------------------------------------------------------------------------- /images/doc/009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/009.jpg -------------------------------------------------------------------------------- /images/doc/010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/010.jpg -------------------------------------------------------------------------------- /images/doc/011.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/011.jpg -------------------------------------------------------------------------------- /images/doc/012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/012.jpg -------------------------------------------------------------------------------- /images/doc/013.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/013.jpg -------------------------------------------------------------------------------- /images/doc/014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/014.jpg -------------------------------------------------------------------------------- /images/doc/015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/015.jpg -------------------------------------------------------------------------------- /images/doc/016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/016.jpg -------------------------------------------------------------------------------- /images/doc/017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/017.jpg -------------------------------------------------------------------------------- /images/doc/018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/018.jpg -------------------------------------------------------------------------------- /images/doc/019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/019.jpg -------------------------------------------------------------------------------- /images/doc/020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/doc/020.jpg -------------------------------------------------------------------------------- /images/testing/aws/aws1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws1.png -------------------------------------------------------------------------------- /images/testing/aws/aws10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws10.png -------------------------------------------------------------------------------- /images/testing/aws/aws11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws11.png -------------------------------------------------------------------------------- /images/testing/aws/aws12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws12.png -------------------------------------------------------------------------------- /images/testing/aws/aws2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws2.png -------------------------------------------------------------------------------- /images/testing/aws/aws5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/aws5.png -------------------------------------------------------------------------------- /images/testing/aws/close_vpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/close_vpc.png -------------------------------------------------------------------------------- /images/testing/aws/create_vpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/aws/create_vpc.png -------------------------------------------------------------------------------- /images/testing/billing/billing0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing0.png -------------------------------------------------------------------------------- /images/testing/billing/billing1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing1.png -------------------------------------------------------------------------------- /images/testing/billing/billing2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing2.png -------------------------------------------------------------------------------- /images/testing/billing/billing3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing3.png -------------------------------------------------------------------------------- /images/testing/billing/billing4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing4.png -------------------------------------------------------------------------------- /images/testing/billing/billing5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing5.png -------------------------------------------------------------------------------- /images/testing/billing/billing7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/billing/billing7.png -------------------------------------------------------------------------------- /images/testing/comparison/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/comparison/chat.png -------------------------------------------------------------------------------- /images/testing/comparison/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/comparison/db.png -------------------------------------------------------------------------------- /images/testing/comparison/gw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/comparison/gw.png -------------------------------------------------------------------------------- /images/testing/comparison/localpost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/comparison/localpost.png -------------------------------------------------------------------------------- /images/testing/comparison/po.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/comparison/po.png -------------------------------------------------------------------------------- /images/testing/donate/0.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/donate/0.01.png -------------------------------------------------------------------------------- /images/testing/donate/1.00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/donate/1.00.png -------------------------------------------------------------------------------- /images/testing/security/key0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key0.png -------------------------------------------------------------------------------- /images/testing/security/key1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key1.png -------------------------------------------------------------------------------- /images/testing/security/key2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key2.png -------------------------------------------------------------------------------- /images/testing/security/key4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key4.png -------------------------------------------------------------------------------- /images/testing/security/key5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key5.png -------------------------------------------------------------------------------- /images/testing/security/key6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key6.png -------------------------------------------------------------------------------- /images/testing/security/key7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/security/key7.png -------------------------------------------------------------------------------- /images/testing/setup/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/10.png -------------------------------------------------------------------------------- /images/testing/setup/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/11.png -------------------------------------------------------------------------------- /images/testing/setup/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/12.png -------------------------------------------------------------------------------- /images/testing/setup/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/3.png -------------------------------------------------------------------------------- /images/testing/setup/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/6.png -------------------------------------------------------------------------------- /images/testing/setup/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/setup/7.png -------------------------------------------------------------------------------- /images/testing/signup/signup1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/signup/signup1.png -------------------------------------------------------------------------------- /images/testing/signup/signup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/signup/signup2.png -------------------------------------------------------------------------------- /images/testing/signup/signup3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/signup/signup3.png -------------------------------------------------------------------------------- /images/testing/signup/signup4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/signup/signup4.png -------------------------------------------------------------------------------- /images/testing/system/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/system/network.png -------------------------------------------------------------------------------- /images/testing/system/process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/system/process.png -------------------------------------------------------------------------------- /images/testing/system/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/system/test.png -------------------------------------------------------------------------------- /images/testing/tryit/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/0.png -------------------------------------------------------------------------------- /images/testing/tryit/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/1.png -------------------------------------------------------------------------------- /images/testing/tryit/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/2.png -------------------------------------------------------------------------------- /images/testing/tryit/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/3.png -------------------------------------------------------------------------------- /images/testing/tryit/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/4.png -------------------------------------------------------------------------------- /images/testing/tryit/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/5.png -------------------------------------------------------------------------------- /images/testing/tryit/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/images/testing/tryit/6.png -------------------------------------------------------------------------------- /lib/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | const ( 4 | GateWayChannelSize = 4 5 | GateWayWorkThreadSize = GateWayChannelSize 6 | 7 | GateWayChannelLength = 100000 8 | 9 | MinLocalPostChannelSize = 3 /* 0 for client to local, 1 for local to local , 2 for local ack*/ 10 | LocalPostChannelSize = 18 11 | 12 | LocalPostWorkThreadSize = LocalPostChannelSize 13 | 14 | LocalPostChannelLength = 100000 15 | LocalPostThreadQueueLength = 10 // each time, one thread get request from queue 16 | 17 | PostChannelSize = 4 18 | PostWorkThreadSize = PostChannelSize 19 | 20 | PostChannelLength = 300000 21 | PostThreadQueueLength = 10 22 | 23 | CacheServerChannelSize = 4 24 | CacheThreadSize = CacheServerChannelSize 25 | 26 | ClientPoolSize = 64 // must bigger than each channelsize or each workthreadsize 27 | 28 | MonitServerUpdateInterval = 10 // second 29 | ) 30 | -------------------------------------------------------------------------------- /lib/contstant/contstant.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | CHAT_CLIENT_TO_LOCALPOST = 1000 5 | CHAT_LOCALPOST_TO_LOCALPOST = 2000 6 | CHAT_LOCALPOST_ACK = 3000 7 | ) 8 | 9 | const REDISSERVER string = "redis" 10 | const MEMCACHEDSERVER string = "memcached" 11 | const GWSEVER string = "gw" 12 | const LOCALPOSTSERVER string = "localposter" 13 | const POSTERSERVER string = "poster" 14 | const CACHESERVER string = "cache" 15 | 16 | func IsServer(s string) bool { 17 | // use a map instead? no, multithread 18 | if (s == REDISSERVER) || (s == MEMCACHEDSERVER) || (s == GWSEVER) || (s == LOCALPOSTSERVER) || (s == POSTERSERVER) || (s == CACHESERVER) { 19 | return true 20 | } 21 | return false 22 | } 23 | 24 | func IsAppServer(s string) bool { 25 | 26 | if (s == GWSEVER) || (s == LOCALPOSTSERVER) || (s == POSTERSERVER) || (s == CACHESERVER) { 27 | return true 28 | } 29 | return false 30 | } 31 | 32 | func IsRedis(s string) bool { 33 | 34 | if s == REDISSERVER { 35 | return true 36 | } 37 | return false 38 | } 39 | func IsMem(s string) bool { 40 | 41 | if s == MEMCACHEDSERVER { 42 | return true 43 | } 44 | return false 45 | 46 | } 47 | -------------------------------------------------------------------------------- /lib/monitor/monitor_test.go: -------------------------------------------------------------------------------- 1 | package monitor 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func Test_monitor(t *testing.T) { 8 | a := &Monitor{} 9 | 10 | a.Init() 11 | 12 | a.Regist("aaa") 13 | a.Regist("bbb") 14 | a.Regist("ccc") 15 | 16 | a.Add("aaa", 1) 17 | a.Add("aaa", 1) 18 | a.Add("aaa", 1) 19 | 20 | a.Add("bbb", 1) 21 | a.Add("bbb", 1) 22 | a.Add("ccc", 1) 23 | a.Add("ccc", 2) 24 | a.Add("ccc", -1) 25 | 26 | a.Print() 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/cgo_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !netgo 6 | // +build darwin dragonfly freebsd solaris 7 | 8 | package net 9 | 10 | /* 11 | #include 12 | */ 13 | import "C" 14 | 15 | func cgoAddrInfoFlags() C.int { 16 | return (C.AI_CANONNAME | C.AI_V4MAPPED | C.AI_ALL) & C.AI_MASK 17 | } 18 | -------------------------------------------------------------------------------- /lib/net/cgo_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build cgo,!netgo 6 | 7 | package net 8 | 9 | /* 10 | #include 11 | */ 12 | import "C" 13 | 14 | func cgoAddrInfoFlags() C.int { 15 | // NOTE(rsc): In theory there are approximately balanced 16 | // arguments for and against including AI_ADDRCONFIG 17 | // in the flags (it includes IPv4 results only on IPv4 systems, 18 | // and similarly for IPv6), but in practice setting it causes 19 | // getaddrinfo to return the wrong canonical name on Linux. 20 | // So definitely leave it out. 21 | return C.AI_CANONNAME | C.AI_V4MAPPED | C.AI_ALL 22 | } 23 | -------------------------------------------------------------------------------- /lib/net/cgo_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build cgo,!netgo 6 | 7 | package net 8 | 9 | /* 10 | #include 11 | */ 12 | import "C" 13 | 14 | func cgoAddrInfoFlags() C.int { 15 | return C.AI_CANONNAME 16 | } 17 | -------------------------------------------------------------------------------- /lib/net/cgo_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build cgo,!netgo 6 | 7 | package net 8 | 9 | /* 10 | #include 11 | */ 12 | import "C" 13 | 14 | func cgoAddrInfoFlags() C.int { 15 | return C.AI_CANONNAME 16 | } 17 | -------------------------------------------------------------------------------- /lib/net/cgo_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !cgo netgo 6 | 7 | // Stub cgo routines for systems that do not use cgo to do network lookups. 8 | 9 | package net 10 | 11 | func cgoLookupHost(name string) (addrs []string, err error, completed bool) { 12 | return nil, nil, false 13 | } 14 | 15 | func cgoLookupPort(network, service string) (port int, err error, completed bool) { 16 | return 0, nil, false 17 | } 18 | 19 | func cgoLookupIP(name string) (addrs []IP, err error, completed bool) { 20 | return nil, nil, false 21 | } 22 | 23 | func cgoLookupCNAME(name string) (cname string, err error, completed bool) { 24 | return "", nil, false 25 | } 26 | -------------------------------------------------------------------------------- /lib/net/cgo_unix_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build cgo,!netgo 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package net 9 | 10 | import "testing" 11 | 12 | func TestCgoLookupIP(t *testing.T) { 13 | host := "localhost" 14 | _, err, ok := cgoLookupIP(host) 15 | if !ok { 16 | t.Errorf("cgoLookupIP must not be a placeholder") 17 | } 18 | if err != nil { 19 | t.Errorf("cgoLookupIP failed: %v", err) 20 | } 21 | if _, err := goLookupIP(host); err != nil { 22 | t.Errorf("goLookupIP failed: %v", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/net/dial_gen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows plan9 6 | 7 | package net 8 | 9 | import ( 10 | "time" 11 | ) 12 | 13 | var testingIssue5349 bool // used during tests 14 | 15 | // dialChannel is the simple pure-Go implementation of dial, still 16 | // used on operating systems where the deadline hasn't been pushed 17 | // down into the pollserver. (Plan 9 and some old versions of Windows) 18 | func dialChannel(net string, ra Addr, dialer func(time.Time) (Conn, error), deadline time.Time) (Conn, error) { 19 | var timeout time.Duration 20 | if !deadline.IsZero() { 21 | timeout = deadline.Sub(time.Now()) 22 | } 23 | if timeout <= 0 { 24 | return dialer(noDeadline) 25 | } 26 | t := time.NewTimer(timeout) 27 | defer t.Stop() 28 | type racer struct { 29 | Conn 30 | error 31 | } 32 | ch := make(chan racer, 1) 33 | go func() { 34 | if testingIssue5349 { 35 | time.Sleep(time.Millisecond) 36 | } 37 | c, err := dialer(noDeadline) 38 | ch <- racer{c, err} 39 | }() 40 | select { 41 | case <-t.C: 42 | return nil, &OpError{Op: "dial", Net: net, Addr: ra, Err: errTimeout} 43 | case racer := <-ch: 44 | return racer.Conn, racer.error 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/net/dial_gen_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows plan9 6 | 7 | package net 8 | 9 | func init() { 10 | testingIssue5349 = true 11 | } 12 | -------------------------------------------------------------------------------- /lib/net/empty.c: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is required to prevent compiler errors 6 | // when the package built with CGO_ENABLED=0. 7 | // Otherwise the compiler says: 8 | // pkg/net/fd_poll_runtime.go:15: missing function body 9 | -------------------------------------------------------------------------------- /lib/net/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net_test 6 | 7 | import ( 8 | "io" 9 | "log" 10 | "net" 11 | ) 12 | 13 | func ExampleListener() { 14 | // Listen on TCP port 2000 on all interfaces. 15 | l, err := net.Listen("tcp", ":2000") 16 | if err != nil { 17 | log.Fatal(err) 18 | } 19 | defer l.Close() 20 | for { 21 | // Wait for a connection. 22 | conn, err := l.Accept() 23 | if err != nil { 24 | log.Fatal(err) 25 | } 26 | // Handle the connection in a new goroutine. 27 | // The loop then returns to accepting, so that 28 | // multiple connections may be served concurrently. 29 | go func(c net.Conn) { 30 | // Echo all incoming data. 31 | io.Copy(c, c) 32 | // Shut down the connection. 33 | c.Close() 34 | }(conn) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/net/http/cgi/plan9_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build plan9 6 | 7 | package cgi 8 | 9 | import ( 10 | "os" 11 | "strconv" 12 | "testing" 13 | ) 14 | 15 | func isProcessRunning(t *testing.T, pid int) bool { 16 | _, err := os.Stat("/proc/" + strconv.Itoa(pid)) 17 | return err == nil 18 | } 19 | -------------------------------------------------------------------------------- /lib/net/http/cgi/posix_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !plan9 6 | 7 | package cgi 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "testing" 13 | ) 14 | 15 | func isProcessRunning(t *testing.T, pid int) bool { 16 | p, err := os.FindProcess(pid) 17 | if err != nil { 18 | return false 19 | } 20 | return p.Signal(syscall.Signal(0)) == nil 21 | } 22 | -------------------------------------------------------------------------------- /lib/net/http/httptest/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package httptest_test 6 | 7 | import ( 8 | "fmt" 9 | "io/ioutil" 10 | "log" 11 | "net/http" 12 | "net/http/httptest" 13 | ) 14 | 15 | func ExampleResponseRecorder() { 16 | handler := func(w http.ResponseWriter, r *http.Request) { 17 | http.Error(w, "something failed", http.StatusInternalServerError) 18 | } 19 | 20 | req, err := http.NewRequest("GET", "http://example.com/foo", nil) 21 | if err != nil { 22 | log.Fatal(err) 23 | } 24 | 25 | w := httptest.NewRecorder() 26 | handler(w, req) 27 | 28 | fmt.Printf("%d - %s", w.Code, w.Body.String()) 29 | // Output: 500 - something failed 30 | } 31 | 32 | func ExampleServer() { 33 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 34 | fmt.Fprintln(w, "Hello, client") 35 | })) 36 | defer ts.Close() 37 | 38 | res, err := http.Get(ts.URL) 39 | if err != nil { 40 | log.Fatal(err) 41 | } 42 | greeting, err := ioutil.ReadAll(res.Body) 43 | res.Body.Close() 44 | if err != nil { 45 | log.Fatal(err) 46 | } 47 | 48 | fmt.Printf("%s", greeting) 49 | // Output: Hello, client 50 | } 51 | -------------------------------------------------------------------------------- /lib/net/http/httptest/server_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package httptest 6 | 7 | import ( 8 | "io/ioutil" 9 | "net/http" 10 | "testing" 11 | "time" 12 | ) 13 | 14 | func TestServer(t *testing.T) { 15 | ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 16 | w.Write([]byte("hello")) 17 | })) 18 | defer ts.Close() 19 | res, err := http.Get(ts.URL) 20 | if err != nil { 21 | t.Fatal(err) 22 | } 23 | got, err := ioutil.ReadAll(res.Body) 24 | if err != nil { 25 | t.Fatal(err) 26 | } 27 | if string(got) != "hello" { 28 | t.Errorf("got %q, want hello", string(got)) 29 | } 30 | } 31 | 32 | func TestIssue7264(t *testing.T) { 33 | t.Skip("broken test - removed at tip") 34 | for i := 0; i < 1000; i++ { 35 | func() { 36 | inHandler := make(chan bool, 1) 37 | ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 38 | inHandler <- true 39 | })) 40 | defer ts.Close() 41 | tr := &http.Transport{ 42 | ResponseHeaderTimeout: time.Nanosecond, 43 | } 44 | defer tr.CloseIdleConnections() 45 | c := &http.Client{Transport: tr} 46 | res, err := c.Get(ts.URL) 47 | <-inHandler 48 | if err == nil { 49 | res.Body.Close() 50 | } 51 | }() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/net/http/jar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package http 6 | 7 | import ( 8 | "net/url" 9 | ) 10 | 11 | // A CookieJar manages storage and use of cookies in HTTP requests. 12 | // 13 | // Implementations of CookieJar must be safe for concurrent use by multiple 14 | // goroutines. 15 | // 16 | // The net/http/cookiejar package provides a CookieJar implementation. 17 | type CookieJar interface { 18 | // SetCookies handles the receipt of the cookies in a reply for the 19 | // given URL. It may or may not choose to save the cookies, depending 20 | // on the jar's policy and implementation. 21 | SetCookies(u *url.URL, cookies []*Cookie) 22 | 23 | // Cookies returns the cookies to send in a request for the given URL. 24 | // It is up to the implementation to honor the standard cookie use 25 | // restrictions such as in RFC 6265. 26 | Cookies(u *url.URL) []*Cookie 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/http/lex_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package http 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func isChar(c rune) bool { return c <= 127 } 12 | 13 | func isCtl(c rune) bool { return c <= 31 || c == 127 } 14 | 15 | func isSeparator(c rune) bool { 16 | switch c { 17 | case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t': 18 | return true 19 | } 20 | return false 21 | } 22 | 23 | func TestIsToken(t *testing.T) { 24 | for i := 0; i <= 130; i++ { 25 | r := rune(i) 26 | expected := isChar(r) && !isCtl(r) && !isSeparator(r) 27 | if isToken(r) != expected { 28 | t.Errorf("isToken(0x%x) = %v", r, !expected) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/net/http/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build race 6 | 7 | package http 8 | 9 | func init() { 10 | raceEnabled = true 11 | } 12 | -------------------------------------------------------------------------------- /lib/net/http/testdata/file: -------------------------------------------------------------------------------- 1 | 0123456789 2 | -------------------------------------------------------------------------------- /lib/net/http/testdata/index.html: -------------------------------------------------------------------------------- 1 | index.html says hello 2 | -------------------------------------------------------------------------------- /lib/net/http/testdata/style.css: -------------------------------------------------------------------------------- 1 | body {} 2 | -------------------------------------------------------------------------------- /lib/net/interface_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | // interfaceMulticastAddrTable returns addresses for a specific 8 | // interface. 9 | func interfaceMulticastAddrTable(ifi *Interface) ([]Addr, error) { 10 | // TODO(mikio): Implement this like other platforms. 11 | return nil, nil 12 | } 13 | -------------------------------------------------------------------------------- /lib/net/interface_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | // interfaceMulticastAddrTable returns addresses for a specific 8 | // interface. 9 | func interfaceMulticastAddrTable(ifi *Interface) ([]Addr, error) { 10 | // TODO(mikio): Implement this like other platforms. 11 | return nil, nil 12 | } 13 | -------------------------------------------------------------------------------- /lib/net/interface_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | // interfaceMulticastAddrTable returns addresses for a specific 8 | // interface. 9 | func interfaceMulticastAddrTable(ifi *Interface) ([]Addr, error) { 10 | // TODO(mikio): Implement this like other platforms. 11 | return nil, nil 12 | } 13 | -------------------------------------------------------------------------------- /lib/net/interface_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build nacl plan9 solaris 6 | 7 | package net 8 | 9 | // If the ifindex is zero, interfaceTable returns mappings of all 10 | // network interfaces. Otherwise it returns a mapping of a specific 11 | // interface. 12 | func interfaceTable(ifindex int) ([]Interface, error) { 13 | return nil, nil 14 | } 15 | 16 | // If the ifi is nil, interfaceAddrTable returns addresses for all 17 | // network interfaces. Otherwise it returns addresses for a specific 18 | // interface. 19 | func interfaceAddrTable(ifi *Interface) ([]Addr, error) { 20 | return nil, nil 21 | } 22 | 23 | // interfaceMulticastAddrTable returns addresses for a specific 24 | // interface. 25 | func interfaceMulticastAddrTable(ifi *Interface) ([]Addr, error) { 26 | return nil, nil 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/netgo_unix_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !cgo netgo 6 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 7 | 8 | package net 9 | 10 | import "testing" 11 | 12 | func TestGoLookupIP(t *testing.T) { 13 | host := "localhost" 14 | _, err, ok := cgoLookupIP(host) 15 | if ok { 16 | t.Errorf("cgoLookupIP must be a placeholder") 17 | } 18 | if err != nil { 19 | t.Errorf("cgoLookupIP failed: %v", err) 20 | } 21 | if _, err := goLookupIP(host); err != nil { 22 | t.Errorf("goLookupIP failed: %v", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/net/parse_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "bufio" 9 | "os" 10 | "runtime" 11 | "testing" 12 | ) 13 | 14 | func TestReadLine(t *testing.T) { 15 | // /etc/services file does not exist on windows and Plan 9. 16 | switch runtime.GOOS { 17 | case "plan9", "windows": 18 | t.Skipf("skipping test on %q", runtime.GOOS) 19 | } 20 | filename := "/etc/services" // a nice big file 21 | 22 | fd, err := os.Open(filename) 23 | if err != nil { 24 | t.Fatalf("open %s: %v", filename, err) 25 | } 26 | defer fd.Close() 27 | br := bufio.NewReader(fd) 28 | 29 | file, err := open(filename) 30 | if file == nil { 31 | t.Fatalf("net.open(%s) = nil", filename) 32 | } 33 | defer file.close() 34 | 35 | lineno := 1 36 | byteno := 0 37 | for { 38 | bline, berr := br.ReadString('\n') 39 | if n := len(bline); n > 0 { 40 | bline = bline[0 : n-1] 41 | } 42 | line, ok := file.readLine() 43 | if (berr != nil) != !ok || bline != line { 44 | t.Fatalf("%s:%d (#%d)\nbufio => %q, %v\nnet => %q, %v", 45 | filename, lineno, byteno, bline, berr, line, ok) 46 | } 47 | if !ok { 48 | break 49 | } 50 | lineno++ 51 | byteno += len(line) + 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/net/port.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Network service port manipulations 6 | 7 | package net 8 | 9 | // parsePort parses port as a network service port number for both 10 | // TCP and UDP. 11 | func parsePort(net, port string) (int, error) { 12 | p, i, ok := dtoi(port, 0) 13 | if !ok || i != len(port) { 14 | var err error 15 | p, err = LookupPort(net, port) 16 | if err != nil { 17 | return 0, err 18 | } 19 | } 20 | if p < 0 || p > 0xFFFF { 21 | return 0, &AddrError{"invalid port", port} 22 | } 23 | return p, nil 24 | } 25 | -------------------------------------------------------------------------------- /lib/net/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build race 6 | // +build windows 7 | 8 | package net 9 | 10 | import ( 11 | "runtime" 12 | "unsafe" 13 | ) 14 | 15 | const raceenabled = true 16 | 17 | func raceAcquire(addr unsafe.Pointer) { 18 | runtime.RaceAcquire(addr) 19 | } 20 | 21 | func raceReleaseMerge(addr unsafe.Pointer) { 22 | runtime.RaceReleaseMerge(addr) 23 | } 24 | 25 | func raceReadRange(addr unsafe.Pointer, len int) { 26 | runtime.RaceReadRange(addr, len) 27 | } 28 | 29 | func raceWriteRange(addr unsafe.Pointer, len int) { 30 | runtime.RaceWriteRange(addr, len) 31 | } 32 | -------------------------------------------------------------------------------- /lib/net/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !race 6 | // +build windows 7 | 8 | package net 9 | 10 | import ( 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = false 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | } 18 | 19 | func raceReleaseMerge(addr unsafe.Pointer) { 20 | } 21 | 22 | func raceReadRange(addr unsafe.Pointer, len int) { 23 | } 24 | 25 | func raceWriteRange(addr unsafe.Pointer, len int) { 26 | } 27 | -------------------------------------------------------------------------------- /lib/net/rpc/client_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package rpc 6 | 7 | import ( 8 | "errors" 9 | "testing" 10 | ) 11 | 12 | type shutdownCodec struct { 13 | responded chan int 14 | closed bool 15 | } 16 | 17 | func (c *shutdownCodec) WriteRequest(*Request, interface{}) error { return nil } 18 | func (c *shutdownCodec) ReadResponseBody(interface{}) error { return nil } 19 | func (c *shutdownCodec) ReadResponseHeader(*Response) error { 20 | c.responded <- 1 21 | return errors.New("shutdownCodec ReadResponseHeader") 22 | } 23 | func (c *shutdownCodec) Close() error { 24 | c.closed = true 25 | return nil 26 | } 27 | 28 | func TestCloseCodec(t *testing.T) { 29 | codec := &shutdownCodec{responded: make(chan int)} 30 | client := NewClientWithCodec(codec) 31 | <-codec.responded 32 | client.Close() 33 | if !codec.closed { 34 | t.Error("client.Close did not close codec") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/net/sendfile_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin nacl netbsd openbsd solaris 6 | 7 | package net 8 | 9 | import "io" 10 | 11 | func sendFile(c *netFD, r io.Reader) (n int64, err error, handled bool) { 12 | return 0, nil, false 13 | } 14 | -------------------------------------------------------------------------------- /lib/net/sock_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd nacl netbsd openbsd 6 | 7 | package net 8 | 9 | import ( 10 | "runtime" 11 | "syscall" 12 | ) 13 | 14 | func maxListenerBacklog() int { 15 | var ( 16 | n uint32 17 | err error 18 | ) 19 | switch runtime.GOOS { 20 | case "darwin", "freebsd": 21 | n, err = syscall.SysctlUint32("kern.ipc.somaxconn") 22 | case "netbsd": 23 | // NOTE: NetBSD has no somaxconn-like kernel state so far 24 | case "openbsd": 25 | n, err = syscall.SysctlUint32("kern.somaxconn") 26 | } 27 | if n == 0 || err != nil { 28 | return syscall.SOMAXCONN 29 | } 30 | // FreeBSD stores the backlog in a uint16, as does Linux. 31 | // Assume the other BSDs do too. Truncate number to avoid wrapping. 32 | // See issue 5030. 33 | if n > 1<<16-1 { 34 | n = 1<<16 - 1 35 | } 36 | return int(n) 37 | } 38 | -------------------------------------------------------------------------------- /lib/net/sock_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import "syscall" 8 | 9 | func maxListenerBacklog() int { 10 | fd, err := open("/proc/sys/net/core/somaxconn") 11 | if err != nil { 12 | return syscall.SOMAXCONN 13 | } 14 | defer fd.close() 15 | l, ok := fd.readLine() 16 | if !ok { 17 | return syscall.SOMAXCONN 18 | } 19 | f := getFields(l) 20 | n, _, ok := dtoi(f[0], 0) 21 | if n == 0 || !ok { 22 | return syscall.SOMAXCONN 23 | } 24 | // Linux stores the backlog in a uint16. 25 | // Truncate number to avoid wrapping. 26 | // See issue 5030. 27 | if n > 1<<16-1 { 28 | n = 1<<16 - 1 29 | } 30 | return n 31 | } 32 | -------------------------------------------------------------------------------- /lib/net/sock_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | func maxListenerBacklog() int { 8 | // /sys/include/ape/sys/socket.h:/SOMAXCONN 9 | return 5 10 | } 11 | -------------------------------------------------------------------------------- /lib/net/sock_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import "syscall" 8 | 9 | func maxListenerBacklog() int { 10 | // TODO: Implement this 11 | // NOTE: Never return a number bigger than 1<<16 - 1. See issue 5030. 12 | return syscall.SOMAXCONN 13 | } 14 | -------------------------------------------------------------------------------- /lib/net/sock_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import "syscall" 8 | 9 | func maxListenerBacklog() int { 10 | // TODO: Implement this 11 | // NOTE: Never return a number bigger than 1<<16 - 1. See issue 5030. 12 | return syscall.SOMAXCONN 13 | } 14 | 15 | func sysSocket(f, t, p int) (syscall.Handle, error) { 16 | // See ../syscall/exec_unix.go for description of ForkLock. 17 | syscall.ForkLock.RLock() 18 | s, err := syscall.Socket(f, t, p) 19 | if err == nil { 20 | syscall.CloseOnExec(s) 21 | } 22 | syscall.ForkLock.RUnlock() 23 | return s, err 24 | } 25 | -------------------------------------------------------------------------------- /lib/net/sockopt_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | func setDefaultSockopts(s, family, sotype int, ipv6only bool) error { 13 | if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW { 14 | // Allow both IP versions even if the OS default 15 | // is otherwise. Note that some operating systems 16 | // never admit this option. 17 | syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only)) 18 | } 19 | // Allow broadcast. 20 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)) 21 | } 22 | 23 | func setDefaultListenerSockopts(s int) error { 24 | // Allow reuse of recently-used addresses. 25 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)) 26 | } 27 | 28 | func setDefaultMulticastSockopts(s int) error { 29 | // Allow multicast UDP and raw IP datagram sockets to listen 30 | // concurrently across multiple listeners. 31 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)) 32 | } 33 | -------------------------------------------------------------------------------- /lib/net/sockopt_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | func setKeepAlive(fd *netFD, keepalive bool) error { 8 | if keepalive { 9 | _, e := fd.ctl.WriteAt([]byte("keepalive"), 0) 10 | return e 11 | } 12 | return nil 13 | } 14 | -------------------------------------------------------------------------------- /lib/net/sockopt_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | func setDefaultSockopts(s, family, sotype int, ipv6only bool) error { 13 | if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW { 14 | // Allow both IP versions even if the OS default 15 | // is otherwise. Note that some operating systems 16 | // never admit this option. 17 | syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only)) 18 | } 19 | // Allow broadcast. 20 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)) 21 | } 22 | 23 | func setDefaultListenerSockopts(s int) error { 24 | // Allow reuse of recently-used addresses. 25 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)) 26 | } 27 | 28 | func setDefaultMulticastSockopts(s int) error { 29 | // Allow multicast UDP and raw IP datagram sockets to listen 30 | // concurrently across multiple listeners. 31 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)) 32 | } 33 | -------------------------------------------------------------------------------- /lib/net/sockoptip_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd nacl netbsd openbsd 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | ) 13 | 14 | func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { 15 | ip, err := interfaceToIPv4Addr(ifi) 16 | if err != nil { 17 | return os.NewSyscallError("setsockopt", err) 18 | } 19 | var a [4]byte 20 | copy(a[:], ip.To4()) 21 | if err := fd.incref(); err != nil { 22 | return err 23 | } 24 | defer fd.decref() 25 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInet4Addr(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, a)) 26 | } 27 | 28 | func setIPv4MulticastLoopback(fd *netFD, v bool) error { 29 | if err := fd.incref(); err != nil { 30 | return err 31 | } 32 | defer fd.decref() 33 | return os.NewSyscallError("setsockopt", syscall.SetsockoptByte(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, byte(boolint(v)))) 34 | } 35 | -------------------------------------------------------------------------------- /lib/net/sockoptip_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { 13 | var v int32 14 | if ifi != nil { 15 | v = int32(ifi.Index) 16 | } 17 | mreq := &syscall.IPMreqn{Ifindex: v} 18 | if err := fd.incref(); err != nil { 19 | return err 20 | } 21 | defer fd.decref() 22 | return os.NewSyscallError("setsockopt", syscall.SetsockoptIPMreqn(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, mreq)) 23 | } 24 | 25 | func setIPv4MulticastLoopback(fd *netFD, v bool) error { 26 | if err := fd.incref(); err != nil { 27 | return err 28 | } 29 | defer fd.decref() 30 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, boolint(v))) 31 | } 32 | -------------------------------------------------------------------------------- /lib/net/sockoptip_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build solaris 6 | 7 | package net 8 | 9 | import "syscall" 10 | 11 | func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { 12 | // See golang.org/issue/7399. 13 | return syscall.EINVAL 14 | } 15 | 16 | func setIPv4MulticastLoopback(fd *netFD, v bool) error { 17 | // See golang.org/issue/7399. 18 | return syscall.EINVAL 19 | } 20 | 21 | func joinIPv4Group(fd *netFD, ifi *Interface, ip IP) error { 22 | // See golang.org/issue/7399. 23 | return syscall.EINVAL 24 | } 25 | 26 | func setIPv6MulticastInterface(fd *netFD, ifi *Interface) error { 27 | // See golang.org/issue/7399. 28 | return syscall.EINVAL 29 | } 30 | 31 | func setIPv6MulticastLoopback(fd *netFD, v bool) error { 32 | // See golang.org/issue/7399. 33 | return syscall.EINVAL 34 | } 35 | 36 | func joinIPv6Group(fd *netFD, ifi *Interface, ip IP) error { 37 | // See golang.org/issue/7399. 38 | return syscall.EINVAL 39 | } 40 | -------------------------------------------------------------------------------- /lib/net/sockoptip_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { 14 | ip, err := interfaceToIPv4Addr(ifi) 15 | if err != nil { 16 | return os.NewSyscallError("setsockopt", err) 17 | } 18 | var a [4]byte 19 | copy(a[:], ip.To4()) 20 | if err := fd.incref(); err != nil { 21 | return err 22 | } 23 | defer fd.decref() 24 | return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, (*byte)(unsafe.Pointer(&a[0])), 4)) 25 | } 26 | 27 | func setIPv4MulticastLoopback(fd *netFD, v bool) error { 28 | if err := fd.incref(); err != nil { 29 | return err 30 | } 31 | defer fd.decref() 32 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, boolint(v))) 33 | } 34 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TCP socket options for darwin 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "time" 13 | ) 14 | 15 | // Set keep alive period. 16 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 17 | if err := fd.incref(); err != nil { 18 | return err 19 | } 20 | defer fd.decref() 21 | 22 | // The kernel expects seconds so round to next highest second. 23 | d += (time.Second - time.Nanosecond) 24 | secs := int(d.Seconds()) 25 | 26 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE, secs)) 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | "time" 11 | ) 12 | 13 | // Set keep alive period. 14 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 15 | if err := fd.incref(); err != nil { 16 | return err 17 | } 18 | defer fd.decref() 19 | 20 | // The kernel expects milliseconds so round to next highest millisecond. 21 | d += (time.Millisecond - time.Nanosecond) 22 | msecs := int(time.Duration(d.Nanoseconds()) / time.Millisecond) 23 | 24 | err := os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, msecs)) 25 | if err != nil { 26 | return err 27 | } 28 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, msecs)) 29 | } 30 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TCP socket options for openbsd 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "time" 13 | ) 14 | 15 | // Set keep alive period. 16 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 17 | if err := fd.incref(); err != nil { 18 | return err 19 | } 20 | defer fd.decref() 21 | 22 | // The kernel expects seconds so round to next highest second. 23 | d += (time.Second - time.Nanosecond) 24 | secs := int(d.Seconds()) 25 | 26 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.SO_KEEPALIVE, secs)) 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TCP socket options for plan9 6 | 7 | package net 8 | 9 | import ( 10 | "time" 11 | ) 12 | 13 | // Set keep alive period. 14 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 15 | cmd := "keepalive " + string(int64(d/time.Millisecond)) 16 | _, e := fd.ctl.WriteAt([]byte(cmd), 0) 17 | return e 18 | } 19 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_posix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | ) 13 | 14 | func setNoDelay(fd *netFD, noDelay bool) error { 15 | if err := fd.incref(); err != nil { 16 | return err 17 | } 18 | defer fd.decref() 19 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_NODELAY, boolint(noDelay))) 20 | } 21 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TCP socket options for solaris 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "time" 13 | ) 14 | 15 | // Set keep alive period. 16 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 17 | if err := fd.incref(); err != nil { 18 | return err 19 | } 20 | defer fd.decref() 21 | 22 | // The kernel expects seconds so round to next highest second. 23 | d += (time.Second - time.Nanosecond) 24 | secs := int(d.Seconds()) 25 | 26 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.SO_KEEPALIVE, secs)) 27 | } 28 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd linux nacl netbsd 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "time" 13 | ) 14 | 15 | // Set keep alive period. 16 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 17 | if err := fd.incref(); err != nil { 18 | return err 19 | } 20 | defer fd.decref() 21 | 22 | // The kernel expects seconds so round to next highest second. 23 | d += (time.Second - time.Nanosecond) 24 | secs := int(d.Seconds()) 25 | 26 | err := os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs)) 27 | if err != nil { 28 | return err 29 | } 30 | return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, secs)) 31 | } 32 | -------------------------------------------------------------------------------- /lib/net/tcpsockopt_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TCP socket options for windows 6 | 7 | package net 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | "time" 13 | "unsafe" 14 | ) 15 | 16 | func setKeepAlivePeriod(fd *netFD, d time.Duration) error { 17 | if err := fd.incref(); err != nil { 18 | return err 19 | } 20 | defer fd.decref() 21 | 22 | // Windows expects milliseconds so round to next highest millisecond. 23 | d += (time.Millisecond - time.Nanosecond) 24 | millis := uint32(d / time.Millisecond) 25 | ka := syscall.TCPKeepalive{ 26 | OnOff: 1, 27 | Time: millis, 28 | Interval: millis, 29 | } 30 | ret := uint32(0) 31 | size := uint32(unsafe.Sizeof(ka)) 32 | err := syscall.WSAIoctl(fd.sysfd, syscall.SIO_KEEPALIVE_VALS, (*byte)(unsafe.Pointer(&ka)), size, nil, 0, &ret, nil, 0) 33 | return os.NewSyscallError("WSAIoctl", err) 34 | } 35 | -------------------------------------------------------------------------------- /lib/net/testdata/hosts: -------------------------------------------------------------------------------- 1 | 255.255.255.255 broadcasthost 2 | 127.0.0.2 odin 3 | 127.0.0.3 odin # inline comment 4 | ::2 odin 5 | 127.1.1.1 thor 6 | # aliases 7 | 127.1.1.2 ullr ullrhost 8 | # Bogus entries that must be ignored. 9 | 123.123.123 loki 10 | 321.321.321.321 11 | # TODO(yvesj): Should we be able to parse this? From a Darwin system. 12 | fe80::1%lo0 localhost 13 | -------------------------------------------------------------------------------- /lib/net/testdata/hosts_singleline: -------------------------------------------------------------------------------- 1 | 127.0.0.2 odin -------------------------------------------------------------------------------- /lib/net/testdata/igmp: -------------------------------------------------------------------------------- 1 | Idx Device : Count Querier Group Users Timer Reporter 2 | 1 lo : 1 V3 3 | 010000E0 1 0:00000000 0 4 | 2 eth0 : 2 V2 5 | FB0000E0 1 0:00000000 1 6 | 010000E0 1 0:00000000 0 7 | 3 eth1 : 1 V3 8 | 010000E0 1 0:00000000 0 9 | 4 eth2 : 1 V3 10 | 010000E0 1 0:00000000 0 11 | 5 eth0.100 : 2 V3 12 | FB0000E0 1 0:00000000 0 13 | 010000E0 1 0:00000000 0 14 | 6 eth0.101 : 2 V3 15 | FB0000E0 1 0:00000000 0 16 | 010000E0 1 0:00000000 0 17 | 7 eth0.102 : 2 V3 18 | FB0000E0 1 0:00000000 0 19 | 010000E0 1 0:00000000 0 20 | 8 eth0.103 : 2 V3 21 | FB0000E0 1 0:00000000 0 22 | 010000E0 1 0:00000000 0 23 | 9 device1tap2: 1 V3 24 | 010000E0 1 0:00000000 0 25 | -------------------------------------------------------------------------------- /lib/net/testdata/igmp6: -------------------------------------------------------------------------------- 1 | 1 lo ff020000000000000000000000000001 1 0000000C 0 2 | 2 eth0 ff0200000000000000000001ffac891e 1 00000006 0 3 | 2 eth0 ff020000000000000000000000000001 1 0000000C 0 4 | 3 eth1 ff0200000000000000000001ffac8928 2 00000006 0 5 | 3 eth1 ff020000000000000000000000000001 1 0000000C 0 6 | 4 eth2 ff0200000000000000000001ffac8932 2 00000006 0 7 | 4 eth2 ff020000000000000000000000000001 1 0000000C 0 8 | 5 eth0.100 ff0200000000000000000001ffac891e 1 00000004 0 9 | 5 eth0.100 ff020000000000000000000000000001 1 0000000C 0 10 | 6 pan0 ff020000000000000000000000000001 1 0000000C 0 11 | 7 eth0.101 ff0200000000000000000001ffac891e 1 00000004 0 12 | 7 eth0.101 ff020000000000000000000000000001 1 0000000C 0 13 | 8 eth0.102 ff0200000000000000000001ffac891e 1 00000004 0 14 | 8 eth0.102 ff020000000000000000000000000001 1 0000000C 0 15 | 9 eth0.103 ff0200000000000000000001ffac891e 1 00000004 0 16 | 9 eth0.103 ff020000000000000000000000000001 1 0000000C 0 17 | 10 device1tap2 ff0200000000000000000001ff4cc3a3 1 00000004 0 18 | 10 device1tap2 ff020000000000000000000000000001 1 0000000C 0 19 | -------------------------------------------------------------------------------- /lib/net/testdata/resolv.conf: -------------------------------------------------------------------------------- 1 | # /etc/resolv.conf 2 | 3 | domain Home 4 | nameserver 192.168.1.1 5 | options ndots:5 timeout:10 attempts:3 rotate 6 | options attempts 3 7 | -------------------------------------------------------------------------------- /lib/net/textproto/writer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package textproto 6 | 7 | import ( 8 | "bufio" 9 | "bytes" 10 | "testing" 11 | ) 12 | 13 | func TestPrintfLine(t *testing.T) { 14 | var buf bytes.Buffer 15 | w := NewWriter(bufio.NewWriter(&buf)) 16 | err := w.PrintfLine("foo %d", 123) 17 | if s := buf.String(); s != "foo 123\r\n" || err != nil { 18 | t.Fatalf("s=%q; err=%s", s, err) 19 | } 20 | } 21 | 22 | func TestDotWriter(t *testing.T) { 23 | var buf bytes.Buffer 24 | w := NewWriter(bufio.NewWriter(&buf)) 25 | d := w.DotWriter() 26 | n, err := d.Write([]byte("abc\n.def\n..ghi\n.jkl\n.")) 27 | if n != 21 || err != nil { 28 | t.Fatalf("Write: %d, %s", n, err) 29 | } 30 | d.Close() 31 | want := "abc\r\n..def\r\n...ghi\r\n..jkl\r\n..\r\n.\r\n" 32 | if s := buf.String(); s != want { 33 | t.Fatalf("wrote %q", s) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/net/unixsock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | // UnixAddr represents the address of a Unix domain socket end point. 8 | type UnixAddr struct { 9 | Name string 10 | Net string 11 | } 12 | 13 | // Network returns the address's network name, "unix", "unixgram" or 14 | // "unixpacket". 15 | func (a *UnixAddr) Network() string { 16 | return a.Net 17 | } 18 | 19 | func (a *UnixAddr) String() string { 20 | if a == nil { 21 | return "" 22 | } 23 | return a.Name 24 | } 25 | 26 | func (a *UnixAddr) toAddr() Addr { 27 | if a == nil { 28 | return nil 29 | } 30 | return a 31 | } 32 | 33 | // ResolveUnixAddr parses addr as a Unix domain socket address. 34 | // The string net gives the network name, "unix", "unixgram" or 35 | // "unixpacket". 36 | func ResolveUnixAddr(net, addr string) (*UnixAddr, error) { 37 | switch net { 38 | case "unix", "unixgram", "unixpacket": 39 | return &UnixAddr{Name: addr, Net: net}, nil 40 | default: 41 | return nil, UnknownNetworkError(net) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/net/url/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package url_test 6 | 7 | import ( 8 | "fmt" 9 | "log" 10 | "net/url" 11 | ) 12 | 13 | func ExampleValues() { 14 | v := url.Values{} 15 | v.Set("name", "Ava") 16 | v.Add("friend", "Jess") 17 | v.Add("friend", "Sarah") 18 | v.Add("friend", "Zoe") 19 | // v.Encode() == "name=Ava&friend=Jess&friend=Sarah&friend=Zoe" 20 | fmt.Println(v.Get("name")) 21 | fmt.Println(v.Get("friend")) 22 | fmt.Println(v["friend"]) 23 | // Output: 24 | // Ava 25 | // Jess 26 | // [Jess Sarah Zoe] 27 | } 28 | 29 | func ExampleURL() { 30 | u, err := url.Parse("http://bing.com/search?q=dotnet") 31 | if err != nil { 32 | log.Fatal(err) 33 | } 34 | u.Scheme = "https" 35 | u.Host = "google.com" 36 | q := u.Query() 37 | q.Set("q", "golang") 38 | u.RawQuery = q.Encode() 39 | fmt.Println(u) 40 | // Output: https://google.com/search?q=golang 41 | } 42 | -------------------------------------------------------------------------------- /lib/net/z_last_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package net 6 | 7 | import ( 8 | "flag" 9 | "fmt" 10 | "testing" 11 | ) 12 | 13 | var testDNSFlood = flag.Bool("dnsflood", false, "whether to test dns query flooding") 14 | 15 | func TestDNSThreadLimit(t *testing.T) { 16 | if !*testDNSFlood { 17 | t.Skip("test disabled; use -dnsflood to enable") 18 | } 19 | 20 | const N = 10000 21 | c := make(chan int, N) 22 | for i := 0; i < N; i++ { 23 | go func(i int) { 24 | LookupIP(fmt.Sprintf("%d.net-test.golang.org", i)) 25 | c <- 1 26 | }(i) 27 | } 28 | // Don't bother waiting for the stragglers; stop at 0.9 N. 29 | for i := 0; i < N*9/10; i++ { 30 | if i%100 == 0 { 31 | //println("TestDNSThreadLimit:", i) 32 | } 33 | <-c 34 | } 35 | 36 | // If we're still here, it worked. 37 | } 38 | -------------------------------------------------------------------------------- /lib/postrequest/postrequest.go: -------------------------------------------------------------------------------- 1 | package postrequest 2 | 3 | import ( 4 | "errors" 5 | 6 | . "github.com/fakewechat/message" 7 | ) 8 | 9 | func RecvfromQueue(queue *chan *GeneralMessage) (*GeneralMessage, error) { 10 | 11 | select { 12 | case v := <-*queue: 13 | return v, nil 14 | default: 15 | //fmt.Println("it is empty") 16 | return nil, errors.New("it is full") 17 | } 18 | } 19 | 20 | func RecvfromQueueBlock(queue *chan *GeneralMessage) (*GeneralMessage, error) { 21 | 22 | v := <-*queue 23 | return v, nil 24 | } 25 | 26 | func GetSomeMessageFromQueue(queue *chan *GeneralMessage, least int) []*GeneralMessage { 27 | 28 | postList := make([]*GeneralMessage, 0) 29 | 30 | v, _ := RecvfromQueueBlock(queue) 31 | postList = append(postList, v) 32 | for i := 1; i < least; i++ { 33 | 34 | v, err := RecvfromQueue(queue) 35 | if err != nil { 36 | return postList 37 | } 38 | postList = append(postList, v) 39 | } 40 | return postList 41 | } 42 | 43 | func PushtoQueue(queue *chan *GeneralMessage, req *GeneralMessage) error { 44 | 45 | select { 46 | case *queue <- req: 47 | 48 | return nil 49 | default: 50 | 51 | return errors.New("it is full") 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/rg/rg.go: -------------------------------------------------------------------------------- 1 | package rg 2 | 3 | import ( 4 | "github.com/fakewechat/lib/flags" 5 | ) 6 | 7 | const ( 8 | rgsize = 100 9 | rediscellsize = 2500 10 | memcellsize = 10 11 | ) 12 | 13 | func GetRg(userid uint64) int { 14 | // 1-50 1 15 | // 51-100 2 16 | // 101-150 3 17 | 18 | // for Irregular we should use bitmap 19 | id := int(userid) - 1 20 | rg := id / *flags.RgSize + 1 21 | return rg 22 | } 23 | 24 | /* 25 | func GetRedisCellId(userid uint64) int { 26 | id := int(userid) - 1 27 | rg := id / rgsize 28 | id = id - rg * rgsize 29 | rg = id / rediscellsize + 1 30 | 31 | return rg 32 | } 33 | 34 | func GetMemcachedCellId(messageid uint64) int { 35 | 36 | id := int(messageid) 37 | return id % + memcellsize 38 | } 39 | */ 40 | -------------------------------------------------------------------------------- /lib/sid/sid.go: -------------------------------------------------------------------------------- 1 | package sid 2 | 3 | import ( 4 | "sync" 5 | "time" 6 | ) 7 | 8 | type Sid struct { 9 | id uint64 10 | Index uint64 11 | lock sync.Mutex 12 | } 13 | 14 | func (v *Sid) SetIndex(i uint) { 15 | 16 | v.Index = uint64(i) 17 | } 18 | 19 | func (v *Sid) GetId() uint64 { 20 | tnow := time.Now().Unix() 21 | 22 | var s uint64 23 | s = uint64(tnow) 24 | s *= 100 25 | s += v.Index 26 | s *= 1e7 27 | 28 | v.lock.Lock() 29 | v.id += 1 30 | if v.id > 1e6 { 31 | v.id = 1 32 | } 33 | s += v.id 34 | v.lock.Unlock() 35 | return s 36 | } 37 | -------------------------------------------------------------------------------- /lib/storage/storage.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "errors" 5 | . "github.com/fakewechat/lib/monitor" 6 | "github.com/fakewechat/lib/rpc" 7 | . "github.com/fakewechat/message" 8 | ) 9 | 10 | type Storage int 11 | 12 | func (t *Storage) GetUnackMessageId(args *Args, reply *int) error { 13 | return nil 14 | } 15 | 16 | func (t *Storage) GetUnackMessage(args *Args, quo *Quotient) error { 17 | return nil 18 | } 19 | 20 | func (t *Storage) AckMessageId(args *Args, reply *int) error { 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /lib/transfer/transfer.go: -------------------------------------------------------------------------------- 1 | package transfer 2 | 3 | import ( 4 | "fmt" 5 | "github.com/smartproxy/lib/buff" 6 | "github.com/smartproxy/lib/conn" 7 | ) 8 | 9 | func Transfer_Data(ClientConn conn.ConnInterface, ServerConn conn.ConnInterface) { 10 | // 从 server 获取结果 11 | defer ClientConn.Close() 12 | defer fmt.Printf("close ClientConn connection conn %T\n", ClientConn) 13 | 14 | defer ServerConn.Close() 15 | defer fmt.Printf("close ServerConn connection conn %T\n", ServerConn) 16 | 17 | var ClientBuff buff.Buffer 18 | ClientBuff.Init(65 * 1024) 19 | 20 | for { 21 | if !ClientConn.Read(&ClientBuff) { 22 | return 23 | } 24 | 25 | if !ServerConn.Write(&ClientBuff, ClientBuff.BuffDataLen) { 26 | return 27 | } 28 | 29 | } 30 | // 加密后发给客户端 31 | } 32 | -------------------------------------------------------------------------------- /lib/updateserverstatus/updateserverstatus.go: -------------------------------------------------------------------------------- 1 | package updateserverstatus 2 | 3 | import ( 4 | // "fmt" 5 | . "github.com/fakewechat/lib/clientpool" 6 | "github.com/fakewechat/lib/serverstatus" 7 | . "github.com/fakewechat/lib/version" 8 | "time" 9 | ) 10 | 11 | func CheckServerStatusUpdate(index int, servertype string, rg int) { 12 | var LocalVersion Version 13 | for { 14 | time.Sleep(10 * time.Second) 15 | if LocalVersion != serverstatus.GlobalVersion { 16 | LocalVersion = serverstatus.GlobalVersion 17 | copy := serverstatus.CopyLocalServerStatus() 18 | //fmt.Println("get new copy", copy) 19 | GloabalClientPool[index].AddNew(LocalVersion, copy, servertype, rg) 20 | 21 | } else { 22 | // fmt.Println("equal") 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/utils/utils_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | // 8 | // normal test 9 | // 10 | func Test_fun1(t *testing.T) { 11 | 12 | if GetUserQueue(123) != "user#queue#123" { 13 | t.Error("GetUserQueue(123) != user#queue#123") 14 | } 15 | 16 | if GetSendMessage(456) != "send_456" { 17 | t.Error("GetUserQueue(123) == user#queue#123") 18 | } 19 | 20 | if GetLocalMessage(999, 44) != "local_999_44" { 21 | t.Error("GetUserQueue(123) == user#queue#123") 22 | 23 | } 24 | 25 | if GetAckMessage(1111111111) != "ack_1111111111" { 26 | 27 | t.Error("GetAckMessage( 1111111111 ) != ack_1111111111") 28 | } 29 | 30 | if GetQueueId(0, 0, 9, 3) != 0 { 31 | t.Error("GetQueueId(0, 0) != 0 )") 32 | } 33 | 34 | if GetQueueId(1, 0, 9, 3) != 3 { 35 | t.Error("GetQueueId(1, 0) != 0 )") 36 | } 37 | 38 | if GetQueueId(2, 0, 9, 3) != 6 { 39 | t.Error("GetQueueId(2, 0) !=6 )") 40 | } 41 | 42 | if GetQueueId(3, 0, 9, 3) != 0 { 43 | t.Error("GetQueueId(3, 0) != 0 )") 44 | } 45 | 46 | if GetQueueId(0, 1, 9, 3) != 1 { 47 | t.Error("GetQueueId(0, 1) != 1 )") 48 | } 49 | 50 | if GetQueueId(1, 1, 9, 3) != 4 { 51 | t.Error("GetQueueId(1, 1) != 4 )") 52 | } 53 | 54 | if GetQueueId(2, 1, 9, 3) != 7 { 55 | t.Error("GetQueueId(2, 1) != 7 )") 56 | } 57 | 58 | if GetQueueId(3, 1, 9, 3) != 1 { 59 | t.Error("GetQueueId(3, 1) != 1 )") 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | type Version uint64 8 | 9 | var ProgramVersion = "No Version Provided" 10 | var Buildstamp = "No Provided" 11 | var Githash = "No Provided" 12 | 13 | func PrintVersion() { 14 | fmt.Printf("Version: %s Build: %s Git: %s\n", ProgramVersion, Buildstamp, Githash) 15 | } 16 | -------------------------------------------------------------------------------- /localposter/utils/utils.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | func GetChannelId(index uint32, times int, channelsize int, offset int) int { 4 | id := int(index%uint32(times))*channelsize + offset 5 | return id 6 | } 7 | -------------------------------------------------------------------------------- /localposter/utils/utils_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func Test_utls_001(t *testing.T) { 8 | i := 0 9 | i = getChannelId(0, 2, 3, 0) 10 | if i != 0 { 11 | t.Error("getChannelId(2, 0, 3, 0) !=0", i) 12 | } 13 | i = getChannelId(1, 2, 3, 0) 14 | if i != 3 { 15 | t.Error("getChannelId(2, 1, 3,0) != 3", i) 16 | } 17 | i = getChannelId(2, 2, 3, 0) 18 | if i != 0 { 19 | t.Error("getChannelId(1, 2, 3, 0) != 0", i) 20 | } 21 | i = getChannelId(3, 2, 3, 0) 22 | if i != 3 { 23 | t.Error("getChannelId(1, 2, 3, 0) != 3", i) 24 | } 25 | 26 | i = getChannelId(0, 2, 3, 1) 27 | if i != 1 { 28 | t.Error("getChannelId(2, 0, 3, 1) !=1", i) 29 | } 30 | i = getChannelId(1, 2, 3, 1) 31 | if i != 4 { 32 | t.Error("getChannelId(2, 1, 3,1) != 3", i) 33 | } 34 | i = getChannelId(2, 2, 3, 1) 35 | if i != 1 { 36 | t.Error("getChannelId(1, 2, 3, 1) != 0", i) 37 | } 38 | i = getChannelId(3, 2, 3, 1) 39 | if i != 4 { 40 | t.Error("getChannelId(1, 2, 3, 1) != 3", i) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /log/1_server/log_only3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/log/1_server/log_only3.txt -------------------------------------------------------------------------------- /log/2_servers/log_3_7.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/log/2_servers/log_3_7.txt -------------------------------------------------------------------------------- /make/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function dobuild() { 4 | if [ $1 == 'clean' ]; 5 | then 6 | echo "go clean" 7 | go clean 8 | else 9 | echo "go build" 10 | gofmt -w *.go 11 | go build -ldflags "-X github.com/fakewechat/lib/version.Buildstamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X github.com/fakewechat/lib/version.Githash=`git rev-parse HEAD` -X github.com/fakewechat/lib/version.ProgramVersion=0.1 " 12 | fi 13 | } 14 | 15 | function foreachd(){ 16 | for file in $1/* 17 | do 18 | if [ -d $file ]; 19 | then 20 | echo $file 21 | cd $file 22 | dobuild $2 23 | cd - 24 | foreachd $file $2 25 | fi 26 | done 27 | } 28 | 29 | if [ $1 == 'clean' ]; 30 | then 31 | a='clean' 32 | else 33 | a='build' 34 | fi 35 | foreachd `pwd` $a 36 | -------------------------------------------------------------------------------- /message/.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/message/.swp -------------------------------------------------------------------------------- /monitorsystem/monitorsender/monitorsender.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | . "github.com/fakewechat/lib/monitor" 5 | "time" 6 | ) 7 | 8 | func main() { 9 | 10 | GMonitor.Init() 11 | GMonitor.InitServer("demo", "demo_001") 12 | go GMonitor.Report("127.0.0.1:1234") 13 | 14 | for i := 0; ; i++ { 15 | time.Sleep(3 * time.Second) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /package/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o -e 3 | 4 | sudo yum install -y screen gcc gcc-c++ autoconf automake libtool vim wget psmisc yum-utils make 5 | 6 | cd $HOME/gopath/src/github.com/fakewechat/package 7 | 8 | sudo yumdownloader psmisc 9 | 10 | cp psmisc*.rpm $HOME/gopath/src/github.com/fakewechat/bin/ 11 | 12 | #golang install 13 | curl -O -L https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz -kvv 14 | tar zxvf go1.6.2.linux-amd64.tar.gz 15 | mv go $HOME/ 16 | 17 | #setup env 18 | echo -e "export GOROOT=$HOME/go\n export PATH=$PATH:$HOME/go/bin\n export GOPATH=$HOME/gopath" >> $HOME/.bashrc 19 | . $HOME/.bashrc 20 | 21 | 22 | 23 | # build package 24 | cd $HOME/gopath/src/github.com/fakewechat/bin 25 | ./build.sh 26 | 27 | 28 | 29 | # redis 30 | cd $HOME/gopath/src/github.com/fakewechat/package 31 | tar zxvf redis-2.8.24.tar.gz 32 | cd redis-2.8.24 33 | make 34 | sudo make install 35 | 36 | cp src/redis-server $HOME/gopath/src/github.com/fakewechat/bin 37 | cp src/redis-cli $HOME/gopath/src/github.com/fakewechat/bin 38 | 39 | 40 | 41 | sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm 42 | sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 43 | 44 | sudo yum install -y ansible 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /package/install_dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o -e 3 | 4 | sudo yum install -y gcc gcc-c++ autoconf automake libtool vim wget psmisc 5 | 6 | cd $HOME/gopath/src/github.com/fakewechat/package 7 | 8 | #install redis for python 9 | wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python 10 | sudo easy_install redis 11 | 12 | 13 | #install protbuf 14 | cd $HOME/gopath/src/github.com/fakewechat/package 15 | tar zxvf protobuf-master.tar.gz 16 | cd protobuf-master 17 | ./autogen.sh 18 | ./configure 19 | make 20 | cd python 21 | sudo python setup.py install 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /package/protobuf-master.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/package/protobuf-master.tar.gz -------------------------------------------------------------------------------- /package/redis-2.8.24.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/package/redis-2.8.24.tar.gz -------------------------------------------------------------------------------- /python/genUser.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | #from gen import * 4 | from random import * 5 | import sys 6 | import getopt 7 | import genUser 8 | from rg import * 9 | 10 | def create_user(count, rg): 11 | for i in range(1, count+1): 12 | print str(i)+","+str( i)+ "," + str(i)+"@fakewechat.com,"+ str( 13500000000 +i) + "," + "paswd" + str(i) + "," + str(getRG(i,rg)) 13 | 14 | if __name__ == "__main__": 15 | if len(sys.argv) == 1: 16 | usage() 17 | sys.exit(1) 18 | try: 19 | opts, args = getopt.getopt(sys.argv[1:], "a:r:", ["help"]) 20 | except getopt.GetoptError: 21 | usage() 22 | sys.exit(2) 23 | count = 0 24 | rg = 2000000 25 | for o, a in opts: 26 | if o in ('-h', '--help'): 27 | usage() 28 | sys.exit(1) 29 | elif o in ('-a' ): 30 | count = int(a) 31 | elif o in ('-r'): 32 | rg = int(a) 33 | create_user(count, rg) 34 | 35 | 36 | -------------------------------------------------------------------------------- /python/gen_10w.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | for i in range(1,101): 4 | print str(i) + "," + str(i) 5 | -------------------------------------------------------------------------------- /python/gen_300w.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/python/gen_300w.py -------------------------------------------------------------------------------- /python/gen_50w.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/python/gen_50w.py -------------------------------------------------------------------------------- /python/gen_600w.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/python/gen_600w.py -------------------------------------------------------------------------------- /python/mySQL_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import MySQLdb 4 | 5 | try: 6 | conn=MySQLdb.connect(host='localhost',user='root',passwd='',db='test',port=3306) 7 | cur=conn.cursor() 8 | cur.execute('select * from user') 9 | cur.close() 10 | conn.close() 11 | except MySQLdb.Error,e: 12 | print "Mysql Error %d: %s" % (e.args[0], e.args[1]) -------------------------------------------------------------------------------- /python/resort.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | sort -t"," -k1,1 -n -k2,2 -n -u 4 | -------------------------------------------------------------------------------- /python/rg.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | import sys 4 | 5 | def getRG(userid, rg): 6 | if userid % rg == 0 : 7 | return userid /rg 8 | else: 9 | return userid/rg + 1 10 | 11 | -------------------------------------------------------------------------------- /python/todolist: -------------------------------------------------------------------------------- 1 | 1. python 生成关系序列 完成 2 | 2. python 脚本将序列 按 -------------------------------------------------------------------------------- /rpm/rpmbuild/SPECS/fakewechat.spec: -------------------------------------------------------------------------------- 1 | # the sample sec file for fake wechat 2 | %define _topdir /home/aaa/rpmbuild/ 3 | %define name fakewechat 4 | %define release 1 5 | %define version 1.1 6 | %define buildroot %{_topdir}/BUILDROOT/%{name}-%{version} 7 | 8 | 9 | BuildRoot: %{buildroot} 10 | Name: %{name} 11 | Version: %{version} 12 | Release: %{release} 13 | Summary: A fake wechat Demo 14 | 15 | Group: Development/Tools 16 | License: COPY RIGHT 17 | URL: http://www.gitgub.com/xiaojiaqi/ 18 | Source0: %{name}-%{version}.tar.gz 19 | 20 | Prefix: /usr/local/fakewechat 21 | 22 | #BuildRequires: 23 | #Requires: 24 | 25 | %description 26 | A simple wechat demo 27 | 28 | %prep 29 | %setup -q 30 | echo "I will start" 31 | 32 | %build 33 | #%configure 34 | #make %{?_smp_mflags} 35 | ./configure 36 | g++ -o hello hello.cpp 37 | 38 | %install 39 | mkdir -p %{buildroot}/usr/local/%{name} 40 | #cp hello %{buildroot} 41 | cp hello %{buildroot}/usr/local/%{name} 42 | 43 | %files 44 | #%doc 45 | %defattr (-,root,root) 46 | 47 | /usr/local/fakewechat/hello 48 | #/hello 49 | #/usr/bin/${name} 50 | 51 | %changelog 52 | 53 | -------------------------------------------------------------------------------- /rpm/yum.repos.d/test.repo: -------------------------------------------------------------------------------- 1 | # CentOS-Base.repo 2 | # 3 | # The mirror system uses the connecting IP address of the client and the 4 | # update status of each mirror to pick mirrors that are updated to and 5 | # geographically close to the client. You should use this for CentOS updates 6 | # unless you are manually picking other mirrors. 7 | # 8 | # If the mirrorlist= does not work for you, as a fall back you can try the 9 | # remarked out baseurl= line instead. 10 | # 11 | # 12 | 13 | [localyum] 14 | name=test yum 15 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 16 | enabled=1 17 | baseurl=http://172.16.11.194/yum 18 | gpgcheck=0 19 | -------------------------------------------------------------------------------- /vendor/github.com/bradfitz/gomemcache/.gitignore: -------------------------------------------------------------------------------- 1 | _* 2 | *.out 3 | *~ 4 | -------------------------------------------------------------------------------- /vendor/github.com/bradfitz/gomemcache/README.md: -------------------------------------------------------------------------------- 1 | ## About 2 | 3 | This is a memcache client library for the Go programming language 4 | (http://golang.org/). 5 | 6 | ## Installing 7 | 8 | ### Using *go get* 9 | 10 | $ go get github.com/bradfitz/gomemcache/memcache 11 | 12 | After this command *gomemcache* is ready to use. Its source will be in: 13 | 14 | $GOPATH/src/github.com/bradfitz/gomemcache/memcache 15 | 16 | ## Example 17 | 18 | import ( 19 | "github.com/bradfitz/gomemcache/memcache" 20 | ) 21 | 22 | func main() { 23 | mc := memcache.New("10.0.0.1:11211", "10.0.0.2:11211", "10.0.0.3:11212") 24 | mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")}) 25 | 26 | it, err := mc.Get("foo") 27 | ... 28 | } 29 | 30 | ## Full docs, see: 31 | 32 | See https://godoc.org/github.com/bradfitz/gomemcache/memcache 33 | 34 | Or run: 35 | 36 | $ godoc github.com/bradfitz/gomemcache/memcache 37 | 38 | -------------------------------------------------------------------------------- /vendor/github.com/bradfitz/gomemcache/memcache/selector_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package memcache 18 | 19 | import "testing" 20 | 21 | func BenchmarkPickServer(b *testing.B) { 22 | // at least two to avoid 0 and 1 special cases: 23 | benchPickServer(b, "127.0.0.1:1234", "127.0.0.1:1235") 24 | } 25 | 26 | func BenchmarkPickServer_Single(b *testing.B) { 27 | benchPickServer(b, "127.0.0.1:1234") 28 | } 29 | 30 | func benchPickServer(b *testing.B, servers ...string) { 31 | b.ReportAllocs() 32 | var ss ServerList 33 | ss.SetServers(servers...) 34 | for i := 0; i < b.N; i++ { 35 | if _, err := ss.PickServer("some key"); err != nil { 36 | b.Fatal(err) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | services: 6 | - redis-server 7 | 8 | go: 9 | - 1.4 10 | - 1.5 11 | - tip 12 | 13 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/internal/commandinfo_test.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import "testing" 4 | 5 | func TestLookupCommandInfo(t *testing.T) { 6 | for _, n := range []string{"watch", "WATCH", "wAtch"} { 7 | if LookupCommandInfo(n) == (CommandInfo{}) { 8 | t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n) 9 | } 10 | } 11 | } 12 | 13 | func benchmarkLookupCommandInfo(b *testing.B, names ...string) { 14 | for i := 0; i < b.N; i++ { 15 | for _, c := range names { 16 | LookupCommandInfo(c) 17 | } 18 | } 19 | } 20 | 21 | func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) { 22 | benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR") 23 | } 24 | 25 | func BenchmarkLookupCommandInfoMixedCase(b *testing.B) { 26 | benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR") 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redisx/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package redisx contains experimental features for Redigo. Features in this 16 | // package may be modified or deleted at any time. 17 | package redisx // import "github.com/garyburd/redigo/redisx" 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/.gitignore: -------------------------------------------------------------------------------- 1 | *.rdb 2 | .test/ 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | services: 5 | - redis-server 6 | 7 | go: 8 | - 1.4 9 | - 1.5 10 | - tip 11 | 12 | matrix: 13 | allow_failures: 14 | - go: tip 15 | 16 | install: 17 | - go get gopkg.in/bsm/ratelimit.v1 18 | - go get github.com/onsi/ginkgo 19 | - go get github.com/onsi/gomega 20 | - mkdir -p $HOME/gopath/src/gopkg.in 21 | - mv $HOME/gopath/src/github.com/go-redis/redis $HOME/gopath/src/gopkg.in/redis.v3 22 | - cd $HOME/gopath/src/gopkg.in/redis.v3 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/Makefile: -------------------------------------------------------------------------------- 1 | all: testdeps 2 | go test ./... -test.v -test.cpu=1,2,4 3 | go test ./... -test.v -test.short -test.race 4 | 5 | testdeps: .test/redis/src/redis-server 6 | 7 | .PHONY: all test testdeps 8 | 9 | .test/redis: 10 | mkdir -p $@ 11 | wget -qO- https://github.com/antirez/redis/archive/unstable.tar.gz | tar xvz --strip-components=1 -C $@ 12 | 13 | .test/redis/src/redis-server: .test/redis 14 | cd $< && make all 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/conn_test.go: -------------------------------------------------------------------------------- 1 | package redis_test 2 | 3 | import ( 4 | "net" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | 9 | "gopkg.in/redis.v3" 10 | ) 11 | 12 | var _ = Describe("newConnDialer with bad connection", func() { 13 | It("should return an error", func() { 14 | dialer := redis.NewConnDialer(&redis.Options{ 15 | Dialer: func() (net.Conn, error) { 16 | return &badConn{}, nil 17 | }, 18 | MaxRetries: 3, 19 | Password: "password", 20 | DB: 1, 21 | }) 22 | _, err := dialer() 23 | Expect(err).To(MatchError("bad connection")) 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package redis implements a Redis client. 3 | */ 4 | package redis 5 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/export_test.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import "net" 4 | 5 | func (c *baseClient) Pool() pool { 6 | return c.connPool 7 | } 8 | 9 | var NewConnDialer = newConnDialer 10 | 11 | func (cn *conn) SetNetConn(netcn net.Conn) { 12 | cn.netcn = netcn 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/internal/hashtag/hashtag_test.go: -------------------------------------------------------------------------------- 1 | package hashtag 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("CRC16", func() { 9 | 10 | // http://redis.io/topics/cluster-spec#keys-distribution-model 11 | It("should calculate CRC16", func() { 12 | tests := []struct { 13 | s string 14 | n uint16 15 | }{ 16 | {"123456789", 0x31C3}, 17 | {string([]byte{83, 153, 134, 118, 229, 214, 244, 75, 140, 37, 215, 215}), 21847}, 18 | } 19 | 20 | for _, test := range tests { 21 | Expect(crc16sum(test.s)).To(Equal(test.n), "for %s", test.s) 22 | } 23 | }) 24 | 25 | }) 26 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package redis 4 | 5 | func bytesToString(b []byte) string { 6 | return string(b) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/script.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "crypto/sha1" 5 | "encoding/hex" 6 | "io" 7 | "strings" 8 | ) 9 | 10 | type scripter interface { 11 | Eval(script string, keys []string, args []string) *Cmd 12 | EvalSha(sha1 string, keys []string, args []string) *Cmd 13 | ScriptExists(scripts ...string) *BoolSliceCmd 14 | ScriptLoad(script string) *StringCmd 15 | } 16 | 17 | type Script struct { 18 | src, hash string 19 | } 20 | 21 | func NewScript(src string) *Script { 22 | h := sha1.New() 23 | io.WriteString(h, src) 24 | return &Script{ 25 | src: src, 26 | hash: hex.EncodeToString(h.Sum(nil)), 27 | } 28 | } 29 | 30 | func (s *Script) Load(c scripter) *StringCmd { 31 | return c.ScriptLoad(s.src) 32 | } 33 | 34 | func (s *Script) Exists(c scripter) *BoolSliceCmd { 35 | return c.ScriptExists(s.src) 36 | } 37 | 38 | func (s *Script) Eval(c scripter, keys []string, args []string) *Cmd { 39 | return c.Eval(s.src, keys, args) 40 | } 41 | 42 | func (s *Script) EvalSha(c scripter, keys []string, args []string) *Cmd { 43 | return c.EvalSha(s.hash, keys, args) 44 | } 45 | 46 | func (s *Script) Run(c scripter, keys []string, args []string) *Cmd { 47 | r := s.EvalSha(c, keys, args) 48 | if err := r.Err(); err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") { 49 | return s.Eval(c, keys, args) 50 | } 51 | return r 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/go-redis/redis/unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package redis 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | func bytesToString(b []byte) string { 11 | bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) 12 | strHeader := reflect.StringHeader{bytesHeader.Data, bytesHeader.Len} 13 | return *(*string)(unsafe.Pointer(&strHeader)) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/golang/glog-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/golang/glog-master.zip -------------------------------------------------------------------------------- /vendor/github.com/golang/groupcache-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/golang/groupcache-master.zip -------------------------------------------------------------------------------- /vendor/github.com/golang/groupcache/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /vendor/github.com/golang/groupcache/groupcachepb/groupcache.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package groupcachepb; 18 | 19 | message GetRequest { 20 | required string group = 1; 21 | required string key = 2; // not actually required/guaranteed to be UTF-8 22 | } 23 | 24 | message GetResponse { 25 | optional bytes value = 1; 26 | optional double minute_qps = 2; 27 | } 28 | 29 | service GroupCache { 30 | rpc Get(GetRequest) returns (GetResponse) { 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.[568ao] 3 | *.pb.go 4 | *.ao 5 | *.so 6 | *.pyc 7 | ._* 8 | .nfs.* 9 | [568a].out 10 | *~ 11 | *.orig 12 | core 13 | _obj 14 | _test 15 | _testmain.go 16 | compiler/protoc-gen-go 17 | compiler/testdata/extension_test 18 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/protoc-gen-go/protoc-gen-go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/golang/protobuf/protoc-gen-go/protoc-gen-go -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf_bak/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.[568ao] 3 | *.pb.go 4 | *.ao 5 | *.so 6 | *.pyc 7 | ._* 8 | .nfs.* 9 | [568a].out 10 | *~ 11 | *.orig 12 | core 13 | _obj 14 | _test 15 | _testmain.go 16 | compiler/protoc-gen-go 17 | compiler/testdata/extension_test 18 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf_bak/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf_bak/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf_bak/protoc-gen-go/protoc-gen-go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/golang/protobuf_bak/protoc-gen-go/protoc-gen-go -------------------------------------------------------------------------------- /vendor/github.com/hoisie/redis/.gitignore: -------------------------------------------------------------------------------- 1 | *.6 2 | *.8 3 | *.o 4 | *.so 5 | *.out 6 | *.go~ 7 | *.cgo?.* 8 | _cgo_* 9 | _obj 10 | _test 11 | _testmain.go 12 | *.swp 13 | _site 14 | .DS_Store 15 | -------------------------------------------------------------------------------- /vendor/github.com/hoisie/redis/Makefile: -------------------------------------------------------------------------------- 1 | GOFMT=gofmt -s -tabs=false -tabwidth=4 2 | GOFILES=\ 3 | redis.go\ 4 | 5 | format: 6 | ${GOFMT} -w ${GOFILES} 7 | ${GOFMT} -w redis_test.go 8 | ${GOFMT} -w tools/redis-load.go 9 | ${GOFMT} -w tools/redis-dump.go 10 | 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/.gitignore: -------------------------------------------------------------------------------- 1 | *.8 2 | *.a 3 | *.out 4 | gocode 5 | gocode.exe 6 | goremote 7 | gocodetest 8 | *.swp 9 | listidents 10 | showcursor 11 | showsmap 12 | rename 13 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010 nsf 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/README: -------------------------------------------------------------------------------- 1 | --== Desc ==-- 2 | 3 | This is a bunch of automated tests for gocode. 4 | 5 | Tests can be slow, because after each request gocode server runs GC. 6 | And current Go GC is slow. You won't notice that other than in tests 7 | because usually you spend some time in editor between requests and 8 | that time is wasted on a GC run, but testing app throws requests one 9 | after another and it causes GC to eat a lot of CPU. So.. don't worry 10 | about that. 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/all.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | gocode close 3 | sleep 0.5 4 | echo "--------------------------------------------------------------------" 5 | echo "Autocompletion tests..." 6 | echo "--------------------------------------------------------------------" 7 | ./run.rb 8 | sleep 0.5 9 | gocode close 10 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0001/cursor.47: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0001/cursor.47 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0001/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0002/cursor.105: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0002/cursor.105 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0002/out.expected: -------------------------------------------------------------------------------- 1 | Found 5 candidates: 2 | func main() 3 | package os 4 | var key string 5 | var test map[string]os.Error 6 | var value os.Error 7 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0002/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "os" 4 | 5 | var test map[string]os.Error 6 | 7 | func main() { 8 | for key, value := range test { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0003/cursor.552: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0003/cursor.552 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0003/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func End() token.Pos 3 | func IsExported() bool 4 | func Pos() token.Pos 5 | func String() string 6 | var Name string 7 | var NamePos token.Pos 8 | var Obj *ast.Object 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0004/cursor.1348: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0004/cursor.1348 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0004/out.expected: -------------------------------------------------------------------------------- 1 | Found 6 candidates: 2 | func PrettyPrintTypeExpr(out io.Writer, e ast.Expr) 3 | package ast 4 | package io 5 | var e ast.Expr 6 | var out io.Writer 7 | var t ast.Expr 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0005/b.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // this is a file 'a.go' 4 | 5 | import ( 6 | superos "os" 7 | ) 8 | 9 | func B() superos.Error { 10 | return nil 11 | } 12 | 13 | // notice how changing type of a return function in one file, 14 | // the inferred type of a variable in another file changes also 15 | 16 | func (t *Tester) SetC() { 17 | t.c = 31337 18 | } 19 | 20 | func (t *Tester) SetD() { 21 | t.d = 31337 22 | } 23 | 24 | // support for multifile packages, including correct namespace handling 25 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0005/cursor.327: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0005/cursor.327 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0005/out.expected: -------------------------------------------------------------------------------- 1 | Found 5 candidates: 2 | func A() localos.Error 3 | func B() superos.Error 4 | package localos 5 | type Tester struct 6 | var test superos.Error 7 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0005/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // this is a file 'a.go' 4 | 5 | import ( 6 | localos "os" 7 | ) 8 | 9 | func A() localos.Error { 10 | return nil 11 | } 12 | 13 | // B() is defined in file 'b.go' 14 | var test = B() 15 | 16 | type Tester struct { 17 | a, b, c, d int 18 | } 19 | 20 | func (t *Tester) SetA() { 21 | t.a = 31337 22 | } 23 | 24 | func (t *Tester) SetB() { 25 | t.b = 31337 26 | } 27 | 28 | // methods SetC and SetD are defined in 'b.go' 29 | 30 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0006/b.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // this is a file 'a.go' 4 | 5 | import ( 6 | superos "os" 7 | ) 8 | 9 | func B() superos.Error { 10 | return nil 11 | } 12 | 13 | // notice how changing type of a return function in one file, 14 | // the inferred type of a variable in another file changes also 15 | 16 | func (t *Tester) SetC() { 17 | t.c = 31337 18 | } 19 | 20 | func (t *Tester) SetD() { 21 | t.d = 31337 22 | } 23 | 24 | // support for multifile packages, including correct namespace handling 25 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0006/cursor.286: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0006/cursor.286 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0006/out.expected: -------------------------------------------------------------------------------- 1 | Found 8 candidates: 2 | func SetA() 3 | func SetB() 4 | func SetC() 5 | func SetD() 6 | var a int 7 | var b int 8 | var c int 9 | var d int 10 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0006/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // this is a file 'a.go' 4 | 5 | import ( 6 | localos "os" 7 | ) 8 | 9 | func A() localos.Error { 10 | return nil 11 | } 12 | 13 | // B() is defined in file 'b.go' 14 | var test = B() 15 | 16 | type Tester struct { 17 | a, b, c, d int 18 | } 19 | 20 | func (t *Tester) SetA() { 21 | t.a = 31337 22 | } 23 | 24 | func (t *Tester) SetB() { 25 | t.b = 31337 26 | } 27 | 28 | Tester. 29 | 30 | // methods SetC and SetD are defined in 'b.go' 31 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0007/cursor.58: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0007/cursor.58 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0007/out.expected: -------------------------------------------------------------------------------- 1 | Found 5 candidates: 2 | var ForkLock sync.RWMutex 3 | var SocketDisableIPv6 bool 4 | var Stderr int 5 | var Stdin int 6 | var Stdout int 7 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0007/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "syscall" 4 | 5 | func main() { 6 | syscall.var 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0008/cursor.120: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0008/cursor.120 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0008/out.expected: -------------------------------------------------------------------------------- 1 | Found 6 candidates: 2 | func Lock() 3 | func Unlock() 4 | var Mutex sync.Mutex 5 | var data map[string][]string 6 | var path string 7 | var time int64 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0008/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "sync" 4 | 5 | var hosts struct { 6 | sync.Mutex 7 | data map[string][]string 8 | time int64 9 | path string 10 | } 11 | 12 | hosts. 13 | 14 | func main() { 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0009/cursor.126: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0009/cursor.126 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0009/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func Lock() 3 | func Unlock() 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0009/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "sync" 4 | 5 | var hosts struct { 6 | sync.Mutex 7 | data map[string][]string 8 | time int64 9 | path string 10 | } 11 | 12 | hosts.Mutex. 13 | 14 | func main() { 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0010/cursor.104: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0010/cursor.104 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0010/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func End() token.Pos 3 | func Pos() token.Pos 4 | var Comment *ast.CommentGroup 5 | var Doc *ast.CommentGroup 6 | var Names []*ast.Ident 7 | var Type ast.Expr 8 | var Values []ast.Expr 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0010/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "go/ast" 4 | 5 | func main() { 6 | var gd *ast.GenDecl 7 | v := gd.Specs[0].(*ast.ValueSpec) 8 | v. 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0011/cursor.76: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0011/cursor.76 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0011/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "reflect" 4 | 5 | func main() { 6 | var test reflect.Value 7 | test. 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0012/cursor.114: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0012/cursor.114 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0012/out.expected: -------------------------------------------------------------------------------- 1 | Found 6 candidates: 2 | func main() 3 | type MyMap map[string]int 4 | var key string 5 | var m MyMap 6 | var value int 7 | var z int 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0012/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type MyMap map[string]int 4 | 5 | func main() { 6 | var m MyMap 7 | for key, value := range m { 8 | z := m["15"] 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0013/cursor.359: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0013/cursor.359 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0013/out.expected: -------------------------------------------------------------------------------- 1 | Found 24 candidates: 2 | func main() 3 | var a int 4 | var add int 5 | var and int 6 | var andnot int 7 | var b int 8 | var c bool 9 | var d bool 10 | var div int 11 | var eq bool 12 | var geq bool 13 | var greater bool 14 | var leq bool 15 | var less bool 16 | var logand bool 17 | var logor bool 18 | var mul int 19 | var neq bool 20 | var or int 21 | var rem int 22 | var shl int 23 | var shr int 24 | var sub int 25 | var xor int 26 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0013/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var a, b int 5 | add := a + b 6 | sub := a - b 7 | mul := a * b 8 | div := a / b 9 | or := a | b 10 | xor := a ^ b 11 | rem := a % b 12 | shr := a >> uint(b) 13 | shl := a << uint(b) 14 | and := a & b 15 | andnot := a &^ b 16 | 17 | eq := a == b 18 | neq := a != b 19 | less := a < b 20 | leq := a <= b 21 | greater := a > b 22 | geq := a >= b 23 | 24 | var c, d bool 25 | logor := c || d 26 | logand := c && d 27 | 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0014/cursor.191: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0014/cursor.191 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0014/out.expected: -------------------------------------------------------------------------------- 1 | Found 11 candidates: 2 | func main() 3 | type MyPtrInt *int 4 | var a *int 5 | var aa int 6 | var b int 7 | var bb *MyPtrInt 8 | var c *int 9 | var d **int 10 | var megaptr **int 11 | var superint int 12 | var typeptr MyPtrInt 13 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0014/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type MyPtrInt *int 4 | 5 | func main() { 6 | var megaptr **int 7 | a := *megaptr 8 | b := *a 9 | 10 | var superint int 11 | c := &superint 12 | d := &c 13 | 14 | var typeptr MyPtrInt 15 | aa := *typeptr 16 | bb := &typeptr 17 | 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0015/cursor.130: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0015/cursor.130 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0015/out.expected: -------------------------------------------------------------------------------- 1 | Found 9 candidates: 2 | func main() 3 | var a int 4 | var arro bool 5 | var b bool 6 | var c chan bool 7 | var uadd int 8 | var unot bool 9 | var usub int 10 | var uxor bool 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0015/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var a int 5 | var b bool 6 | var c chan bool 7 | uadd := +a 8 | usub := -a 9 | unot := !b 10 | uxor := ^b 11 | arro := <-c 12 | 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0016/cursor.122: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0016/cursor.122 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0016/out.expected: -------------------------------------------------------------------------------- 1 | Found 4 candidates: 2 | func main() 3 | var a int 4 | var b string 5 | var d bool 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0016/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var a int 5 | for { 6 | var b string 7 | if a == len(b) { 8 | var c bool 9 | } else { 10 | var d bool 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0017/cursor.70: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0017/cursor.70 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0017/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | func a(a, b, c int) int 3 | func b(a, b, c string) string 4 | func main() 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0017/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func a(a, b, c int) int { 4 | return 123 5 | } 6 | 7 | func main() { 8 | 9 | } 10 | 11 | func b(a, b, c string) string { 12 | return "abc" 13 | } 14 | 15 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0018/cursor.355: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0018/cursor.355 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0018/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func Bark() 3 | var Legs int 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0018/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // just a dummy example 8 | type Dog struct { 9 | Legs int 10 | } 11 | 12 | func (d *Dog) Bark() { 13 | fmt.Printf("Bark!\n") 14 | } 15 | 16 | // another one 17 | type Test struct { 18 | // map of slices of pointer to a *Dog 19 | MoreTests map[string][]**Dog 20 | } 21 | 22 | func (t *Test) GetMe() *Test { 23 | return t 24 | } 25 | 26 | func main() { 27 | t := new(Test) 28 | (*t.GetMe().MoreTests["blabla"][10]). 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0019/cursor.72: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0019/cursor.72 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0019/out.expected: -------------------------------------------------------------------------------- 1 | Found 14 candidates: 2 | const BestCompression 3 | const BestSpeed 4 | const DefaultCompression 5 | const NoCompression 6 | func NewReader(r io.Reader) (io.ReadCloser, error) 7 | func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, error) 8 | func NewWriter(w io.Writer) *zlib.Writer 9 | func NewWriterLevel(w io.Writer, level int) (*zlib.Writer, error) 10 | func NewWriterLevelDict(w io.Writer, level int, dict []byte) (*zlib.Writer, error) 11 | type Resetter interface 12 | type Writer struct 13 | var ErrChecksum error 14 | var ErrDictionary error 15 | var ErrHeader error 16 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0019/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "compress/zlib" 4 | 5 | func main() { 6 | var b map[int]zlib. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0020/cursor.174: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0020/cursor.174 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0020/out.expected: -------------------------------------------------------------------------------- 1 | Found 4 candidates: 2 | func Lock() 3 | func Unlock() 4 | var Dummy Dummy 5 | var Mutex sync.Mutex 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0020/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "sync" 4 | 5 | type Dummy struct { 6 | sync.Mutex 7 | } 8 | 9 | type Bar struct { 10 | Dummy 11 | } 12 | 13 | func (b *Bar) Lock() { 14 | } 15 | 16 | func (b *Bar) Unlock() { 17 | } 18 | 19 | func main() { 20 | var b Bar 21 | b. 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0021/cursor.82: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0021/cursor.82 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0021/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func End() token.Pos 3 | func IsExported() bool 4 | func Pos() token.Pos 5 | func String() string 6 | var Name string 7 | var NamePos token.Pos 8 | var Obj *ast.Object 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0021/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "go/ast" 4 | 5 | func main() { 6 | var test *ast.ImportSpec 7 | test.Name. 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0022/cursor.79: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0022/cursor.79 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0022/out.expected: -------------------------------------------------------------------------------- 1 | Found 5 candidates: 2 | func getMap() map[string]os.Error 3 | func main() 4 | package os 5 | var key string 6 | var value os.Error 7 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0022/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "os" 4 | 5 | func main() { 6 | for key, value := range getMap() { 7 | 8 | } 9 | } 10 | 11 | func getMap() map[string]os.Error { 12 | // simply to trick type inference 13 | return nil 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0023/cursor.88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0023/cursor.88 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0023/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Simple check for unicode awareness 4 | 5 | import ъ "fmt" 6 | 7 | func main() { 8 | ъ. 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0024/cursor.71: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0024/cursor.71 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0024/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | var a int 3 | var b int 4 | var c int 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0024/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X struct { 4 | a,b,c int 5 | } 6 | 7 | func main() { 8 | var X *X 9 | X. 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0025/cursor.53: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0025/cursor.53 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0025/out.expected: -------------------------------------------------------------------------------- 1 | Found 9 candidates: 2 | func Alignof(any) uintptr 3 | func New(typ interface{}) unsafe.Pointer 4 | func NewArray(typ interface{}, n int) unsafe.Pointer 5 | func Offsetof(any) uintptr 6 | func Reflect(i interface{}) (typ interface{}, addr unsafe.Pointer) 7 | func Sizeof(any) uintptr 8 | func Typeof(i interface{}) interface{} 9 | func Unreflect(typ interface{}, addr unsafe.Pointer) interface{} 10 | type Pointer uintptr 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0025/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "unsafe" 4 | 5 | func main() { 6 | unsafe. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0026/cursor.164: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0026/cursor.164 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0026/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func main() 3 | var A struct 4 | var B struct 5 | var C struct 6 | var a int 7 | var d int 8 | var g int 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0026/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var A = struct { a, b, c int }{1,2,3} 4 | var B struct { d, e, f int } 5 | 6 | func main() { 7 | C := struct { g, h, i int }{1,2,3} 8 | 9 | a := A.a 10 | d := B.d 11 | g := C.g 12 | 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0027/cursor.84: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0027/cursor.84 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0027/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func String() 3 | var name string 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0027/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type file struct { 4 | name string 5 | } 6 | 7 | func (file *file) String() { 8 | file. 9 | return file.name 10 | } 11 | 12 | func main() { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0028/cursor.129: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0028/cursor.129 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0028/out.expected: -------------------------------------------------------------------------------- 1 | Found 1 candidates: 2 | func PowerOfTwo() int 3 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0028/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X int 4 | 5 | func (x X) PowerOfTwo() int { 6 | return int(x * x) 7 | } 8 | 9 | func main() { 10 | a := X(56) 11 | i := a + 67 12 | j := ^i 13 | j. 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0029/cursor.62: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0029/cursor.62 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0029/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "fmt" 4 | 5 | func main() { 6 | var a Formatter 7 | 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0030/cursor.85: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0030/cursor.85 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0030/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | var F1 int 3 | var F2 int 4 | var F3 int 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0030/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type A struct { 4 | F1, F2, F3 int 5 | } 6 | 7 | type B A 8 | 9 | func main() { 10 | var b B 11 | b. 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0031/cursor.80: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0031/cursor.80 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0031/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func main() 3 | var c int 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0031/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var c chan int 5 | select { 6 | case c := <-c: 7 | _ = c 8 | 9 | default: 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0032/cursor.1835: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0032/cursor.1835 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0033/cursor.138: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0033/cursor.138 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0033/out.expected: -------------------------------------------------------------------------------- 1 | Found 6 candidates: 2 | func testEllipsis(dummies ...*Dummy) 3 | type Dummy struct 4 | var d *Dummy 5 | var dummies ...*Dummy 6 | var i int 7 | var x *Dummy 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0033/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type Dummy struct { 4 | a, b, c int 5 | } 6 | 7 | func testEllipsis(dummies ...*Dummy) { 8 | for i, d := range dummies { 9 | x := dummies[0] 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0034/cursor.82: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0034/cursor.82 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0034/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | func At(x int, y int) color.Color 3 | func Bounds() image.Rectangle 4 | func ColorModel() color.Model 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0034/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "image/png" 4 | 5 | func test() { 6 | img, err := png.Decode(nil) 7 | img. 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0035/cursor.91: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0035/cursor.91 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0035/out.expected: -------------------------------------------------------------------------------- 1 | Found 5 candidates: 2 | func main() 3 | var err error 4 | var offset int 5 | var r rune 6 | var s string 7 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0035/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var err error 5 | s := err.Error() 6 | for offset, r := range s { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0036/cursor.67: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0036/cursor.67 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0036/out.expected: -------------------------------------------------------------------------------- 1 | Found 21 candidates: 2 | func Close() error 3 | func DWARF() (*dwarf.Data, error) 4 | func DynString(tag elf.DynTag) ([]string, error) 5 | func DynamicSymbols() ([]elf.Symbol, error) 6 | func ImportedLibraries() ([]string, error) 7 | func ImportedSymbols() ([]elf.ImportedSymbol, error) 8 | func Section(name string) *elf.Section 9 | func SectionByType(typ elf.SectionType) *elf.Section 10 | func Symbols() ([]elf.Symbol, error) 11 | var ABIVersion uint8 12 | var ByteOrder binary.ByteOrder 13 | var Class elf.Class 14 | var Data elf.Data 15 | var Entry uint64 16 | var FileHeader elf.FileHeader 17 | var Machine elf.Machine 18 | var OSABI elf.OSABI 19 | var Progs []*elf.Prog 20 | var Sections []*elf.Section 21 | var Type elf.Type 22 | var Version elf.Version 23 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0036/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "debug/elf" 4 | 5 | func main() { 6 | var f elf.File 7 | f. 8 | } -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0037/cursor.139: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0037/cursor.139 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0037/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func main() 3 | type Array [5]int 4 | var a Array 5 | var s []string 6 | var s1 []string 7 | var s2 []int 8 | var s3 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0037/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type Array [5]int 4 | 5 | func main() { 6 | var s []string 7 | var a Array 8 | s1 := append(s[:], "123") 9 | s2 := a[0:100500] 10 | s3 := append() 11 | 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0038/cursor.87: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0038/cursor.87 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0038/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func main() 3 | var x 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0038/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | if y := 20; y == 0 { 5 | } 6 | if x := 10; x == 0 { 7 | } else if 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0039/cursor.88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0039/cursor.88 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0039/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | func main() 3 | var z 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0039/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | z := 5 5 | if y := 20; y == 0 { 6 | } 7 | if x := 10; x == 0 { 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0040/cursor.96: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0040/cursor.96 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0040/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | func create_foo() Foo 3 | type Foo struct 4 | var t Foo 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0040/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type Foo struct {} 4 | 5 | func (f *Foo) Bar() {} 6 | 7 | func create_foo() Foo { 8 | t := Foo{} 9 | 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0041/cursor.140: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0041/cursor.140 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0041/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | var Xa int 3 | var Xb int 4 | var Xy Y 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0041/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X struct { 4 | Xa int 5 | Xb int 6 | Xy Y 7 | } 8 | 9 | type Y struct { 10 | Ya int 11 | Yb int 12 | } 13 | 14 | func main() { 15 | x := X{ 16 | Xy: Y{ 17 | Ya: 1, 18 | }, 19 | 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0042/cursor.126: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0042/cursor.126 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0042/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | var Ya int 3 | var Yb int 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0042/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X struct { 4 | Xa int 5 | Xb int 6 | Xy Y 7 | } 8 | 9 | type Y struct { 10 | Ya int 11 | Yb int 12 | } 13 | 14 | func main() { 15 | x := X{ 16 | Xy: Y{ 17 | 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0043/cursor.182: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0043/cursor.182 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0043/out.expected: -------------------------------------------------------------------------------- 1 | Found 4 candidates: 2 | func foo() 3 | var Xa int 4 | var Xb int 5 | var Xy Y 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0043/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X struct { 4 | Xa int 5 | Xb int 6 | Xy Y 7 | } 8 | 9 | type Y struct { 10 | Ya int 11 | Yb int 12 | } 13 | 14 | func (x X) foo() { 15 | return 16 | } 17 | 18 | func main() { 19 | x := X{ 20 | Xa: 1, 21 | Xb: 2, 22 | } 23 | y := Y{ 24 | Ya: x. 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0044/cursor.105: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0044/cursor.105 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0044/out.expected: -------------------------------------------------------------------------------- 1 | Found 2 candidates: 2 | var Xa int 3 | var Xb int 4 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0044/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type X struct { 4 | Xa int 5 | Xb int 6 | } 7 | 8 | func (x X) foo() { 9 | return 10 | } 11 | 12 | func main() { 13 | x := X{ 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0045/cursor.51: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0045/cursor.51 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0045/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | if fmt. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0046/cursor.53: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0046/cursor.53 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0046/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | x := fmt. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0047/cursor.43: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0047/out.expected: -------------------------------------------------------------------------------- 1 | Nothing to complete. 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0047/test.go.in: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | type T struct{ X } 4 | 5 | var _ = T.x. 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0048/cursor.53: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0048/cursor.53 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0048/out.expected: -------------------------------------------------------------------------------- 1 | Found 7 candidates: 2 | func Fprint(w io.Writer, a ...interface{}) (n int, err error) 3 | func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) 4 | func Fprintln(w io.Writer, a ...interface{}) (n int, err error) 5 | func Fscan(r io.Reader, a ...interface{}) (n int, err error) 6 | func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error) 7 | func Fscanln(r io.Reader, a ...interface{}) (n int, err error) 8 | type Formatter interface 9 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0048/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | x := fmt.Fpr 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0049/cursor.44: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0049/cursor.44 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0049/out.expected: -------------------------------------------------------------------------------- 1 | Found 1 candidates: 2 | var i int 3 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0049/test.go.in: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | func t(a struct { 4 | i int 5 | }) { 6 | a. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0050/cursor.45: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0050/cursor.45 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0050/out.expected: -------------------------------------------------------------------------------- 1 | Found 1 candidates: 2 | var i int 3 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0050/test.go.in: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | func t(a *struct { 4 | i int 5 | }) { 6 | a. 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0051/cursor.247: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaojiaqi/fakewechat/42b46917c14cdfa8ddf93d1978b2745f7da5f720/vendor/github.com/nsf/gocode/_testing/test.0051/cursor.247 -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0051/out.expected: -------------------------------------------------------------------------------- 1 | Found 3 candidates: 2 | var NumApples int 3 | var NumBananas int 4 | var NumOranges int 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/_testing/test.0051/test.go.in: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type Item struct { 4 | Quantity int 5 | Name string 6 | } 7 | 8 | type Config struct { 9 | NumApples int 10 | NumOranges int 11 | NumBananas int 12 | } 13 | 14 | func main() { 15 | var cfg Config 16 | items := []Item{ 17 | {cfg.NumApples, "apple"}, 18 | {cfg.NumOranges, "orange"}, 19 | {cfg.NumApples, "banana"}, 20 | } 21 | 22 | var a int 23 | var b int 24 | var c int 25 | var d int 26 | var e int 27 | var f int 28 | var g int 29 | var h int 30 | var i int 31 | var j int 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/changelog: -------------------------------------------------------------------------------- 1 | gocode (0.0.1~20110805-1) oneiric; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Juan L. Negron Fri, 05 Aug 2011 22:58:48 -0700 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/control: -------------------------------------------------------------------------------- 1 | Source: gocode 2 | Section: devel 3 | Priority: extra 4 | Maintainer: Juan L. Negron 5 | Build-Depends: debhelper (>= 7.0.50~), golang 6 | Standards-Version: 3.9.1 7 | Homepage: https://github.com/nsf/gocode 8 | #Vcs-Git: git://git.debian.org/collab-maint/gocode.git 9 | #Vcs-Browser: http://git.debian.org/?p=collab-maint/gocode.git;a=summary 10 | 11 | Package: gocode 12 | Architecture: any 13 | Depends: ${shlibs:Depends}, ${misc:Depends}, golang 14 | Description: An autocompletion daemon for the Go programming language 15 | Gocode is a helper tool which is intended to be integraded with your source 16 | code editor, like vim and emacs. It provides several advanced capabilities, 17 | which currently includes: 18 | - Context-sensitive autocompletion 19 | It is called daemon, because it uses client/server architecture for caching 20 | purposes. In particular, it makes autocompletions very fast. Typical 21 | autocompletion time with warm cache is 30ms, which is barely noticeable. 22 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/gocode.default: -------------------------------------------------------------------------------- 1 | # Defaults for gocode initscript 2 | # sourced by /etc/init.d/gocode 3 | # installed at /etc/default/gocode by the maintainer scripts 4 | 5 | # 6 | # This is a POSIX shell fragment 7 | # 8 | 9 | # Additional options that are passed to the Daemon. 10 | DAEMON_OPTS="" 11 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | export GOROOT=/usr/lib/go 12 | 13 | %: 14 | dh $@ 15 | 16 | override_dh_auto_install: install 17 | 18 | install: 19 | mkdir -p debian/gocode/usr/bin 20 | cp gocode debian/gocode/usr/bin 21 | mkdir -p debian/gocode/usr/share/gocode 22 | cp -av emacs debian/gocode/usr/share/gocode 23 | cp -av vim debian/gocode/usr/share/gocode 24 | mkdir -p debian/gocode/usr/share/doc/gocode 25 | cp LICENSE debian/gocode/usr/share/doc/gocode 26 | cp README.md debian/gocode/usr/share/doc/gocode 27 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/nvim/ftplugin/go/gocomplete.vim: -------------------------------------------------------------------------------- 1 | setlocal omnifunc=gocomplete#Complete 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/nvim/pathogen_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p "$HOME/.config/nvim/bundle/gocode/autoload" 3 | mkdir -p "$HOME/.config/nvim/bundle/gocode/ftplugin/go" 4 | cp "${0%/*}/autoload/gocomplete.vim" "$HOME/.config/nvim/bundle/gocode/autoload" 5 | cp "${0%/*}/ftplugin/go/gocomplete.vim" "$HOME/.config/nvim/bundle/gocode/ftplugin/go" 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/nvim/symlink.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd "${0%/*}" 3 | ROOTDIR=`pwd` 4 | mkdir -p "$HOME/.config/nvim/autoload" 5 | mkdir -p "$HOME/.config/nvim/ftplugin/go" 6 | ln -s "$ROOTDIR/autoload/gocomplete.vim" "$HOME/.config/nvim/autoload/" 7 | ln -s "$ROOTDIR/ftplugin/go/gocomplete.vim" "$HOME/.config/nvim/ftplugin/go/" 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/nvim/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p "$HOME/.config/nvim/autoload" 3 | mkdir -p "$HOME/.config/nvim/ftplugin/go" 4 | cp "${0%/*}/autoload/gocomplete.vim" "$HOME/.config/nvim/autoload" 5 | cp "${0%/*}/ftplugin/go/gocomplete.vim" "$HOME/.config/nvim/ftplugin/go" 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/os_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package main 4 | 5 | import ( 6 | "flag" 7 | "os" 8 | "os/exec" 9 | "path/filepath" 10 | ) 11 | 12 | func create_sock_flag(name, desc string) *string { 13 | return flag.String(name, "unix", desc) 14 | } 15 | 16 | // Full path of the current executable 17 | func get_executable_filename() string { 18 | // try readlink first 19 | path, err := os.Readlink("/proc/self/exe") 20 | if err == nil { 21 | return path 22 | } 23 | // use argv[0] 24 | path = os.Args[0] 25 | if !filepath.IsAbs(path) { 26 | cwd, _ := os.Getwd() 27 | path = filepath.Join(cwd, path) 28 | } 29 | if file_exists(path) { 30 | return path 31 | } 32 | // Fallback : use "gocode" and assume we are in the PATH... 33 | path, err = exec.LookPath("gocode") 34 | if err == nil { 35 | return path 36 | } 37 | return "" 38 | } 39 | 40 | // config location 41 | 42 | func config_dir() string { 43 | return filepath.Join(xdg_home_dir(), "gocode") 44 | } 45 | 46 | func config_file() string { 47 | return filepath.Join(xdg_home_dir(), "gocode", "config.json") 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/vim/ftplugin/go/gocomplete.vim: -------------------------------------------------------------------------------- 1 | setlocal omnifunc=gocomplete#Complete 2 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/vim/pathogen_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p "$HOME/.vim/bundle/gocode/autoload" 3 | mkdir -p "$HOME/.vim/bundle/gocode/ftplugin/go" 4 | cp "${0%/*}/autoload/gocomplete.vim" "$HOME/.vim/bundle/gocode/autoload" 5 | cp "${0%/*}/ftplugin/go/gocomplete.vim" "$HOME/.vim/bundle/gocode/ftplugin/go" 6 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/vim/symlink.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd "${0%/*}" 3 | ROOTDIR=`pwd` 4 | mkdir -p "$HOME/.vim/autoload" 5 | mkdir -p "$HOME/.vim/ftplugin/go" 6 | ln -s "$ROOTDIR/autoload/gocomplete.vim" "$HOME/.vim/autoload/" 7 | ln -s "$ROOTDIR/ftplugin/go/gocomplete.vim" "$HOME/.vim/ftplugin/go/" 8 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/gocode/vim/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p "$HOME/.vim/autoload" 3 | mkdir -p "$HOME/.vim/ftplugin/go" 4 | cp "${0%/*}/autoload/gocomplete.vim" "$HOME/.vim/autoload" 5 | cp "${0%/*}/ftplugin/go/gocomplete.vim" "$HOME/.vim/ftplugin/go" 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/bsm/ratelimit.v1/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | script: make testall 3 | go: 4 | - 1.4 5 | - 1.3 6 | - 1.2 7 | - tip 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/bsm/ratelimit.v1/Makefile: -------------------------------------------------------------------------------- 1 | default: test 2 | 3 | testdeps: 4 | @go get github.com/onsi/ginkgo 5 | @go get github.com/onsi/gomega 6 | 7 | test: testdeps 8 | @go test ./... 9 | 10 | testrace: testdeps 11 | @go test ./... -race 12 | 13 | testall: test testrace 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/.gitignore: -------------------------------------------------------------------------------- 1 | *.rdb 2 | .test/ 3 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | services: 5 | - redis-server 6 | 7 | go: 8 | - 1.4 9 | - 1.5 10 | - tip 11 | 12 | matrix: 13 | allow_failures: 14 | - go: tip 15 | 16 | install: 17 | - go get gopkg.in/bsm/ratelimit.v1 18 | - go get github.com/onsi/ginkgo 19 | - go get github.com/onsi/gomega 20 | - mkdir -p $HOME/gopath/src/gopkg.in 21 | - mv $HOME/gopath/src/github.com/go-redis/redis $HOME/gopath/src/gopkg.in/redis.v3 22 | - cd $HOME/gopath/src/gopkg.in/redis.v3 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/Makefile: -------------------------------------------------------------------------------- 1 | all: testdeps 2 | go test ./... -test.v -test.cpu=1,2,4 3 | go test ./... -test.v -test.short -test.race 4 | 5 | testdeps: .test/redis/src/redis-server 6 | 7 | .PHONY: all test testdeps 8 | 9 | .test/redis: 10 | mkdir -p $@ 11 | wget -qO- https://github.com/antirez/redis/archive/unstable.tar.gz | tar xvz --strip-components=1 -C $@ 12 | 13 | .test/redis/src/redis-server: .test/redis 14 | cd $< && make all 15 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/conn_test.go: -------------------------------------------------------------------------------- 1 | package redis_test 2 | 3 | import ( 4 | "net" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | 9 | "gopkg.in/redis.v3" 10 | ) 11 | 12 | var _ = Describe("newConnDialer with bad connection", func() { 13 | It("should return an error", func() { 14 | dialer := redis.NewConnDialer(&redis.Options{ 15 | Dialer: func() (net.Conn, error) { 16 | return &badConn{}, nil 17 | }, 18 | MaxRetries: 3, 19 | Password: "password", 20 | DB: 1, 21 | }) 22 | _, err := dialer() 23 | Expect(err).To(MatchError("bad connection")) 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package redis implements a Redis client. 3 | */ 4 | package redis 5 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/export_test.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import "net" 4 | 5 | func (c *baseClient) Pool() pool { 6 | return c.connPool 7 | } 8 | 9 | var NewConnDialer = newConnDialer 10 | 11 | func (cn *conn) SetNetConn(netcn net.Conn) { 12 | cn.netcn = netcn 13 | } 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/internal/hashtag/hashtag_test.go: -------------------------------------------------------------------------------- 1 | package hashtag 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("CRC16", func() { 9 | 10 | // http://redis.io/topics/cluster-spec#keys-distribution-model 11 | It("should calculate CRC16", func() { 12 | tests := []struct { 13 | s string 14 | n uint16 15 | }{ 16 | {"123456789", 0x31C3}, 17 | {string([]byte{83, 153, 134, 118, 229, 214, 244, 75, 140, 37, 215, 215}), 21847}, 18 | } 19 | 20 | for _, test := range tests { 21 | Expect(crc16sum(test.s)).To(Equal(test.n), "for %s", test.s) 22 | } 23 | }) 24 | 25 | }) 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package redis 4 | 5 | func bytesToString(b []byte) string { 6 | return string(b) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/script.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "crypto/sha1" 5 | "encoding/hex" 6 | "io" 7 | "strings" 8 | ) 9 | 10 | type scripter interface { 11 | Eval(script string, keys []string, args []string) *Cmd 12 | EvalSha(sha1 string, keys []string, args []string) *Cmd 13 | ScriptExists(scripts ...string) *BoolSliceCmd 14 | ScriptLoad(script string) *StringCmd 15 | } 16 | 17 | type Script struct { 18 | src, hash string 19 | } 20 | 21 | func NewScript(src string) *Script { 22 | h := sha1.New() 23 | io.WriteString(h, src) 24 | return &Script{ 25 | src: src, 26 | hash: hex.EncodeToString(h.Sum(nil)), 27 | } 28 | } 29 | 30 | func (s *Script) Load(c scripter) *StringCmd { 31 | return c.ScriptLoad(s.src) 32 | } 33 | 34 | func (s *Script) Exists(c scripter) *BoolSliceCmd { 35 | return c.ScriptExists(s.src) 36 | } 37 | 38 | func (s *Script) Eval(c scripter, keys []string, args []string) *Cmd { 39 | return c.Eval(s.src, keys, args) 40 | } 41 | 42 | func (s *Script) EvalSha(c scripter, keys []string, args []string) *Cmd { 43 | return c.EvalSha(s.hash, keys, args) 44 | } 45 | 46 | func (s *Script) Run(c scripter, keys []string, args []string) *Cmd { 47 | r := s.EvalSha(c, keys, args) 48 | if err := r.Err(); err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") { 49 | return s.Eval(c, keys, args) 50 | } 51 | return r 52 | } 53 | -------------------------------------------------------------------------------- /vendor/gopkg.in/redis.v3/unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package redis 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | func bytesToString(b []byte) string { 11 | bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) 12 | strHeader := reflect.StringHeader{bytesHeader.Data, bytesHeader.Len} 13 | return *(*string)(unsafe.Pointer(&strHeader)) 14 | } 15 | -------------------------------------------------------------------------------- /zabbix/send.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | while [ True ]; 4 | do 5 | 6 | 7 | zabbix_sender -z 172.16.11.194 -k "client.KeepConnection" -o $RANDOM -vv -s "FakeweChat Server" 8 | zabbix_sender -z 172.16.11.194 -k "longCon.KeepConnection" -o $RANDOM -vv -s "FakeweChat Server" 9 | 10 | sleep 10 11 | done 12 | --------------------------------------------------------------------------------