summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile99
-rw-r--r--NOTICE.txt195
-rw-r--r--api/admin.go22
-rw-r--r--api/admin_test.go4
-rw-r--r--api/apitestlib.go21
-rw-r--r--api/channel.go16
-rw-r--r--api/channel_test.go33
-rw-r--r--api/command.go434
-rw-r--r--api/command_expand_collapse.go87
-rw-r--r--api/command_join.go57
-rw-r--r--api/command_msg.go95
-rw-r--r--api/context.go6
-rw-r--r--api/file.go2
-rw-r--r--api/post.go55
-rw-r--r--api/post_test.go147
-rw-r--r--api/user.go32
-rw-r--r--api/user_test.go29
-rw-r--r--api4/api.go29
-rw-r--r--api4/apitestlib.go100
-rw-r--r--api4/brand.go70
-rw-r--r--api4/brand_test.go69
-rw-r--r--api4/channel.go225
-rw-r--r--api4/channel_test.go516
-rw-r--r--api4/cluster.go29
-rw-r--r--api4/cluster_test.go22
-rw-r--r--api4/compliance.go127
-rw-r--r--api4/context.go23
-rw-r--r--api4/context_test.go31
-rw-r--r--api4/file.go134
-rw-r--r--api4/file_test.go269
-rw-r--r--api4/ldap.go45
-rw-r--r--api4/ldap_test.go30
-rw-r--r--api4/params.go5
-rw-r--r--api4/saml.go171
-rw-r--r--api4/saml_test.go19
-rw-r--r--api4/system.go92
-rw-r--r--api4/system_test.go172
-rw-r--r--api4/team.go112
-rw-r--r--api4/team_test.go208
-rw-r--r--api4/user.go92
-rw-r--r--api4/user_test.go191
-rw-r--r--api4/webhook.go206
-rw-r--r--api4/webhook_test.go436
-rw-r--r--app/admin.go21
-rw-r--r--app/auto_channels.go (renamed from api/auto_channels.go)2
-rw-r--r--app/auto_constants.go (renamed from api/auto_constants.go)2
-rw-r--r--app/auto_environment.go (renamed from api/auto_environment.go)2
-rw-r--r--app/auto_posts.go (renamed from api/auto_posts.go)2
-rw-r--r--app/auto_teams.go (renamed from api/auto_teams.go)2
-rw-r--r--app/auto_users.go (renamed from api/auto_users.go)11
-rw-r--r--app/brand.go16
-rw-r--r--app/channel.go28
-rw-r--r--app/command.go304
-rw-r--r--app/command_away.go (renamed from api/command_away.go)16
-rw-r--r--app/command_echo.go (renamed from api/command_echo.go)26
-rw-r--r--app/command_expand_collapse.go87
-rw-r--r--app/command_invite_people.go (renamed from api/command_invite_people.go)24
-rw-r--r--app/command_join.go62
-rw-r--r--app/command_loadtest.go (renamed from api/command_loadtest.go)78
-rw-r--r--app/command_logout.go (renamed from api/command_logout.go)18
-rw-r--r--app/command_me.go (renamed from api/command_me.go)13
-rw-r--r--app/command_msg.go110
-rw-r--r--app/command_offline.go (renamed from api/command_offline.go)16
-rw-r--r--app/command_online.go (renamed from api/command_online.go)16
-rw-r--r--app/command_shortcuts.go (renamed from api/command_shortcuts.go)25
-rw-r--r--app/command_shrug.go (renamed from api/command_shrug.go)13
-rw-r--r--app/compliance.go4
-rw-r--r--app/email_test.go443
-rw-r--r--app/file.go5
-rw-r--r--app/saml.go143
-rw-r--r--app/team.go30
-rw-r--r--app/user.go86
-rw-r--r--app/webhook.go33
-rw-r--r--einterfaces/cluster.go2
-rw-r--r--glide.lock43
-rw-r--r--glide.yaml8
-rw-r--r--i18n/en.json42
-rw-r--r--manualtesting/manual_testing.go4
-rw-r--r--model/channel_member.go30
-rw-r--r--model/channel_member_test.go14
-rw-r--r--model/client.go30
-rw-r--r--model/client4.go629
-rw-r--r--model/command_args.go15
-rw-r--r--model/post.go1
-rw-r--r--model/saml.go31
-rw-r--r--model/saml_test.go24
-rw-r--r--model/team_member.go20
-rw-r--r--model/team_member_test.go14
-rw-r--r--model/user_autocomplete.go25
-rw-r--r--model/utils.go21
-rw-r--r--store/sql_channel_store.go102
-rw-r--r--store/sql_channel_store_test.go202
-rw-r--r--store/sql_compliance_store.go6
-rw-r--r--store/sql_compliance_store_test.go20
-rw-r--r--store/sql_post_store.go1
-rw-r--r--store/sql_team_store.go45
-rw-r--r--store/sql_team_store_test.go55
-rw-r--r--store/sql_upgrade.go13
-rw-r--r--store/sql_webhook_store.go48
-rw-r--r--store/sql_webhook_store_test.go67
-rw-r--r--store/store.go13
-rw-r--r--tests/test-links.md1
-rw-r--r--utils/inbucket.go38
-rw-r--r--utils/mail_test.go26
-rw-r--r--vendor/github.com/goamz/goamz/.gitignore1
-rw-r--r--vendor/github.com/goamz/goamz/.lbox1
-rw-r--r--vendor/github.com/goamz/goamz/.travis.yml32
-rw-r--r--vendor/github.com/goamz/goamz/CHANGES.md5
-rw-r--r--vendor/github.com/goamz/goamz/LICENSE185
-rw-r--r--vendor/github.com/goamz/goamz/README.md64
-rw-r--r--vendor/github.com/goamz/goamz/autoscaling/autoscaling.go1768
-rw-r--r--vendor/github.com/goamz/goamz/autoscaling/autoscaling_test.go1180
-rw-r--r--vendor/github.com/goamz/goamz/autoscaling/responses_test.go627
-rw-r--r--vendor/github.com/goamz/goamz/aws/attempt.go74
-rw-r--r--vendor/github.com/goamz/goamz/aws/attempt_test.go58
-rw-r--r--vendor/github.com/goamz/goamz/aws/aws.go434
-rw-r--r--vendor/github.com/goamz/goamz/aws/aws_test.go211
-rw-r--r--vendor/github.com/goamz/goamz/aws/client.go124
-rw-r--r--vendor/github.com/goamz/goamz/aws/client_test.go121
-rw-r--r--vendor/github.com/goamz/goamz/aws/export_test.go29
-rw-r--r--vendor/github.com/goamz/goamz/aws/regions.go277
-rw-r--r--vendor/github.com/goamz/goamz/aws/sign.go357
-rw-r--r--vendor/github.com/goamz/goamz/aws/sign_test.go540
-rw-r--r--vendor/github.com/goamz/goamz/cloudformation/cloudformation.go837
-rw-r--r--vendor/github.com/goamz/goamz/cloudformation/cloudformation_test.go653
-rw-r--r--vendor/github.com/goamz/goamz/cloudformation/responses_test.go371
-rw-r--r--vendor/github.com/goamz/goamz/cloudfront/cloudfront.go135
-rw-r--r--vendor/github.com/goamz/goamz/cloudfront/cloudfront_test.go52
-rw-r--r--vendor/github.com/goamz/goamz/cloudfront/testdata/key.pem15
-rw-r--r--vendor/github.com/goamz/goamz/cloudfront/testdata/key.pub6
-rw-r--r--vendor/github.com/goamz/goamz/cloudwatch/ChangeLog7
-rw-r--r--vendor/github.com/goamz/goamz/cloudwatch/README.md109
-rw-r--r--vendor/github.com/goamz/goamz/cloudwatch/cloudwatch.go404
-rw-r--r--vendor/github.com/goamz/goamz/cloudwatch/cloudwatch_test.go132
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/.gitignore1
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/Makefile13
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/README.md27
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/attribute.go185
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/const.go11
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/dynamodb.go142
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/dynamodb_test.go166
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/item.go351
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/item_test.go446
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/marshaller.go626
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/marshaller_test.go283
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/query.go111
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/query_builder.go362
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/query_builder_test.go380
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/scan.go51
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/stream.go307
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/stream_test.go198
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/table.go259
-rwxr-xr-xvendor/github.com/goamz/goamz/dynamodb/table_test.go79
-rw-r--r--vendor/github.com/goamz/goamz/dynamodb/update_item.go94
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2.go2267
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2_test.go1280
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2i_test.go204
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2t_test.go581
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2test/filter.go84
-rw-r--r--vendor/github.com/goamz/goamz/ec2/ec2test/server.go993
-rw-r--r--vendor/github.com/goamz/goamz/ec2/export_test.go22
-rw-r--r--vendor/github.com/goamz/goamz/ec2/responses_test.go1084
-rw-r--r--vendor/github.com/goamz/goamz/ec2/sign.go45
-rw-r--r--vendor/github.com/goamz/goamz/ec2/sign_test.go68
-rw-r--r--vendor/github.com/goamz/goamz/ec2/vpc.go399
-rw-r--r--vendor/github.com/goamz/goamz/ec2/vpc_test.go224
-rw-r--r--vendor/github.com/goamz/goamz/ecs/ecs.go1075
-rw-r--r--vendor/github.com/goamz/goamz/ecs/ecs_test.go806
-rw-r--r--vendor/github.com/goamz/goamz/ecs/responses_test.go637
-rw-r--r--vendor/github.com/goamz/goamz/elb/elb.go435
-rw-r--r--vendor/github.com/goamz/goamz/elb/elb_test.go369
-rw-r--r--vendor/github.com/goamz/goamz/elb/elbi_test.go308
-rw-r--r--vendor/github.com/goamz/goamz/elb/elbt_test.go243
-rw-r--r--vendor/github.com/goamz/goamz/elb/elbtest/server.go551
-rw-r--r--vendor/github.com/goamz/goamz/elb/export_test.go9
-rw-r--r--vendor/github.com/goamz/goamz/elb/response_test.go234
-rw-r--r--vendor/github.com/goamz/goamz/elb/sign.go35
-rw-r--r--vendor/github.com/goamz/goamz/elb/sign_test.go66
-rw-r--r--vendor/github.com/goamz/goamz/elb/suite_test.go119
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/example_test.go66
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/export_test.go9
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/mturk.go480
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/mturk_test.go170
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/responses_test.go36
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/sign.go22
-rw-r--r--vendor/github.com/goamz/goamz/exp/mturk/sign_test.go19
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/export_test.go9
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/responses_test.go120
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/sdb.go413
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/sdb_test.go219
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/sign.go54
-rw-r--r--vendor/github.com/goamz/goamz/exp/sdb/sign_test.go29
-rw-r--r--vendor/github.com/goamz/goamz/exp/ses/ses.go149
-rw-r--r--vendor/github.com/goamz/goamz/exp/ses/ses_test.go69
-rw-r--r--vendor/github.com/goamz/goamz/exp/ses/ses_types.go160
-rw-r--r--vendor/github.com/goamz/goamz/exp/ses/sign.go26
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/Makefile21
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/README1
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/endpoint.go132
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/permissions.go51
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/platform.go135
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/responses_test.go317
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/sign.go72
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/sns.go113
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/sns_test.go455
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/subscription.go165
-rw-r--r--vendor/github.com/goamz/goamz/exp/sns/topic.go104
-rw-r--r--vendor/github.com/goamz/goamz/iam/iam.go643
-rw-r--r--vendor/github.com/goamz/goamz/iam/iam_test.go450
-rw-r--r--vendor/github.com/goamz/goamz/iam/iami_test.go209
-rw-r--r--vendor/github.com/goamz/goamz/iam/iamt_test.go39
-rw-r--r--vendor/github.com/goamz/goamz/iam/iamtest/server.go432
-rw-r--r--vendor/github.com/goamz/goamz/iam/responses_test.go261
-rw-r--r--vendor/github.com/goamz/goamz/iam/sign.go38
-rw-r--r--vendor/github.com/goamz/goamz/rds/rds.go96
-rw-r--r--vendor/github.com/goamz/goamz/rds/rds_test.go77
-rw-r--r--vendor/github.com/goamz/goamz/rds/responses_test.go57
-rw-r--r--vendor/github.com/goamz/goamz/rds/types.go388
-rw-r--r--vendor/github.com/goamz/goamz/route53/route53.go254
-rw-r--r--vendor/github.com/goamz/goamz/s3/export_test.go17
-rw-r--r--vendor/github.com/goamz/goamz/s3/multi.go439
-rw-r--r--vendor/github.com/goamz/goamz/s3/multi_test.go373
-rw-r--r--vendor/github.com/goamz/goamz/s3/responses_test.go202
-rw-r--r--vendor/github.com/goamz/goamz/s3/s3.go1164
-rw-r--r--vendor/github.com/goamz/goamz/s3/s3_test.go427
-rw-r--r--vendor/github.com/goamz/goamz/s3/s3i_test.go590
-rw-r--r--vendor/github.com/goamz/goamz/s3/s3t_test.go83
-rw-r--r--vendor/github.com/goamz/goamz/s3/s3test/server.go642
-rw-r--r--vendor/github.com/goamz/goamz/s3/sign.go141
-rw-r--r--vendor/github.com/goamz/goamz/s3/sign_test.go132
-rw-r--r--vendor/github.com/goamz/goamz/sqs/Makefile20
-rw-r--r--vendor/github.com/goamz/goamz/sqs/README.md38
-rw-r--r--vendor/github.com/goamz/goamz/sqs/responses_test.go196
-rw-r--r--vendor/github.com/goamz/goamz/sqs/sqs.go583
-rw-r--r--vendor/github.com/goamz/goamz/sqs/sqs_test.go414
-rw-r--r--vendor/github.com/goamz/goamz/sqs/suite_test.go145
-rw-r--r--vendor/github.com/goamz/goamz/sts/responses_test.go84
-rw-r--r--vendor/github.com/goamz/goamz/sts/sts.go273
-rw-r--r--vendor/github.com/goamz/goamz/sts/sts_test.go151
-rw-r--r--vendor/github.com/goamz/goamz/testutil/http.go180
-rw-r--r--vendor/github.com/goamz/goamz/testutil/suite.go31
-rw-r--r--vendor/github.com/golang/protobuf/descriptor/descriptor.go2
-rw-r--r--vendor/github.com/golang/protobuf/descriptor/descriptor_test.go2
-rw-r--r--vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile6
-rw-r--r--vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go7
-rw-r--r--vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden7
-rw-r--r--vendor/github.com/jaytaylor/html2text/.gitignore24
-rw-r--r--vendor/github.com/jaytaylor/html2text/.travis.yml14
-rw-r--r--vendor/github.com/jaytaylor/html2text/LICENSE22
-rw-r--r--vendor/github.com/jaytaylor/html2text/README.md116
-rw-r--r--vendor/github.com/jaytaylor/html2text/html2text.go312
-rw-r--r--vendor/github.com/jaytaylor/html2text/html2text_test.go674
-rwxr-xr-xvendor/github.com/jaytaylor/html2text/testdata/utf8.html22
-rwxr-xr-xvendor/github.com/jaytaylor/html2text/testdata/utf8_with_bom.xhtml24
-rw-r--r--vendor/github.com/lib/pq/README.md2
-rw-r--r--vendor/github.com/lib/pq/conn.go92
-rw-r--r--vendor/github.com/lib/pq/conn_go18.go35
-rw-r--r--vendor/github.com/lib/pq/conn_test.go108
-rw-r--r--vendor/github.com/lib/pq/go18_test.go15
-rw-r--r--vendor/github.com/lib/pq/listen_example/doc.go24
-rw-r--r--vendor/github.com/lib/pq/notify_test.go24
-rw-r--r--vendor/github.com/lib/pq/oid/types.go12
-rw-r--r--vendor/github.com/lib/pq/ssl.go119
-rw-r--r--vendor/github.com/lib/pq/ssl_permissions.go16
-rw-r--r--vendor/github.com/lib/pq/ssl_test.go186
-rw-r--r--vendor/github.com/lib/pq/ssl_windows.go10
-rw-r--r--vendor/github.com/miekg/dns/README.md4
-rw-r--r--vendor/github.com/miekg/dns/client.go20
-rw-r--r--vendor/github.com/miekg/dns/client_test.go63
-rw-r--r--vendor/github.com/miekg/dns/clientconfig.go32
-rw-r--r--vendor/github.com/miekg/dns/clientconfig_test.go37
-rw-r--r--vendor/github.com/miekg/dns/compress_generate.go184
-rw-r--r--vendor/github.com/miekg/dns/dane.go9
-rw-r--r--vendor/github.com/miekg/dns/dns_test.go17
-rw-r--r--vendor/github.com/miekg/dns/dnssec.go21
-rw-r--r--vendor/github.com/miekg/dns/dnssec_keygen.go16
-rw-r--r--vendor/github.com/miekg/dns/dnssec_keyscan.go2
-rw-r--r--vendor/github.com/miekg/dns/edns.go12
-rw-r--r--vendor/github.com/miekg/dns/idn/punycode.go3
-rw-r--r--vendor/github.com/miekg/dns/msg.go188
-rw-r--r--vendor/github.com/miekg/dns/nsecx.go11
-rw-r--r--vendor/github.com/miekg/dns/parse_test.go6
-rw-r--r--vendor/github.com/miekg/dns/reverse.go4
-rw-r--r--vendor/github.com/miekg/dns/scan.go8
-rw-r--r--vendor/github.com/miekg/dns/scan_rr.go116
-rw-r--r--vendor/github.com/miekg/dns/server_test.go4
-rw-r--r--vendor/github.com/miekg/dns/sig0.go5
-rw-r--r--vendor/github.com/miekg/dns/smimea.go8
-rw-r--r--vendor/github.com/miekg/dns/tsig.go3
-rw-r--r--vendor/github.com/miekg/dns/types.go2
-rw-r--r--vendor/github.com/miekg/dns/types_generate.go2
-rw-r--r--vendor/github.com/miekg/dns/udp.go26
-rw-r--r--vendor/github.com/miekg/dns/udp_linux.go25
-rw-r--r--vendor/github.com/miekg/dns/udp_other.go6
-rw-r--r--vendor/github.com/miekg/dns/udp_plan9.go34
-rw-r--r--vendor/github.com/miekg/dns/udp_windows.go9
-rw-r--r--vendor/github.com/miekg/dns/update_test.go36
-rw-r--r--vendor/github.com/miekg/dns/zcompress.go119
-rw-r--r--vendor/github.com/miekg/dns/ztypes.go58
-rw-r--r--vendor/github.com/prometheus/client_model/AUTHORS.md13
-rw-r--r--vendor/github.com/prometheus/client_model/CONTRIBUTING.md8
-rw-r--r--vendor/github.com/prometheus/client_model/MAINTAINERS.md1
-rw-r--r--vendor/github.com/prometheus/common/AUTHORS.md11
-rw-r--r--vendor/github.com/prometheus/common/CONTRIBUTING.md6
-rw-r--r--vendor/github.com/prometheus/common/MAINTAINERS.md1
-rw-r--r--vendor/github.com/prometheus/common/model/value.go5
-rw-r--r--vendor/github.com/prometheus/common/model/value_test.go53
-rw-r--r--vendor/github.com/prometheus/procfs/AUTHORS.md21
-rw-r--r--vendor/github.com/prometheus/procfs/CONTRIBUTING.md6
-rw-r--r--vendor/github.com/prometheus/procfs/MAINTAINERS.md1
-rw-r--r--vendor/github.com/prometheus/procfs/README.md1
-rw-r--r--vendor/github.com/prometheus/procfs/buddyinfo.go95
-rw-r--r--vendor/github.com/prometheus/procfs/buddyinfo_test.go64
-rw-r--r--vendor/github.com/prometheus/procfs/fixtures/buddyinfo/short/buddyinfo3
-rw-r--r--vendor/github.com/prometheus/procfs/fixtures/buddyinfo/sizemismatch/buddyinfo3
-rw-r--r--vendor/github.com/prometheus/procfs/fixtures/buddyinfo/valid/buddyinfo3
-rw-r--r--vendor/github.com/prometheus/procfs/fixtures/fs/xfs/stat23
-rw-r--r--vendor/github.com/prometheus/procfs/fs.go13
-rw-r--r--vendor/github.com/prometheus/procfs/fs_test.go13
-rw-r--r--vendor/github.com/prometheus/procfs/ipvs_test.go16
-rw-r--r--vendor/github.com/prometheus/procfs/mdstat_test.go14
-rw-r--r--vendor/github.com/prometheus/procfs/mountstats.go4
-rw-r--r--vendor/github.com/prometheus/procfs/mountstats_test.go9
-rw-r--r--vendor/github.com/prometheus/procfs/xfs/parse.go361
-rw-r--r--vendor/github.com/prometheus/procfs/xfs/parse_test.go446
-rw-r--r--vendor/github.com/prometheus/procfs/xfs/xfs.go158
-rw-r--r--vendor/github.com/spf13/cobra/.travis.yml5
-rw-r--r--vendor/github.com/spf13/cobra/README.md3
-rw-r--r--vendor/github.com/spf13/cobra/command.go62
-rw-r--r--vendor/github.com/spf13/cobra/doc/man_docs.go4
-rw-r--r--vendor/github.com/spf13/cobra/doc/md_docs.go4
-rw-r--r--vendor/github.com/spf13/cobra/doc/util.go2
-rw-r--r--vendor/github.com/spf13/cobra/doc/yaml_docs.go4
-rw-r--r--vendor/github.com/tylerb/graceful/README.md5
-rw-r--r--vendor/github.com/tylerb/graceful/graceful.go1
-rw-r--r--vendor/github.com/xenolf/lego/README.md6
-rw-r--r--vendor/github.com/xenolf/lego/acme/client.go9
-rw-r--r--vendor/github.com/xenolf/lego/acme/client_test.go71
-rw-r--r--vendor/github.com/xenolf/lego/acme/error.go15
-rw-r--r--vendor/github.com/xenolf/lego/acme/http.go10
-rw-r--r--vendor/github.com/xenolf/lego/acme/jws.go93
-rw-r--r--vendor/github.com/xenolf/lego/providers/http/memcached/memcached.go3
-rw-r--r--vendor/golang.org/x/crypto/acme/acme.go119
-rw-r--r--vendor/golang.org/x/crypto/acme/acme_test.go117
-rw-r--r--vendor/golang.org/x/crypto/acme/autocert/autocert_test.go41
-rw-r--r--vendor/golang.org/x/crypto/acme/autocert/renewal_test.go2
-rw-r--r--vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s696
-rw-r--r--vendor/golang.org/x/crypto/blake2b/register.go32
-rw-r--r--vendor/golang.org/x/crypto/blake2s/register.go21
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/asn1.go604
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/asn1_test.go285
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/builder.go255
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/cryptobyte_test.go379
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/example_test.go120
-rw-r--r--vendor/golang.org/x/crypto/cryptobyte/string.go157
-rw-r--r--vendor/golang.org/x/crypto/curve25519/const_amd64.h8
-rw-r--r--vendor/golang.org/x/crypto/curve25519/const_amd64.s4
-rw-r--r--vendor/golang.org/x/crypto/curve25519/freeze_amd64.s4
-rw-r--r--vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s20
-rw-r--r--vendor/golang.org/x/crypto/curve25519/mul_amd64.s4
-rw-r--r--vendor/golang.org/x/crypto/curve25519/square_amd64.s4
-rw-r--r--vendor/golang.org/x/crypto/ocsp/ocsp_test.go6
-rw-r--r--vendor/golang.org/x/crypto/poly1305/poly1305_test.go37
-rw-r--r--vendor/golang.org/x/crypto/poly1305/sum_ref.go1634
-rw-r--r--vendor/golang.org/x/crypto/ssh/agent/client_test.go2
-rw-r--r--vendor/golang.org/x/crypto/ssh/cipher.go62
-rw-r--r--vendor/golang.org/x/crypto/ssh/cipher_test.go68
-rw-r--r--vendor/golang.org/x/crypto/ssh/client_auth_test.go4
-rw-r--r--vendor/golang.org/x/crypto/ssh/common.go2
-rw-r--r--vendor/golang.org/x/crypto/ssh/handshake.go49
-rw-r--r--vendor/golang.org/x/crypto/ssh/handshake_test.go61
-rw-r--r--vendor/golang.org/x/crypto/ssh/mac.go10
-rw-r--r--vendor/golang.org/x/crypto/ssh/mux_test.go3
-rw-r--r--vendor/golang.org/x/crypto/ssh/server.go27
-rw-r--r--vendor/golang.org/x/crypto/ssh/transport.go32
-rw-r--r--vendor/golang.org/x/image/draw/draw.go42
-rw-r--r--vendor/golang.org/x/image/draw/gen.go2
-rw-r--r--vendor/golang.org/x/image/draw/go1_8.go49
-rw-r--r--vendor/golang.org/x/image/draw/go1_9.go57
-rw-r--r--vendor/golang.org/x/image/draw/impl.go96
-rw-r--r--vendor/golang.org/x/image/draw/stdlib_test.go6
-rw-r--r--vendor/golang.org/x/image/font/sfnt/cmap.go269
-rw-r--r--vendor/golang.org/x/image/font/sfnt/data.go68
-rw-r--r--vendor/golang.org/x/image/font/sfnt/example_test.go128
-rw-r--r--vendor/golang.org/x/image/font/sfnt/gen.go321
-rw-r--r--vendor/golang.org/x/image/font/sfnt/postscript.go111
-rw-r--r--vendor/golang.org/x/image/font/sfnt/proprietary_test.go479
-rw-r--r--vendor/golang.org/x/image/font/sfnt/sfnt.go561
-rw-r--r--vendor/golang.org/x/image/font/sfnt/sfnt_test.go370
-rw-r--r--vendor/golang.org/x/image/font/sfnt/truetype.go29
-rw-r--r--vendor/golang.org/x/image/font/testdata/cmapTest.sfd265
-rw-r--r--vendor/golang.org/x/image/font/testdata/cmapTest.ttfbin0 -> 2528 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-down-ab.pngbin21338 -> 21092 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-down-bl.pngbin18581 -> 18169 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-down-cr.pngbin19519 -> 19141 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-down-nn.pngbin21504 -> 21320 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-rotate-ab.pngbin7654 -> 7417 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-rotate-bl.pngbin7653 -> 7421 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-rotate-cr.pngbin7808 -> 7544 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-rotate-nn.pngbin4915 -> 5128 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-up-ab.pngbin9633 -> 9427 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-up-bl.pngbin9639 -> 9427 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-up-cr.pngbin10987 -> 10694 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/go-turns-two-up-nn.pngbin1368 -> 1369 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/tux-rotate-ab.pngbin3237 -> 3340 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/tux-rotate-bl.pngbin3751 -> 3836 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/tux-rotate-cr.pngbin3753 -> 3841 bytes
-rw-r--r--vendor/golang.org/x/image/testdata/tux-rotate-nn.pngbin3055 -> 3159 bytes
-rw-r--r--vendor/golang.org/x/net/bpf/vm_bpf_test.go7
-rw-r--r--vendor/golang.org/x/net/context/context.go30
-rw-r--r--vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go1
-rw-r--r--vendor/golang.org/x/net/context/go17.go4
-rw-r--r--vendor/golang.org/x/net/context/pre_go17.go18
-rw-r--r--vendor/golang.org/x/net/dns/dnsmessage/message.go1418
-rw-r--r--vendor/golang.org/x/net/dns/dnsmessage/message_test.go575
-rw-r--r--vendor/golang.org/x/net/http2/client_conn_pool.go2
-rw-r--r--vendor/golang.org/x/net/http2/databuffer.go146
-rw-r--r--vendor/golang.org/x/net/http2/databuffer_test.go155
-rw-r--r--vendor/golang.org/x/net/http2/fixed_buffer.go60
-rw-r--r--vendor/golang.org/x/net/http2/fixed_buffer_test.go128
-rw-r--r--vendor/golang.org/x/net/http2/frame.go81
-rw-r--r--vendor/golang.org/x/net/http2/frame_test.go91
-rw-r--r--vendor/golang.org/x/net/http2/go18.go6
-rw-r--r--vendor/golang.org/x/net/http2/go18_test.go13
-rw-r--r--vendor/golang.org/x/net/http2/hpack/encode.go29
-rw-r--r--vendor/golang.org/x/net/http2/hpack/encode_test.go70
-rw-r--r--vendor/golang.org/x/net/http2/hpack/hpack.go104
-rw-r--r--vendor/golang.org/x/net/http2/hpack/hpack_test.go146
-rw-r--r--vendor/golang.org/x/net/http2/hpack/tables.go250
-rw-r--r--vendor/golang.org/x/net/http2/hpack/tables_test.go188
-rw-r--r--vendor/golang.org/x/net/http2/pipe.go2
-rw-r--r--vendor/golang.org/x/net/http2/server.go199
-rw-r--r--vendor/golang.org/x/net/http2/server_test.go155
-rw-r--r--vendor/golang.org/x/net/http2/transport.go9
-rw-r--r--vendor/golang.org/x/net/http2/transport_test.go2
-rw-r--r--vendor/golang.org/x/net/internal/netreflect/socket.go4
-rw-r--r--vendor/golang.org/x/net/internal/netreflect/socket_19.go37
-rw-r--r--vendor/golang.org/x/net/internal/netreflect/socket_posix.go1
-rw-r--r--vendor/golang.org/x/net/internal/netreflect/socket_stub.go1
-rw-r--r--vendor/golang.org/x/net/internal/netreflect/socket_test.go3
-rw-r--r--vendor/golang.org/x/net/internal/timeseries/timeseries.go2
-rw-r--r--vendor/golang.org/x/net/ipv4/doc.go12
-rw-r--r--vendor/golang.org/x/net/ipv4/endpoint.go8
-rw-r--r--vendor/golang.org/x/net/ipv4/go19_test.go11
-rw-r--r--vendor/golang.org/x/net/ipv4/ipv4_test.go22
-rw-r--r--vendor/golang.org/x/net/ipv4/packet.go6
-rw-r--r--vendor/golang.org/x/net/ipv4/payload_cmsg.go8
-rw-r--r--vendor/golang.org/x/net/ipv4/payload_nocmsg.go8
-rw-r--r--vendor/golang.org/x/net/ipv6/control.go2
-rw-r--r--vendor/golang.org/x/net/ipv6/dgramopt_posix.go4
-rw-r--r--vendor/golang.org/x/net/ipv6/dgramopt_stub.go4
-rw-r--r--vendor/golang.org/x/net/ipv6/doc.go12
-rw-r--r--vendor/golang.org/x/net/ipv6/endpoint.go4
-rw-r--r--vendor/golang.org/x/net/ipv6/go19_test.go11
-rw-r--r--vendor/golang.org/x/net/ipv6/ipv6_test.go22
-rw-r--r--vendor/golang.org/x/net/ipv6/payload_cmsg.go8
-rw-r--r--vendor/golang.org/x/net/ipv6/payload_nocmsg.go8
-rw-r--r--vendor/golang.org/x/net/lif/address.go4
-rw-r--r--vendor/golang.org/x/net/lif/binary.go49
-rw-r--r--vendor/golang.org/x/net/lif/link.go12
-rw-r--r--vendor/golang.org/x/net/lif/sys.go21
-rw-r--r--vendor/golang.org/x/net/lif/sys_solaris_amd64.s3
-rw-r--r--vendor/golang.org/x/net/lif/syscall.go5
-rw-r--r--vendor/golang.org/x/net/proxy/socks5.go57
-rw-r--r--vendor/golang.org/x/net/publicsuffix/table.go17901
-rw-r--r--vendor/golang.org/x/net/publicsuffix/table_test.go559
-rw-r--r--vendor/golang.org/x/net/route/address.go152
-rw-r--r--vendor/golang.org/x/net/route/binary.go2
-rw-r--r--vendor/golang.org/x/net/route/defs_darwin.go8
-rw-r--r--vendor/golang.org/x/net/route/defs_dragonfly.go8
-rw-r--r--vendor/golang.org/x/net/route/defs_freebsd.go8
-rw-r--r--vendor/golang.org/x/net/route/defs_netbsd.go8
-rw-r--r--vendor/golang.org/x/net/route/defs_openbsd.go12
-rw-r--r--vendor/golang.org/x/net/route/message.go8
-rw-r--r--vendor/golang.org/x/net/route/message_test.go129
-rw-r--r--vendor/golang.org/x/net/route/route.go59
-rw-r--r--vendor/golang.org/x/net/route/route_classic.go36
-rw-r--r--vendor/golang.org/x/net/route/route_openbsd.go35
-rw-r--r--vendor/golang.org/x/net/route/sys.go7
-rw-r--r--vendor/golang.org/x/net/route/sys_darwin.go45
-rw-r--r--vendor/golang.org/x/net/route/sys_dragonfly.go39
-rw-r--r--vendor/golang.org/x/net/route/sys_freebsd.go39
-rw-r--r--vendor/golang.org/x/net/route/sys_netbsd.go34
-rw-r--r--vendor/golang.org/x/net/route/sys_openbsd.go39
-rw-r--r--vendor/golang.org/x/net/route/syscall.go5
-rw-r--r--vendor/golang.org/x/net/route/syscall.s8
-rw-r--r--vendor/golang.org/x/net/route/zsys_darwin.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_dragonfly.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_freebsd_386.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_freebsd_amd64.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_freebsd_arm.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_netbsd.go6
-rw-r--r--vendor/golang.org/x/net/route/zsys_openbsd.go10
-rw-r--r--vendor/golang.org/x/net/webdav/internal/xml/marshal.go8
-rw-r--r--vendor/golang.org/x/net/webdav/internal/xml/read.go8
-rw-r--r--vendor/golang.org/x/net/webdav/internal/xml/xml.go6
-rw-r--r--vendor/golang.org/x/sys/unix/asm.s10
-rwxr-xr-xvendor/golang.org/x/sys/unix/mkall.sh4
-rwxr-xr-xvendor/golang.org/x/sys/unix/mkerrors.sh18
-rwxr-xr-xvendor/golang.org/x/sys/unix/mksyscall.pl25
-rwxr-xr-xvendor/golang.org/x/sys/unix/mksyscall_solaris.pl23
-rwxr-xr-xvendor/golang.org/x/sys/unix/mksysnum_linux.pl12
-rw-r--r--vendor/golang.org/x/sys/unix/syscall.go7
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_darwin.go2
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_dragonfly.go1
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_freebsd.go1
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux.go150
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go2
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_s390x.go1
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_openbsd.go1
-rw-r--r--vendor/golang.org/x/sys/unix/types_linux.go8
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_386.go49
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go56
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_arm.go53
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go51
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_mips.go55
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go48
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go48
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go46
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go51
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go48
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go47
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go46
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go37
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go38
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go51
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go37
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go35
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go52
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go52
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go52
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_386.go60
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go59
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go58
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go60
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go60
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go61
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go32
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go32
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go32
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go34
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go34
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go41
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_386.go37
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go22
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go35
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go15
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go25
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go9
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go9
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go25
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go11
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go18
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go5
-rw-r--r--vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go2
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_386.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go18
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go18
-rw-r--r--vendor/gopkg.in/gomail.v2/.travis.yml8
-rw-r--r--vendor/gopkg.in/gomail.v2/CHANGELOG.md20
-rw-r--r--vendor/gopkg.in/gomail.v2/CONTRIBUTING.md20
-rw-r--r--vendor/gopkg.in/gomail.v2/LICENSE20
-rw-r--r--vendor/gopkg.in/gomail.v2/README.md97
-rw-r--r--vendor/gopkg.in/gomail.v2/auth.go67
-rw-r--r--vendor/gopkg.in/gomail.v2/auth_test.go156
-rw-r--r--vendor/gopkg.in/gomail.v2/doc.go5
-rw-r--r--vendor/gopkg.in/gomail.v2/example_test.go215
-rw-r--r--vendor/gopkg.in/gomail.v2/message.go302
-rw-r--r--vendor/gopkg.in/gomail.v2/message_test.go630
-rw-r--r--vendor/gopkg.in/gomail.v2/mime.go19
-rw-r--r--vendor/gopkg.in/gomail.v2/mime_go14.go16
-rw-r--r--vendor/gopkg.in/gomail.v2/send.go117
-rw-r--r--vendor/gopkg.in/gomail.v2/send_test.go80
-rw-r--r--vendor/gopkg.in/gomail.v2/smtp.go175
-rw-r--r--vendor/gopkg.in/gomail.v2/smtp_test.go254
-rw-r--r--vendor/gopkg.in/gomail.v2/writeto.go242
-rw-r--r--vendor/gopkg.in/yaml.v2/scannerc.go2
-rw-r--r--webapp/.eslintrc.json11
-rw-r--r--webapp/actions/channel_actions.jsx1
-rw-r--r--webapp/actions/post_actions.jsx36
-rw-r--r--webapp/client/client.jsx27
-rw-r--r--webapp/components/admin_console/password_settings.jsx16
-rw-r--r--webapp/components/admin_console/reset_password_modal.jsx2
-rw-r--r--webapp/components/audio_video_preview.jsx4
-rw-r--r--webapp/components/channel_header.jsx60
-rw-r--r--webapp/components/create_team/components/display_name.jsx9
-rw-r--r--webapp/components/integrations/components/confirm_integration.jsx11
-rw-r--r--webapp/components/login/login_controller.jsx1
-rw-r--r--webapp/components/navbar.jsx38
-rw-r--r--webapp/components/needs_team.jsx16
-rw-r--r--webapp/components/new_channel_modal.jsx6
-rw-r--r--webapp/components/popover_list_members.jsx14
-rw-r--r--webapp/components/post_view/components/date_separator.jsx27
-rw-r--r--webapp/components/post_view/components/post_attachment.jsx3
-rw-r--r--webapp/components/post_view/components/post_attachment_opengraph.jsx23
-rw-r--r--webapp/components/post_view/components/post_image.jsx2
-rw-r--r--webapp/components/post_view/components/post_info.jsx61
-rw-r--r--webapp/components/post_view/components/post_time.jsx7
-rw-r--r--webapp/components/profile_picture.jsx2
-rw-r--r--webapp/components/profile_popover.jsx1
-rw-r--r--webapp/components/rhs_comment.jsx66
-rw-r--r--webapp/components/rhs_root_post.jsx66
-rw-r--r--webapp/components/rhs_thread.jsx90
-rw-r--r--webapp/components/search_bar.jsx5
-rw-r--r--webapp/components/search_results.jsx31
-rw-r--r--webapp/components/search_results_header.jsx14
-rw-r--r--webapp/components/search_results_item.jsx13
-rw-r--r--webapp/components/searchable_user_list.jsx12
-rw-r--r--webapp/components/setting_item_max.jsx24
-rw-r--r--webapp/components/setting_item_min.jsx8
-rw-r--r--webapp/components/setting_picture.jsx52
-rw-r--r--webapp/components/sidebar.jsx14
-rw-r--r--webapp/components/sidebar_header_dropdown.jsx2
-rw-r--r--webapp/components/sidebar_right.jsx23
-rw-r--r--webapp/components/team_general_tab.jsx9
-rw-r--r--webapp/components/user_settings/desktop_notification_settings.jsx9
-rw-r--r--webapp/components/user_settings/email_notification_setting.jsx4
-rw-r--r--webapp/components/user_settings/user_settings_general.jsx21
-rw-r--r--webapp/components/user_settings/user_settings_notifications.jsx18
-rw-r--r--webapp/components/user_settings/user_settings_security.jsx3
-rw-r--r--webapp/components/view_image.jsx12
-rw-r--r--webapp/i18n/en.json16
-rw-r--r--webapp/package.json64
-rw-r--r--webapp/sass/components/_modal.scss2
-rw-r--r--webapp/sass/components/_popover.scss9
-rw-r--r--webapp/sass/components/_tooltip.scss6
-rw-r--r--webapp/sass/layout/_content.scss28
-rw-r--r--webapp/sass/layout/_forms.scss5
-rw-r--r--webapp/sass/layout/_headers.scss29
-rw-r--r--webapp/sass/layout/_post-right.scss9
-rw-r--r--webapp/sass/layout/_post.scss20
-rw-r--r--webapp/sass/layout/_webhooks.scss16
-rw-r--r--webapp/sass/responsive/_desktop.scss17
-rw-r--r--webapp/sass/responsive/_mobile.scss8
-rw-r--r--webapp/sass/responsive/_tablet.scss35
-rw-r--r--webapp/stores/post_store.jsx57
-rw-r--r--webapp/stores/search_store.jsx10
-rw-r--r--webapp/tests/formatting_imgs.test.jsx55
-rw-r--r--webapp/utils/async_client.jsx40
-rw-r--r--webapp/utils/constants.jsx5
-rw-r--r--webapp/utils/markdown.jsx1
-rw-r--r--webapp/utils/utils.jsx17
-rw-r--r--webapp/webpack.config.js18
659 files changed, 34302 insertions, 53752 deletions
diff --git a/.gitignore b/.gitignore
index f412f0342..b9775bad9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,6 +77,7 @@ enterprise
cover.out
ecover.out
+*.test
.agignore
.ctags
diff --git a/Makefile b/Makefile
index af4302642..269734682 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,19 @@ DIST_PATH=$(DIST_ROOT)/mattermost
# Tests
TESTS=.
+# Packages lists
+TE_PACKAGES=$(shell go list ./... | grep -v vendor)
+TE_PACKAGES_COMMA=$(shell echo $(TE_PACKAGES) | tr ' ' ',')
+
+EE_PACKAGES=$(shell go list ./enterprise/... | grep -v vendor | tail -n +2)
+EE_PACKAGES_COMMA=$(shell echo $(EE_PACKAGES) | tr ' ' ',')
+
+ifeq ($(BUILD_ENTERPRISE_READY),true)
+ALL_PACKAGES_COMMA=$(TE_PACKAGES_COMMA),$(EE_PACKAGES_COMMA)
+else
+ALL_PACKAGES_COMMA=$(TE_PACKAGES_COMMA)
+endif
+
all: dist
dist: | check-style test package
@@ -196,65 +209,48 @@ check-server-style: govet
check-style: check-client-style check-server-style
-test-server: start-docker prepare-enterprise
- @echo Running server tests
+test-te: start-docker prepare-enterprise
+ @echo Testing TE
- rm -f cover.out
- echo "mode: count" > cover.out
-
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=1050s -covermode=count -coverprofile=capi.out ./api || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=650s -covermode=count -coverprofile=capi4.out ./api4 || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=60s -covermode=count -coverprofile=capp.out ./app || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=60s -covermode=count -coverprofile=cmodel.out ./model || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s -covermode=count -coverprofile=cstore.out ./store || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s -covermode=count -coverprofile=cutils.out ./utils || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s -covermode=count -coverprofile=cweb.out ./web || exit 1
-
- tail -n +2 capi.out >> cover.out
- tail -n +2 capi4.out >> cover.out
- tail -n +2 capp.out >> cover.out
- tail -n +2 cmodel.out >> cover.out
- tail -n +2 cstore.out >> cover.out
- tail -n +2 cutils.out >> cover.out
- tail -n +2 cweb.out >> cover.out
- rm -f capi.out capi4.out capp.out cmodel.out cstore.out cutils.out cweb.out
+ @echo "mode: count" > cover.out
+
+ @echo "Packages to test: "$(TE_PACKAGES)
+
+ @for package in $(TE_PACKAGES); do \
+ echo "Testing "$$package; \
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=2000s -covermode=count -coverprofile=cprofile.out -coverpkg=$(ALL_PACKAGES_COMMA) $$package || exit 1; \
+ if [ -f cprofile.out ]; then \
+ tail -n +2 cprofile.out >> cover.out; \
+ rm cprofile.out; \
+ fi; \
+ done
+
+test-ee: start-docker prepare-enterprise
+ @echo Testing EE
ifeq ($(BUILD_ENTERPRISE_READY),true)
- @echo Running Enterprise tests
+ @echo "Packages to test: "$(EE_PACKAGES)
+
+ for package in $(EE_PACKAGES); do \
+ echo "Testing "$$package; \
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -coverpkg=$(ALL_PACKAGES_COMMA) -c $$package; \
+ if [ -f $$(basename $$package).test ]; then \
+ echo "Testing "$$package; \
+ ./$$(basename $$package).test -test.v -test.timeout=2000s -test.coverprofile=cprofile.out || exit 1; \
+ if [ -f cprofile.out ]; then \
+ tail -n +2 cprofile.out >> cover.out; \
+ rm cprofile.out; \
+ fi; \
+ rm -r $$(basename $$package).test; \
+ fi; \
+ done
- rm -f ecover.out
- echo "mode: count" > ecover.out
-
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s -test.coverprofile=cldap.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/compliance && ./compliance.test -test.v -test.timeout=120s -test.coverprofile=ccompliance.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/mfa && ./mfa.test -test.v -test.timeout=120s -test.coverprofile=cmfa.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/emoji && ./emoji.test -test.v -test.timeout=120s -test.coverprofile=cemoji.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/saml && ./saml.test -test.v -test.timeout=60s -test.coverprofile=csaml.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/cluster && ./cluster.test -test.v -test.timeout=60s -test.coverprofile=ccluster.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/metrics && ./metrics.test -test.v -test.timeout=60s -test.coverprofile=cmetrics.out || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/account_migration && ./account_migration.test -test.v -test.timeout=60s -test.coverprofile=caccount_migration.out || exit 1
-
- tail -n +2 cldap.out >> ecover.out
- tail -n +2 ccompliance.out >> ecover.out
- tail -n +2 cmfa.out >> ecover.out
- tail -n +2 cemoji.out >> ecover.out
- tail -n +2 csaml.out >> ecover.out
- tail -n +2 ccluster.out >> ecover.out
- tail -n +2 cmetrics.out >> ecover.out
- tail -n +2 caccount_migration.out >> ecover.out
- rm -f cldap.out ccompliance.out cmfa.out cemoji.out csaml.out ccluster.out cmetrics.out caccount_migration.out
- rm -r ldap.test
- rm -r compliance.test
- rm -r mfa.test
- rm -r emoji.test
- rm -r saml.test
- rm -r cluster.test
- rm -r metrics.test
- rm -r account_migration.test
rm -f config/*.crt
rm -f config/*.key
endif
+test-server: test-te test-ee
+
internal-test-web-client: start-docker prepare-enterprise
$(GO) run $(GOFLAGS) ./cmd/platform/*go test web_client_tests
@@ -458,6 +454,7 @@ clean: stop-docker
rm -f ecover.out
rm -f *.out
rm -f *.test
+ rm -f imports.go
nuke: clean clean-docker
@echo BOOM
diff --git a/NOTICE.txt b/NOTICE.txt
index 95bce5e38..4448119ed 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -3554,201 +3554,6 @@ the property of their respective owners.
---
-This product contains a modified portion of 'goamz', which enables Go programs to interact with Amazon Web Services.
-
-* HOMEPAGE:
- * https://github.com/goamz/goamz
-
-* LICENSE:
-
-This software is licensed under the LGPLv3, included below.
-
-As a special exception to the GNU Lesser General Public License version 3
-("LGPL3"), the copyright holders of this Library give you permission to
-convey to a third party a Combined Work that links statically or dynamically
-to this Library without providing any Minimal Corresponding Source or
-Minimal Application Code as set out in 4d or providing the installation
-information set out in section 4e, provided that you comply with the other
-provisions of LGPL3 and provided that you meet, for the Application the
-terms and conditions of the license(s) which apply to the Application.
-
-Except as stated in this special exception, the provisions of LGPL3 will
-continue to comply in full to this Library. If you modify this Library, you
-may apply this exception to your version of this Library, but you are not
-obliged to do so. If you do not wish to do so, delete this exception
-statement from your version. This exception does not (and cannot) modify any
-license terms which apply to the Application, with which you must still
-comply.
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
-
----
-
This product contains a modified portion of 'pdfjs-dist', is a Portable Document Format (PDF) library that is built with HTML5 built by mozilla.
* HOMEPAGE:
diff --git a/api/admin.go b/api/admin.go
index 3aa1dc67d..59890c739 100644
--- a/api/admin.go
+++ b/api/admin.go
@@ -46,7 +46,7 @@ func InitAdmin() {
}
func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
- lines, err := app.GetLogs()
+ lines, err := app.GetLogs(0, 100000)
if err != nil {
c.Err = err
return
@@ -142,7 +142,7 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
}
func getComplianceReports(c *Context, w http.ResponseWriter, r *http.Request) {
- crs, err := app.GetComplianceReports()
+ crs, err := app.GetComplianceReports(0, 10000)
if err != nil {
c.Err = err
return
@@ -230,12 +230,6 @@ func getAnalytics(c *Context, w http.ResponseWriter, r *http.Request) {
}
func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
- if len(utils.Cfg.FileSettings.DriverName) == 0 {
- c.Err = model.NewLocAppError("uploadBrandImage", "api.admin.upload_brand_image.storage.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
- return
- }
-
if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize {
c.Err = model.NewLocAppError("uploadBrandImage", "api.admin.upload_brand_image.too_large.app_error", nil, "")
c.Err.StatusCode = http.StatusRequestEntityTooLarge
@@ -383,7 +377,7 @@ func addCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
fileData := fileArray[0]
- if err := app.AddSamlCertificate(fileData); err != nil {
+ if err := app.WriteSamlFile(fileData); err != nil {
c.Err = err
return
}
@@ -393,7 +387,7 @@ func addCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
func removeCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
- if err := app.RemoveSamlCertificate(props["filename"]); err != nil {
+ if err := app.RemoveSamlFile(props["filename"]); err != nil {
c.Err = err
return
}
@@ -403,7 +397,13 @@ func removeCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
func samlCertificateStatus(c *Context, w http.ResponseWriter, r *http.Request) {
status := app.GetSamlCertificateStatus()
- w.Write([]byte(model.StringInterfaceToJson(status)))
+
+ statusMap := map[string]interface{}{}
+ statusMap["IdpCertificateFile"] = status.IdpCertificateFile
+ statusMap["PrivateKeyFile"] = status.PrivateKeyFile
+ statusMap["PublicCertificateFile"] = status.PublicCertificateFile
+
+ w.Write([]byte(model.StringInterfaceToJson(statusMap)))
}
func getRecentlyActiveUsers(c *Context, w http.ResponseWriter, r *http.Request) {
diff --git a/api/admin_test.go b/api/admin_test.go
index 801ad8f21..dc569620e 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -225,7 +225,7 @@ func TestGetTeamAnalyticsStandard(t *testing.T) {
t.Fatal()
}
- if rows[0].Value != 3 {
+ if rows[0].Value != 4 {
t.Log(rows.ToJson())
t.Fatal()
}
@@ -245,7 +245,7 @@ func TestGetTeamAnalyticsStandard(t *testing.T) {
t.Fatal()
}
- if rows[2].Value != 5 {
+ if rows[2].Value != 6 {
t.Log(rows.ToJson())
t.Fatal()
}
diff --git a/api/apitestlib.go b/api/apitestlib.go
index ea0d12d4a..89a65518a 100644
--- a/api/apitestlib.go
+++ b/api/apitestlib.go
@@ -6,6 +6,7 @@ package api
import (
"time"
+ "github.com/mattermost/platform/api4"
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
@@ -21,6 +22,7 @@ type TestHelper struct {
BasicUser2 *model.User
BasicChannel *model.Channel
BasicPost *model.Post
+ PinnedPost *model.Post
SystemAdminClient *model.Client
SystemAdminTeam *model.Team
@@ -42,6 +44,7 @@ func SetupEnterprise() *TestHelper {
InitRouter()
app.StartServer()
utils.InitHTML()
+ api4.InitApi(false)
InitApi()
utils.EnableDebugLogForTest()
app.Srv.Store.MarkSystemRanUnitTests()
@@ -91,6 +94,9 @@ func (me *TestHelper) InitBasic() *TestHelper {
me.BasicChannel = me.CreateChannel(me.BasicClient, me.BasicTeam)
me.BasicPost = me.CreatePost(me.BasicClient, me.BasicChannel)
+ pinnedPostChannel := me.CreateChannel(me.BasicClient, me.BasicTeam)
+ me.PinnedPost = me.CreatePinnedPost(me.BasicClient, pinnedPostChannel)
+
return me
}
@@ -265,6 +271,21 @@ func (me *TestHelper) CreatePost(client *model.Client, channel *model.Channel) *
return r
}
+func (me *TestHelper) CreatePinnedPost(client *model.Client, channel *model.Channel) *model.Post {
+ id := model.NewId()
+
+ post := &model.Post{
+ ChannelId: channel.Id,
+ Message: "message_" + id,
+ IsPinned: true,
+ }
+
+ utils.DisableDebugLogForTest()
+ r := client.Must(client.CreatePost(post)).Data.(*model.Post)
+ utils.EnableDebugLogForTest()
+ return r
+}
+
func (me *TestHelper) LoginBasic() {
utils.DisableDebugLogForTest()
me.BasicClient.Must(me.BasicClient.Login(me.BasicUser.Email, me.BasicUser.Password))
diff --git a/api/channel.go b/api/channel.go
index 062f582a7..d408e9478 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -39,6 +39,7 @@ func InitChannel() {
BaseRoutes.NeedChannel.Handle("/stats", ApiUserRequired(getChannelStats)).Methods("GET")
BaseRoutes.NeedChannel.Handle("/members/{user_id:[A-Za-z0-9]+}", ApiUserRequired(getChannelMember)).Methods("GET")
BaseRoutes.NeedChannel.Handle("/members/ids", ApiUserRequired(getChannelMembersByIds)).Methods("POST")
+ BaseRoutes.NeedChannel.Handle("/pinned", ApiUserRequired(getPinnedPosts)).Methods("GET")
BaseRoutes.NeedChannel.Handle("/join", ApiUserRequired(join)).Methods("POST")
BaseRoutes.NeedChannel.Handle("/leave", ApiUserRequired(leave)).Methods("POST")
BaseRoutes.NeedChannel.Handle("/delete", ApiUserRequired(deleteChannel)).Methods("POST")
@@ -598,6 +599,21 @@ func getMyChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func getPinnedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
+ params := mux.Vars(r)
+ channelId := params["channel_id"]
+ posts := &model.PostList{}
+
+ if result := <-app.Srv.Store.Channel().GetPinnedPosts(channelId); result.Err != nil {
+ c.Err = result.Err
+ return
+ } else {
+ posts = result.Data.(*model.PostList)
+ }
+
+ w.Write([]byte(posts.ToJson()))
+}
+
func addMember(c *Context, w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id := params["channel_id"]
diff --git a/api/channel_test.go b/api/channel_test.go
index 93c79d416..08136bc35 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -926,8 +926,8 @@ func TestGetMoreChannelsPage(t *testing.T) {
} else {
channels := r.Data.(*model.ChannelList)
- // 1 for BasicChannel, 2 for open channels created above
- if len(*channels) != 3 {
+ // 1 for BasicChannel, 1 for PinnedPostChannel, 2 for open channels created above
+ if len(*channels) != 4 {
t.Fatal("wrong length")
}
@@ -990,11 +990,11 @@ func TestGetChannelCounts(t *testing.T) {
} else {
counts := result.Data.(*model.ChannelCounts)
- if len(counts.Counts) != 5 {
+ if len(counts.Counts) != 6 {
t.Fatal("wrong number of channel counts")
}
- if len(counts.UpdateTimes) != 5 {
+ if len(counts.UpdateTimes) != 6 {
t.Fatal("wrong number of channel update times")
}
@@ -1024,8 +1024,8 @@ func TestGetMyChannelMembers(t *testing.T) {
} else {
members := result.Data.(*model.ChannelMembers)
- // town-square, off-topic, basic test channel, channel1, channel2
- if len(*members) != 5 {
+ // town-square, off-topic, basic test channel, pinned post channel, channel1, channel2
+ if len(*members) != 6 {
t.Fatal("wrong number of members", len(*members))
}
}
@@ -2117,3 +2117,24 @@ func TestUpdateChannelRoles(t *testing.T) {
t.Fatal("Channel member should not be able to promote itself to channel admin:", meta)
}
}
+
+func TestGetPinnedPosts(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+
+ post1 := th.BasicPost
+ r1 := Client.Must(Client.GetPinnedPosts(post1.ChannelId)).Data.(*model.PostList)
+ if len(r1.Order) != 0 {
+ t.Fatal("should not have gotten a pinned post")
+ }
+
+ post2 := th.PinnedPost
+ r2 := Client.Must(Client.GetPinnedPosts(post2.ChannelId)).Data.(*model.PostList)
+ if len(r2.Order) == 0 {
+ t.Fatal("should have gotten a pinned post")
+ }
+
+ if _, ok := r2.Posts[post2.Id]; !ok {
+ t.Fatal("missing pinned post")
+ }
+}
diff --git a/api/command.go b/api/command.go
index 9acc3485c..2248caf76 100644
--- a/api/command.go
+++ b/api/command.go
@@ -4,11 +4,8 @@
package api
import (
- "crypto/tls"
- "fmt"
"io/ioutil"
"net/http"
- "net/url"
"strings"
l4g "github.com/alecthomas/log4go"
@@ -18,27 +15,6 @@ import (
"github.com/mattermost/platform/utils"
)
-type CommandProvider interface {
- GetTrigger() string
- GetCommand(c *Context) *model.Command
- DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse
-}
-
-var commandProviders = make(map[string]CommandProvider)
-
-func RegisterCommandProvider(newProvider CommandProvider) {
- commandProviders[newProvider.GetTrigger()] = newProvider
-}
-
-func GetCommandProvider(name string) CommandProvider {
- provider, ok := commandProviders[name]
- if ok {
- return provider
- }
-
- return nil
-}
-
func InitCommand() {
l4g.Debug(utils.T("api.command.init.debug"))
@@ -58,31 +34,10 @@ func InitCommand() {
}
func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
- commands := make([]*model.Command, 0, 32)
- seen := make(map[string]bool)
- for _, value := range commandProviders {
- cpy := *value.GetCommand(c)
- if cpy.AutoComplete && !seen[cpy.Id] {
- cpy.Sanitize()
- seen[cpy.Trigger] = true
- commands = append(commands, &cpy)
- }
- }
-
- if *utils.Cfg.ServiceSettings.EnableCommands {
- if result := <-app.Srv.Store.Command().GetByTeam(c.TeamId); result.Err != nil {
- c.Err = result.Err
- return
- } else {
- teamCmds := result.Data.([]*model.Command)
- for _, cmd := range teamCmds {
- if cmd.AutoComplete && !seen[cmd.Id] {
- cmd.Sanitize()
- seen[cmd.Trigger] = true
- commands = append(commands, cmd)
- }
- }
- }
+ commands, err := app.ListCommands(c.TeamId, c.T)
+ if err != nil {
+ c.Err = err
+ return
}
w.Write([]byte(model.CommandListToJson(commands)))
@@ -90,9 +45,13 @@ func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
commandArgs := model.CommandArgsFromJson(r.Body)
+ if commandArgs == nil {
+ c.SetInvalidParam("executeCommand", "command_args")
+ return
+ }
if len(commandArgs.Command) <= 1 || strings.Index(commandArgs.Command, "/") != 0 {
- c.Err = model.NewLocAppError("executeCommand", "api.command.execute_command.start.app_error", nil, "")
+ c.Err = model.NewAppError("executeCommand", "api.command.execute_command.start.app_error", nil, "", http.StatusBadRequest)
return
}
@@ -103,232 +62,50 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
- parts := strings.Split(commandArgs.Command, " ")
- trigger := parts[0][1:]
- trigger = strings.ToLower(trigger)
- message := strings.Join(parts[1:], " ")
- provider := GetCommandProvider(trigger)
-
- if provider != nil {
- response := provider.DoCommand(c, commandArgs, message)
- handleResponse(c, w, response, commandArgs, provider.GetCommand(c), true)
- return
- } else {
-
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("executeCommand", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
- return
- }
-
- chanChan := app.Srv.Store.Channel().Get(commandArgs.ChannelId, true)
- teamChan := app.Srv.Store.Team().Get(c.TeamId)
- userChan := app.Srv.Store.User().Get(c.Session.UserId)
-
- if result := <-app.Srv.Store.Command().GetByTeam(c.TeamId); result.Err != nil {
- c.Err = result.Err
- return
- } else {
-
- var team *model.Team
- if tr := <-teamChan; tr.Err != nil {
- c.Err = tr.Err
- return
- } else {
- team = tr.Data.(*model.Team)
- }
-
- var user *model.User
- if ur := <-userChan; ur.Err != nil {
- c.Err = ur.Err
- return
- } else {
- user = ur.Data.(*model.User)
- }
-
- var channel *model.Channel
- if cr := <-chanChan; cr.Err != nil {
- c.Err = cr.Err
- return
- } else {
- channel = cr.Data.(*model.Channel)
- }
-
- teamCmds := result.Data.([]*model.Command)
- for _, cmd := range teamCmds {
- if trigger == cmd.Trigger {
- l4g.Debug(fmt.Sprintf(utils.T("api.command.execute_command.debug"), trigger, c.Session.UserId))
-
- p := url.Values{}
- p.Set("token", cmd.Token)
-
- p.Set("team_id", cmd.TeamId)
- p.Set("team_domain", team.Name)
-
- p.Set("channel_id", commandArgs.ChannelId)
- p.Set("channel_name", channel.Name)
-
- p.Set("user_id", c.Session.UserId)
- p.Set("user_name", user.Username)
-
- p.Set("command", "/"+trigger)
- p.Set("text", message)
- p.Set("response_url", "not supported yet")
-
- method := "POST"
- if cmd.Method == model.COMMAND_METHOD_GET {
- method = "GET"
- }
-
- tr := &http.Transport{
- TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections},
- }
- client := &http.Client{Transport: tr}
-
- req, _ := http.NewRequest(method, cmd.URL, strings.NewReader(p.Encode()))
- req.Header.Set("Accept", "application/json")
- if cmd.Method == model.COMMAND_METHOD_POST {
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- }
-
- if resp, err := client.Do(req); err != nil {
- c.Err = model.NewLocAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": trigger}, err.Error())
- } else {
- if resp.StatusCode == http.StatusOK {
- response := model.CommandResponseFromJson(resp.Body)
- if response == nil {
- c.Err = model.NewLocAppError("command", "api.command.execute_command.failed_empty.app_error", map[string]interface{}{"Trigger": trigger}, "")
- } else {
- handleResponse(c, w, response, commandArgs, cmd, false)
- }
- } else {
- defer resp.Body.Close()
- body, _ := ioutil.ReadAll(resp.Body)
- c.Err = model.NewLocAppError("command", "api.command.execute_command.failed_resp.app_error", map[string]interface{}{"Trigger": trigger, "Status": resp.Status}, string(body))
- }
- }
-
- return
- }
- }
-
- }
- }
-
- c.Err = model.NewLocAppError("command", "api.command.execute_command.not_found.app_error", map[string]interface{}{"Trigger": trigger}, "")
-}
+ commandArgs.TeamId = c.TeamId
+ commandArgs.UserId = c.Session.UserId
+ commandArgs.T = c.T
+ commandArgs.Session = c.Session
+ commandArgs.SiteURL = c.GetSiteURL()
-func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandResponse, commandArgs *model.CommandArgs, cmd *model.Command, builtIn bool) {
- if c.Err != nil {
+ response, err := app.ExecuteCommand(commandArgs)
+ if err != nil {
+ c.Err = err
return
}
- post := &model.Post{}
- post.ChannelId = commandArgs.ChannelId
- post.RootId = commandArgs.RootId
- post.ParentId = commandArgs.ParentId
- post.UserId = c.Session.UserId
-
- if !builtIn {
- post.AddProp("from_webhook", "true")
- }
-
- if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
- if len(cmd.Username) != 0 {
- post.AddProp("override_username", cmd.Username)
- } else if len(response.Username) != 0 {
- post.AddProp("override_username", response.Username)
- }
- }
-
- if utils.Cfg.ServiceSettings.EnablePostIconOverride {
- if len(cmd.IconURL) != 0 {
- post.AddProp("override_icon_url", cmd.IconURL)
- } else if len(response.IconURL) != 0 {
- post.AddProp("override_icon_url", response.IconURL)
- } else {
- post.AddProp("override_icon_url", "")
- }
- }
-
- if _, err := app.CreateCommandPost(post, c.TeamId, response, c.GetSiteURL()); err != nil {
- l4g.Error(err.Error())
- }
-
w.Write([]byte(response.ToJson()))
}
func createCommand(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("createCommand", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
- return
- }
+ cmd := model.CommandFromJson(r.Body)
- if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
- c.Err = model.NewLocAppError("createCommand", "api.command.admin_only.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ if cmd == nil {
+ c.SetInvalidParam("createCommand", "command")
return
}
c.LogAudit("attempt")
- cmd := model.CommandFromJson(r.Body)
-
- if cmd == nil {
- c.SetInvalidParam("createCommand", "command")
+ if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SLASH_COMMANDS)
return
}
- cmd.Trigger = strings.ToLower(cmd.Trigger)
cmd.CreatorId = c.Session.UserId
cmd.TeamId = c.TeamId
- if result := <-app.Srv.Store.Command().GetByTeam(c.TeamId); result.Err != nil {
- c.Err = result.Err
+ rcmd, err := app.CreateCommand(cmd)
+ if err != nil {
+ c.Err = err
return
- } else {
- teamCmds := result.Data.([]*model.Command)
- for _, existingCommand := range teamCmds {
- if cmd.Trigger == existingCommand.Trigger {
- c.Err = model.NewLocAppError("createCommand", "api.command.duplicate_trigger.app_error", nil, "")
- return
- }
- }
- for _, builtInProvider := range commandProviders {
- builtInCommand := *builtInProvider.GetCommand(c)
- if cmd.Trigger == builtInCommand.Trigger {
- c.Err = model.NewLocAppError("createCommand", "api.command.duplicate_trigger.app_error", nil, "")
- return
- }
- }
}
- if result := <-app.Srv.Store.Command().Save(cmd); result.Err != nil {
- c.Err = result.Err
- return
- } else {
- c.LogAudit("success")
- rcmd := result.Data.(*model.Command)
- w.Write([]byte(rcmd.ToJson()))
- }
+ c.LogAudit("success")
+ w.Write([]byte(rcmd.ToJson()))
}
func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("updateCommand", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
- return
- }
-
- if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
- c.Err = model.NewLocAppError("updateCommand", "api.command.admin_only.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
- return
- }
-
- c.LogAudit("attempt")
-
cmd := model.CommandFromJson(r.Body)
if cmd == nil {
@@ -336,80 +113,58 @@ func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- cmd.Trigger = strings.ToLower(cmd.Trigger)
+ c.LogAudit("attempt")
- var oldCmd *model.Command
- if result := <-app.Srv.Store.Command().Get(cmd.Id); result.Err != nil {
- c.Err = result.Err
+ oldCmd, err := app.GetCommand(cmd.Id)
+ if err != nil {
+ c.Err = err
return
- } else {
- oldCmd = result.Data.(*model.Command)
-
- if c.Session.UserId != oldCmd.CreatorId && !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS) {
- c.LogAudit("fail - inappropriate permissions")
- c.Err = model.NewLocAppError("updateCommand", "api.command.update.app_error", nil, "user_id="+c.Session.UserId)
- return
- }
-
- if c.TeamId != oldCmd.TeamId {
- c.Err = model.NewLocAppError("updateCommand", "api.command.team_mismatch.app_error", nil, "user_id="+c.Session.UserId)
- return
- }
-
- cmd.Id = oldCmd.Id
- cmd.Token = oldCmd.Token
- cmd.CreateAt = oldCmd.CreateAt
- cmd.UpdateAt = model.GetMillis()
- cmd.DeleteAt = oldCmd.DeleteAt
- cmd.CreatorId = oldCmd.CreatorId
- cmd.TeamId = oldCmd.TeamId
}
- if result := <-app.Srv.Store.Command().Update(cmd); result.Err != nil {
- c.Err = result.Err
+ if c.TeamId != oldCmd.TeamId {
+ c.Err = model.NewAppError("updateCommand", "api.command.team_mismatch.app_error", nil, "user_id="+c.Session.UserId, http.StatusBadRequest)
return
- } else {
- w.Write([]byte(result.Data.(*model.Command).ToJson()))
}
-}
-func listTeamCommands(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("listTeamCommands", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+ if !app.SessionHasPermissionToTeam(c.Session, oldCmd.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
+ c.LogAudit("fail - inappropriate permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_SLASH_COMMANDS)
return
}
- if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
- c.Err = model.NewLocAppError("listTeamCommands", "api.command.admin_only.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ if c.Session.UserId != oldCmd.CreatorId && !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS) {
+ c.LogAudit("fail - inappropriate permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS)
return
}
- if result := <-app.Srv.Store.Command().GetByTeam(c.TeamId); result.Err != nil {
- c.Err = result.Err
+ rcmd, err := app.UpdateCommand(oldCmd, cmd)
+ if err != nil {
+ c.Err = err
return
- } else {
- cmds := result.Data.([]*model.Command)
- w.Write([]byte(model.CommandListToJson(cmds)))
}
+
+ c.LogAudit("success")
+
+ w.Write([]byte(rcmd.ToJson()))
}
-func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("regenCommandToken", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+func listTeamCommands(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SLASH_COMMANDS)
return
}
- if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
- c.Err = model.NewLocAppError("regenCommandToken", "api.command.admin_only.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ cmds, err := app.ListTeamCommands(c.TeamId)
+ if err != nil {
+ c.Err = err
return
}
- c.LogAudit("attempt")
+ w.Write([]byte(model.CommandListToJson(cmds)))
+}
+func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
id := props["id"]
@@ -418,45 +173,41 @@ func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- var cmd *model.Command
- if result := <-app.Srv.Store.Command().Get(id); result.Err != nil {
- c.Err = result.Err
- return
- } else {
- cmd = result.Data.(*model.Command)
+ c.LogAudit("attempt")
- if c.TeamId != cmd.TeamId || (c.Session.UserId != cmd.CreatorId && !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS)) {
- c.LogAudit("fail - inappropriate permissions")
- c.Err = model.NewLocAppError("regenToken", "api.command.regen.app_error", nil, "user_id="+c.Session.UserId)
- return
- }
+ cmd, err := app.GetCommand(id)
+ if err != nil {
+ c.Err = err
+ return
}
- cmd.Token = model.NewId()
+ if c.TeamId != cmd.TeamId {
+ c.Err = model.NewAppError("regenCommandToken", "api.command.team_mismatch.app_error", nil, "user_id="+c.Session.UserId, http.StatusBadRequest)
+ return
+ }
- if result := <-app.Srv.Store.Command().Update(cmd); result.Err != nil {
- c.Err = result.Err
+ if !app.SessionHasPermissionToTeam(c.Session, cmd.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
+ c.LogAudit("fail - inappropriate permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_SLASH_COMMANDS)
return
- } else {
- w.Write([]byte(result.Data.(*model.Command).ToJson()))
}
-}
-func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
- if !*utils.Cfg.ServiceSettings.EnableCommands {
- c.Err = model.NewLocAppError("deleteCommand", "api.command.disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+ if c.Session.UserId != cmd.CreatorId && !app.SessionHasPermissionToTeam(c.Session, cmd.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS) {
+ c.LogAudit("fail - inappropriate permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS)
return
}
- if !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
- c.Err = model.NewLocAppError("deleteCommand", "api.command.admin_only.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ rcmd, err := app.RegenCommandToken(cmd)
+ if err != nil {
+ c.Err = err
return
}
- c.LogAudit("attempt")
+ w.Write([]byte(rcmd.ToJson()))
+}
+func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
id := props["id"]
@@ -465,18 +216,33 @@ func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if result := <-app.Srv.Store.Command().Get(id); result.Err != nil {
- c.Err = result.Err
+ c.LogAudit("attempt")
+
+ cmd, err := app.GetCommand(id)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if c.TeamId != cmd.TeamId {
+ c.Err = model.NewAppError("deleteCommand", "api.command.team_mismatch.app_error", nil, "user_id="+c.Session.UserId, http.StatusBadRequest)
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, cmd.TeamId, model.PERMISSION_MANAGE_SLASH_COMMANDS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SLASH_COMMANDS)
+ c.LogAudit("fail - inappropriate permissions")
+ return
+ }
+
+ if c.Session.UserId != cmd.CreatorId && !app.SessionHasPermissionToTeam(c.Session, cmd.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS)
+ c.LogAudit("fail - inappropriate permissions")
return
- } else {
- if c.TeamId != result.Data.(*model.Command).TeamId || (c.Session.UserId != result.Data.(*model.Command).CreatorId && !app.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_MANAGE_OTHERS_SLASH_COMMANDS)) {
- c.LogAudit("fail - inappropriate permissions")
- c.Err = model.NewLocAppError("deleteCommand", "api.command.delete.app_error", nil, "user_id="+c.Session.UserId)
- return
- }
}
- if err := (<-app.Srv.Store.Command().Delete(id, model.GetMillis())).Err; err != nil {
+ err = app.DeleteCommand(cmd.Id)
+ if err != nil {
c.Err = err
return
}
diff --git a/api/command_expand_collapse.go b/api/command_expand_collapse.go
deleted file mode 100644
index 5adbf4bab..000000000
--- a/api/command_expand_collapse.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package api
-
-import (
- "strconv"
-
- "github.com/mattermost/platform/app"
- "github.com/mattermost/platform/model"
-)
-
-type ExpandProvider struct {
-}
-
-type CollapseProvider struct {
-}
-
-const (
- CMD_EXPAND = "expand"
- CMD_COLLAPSE = "collapse"
-)
-
-func init() {
- RegisterCommandProvider(&ExpandProvider{})
- RegisterCommandProvider(&CollapseProvider{})
-}
-
-func (me *ExpandProvider) GetTrigger() string {
- return CMD_EXPAND
-}
-
-func (me *CollapseProvider) GetTrigger() string {
- return CMD_COLLAPSE
-}
-
-func (me *ExpandProvider) GetCommand(c *Context) *model.Command {
- return &model.Command{
- Trigger: CMD_EXPAND,
- AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_expand.desc"),
- DisplayName: c.T("api.command_expand.name"),
- }
-}
-
-func (me *CollapseProvider) GetCommand(c *Context) *model.Command {
- return &model.Command{
- Trigger: CMD_COLLAPSE,
- AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_collapse.desc"),
- DisplayName: c.T("api.command_collapse.name"),
- }
-}
-
-func (me *ExpandProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- return setCollapsePreference(c, false)
-}
-
-func (me *CollapseProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- return setCollapsePreference(c, true)
-}
-
-func setCollapsePreference(c *Context, isCollapse bool) *model.CommandResponse {
- pref := model.Preference{
- UserId: c.Session.UserId,
- Category: model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS,
- Name: model.PREFERENCE_NAME_COLLAPSE_SETTING,
- Value: strconv.FormatBool(isCollapse),
- }
-
- if result := <-app.Srv.Store.Preference().Save(&model.Preferences{pref}); result.Err != nil {
- return &model.CommandResponse{Text: c.T("api.command_expand_collapse.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
-
- socketMessage := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PREFERENCE_CHANGED, "", "", c.Session.UserId, nil)
- socketMessage.Add("preference", pref.ToJson())
- go app.Publish(socketMessage)
-
- var rmsg string
-
- if isCollapse {
- rmsg = c.T("api.command_collapse.success")
- } else {
- rmsg = c.T("api.command_expand.success")
- }
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg}
-}
diff --git a/api/command_join.go b/api/command_join.go
deleted file mode 100644
index 25c62d8c9..000000000
--- a/api/command_join.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package api
-
-import (
- "github.com/mattermost/platform/app"
- "github.com/mattermost/platform/model"
-)
-
-type JoinProvider struct {
-}
-
-const (
- CMD_JOIN = "join"
-)
-
-func init() {
- RegisterCommandProvider(&JoinProvider{})
-}
-
-func (me *JoinProvider) GetTrigger() string {
- return CMD_JOIN
-}
-
-func (me *JoinProvider) GetCommand(c *Context) *model.Command {
- return &model.Command{
- Trigger: CMD_JOIN,
- AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_join.desc"),
- AutoCompleteHint: c.T("api.command_join.hint"),
- DisplayName: c.T("api.command_join.name"),
- }
-}
-
-func (me *JoinProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- if result := <-app.Srv.Store.Channel().GetByName(c.TeamId, message, true); result.Err != nil {
- return &model.CommandResponse{Text: c.T("api.command_join.list.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- } else {
- channel := result.Data.(*model.Channel)
-
- if channel.Name == message {
-
- if channel.Type != model.CHANNEL_OPEN {
- return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
-
- if err := app.JoinChannel(channel, c.Session.UserId, c.GetSiteURL()); err != nil {
- return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
-
- return &model.CommandResponse{GotoLocation: c.GetTeamURL() + "/channels/" + channel.Name, Text: c.T("api.command_join.success"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
- }
-
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_join.missing.app_error")}
-}
diff --git a/api/command_msg.go b/api/command_msg.go
deleted file mode 100644
index 6ed101004..000000000
--- a/api/command_msg.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package api
-
-import (
- "strings"
-
- l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/platform/app"
- "github.com/mattermost/platform/model"
-)
-
-type msgProvider struct {
-}
-
-const (
- CMD_MSG = "msg"
-)
-
-func init() {
- RegisterCommandProvider(&msgProvider{})
-}
-
-func (me *msgProvider) GetTrigger() string {
- return CMD_MSG
-}
-
-func (me *msgProvider) GetCommand(c *Context) *model.Command {
- return &model.Command{
- Trigger: CMD_MSG,
- AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_msg.desc"),
- AutoCompleteHint: c.T("api.command_msg.hint"),
- DisplayName: c.T("api.command_msg.name"),
- }
-}
-
-func (me *msgProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
-
- splitMessage := strings.SplitN(message, " ", 2)
-
- parsedMessage := ""
- targetUsername := ""
-
- if len(splitMessage) > 1 {
- parsedMessage = strings.SplitN(message, " ", 2)[1]
- }
- targetUsername = strings.SplitN(message, " ", 2)[0]
- targetUsername = strings.TrimPrefix(targetUsername, "@")
-
- var userProfile *model.User
- if result := <-app.Srv.Store.User().GetByUsername(targetUsername); result.Err != nil {
- l4g.Error(result.Err.Error())
- return &model.CommandResponse{Text: c.T("api.command_msg.missing.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- } else {
- userProfile = result.Data.(*model.User)
- }
-
- if userProfile.Id == c.Session.UserId {
- return &model.CommandResponse{Text: c.T("api.command_msg.missing.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
-
- // Find the channel based on this user
- channelName := model.GetDMNameFromIds(c.Session.UserId, userProfile.Id)
-
- targetChannelId := ""
- if channel := <-app.Srv.Store.Channel().GetByName(c.TeamId, channelName, true); channel.Err != nil {
- if channel.Err.Id == "store.sql_channel.get_by_name.missing.app_error" {
- if directChannel, err := app.CreateDirectChannel(c.Session.UserId, userProfile.Id); err != nil {
- l4g.Error(err.Error())
- return &model.CommandResponse{Text: c.T("api.command_msg.dm_fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- } else {
- targetChannelId = directChannel.Id
- }
- } else {
- l4g.Error(channel.Err.Error())
- return &model.CommandResponse{Text: c.T("api.command_msg.dm_fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
- } else {
- targetChannelId = channel.Data.(*model.Channel).Id
- }
-
- if len(parsedMessage) > 0 {
- post := &model.Post{}
- post.Message = parsedMessage
- post.ChannelId = targetChannelId
- post.UserId = c.Session.UserId
- if _, err := app.CreatePost(post, c.TeamId, true, c.GetSiteURL()); err != nil {
- return &model.CommandResponse{Text: c.T("api.command_msg.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
- }
- }
-
- return &model.CommandResponse{GotoLocation: c.GetTeamURL() + "/channels/" + channelName, Text: "", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
-}
diff --git a/api/context.go b/api/context.go
index 21989f775..9a707c968 100644
--- a/api/context.go
+++ b/api/context.go
@@ -102,6 +102,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
now := time.Now()
l4g.Debug("%v", r.URL.Path)
+ if metrics := einterfaces.GetMetricsInterface(); metrics != nil && h.isApi {
+ metrics.IncrementHttpRequest()
+ }
+
c := &Context{}
c.T, c.Locale = utils.GetTranslationsAndLocale(w, r)
c.RequestId = model.NewId()
@@ -250,8 +254,6 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
if h.isApi && einterfaces.GetMetricsInterface() != nil {
- einterfaces.GetMetricsInterface().IncrementHttpRequest()
-
if r.URL.Path != model.API_URL_SUFFIX_V3+"/users/websocket" {
elapsed := float64(time.Since(now)) / float64(time.Second)
einterfaces.GetMetricsInterface().ObserveHttpRequestDuration(elapsed)
diff --git a/api/file.go b/api/file.go
index afc0ddbd8..12219a2dc 100644
--- a/api/file.go
+++ b/api/file.go
@@ -316,5 +316,5 @@ func getPublicLink(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- w.Write([]byte(model.StringToJson(app.GeneratePublicLink(c.GetSiteURL(), info))))
+ w.Write([]byte(model.StringToJson(app.GeneratePublicLinkV3(c.GetSiteURL(), info))))
}
diff --git a/api/post.go b/api/post.go
index f5b551218..4944ad28f 100644
--- a/api/post.go
+++ b/api/post.go
@@ -38,6 +38,8 @@ func InitPost() {
BaseRoutes.NeedPost.Handle("/before/{offset:[0-9]+}/{num_posts:[0-9]+}", ApiUserRequired(getPostsBefore)).Methods("GET")
BaseRoutes.NeedPost.Handle("/after/{offset:[0-9]+}/{num_posts:[0-9]+}", ApiUserRequired(getPostsAfter)).Methods("GET")
BaseRoutes.NeedPost.Handle("/get_file_infos", ApiUserRequired(getFileInfosForPost)).Methods("GET")
+ BaseRoutes.NeedPost.Handle("/pin", ApiUserRequired(pinPost)).Methods("POST")
+ BaseRoutes.NeedPost.Handle("/unpin", ApiUserRequired(unpinPost)).Methods("POST")
}
func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -91,6 +93,59 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(rpost.ToJson()))
}
+func saveIsPinnedPost(c *Context, w http.ResponseWriter, r *http.Request, isPinned bool) {
+ params := mux.Vars(r)
+
+ channelId := params["channel_id"]
+ if len(channelId) != 26 {
+ c.SetInvalidParam("savedIsPinnedPost", "channelId")
+ return
+ }
+
+ postId := params["post_id"]
+ if len(postId) != 26 {
+ c.SetInvalidParam("savedIsPinnedPost", "postId")
+ return
+ }
+
+ pchan := app.Srv.Store.Post().Get(postId)
+
+ var oldPost *model.Post
+ if result := <-pchan; result.Err != nil {
+ c.Err = result.Err
+ return
+ } else {
+ oldPost = result.Data.(*model.PostList).Posts[postId]
+ newPost := &model.Post{}
+ *newPost = *oldPost
+ newPost.IsPinned = isPinned
+
+ if result := <-app.Srv.Store.Post().Update(newPost, oldPost); result.Err != nil {
+ c.Err = result.Err
+ return
+ } else {
+ rpost := result.Data.(*model.Post)
+
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POST_EDITED, "", rpost.ChannelId, "", nil)
+ message.Add("post", rpost.ToJson())
+
+ go app.Publish(message)
+
+ app.InvalidateCacheForChannelPosts(rpost.ChannelId)
+
+ w.Write([]byte(rpost.ToJson()))
+ }
+ }
+}
+
+func pinPost(c *Context, w http.ResponseWriter, r *http.Request) {
+ saveIsPinnedPost(c, w, r, true)
+}
+
+func unpinPost(c *Context, w http.ResponseWriter, r *http.Request) {
+ saveIsPinnedPost(c, w, r, false)
+}
+
func getFlaggedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
diff --git a/api/post_test.go b/api/post_test.go
index 39ef2f6c0..5546e7165 100644
--- a/api/post_test.go
+++ b/api/post_test.go
@@ -997,51 +997,62 @@ func TestDeletePosts(t *testing.T) {
}
-// func TestEmailMention(t *testing.T) {
-// th := Setup().InitBasic()
-// Client := th.BasicClient
-// channel1 := th.BasicChannel
-// Client.Must(Client.AddChannelMember(channel1.Id, th.BasicUser2.Id))
-
-// th.LoginBasic2()
-// //Set the notification properties
-// data := make(map[string]string)
-// data["user_id"] = th.BasicUser2.Id
-// data["email"] = "true"
-// data["desktop"] = "all"
-// data["desktop_sound"] = "false"
-// data["comments"] = "any"
-// Client.Must(Client.UpdateUserNotify(data))
-
-// store.Must(app.Srv.Store.Preference().Save(&model.Preferences{{
-// UserId: th.BasicUser2.Id,
-// Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
-// Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
-// Value: "0",
-// }}))
-
-// //Delete all the messages before create a mention post
-// utils.DeleteMailBox(th.BasicUser2.Email)
-
-// //Send a mention message from user1 to user2
-// th.LoginBasic()
-// time.Sleep(10 * time.Millisecond)
-// post1 := &model.Post{ChannelId: channel1.Id, Message: "@" + th.BasicUser2.Username + " this is a test"}
-// post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
-
-// //Check if the email was send to the rigth email address and the mention
-// if resultsMailbox, err := utils.GetMailBox(th.BasicUser2.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], th.BasicUser2.Email) {
-// t.Fatal("Wrong To recipient")
-// } else {
-// if resultsEmail, err := utils.GetMessageFromMailbox(th.BasicUser2.Email, resultsMailbox[0].ID); err == nil {
-// if !strings.Contains(resultsEmail.Body.Text, post1.Message) {
-// t.Log(resultsEmail.Body.Text)
-// t.Fatal("Received wrong Message")
-// }
-// }
-// }
-
-// }
+func TestEmailMention(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+ channel1 := th.BasicChannel
+ Client.Must(Client.AddChannelMember(channel1.Id, th.BasicUser2.Id))
+
+ th.LoginBasic2()
+ //Set the notification properties
+ data := make(map[string]string)
+ data["user_id"] = th.BasicUser2.Id
+ data["email"] = "true"
+ data["desktop"] = "all"
+ data["desktop_sound"] = "false"
+ data["comments"] = "any"
+ Client.Must(Client.UpdateUserNotify(data))
+
+ store.Must(app.Srv.Store.Preference().Save(&model.Preferences{{
+ UserId: th.BasicUser2.Id,
+ Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
+ Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
+ Value: "0",
+ }}))
+
+ //Delete all the messages before create a mention post
+ utils.DeleteMailBox(th.BasicUser2.Email)
+
+ //Send a mention message from user1 to user2
+ th.LoginBasic()
+ time.Sleep(10 * time.Millisecond)
+ post1 := &model.Post{ChannelId: channel1.Id, Message: "@" + th.BasicUser2.Username + " this is a test"}
+ post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
+
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(th.BasicUser2.Email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], th.BasicUser2.Email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(th.BasicUser2.Email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Body.Text, post1.Message) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Received wrong Message")
+ }
+ }
+ }
+ }
+
+}
func TestFuzzyPosts(t *testing.T) {
th := Setup().InitBasic()
@@ -1367,3 +1378,49 @@ func TestGetOpenGraphMetadata(t *testing.T) {
t.Fatal("should have failed with 501 - disabled link previews")
}
}
+
+func TestPinPost(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+
+ post := th.BasicPost
+ if rupost1, err := Client.PinPost(post.ChannelId, post.Id); err != nil {
+ t.Fatal(err)
+ } else {
+ if rupost1.Data.(*model.Post).IsPinned != true {
+ t.Fatal("failed to pin post")
+ }
+ }
+
+ pinnedPost := th.PinnedPost
+ if rupost2, err := Client.PinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil {
+ t.Fatal(err)
+ } else {
+ if rupost2.Data.(*model.Post).IsPinned != true {
+ t.Fatal("pinning a post should be idempotent")
+ }
+ }
+}
+
+func TestUnpinPost(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+
+ pinnedPost := th.PinnedPost
+ if rupost1, err := Client.UnpinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil {
+ t.Fatal(err)
+ } else {
+ if rupost1.Data.(*model.Post).IsPinned != false {
+ t.Fatal("failed to unpin post")
+ }
+ }
+
+ post := th.BasicPost
+ if rupost2, err := Client.UnpinPost(post.ChannelId, post.Id); err != nil {
+ t.Fatal(err)
+ } else {
+ if rupost2.Data.(*model.Post).IsPinned != false {
+ t.Fatal("unpinning a post should be idempotent")
+ }
+ }
+}
diff --git a/api/user.go b/api/user.go
index cac6aeade..24a9025e4 100644
--- a/api/user.go
+++ b/api/user.go
@@ -1538,11 +1538,11 @@ func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) {
var profiles []*model.User
var err *model.AppError
if props.InChannelId != "" {
- profiles, err = app.SearchUsersInChannel(props.InChannelId, props.Term, searchOptions)
+ profiles, err = app.SearchUsersInChannel(props.InChannelId, props.Term, searchOptions, c.IsSystemAdmin())
} else if props.NotInChannelId != "" {
- profiles, err = app.SearchUsersNotInChannel(props.TeamId, props.NotInChannelId, props.Term, searchOptions)
+ profiles, err = app.SearchUsersNotInChannel(props.TeamId, props.NotInChannelId, props.Term, searchOptions, c.IsSystemAdmin())
} else {
- profiles, err = app.SearchUsersInTeam(props.TeamId, props.Term, searchOptions)
+ profiles, err = app.SearchUsersInTeam(props.TeamId, props.Term, searchOptions, c.IsSystemAdmin())
}
if err != nil {
@@ -1550,10 +1550,6 @@ func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- for _, p := range profiles {
- sanitizeProfile(c, p)
- }
-
w.Write([]byte(model.UserListToJson(profiles)))
}
@@ -1604,20 +1600,12 @@ func autocompleteUsersInChannel(c *Context, w http.ResponseWriter, r *http.Reque
searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY] = true
}
- autocomplete, err := app.AutocompleteUsersInChannel(teamId, channelId, term, searchOptions)
+ autocomplete, err := app.AutocompleteUsersInChannel(teamId, channelId, term, searchOptions, c.IsSystemAdmin())
if err != nil {
c.Err = err
return
}
- for _, p := range autocomplete.InChannel {
- sanitizeProfile(c, p)
- }
-
- for _, p := range autocomplete.OutOfChannel {
- sanitizeProfile(c, p)
- }
-
w.Write([]byte(autocomplete.ToJson()))
}
@@ -1642,16 +1630,12 @@ func autocompleteUsersInTeam(c *Context, w http.ResponseWriter, r *http.Request)
searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY] = true
}
- autocomplete, err := app.AutocompleteUsersInTeam(teamId, term, searchOptions)
+ autocomplete, err := app.AutocompleteUsersInTeam(teamId, term, searchOptions, c.IsSystemAdmin())
if err != nil {
c.Err = err
return
}
- for _, p := range autocomplete.InTeam {
- sanitizeProfile(c, p)
- }
-
w.Write([]byte(autocomplete.ToJson()))
}
@@ -1670,14 +1654,10 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
var profiles []*model.User
var err *model.AppError
- if profiles, err = app.SearchUsersInTeam("", term, searchOptions); err != nil {
+ if profiles, err = app.SearchUsersInTeam("", term, searchOptions, c.IsSystemAdmin()); err != nil {
c.Err = err
return
}
- for _, p := range profiles {
- sanitizeProfile(c, p)
- }
-
w.Write([]byte(model.UserListToJson(profiles)))
}
diff --git a/api/user_test.go b/api/user_test.go
index 2288f2a62..1fdb3a290 100644
--- a/api/user_test.go
+++ b/api/user_test.go
@@ -1330,14 +1330,27 @@ func TestResetPassword(t *testing.T) {
}
//Check if the email was send to the rigth email address and the recovery key match
- if resultsMailbox, err := utils.GetMailBox(user.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], user.Email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
- t.Log(resultsEmail.Body.Text)
- t.Log(recovery.Code)
- t.Fatal("Received wrong recovery code")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(user.Email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], user.Email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
+ t.Log(resultsEmail.Body.Text)
+ t.Log(recovery.Code)
+ t.Fatal("Received wrong recovery code")
+ }
}
}
}
diff --git a/api4/api.go b/api4/api.go
index c8c0e170b..75f2e0254 100644
--- a/api4/api.go
+++ b/api4/api.go
@@ -28,12 +28,14 @@ type Routes struct {
Teams *mux.Router // 'api/v4/teams'
TeamsForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams'
Team *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}'
+ TeamForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}'
TeamByName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}'
TeamMembers *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members'
TeamMember *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members/{user_id:[A-Za-z0-9_-]+}'
Channels *mux.Router // 'api/v4/channels'
Channel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}'
+ ChannelForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}'
ChannelByName *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}'
ChannelByNameForTeamName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}'
ChannelsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels'
@@ -48,6 +50,8 @@ type Routes struct {
Files *mux.Router // 'api/v4/files'
File *mux.Router // 'api/v4/files/{file_id:[A-Za-z0-9]+}'
+ PublicFile *mux.Router // 'files/{file_id:[A-Za-z0-9]+}/public'
+
Commands *mux.Router // 'api/v4/commands'
Command *mux.Router // 'api/v4/commands/{command_id:[A-Za-z0-9]+}'
CommandsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/commands'
@@ -58,9 +62,15 @@ type Routes struct {
OutgoingHooks *mux.Router // 'api/v4/hooks/outgoing'
OutgoingHook *mux.Router // 'api/v4/hooks/outgoing/{hook_id:[A-Za-z0-9]+}'
- OAuth *mux.Router // 'api/v4/oauth'
+ Admin *mux.Router // 'api/v4/admin'
+ OAuth *mux.Router // 'api/v4/oauth'
+ SAML *mux.Router // 'api/v4/saml'
+ Compliance *mux.Router // 'api/v4/compliance'
+ Cluster *mux.Router // 'api/v4/cluster'
+
+ LDAP *mux.Router // 'api/v4/ldap'
- Admin *mux.Router // 'api/v4/admin'
+ Brand *mux.Router // 'api/v4/brand'
System *mux.Router // 'api/v4/system'
@@ -90,19 +100,21 @@ func InitApi(full bool) {
BaseRoutes.ApiRoot = app.Srv.Router.PathPrefix(model.API_URL_SUFFIX).Subrouter()
BaseRoutes.Users = BaseRoutes.ApiRoot.PathPrefix("/users").Subrouter()
- BaseRoutes.User = BaseRoutes.Users.PathPrefix("/{user_id:[A-Za-z0-9]+}").Subrouter()
+ BaseRoutes.User = BaseRoutes.ApiRoot.PathPrefix("/users/{user_id:[A-Za-z0-9]+}").Subrouter()
BaseRoutes.UserByUsername = BaseRoutes.Users.PathPrefix("/username/{username:[A-Za-z0-9\\_\\-\\.]+}").Subrouter()
BaseRoutes.UserByEmail = BaseRoutes.Users.PathPrefix("/email/{email}").Subrouter()
BaseRoutes.Teams = BaseRoutes.ApiRoot.PathPrefix("/teams").Subrouter()
BaseRoutes.TeamsForUser = BaseRoutes.User.PathPrefix("/teams").Subrouter()
BaseRoutes.Team = BaseRoutes.Teams.PathPrefix("/{team_id:[A-Za-z0-9]+}").Subrouter()
+ BaseRoutes.TeamForUser = BaseRoutes.TeamsForUser.PathPrefix("/{team_id:[A-Za-z0-9]+}").Subrouter()
BaseRoutes.TeamByName = BaseRoutes.Teams.PathPrefix("/name/{team_name:[A-Za-z0-9_-]+}").Subrouter()
BaseRoutes.TeamMembers = BaseRoutes.Team.PathPrefix("/members").Subrouter()
BaseRoutes.TeamMember = BaseRoutes.TeamMembers.PathPrefix("/{user_id:[A-Za-z0-9]+}").Subrouter()
BaseRoutes.Channels = BaseRoutes.ApiRoot.PathPrefix("/channels").Subrouter()
BaseRoutes.Channel = BaseRoutes.Channels.PathPrefix("/{channel_id:[A-Za-z0-9]+}").Subrouter()
+ BaseRoutes.ChannelForUser = BaseRoutes.User.PathPrefix("/channels/{channel_id:[A-Za-z0-9]+}").Subrouter()
BaseRoutes.ChannelByName = BaseRoutes.Team.PathPrefix("/channels/name/{channel_name:[A-Za-z0-9_-]+}").Subrouter()
BaseRoutes.ChannelByNameForTeamName = BaseRoutes.TeamByName.PathPrefix("/channels/name/{channel_name:[A-Za-z0-9_-]+}").Subrouter()
BaseRoutes.ChannelsForTeam = BaseRoutes.Team.PathPrefix("/channels").Subrouter()
@@ -116,6 +128,7 @@ func InitApi(full bool) {
BaseRoutes.Files = BaseRoutes.ApiRoot.PathPrefix("/files").Subrouter()
BaseRoutes.File = BaseRoutes.Files.PathPrefix("/{file_id:[A-Za-z0-9]+}").Subrouter()
+ BaseRoutes.PublicFile = BaseRoutes.Root.PathPrefix("/files/{file_id:[A-Za-z0-9]+}/public").Subrouter()
BaseRoutes.Commands = BaseRoutes.ApiRoot.PathPrefix("/commands").Subrouter()
BaseRoutes.Command = BaseRoutes.Commands.PathPrefix("/{command_id:[A-Za-z0-9]+}").Subrouter()
@@ -127,8 +140,13 @@ func InitApi(full bool) {
BaseRoutes.OutgoingHooks = BaseRoutes.Hooks.PathPrefix("/outgoing").Subrouter()
BaseRoutes.OutgoingHook = BaseRoutes.OutgoingHooks.PathPrefix("/{hook_id:[A-Za-z0-9]+}").Subrouter()
+ BaseRoutes.SAML = BaseRoutes.ApiRoot.PathPrefix("/saml").Subrouter()
BaseRoutes.OAuth = BaseRoutes.ApiRoot.PathPrefix("/oauth").Subrouter()
BaseRoutes.Admin = BaseRoutes.ApiRoot.PathPrefix("/admin").Subrouter()
+ BaseRoutes.Compliance = BaseRoutes.ApiRoot.PathPrefix("/compliance").Subrouter()
+ BaseRoutes.Cluster = BaseRoutes.ApiRoot.PathPrefix("/cluster").Subrouter()
+ BaseRoutes.LDAP = BaseRoutes.ApiRoot.PathPrefix("/ldap").Subrouter()
+ BaseRoutes.Brand = BaseRoutes.ApiRoot.PathPrefix("/brand").Subrouter()
BaseRoutes.System = BaseRoutes.ApiRoot.PathPrefix("/system").Subrouter()
BaseRoutes.Preferences = BaseRoutes.User.PathPrefix("/preferences").Subrouter()
BaseRoutes.License = BaseRoutes.ApiRoot.PathPrefix("/license").Subrouter()
@@ -147,6 +165,11 @@ func InitApi(full bool) {
InitSystem()
InitWebhook()
InitPreference()
+ InitSaml()
+ InitCompliance()
+ InitCluster()
+ InitLdap()
+ InitBrand()
app.Srv.Router.Handle("/api/v4/{anything:.*}", http.HandlerFunc(Handle404))
diff --git a/api4/apitestlib.go b/api4/apitestlib.go
index ffeeb32fa..64d3f22b2 100644
--- a/api4/apitestlib.go
+++ b/api4/apitestlib.go
@@ -38,6 +38,37 @@ type TestHelper struct {
SystemAdminUser *model.User
}
+func SetupEnterprise() *TestHelper {
+ if app.Srv == nil {
+ utils.TranslationsPreInit()
+ utils.LoadConfig("config.json")
+ utils.InitTranslations(utils.Cfg.LocalizationSettings)
+ utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
+ *utils.Cfg.RateLimitSettings.Enable = false
+ utils.Cfg.EmailSettings.SendEmailNotifications = true
+ utils.Cfg.EmailSettings.SMTPServer = "dockerhost"
+ utils.Cfg.EmailSettings.SMTPPort = "2500"
+ utils.Cfg.EmailSettings.FeedbackEmail = "test@example.com"
+ utils.DisableDebugLogForTest()
+ utils.License.Features.SetDefaults()
+ app.NewServer()
+ app.InitStores()
+ InitRouter()
+ app.StartServer()
+ utils.InitHTML()
+ InitApi(true)
+ utils.EnableDebugLogForTest()
+ app.Srv.Store.MarkSystemRanUnitTests()
+
+ *utils.Cfg.TeamSettings.EnableOpenServer = true
+ }
+
+ th := &TestHelper{}
+ th.Client = th.CreateClient()
+ th.SystemAdminClient = th.CreateClient()
+ return th
+}
+
func Setup() *TestHelper {
if app.Srv == nil {
utils.TranslationsPreInit()
@@ -441,6 +472,14 @@ func CheckNotImplementedStatus(t *testing.T, resp *model.Response) {
}
}
+func CheckOKStatus(t *testing.T, resp *model.Response) {
+ CheckNoError(t, resp)
+
+ if resp.StatusCode != http.StatusOK {
+ t.Fatalf("wrong status code. expected %d got %d", http.StatusOK, resp.StatusCode)
+ }
+}
+
func CheckErrorMessage(t *testing.T, resp *model.Response, errorId string) {
if resp.Error == nil {
debug.PrintStack()
@@ -456,6 +495,21 @@ func CheckErrorMessage(t *testing.T, resp *model.Response, errorId string) {
}
}
+func CheckInternalErrorStatus(t *testing.T, resp *model.Response) {
+ if resp.Error == nil {
+ debug.PrintStack()
+ t.Fatal("should have errored with status:" + strconv.Itoa(http.StatusNotImplemented))
+ return
+ }
+
+ if resp.StatusCode != http.StatusInternalServerError {
+ debug.PrintStack()
+ t.Log("actual: " + strconv.Itoa(resp.StatusCode))
+ t.Log("expected: " + strconv.Itoa(http.StatusNotImplemented))
+ t.Fatal("wrong status code")
+ }
+}
+
func readTestFile(name string) ([]byte, error) {
path := utils.FindDir("tests")
file, err := os.Open(path + "/" + name)
@@ -518,3 +572,49 @@ func cleanupTestFile(info *model.FileInfo) error {
return nil
}
+
+func MakeUserChannelAdmin(user *model.User, channel *model.Channel) {
+ utils.DisableDebugLogForTest()
+
+ if cmr := <-app.Srv.Store.Channel().GetMember(channel.Id, user.Id); cmr.Err == nil {
+ cm := cmr.Data.(*model.ChannelMember)
+ cm.Roles = "channel_admin channel_user"
+ if sr := <-app.Srv.Store.Channel().UpdateMember(cm); sr.Err != nil {
+ utils.EnableDebugLogForTest()
+ panic(sr.Err)
+ }
+ } else {
+ utils.EnableDebugLogForTest()
+ panic(cmr.Err)
+ }
+
+ utils.EnableDebugLogForTest()
+}
+
+func UpdateUserToTeamAdmin(user *model.User, team *model.Team) {
+ utils.DisableDebugLogForTest()
+
+ tm := &model.TeamMember{TeamId: team.Id, UserId: user.Id, Roles: model.ROLE_TEAM_USER.Id + " " + model.ROLE_TEAM_ADMIN.Id}
+ if tmr := <-app.Srv.Store.Team().UpdateMember(tm); tmr.Err != nil {
+ utils.EnableDebugLogForTest()
+ l4g.Error(tmr.Err.Error())
+ l4g.Close()
+ time.Sleep(time.Second)
+ panic(tmr.Err)
+ }
+ utils.EnableDebugLogForTest()
+}
+
+func UpdateUserToNonTeamAdmin(user *model.User, team *model.Team) {
+ utils.DisableDebugLogForTest()
+
+ tm := &model.TeamMember{TeamId: team.Id, UserId: user.Id, Roles: model.ROLE_TEAM_USER.Id}
+ if tmr := <-app.Srv.Store.Team().UpdateMember(tm); tmr.Err != nil {
+ utils.EnableDebugLogForTest()
+ l4g.Error(tmr.Err.Error())
+ l4g.Close()
+ time.Sleep(time.Second)
+ panic(tmr.Err)
+ }
+ utils.EnableDebugLogForTest()
+}
diff --git a/api4/brand.go b/api4/brand.go
new file mode 100644
index 000000000..00e6bbbff
--- /dev/null
+++ b/api4/brand.go
@@ -0,0 +1,70 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitBrand() {
+ l4g.Debug(utils.T("api.brand.init.debug"))
+
+ BaseRoutes.Brand.Handle("/image", ApiHandlerTrustRequester(getBrandImage)).Methods("GET")
+ BaseRoutes.Brand.Handle("/image", ApiSessionRequired(uploadBrandImage)).Methods("POST")
+}
+
+func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
+ // No permission check required
+
+ if img, err := app.GetBrandImage(); err != nil {
+ w.Write(nil)
+ } else {
+ w.Header().Set("Content-Type", "image/png")
+ w.Write(img)
+ }
+}
+
+func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
+ if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize {
+ c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
+ return
+ }
+
+ if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil {
+ c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.parse.app_error", nil, "", http.StatusBadRequest)
+ return
+ }
+
+ m := r.MultipartForm
+
+ imageArray, ok := m.File["image"]
+ if !ok {
+ c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.no_file.app_error", nil, "", http.StatusBadRequest)
+ return
+ }
+
+ if len(imageArray) <= 0 {
+ c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.array.app_error", nil, "", http.StatusBadRequest)
+ return
+ }
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ if err := app.SaveBrandImage(imageArray[0]); err != nil {
+ c.Err = err
+ return
+ }
+
+ c.LogAudit("")
+
+ ReturnStatusOK(w)
+}
diff --git a/api4/brand_test.go b/api4/brand_test.go
new file mode 100644
index 000000000..fd5e472a8
--- /dev/null
+++ b/api4/brand_test.go
@@ -0,0 +1,69 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+ "testing"
+)
+
+func TestGetBrandImage(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ data, resp := Client.GetBrandImage()
+ CheckNoError(t, resp)
+
+ if len(data) != 0 {
+ t.Fatal("no image uploaded - should be empty")
+ }
+
+ Client.Logout()
+ data, resp = Client.GetBrandImage()
+ CheckNoError(t, resp)
+
+ if len(data) != 0 {
+ t.Fatal("no image uploaded - should be empty")
+ }
+
+ data, resp = th.SystemAdminClient.GetBrandImage()
+ CheckNoError(t, resp)
+
+ if len(data) != 0 {
+ t.Fatal("no image uploaded - should be empty")
+ }
+}
+
+func TestUploadBrandImage(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ data, err := readTestFile("test.png")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ ok, resp := Client.UploadBrandImage(data)
+ CheckForbiddenStatus(t, resp)
+ if ok {
+ t.Fatal("Should return false, set brand image not allowed")
+ }
+
+ // status code returns either forbidden or unauthorized
+ // note: forbidden is set as default at Client4.SetProfileImage when request is terminated early by server
+ Client.Logout()
+ _, resp = Client.UploadBrandImage(data)
+ if resp.StatusCode == http.StatusForbidden {
+ CheckForbiddenStatus(t, resp)
+ } else if resp.StatusCode == http.StatusUnauthorized {
+ CheckUnauthorizedStatus(t, resp)
+ } else {
+ t.Fatal("Should have failed either forbidden or unauthorized")
+ }
+
+ _, resp = th.SystemAdminClient.UploadBrandImage(data)
+ CheckNotImplementedStatus(t, resp)
+}
diff --git a/api4/channel.go b/api4/channel.go
index 8ac6f2b14..bd1710975 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -17,17 +17,26 @@ func InitChannel() {
BaseRoutes.Channels.Handle("", ApiSessionRequired(createChannel)).Methods("POST")
BaseRoutes.Channels.Handle("/direct", ApiSessionRequired(createDirectChannel)).Methods("POST")
+ BaseRoutes.Channels.Handle("/members/{user_id:[A-Za-z0-9]+}/view", ApiSessionRequired(viewChannel)).Methods("POST")
+
+ BaseRoutes.Team.Handle("/channels", ApiSessionRequired(getPublicChannelsForTeam)).Methods("GET")
BaseRoutes.Channel.Handle("", ApiSessionRequired(getChannel)).Methods("GET")
+ BaseRoutes.Channel.Handle("", ApiSessionRequired(updateChannel)).Methods("PUT")
+ BaseRoutes.Channel.Handle("", ApiSessionRequired(deleteChannel)).Methods("DELETE")
+ BaseRoutes.Channel.Handle("/stats", ApiSessionRequired(getChannelStats)).Methods("GET")
+
+ BaseRoutes.ChannelForUser.Handle("/unread", ApiSessionRequired(getChannelUnread)).Methods("GET")
+
BaseRoutes.ChannelByName.Handle("", ApiSessionRequired(getChannelByName)).Methods("GET")
BaseRoutes.ChannelByNameForTeamName.Handle("", ApiSessionRequired(getChannelByNameForTeamName)).Methods("GET")
BaseRoutes.ChannelMembers.Handle("", ApiSessionRequired(getChannelMembers)).Methods("GET")
+ BaseRoutes.ChannelMembers.Handle("/ids", ApiSessionRequired(getChannelMembersByIds)).Methods("POST")
BaseRoutes.ChannelMembersForUser.Handle("", ApiSessionRequired(getChannelMembersForUser)).Methods("GET")
BaseRoutes.ChannelMember.Handle("", ApiSessionRequired(getChannelMember)).Methods("GET")
BaseRoutes.ChannelMember.Handle("", ApiSessionRequired(removeChannelMember)).Methods("DELETE")
BaseRoutes.ChannelMember.Handle("/roles", ApiSessionRequired(updateChannelMemberRoles)).Methods("PUT")
- BaseRoutes.Channels.Handle("/members/{user_id:[A-Za-z0-9]+}/view", ApiSessionRequired(viewChannel)).Methods("POST")
}
func createChannel(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -57,6 +66,94 @@ func createChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireChannelId()
+ if c.Err != nil {
+ return
+ }
+
+ channel := model.ChannelFromJson(r.Body)
+
+ if channel == nil {
+ c.SetInvalidParam("channel")
+ return
+ }
+
+ var oldChannel *model.Channel
+ var err *model.AppError
+ if oldChannel, err = app.GetChannel(channel.Id); err != nil {
+ c.Err = err
+ return
+ }
+
+ if _, err = app.GetChannelMember(channel.Id, c.Session.UserId); err != nil {
+ c.Err = err
+ return
+ }
+
+ if !CanManageChannel(c, channel) {
+ return
+ }
+
+ if oldChannel.DeleteAt > 0 {
+ c.Err = model.NewLocAppError("updateChannel", "api.channel.update_channel.deleted.app_error", nil, "")
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+
+ if oldChannel.Name == model.DEFAULT_CHANNEL {
+ if (len(channel.Name) > 0 && channel.Name != oldChannel.Name) || (len(channel.Type) > 0 && channel.Type != oldChannel.Type) {
+ c.Err = model.NewLocAppError("updateChannel", "api.channel.update_channel.tried.app_error", map[string]interface{}{"Channel": model.DEFAULT_CHANNEL}, "")
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+ }
+
+ oldChannel.Header = channel.Header
+ oldChannel.Purpose = channel.Purpose
+
+ oldChannelDisplayName := oldChannel.DisplayName
+
+ if len(channel.DisplayName) > 0 {
+ oldChannel.DisplayName = channel.DisplayName
+ }
+
+ if len(channel.Name) > 0 {
+ oldChannel.Name = channel.Name
+ }
+
+ if len(channel.Type) > 0 {
+ oldChannel.Type = channel.Type
+ }
+
+ if _, err := app.UpdateChannel(oldChannel); err != nil {
+ c.Err = err
+ return
+ } else {
+ if oldChannelDisplayName != channel.DisplayName {
+ if err := app.PostUpdateChannelDisplayNameMessage(c.Session.UserId, channel.Id, c.Params.TeamId, oldChannelDisplayName, channel.DisplayName, c.GetSiteURL()); err != nil {
+ l4g.Error(err.Error())
+ }
+ }
+ c.LogAudit("name=" + channel.Name)
+ w.Write([]byte(oldChannel.ToJson()))
+ }
+}
+
+func CanManageChannel(c *Context, channel *model.Channel) bool {
+ if channel.Type == model.CHANNEL_OPEN && !app.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_MANAGE_PUBLIC_CHANNEL_PROPERTIES) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_PUBLIC_CHANNEL_PROPERTIES)
+ return false
+ }
+
+ if channel.Type == model.CHANNEL_PRIVATE && !app.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_MANAGE_PRIVATE_CHANNEL_PROPERTIES) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_PRIVATE_CHANNEL_PROPERTIES)
+ return false
+ }
+
+ return true
+}
+
func createDirectChannel(c *Context, w http.ResponseWriter, r *http.Request) {
userIds := model.ArrayFromJson(r.Body)
allowed := false
@@ -115,6 +212,107 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func getChannelUnread(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireChannelId().RequireUserId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionToUser(c.Session, c.Params.UserId) {
+ c.SetPermissionError(model.PERMISSION_EDIT_OTHER_USERS)
+ return
+ }
+
+ if !app.SessionHasPermissionToChannel(c.Session, c.Params.ChannelId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ channelUnread, err := app.GetChannelUnread(c.Params.ChannelId, c.Params.UserId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(channelUnread.ToJson()))
+}
+
+func getChannelStats(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireChannelId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionToChannel(c.Session, c.Params.ChannelId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ memberCount, err := app.GetChannelMemberCount(c.Params.ChannelId)
+
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ stats := model.ChannelStats{ChannelId: c.Params.ChannelId, MemberCount: memberCount}
+ w.Write([]byte(stats.ToJson()))
+}
+
+func getPublicChannelsForTeam(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_LIST_TEAM_CHANNELS) {
+ c.SetPermissionError(model.PERMISSION_LIST_TEAM_CHANNELS)
+ return
+ }
+
+ if channels, err := app.GetPublicChannelsForTeam(c.Params.TeamId, c.Params.Page, c.Params.PerPage); err != nil {
+ c.Err = err
+ return
+ } else {
+ w.Write([]byte(channels.ToJson()))
+ return
+ }
+}
+
+func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireChannelId()
+ if c.Err != nil {
+ return
+ }
+
+ var channel *model.Channel
+ var err *model.AppError
+ if channel, err = app.GetChannel(c.Params.ChannelId); err != nil {
+ c.Err = err
+ return
+ }
+
+ if channel.Type == model.CHANNEL_OPEN && !app.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_DELETE_PUBLIC_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_DELETE_PUBLIC_CHANNEL)
+ return
+ }
+
+ if channel.Type == model.CHANNEL_PRIVATE && !app.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_DELETE_PRIVATE_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_DELETE_PRIVATE_CHANNEL)
+ return
+ }
+
+ err = app.DeleteChannel(channel, c.Session.UserId, c.GetSiteURL())
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ c.LogAudit("name=" + channel.Name)
+
+ ReturnStatusOK(w)
+}
+
func getChannelByName(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireTeamId().RequireChannelName()
if c.Err != nil {
@@ -180,6 +378,31 @@ func getChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func getChannelMembersByIds(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireChannelId()
+ if c.Err != nil {
+ return
+ }
+
+ userIds := model.ArrayFromJson(r.Body)
+ if len(userIds) == 0 {
+ c.SetInvalidParam("user_ids")
+ return
+ }
+
+ if !app.SessionHasPermissionToChannel(c.Session, c.Params.ChannelId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ if members, err := app.GetChannelMembersByIds(c.Params.ChannelId, userIds); err != nil {
+ c.Err = err
+ return
+ } else {
+ w.Write([]byte(members.ToJson()))
+ }
+}
+
func getChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireChannelId().RequireUserId()
if c.Err != nil {
diff --git a/api4/channel_test.go b/api4/channel_test.go
index c8faf7aa1..6d5b5cef3 100644
--- a/api4/channel_test.go
+++ b/api4/channel_test.go
@@ -11,6 +11,7 @@ import (
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
)
@@ -171,6 +172,78 @@ func TestCreateChannel(t *testing.T) {
}
}
+func TestUpdateChannel(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ team := th.BasicTeam
+
+ channel := &model.Channel{DisplayName: "Test API Name", Name: GenerateTestChannelName(), Type: model.CHANNEL_OPEN, TeamId: team.Id}
+ private := &model.Channel{DisplayName: "Test API Name", Name: GenerateTestChannelName(), Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
+
+ channel, resp := Client.CreateChannel(channel)
+ private, resp = Client.CreateChannel(private)
+
+ //Update a open channel
+ channel.DisplayName = "My new display name"
+ channel.Header = "My fancy header"
+ channel.Purpose = "Mattermost ftw!"
+
+ newChannel, resp := Client.UpdateChannel(channel)
+ CheckNoError(t, resp)
+
+ if newChannel.DisplayName != channel.DisplayName {
+ t.Fatal("Update failed for DisplayName")
+ }
+
+ if newChannel.Header != channel.Header {
+ t.Fatal("Update failed for Header")
+ }
+
+ if newChannel.Purpose != channel.Purpose {
+ t.Fatal("Update failed for Purpose")
+ }
+
+ //Update a private channel
+ private.DisplayName = "My new display name for private channel"
+ private.Header = "My fancy private header"
+ private.Purpose = "Mattermost ftw! in private mode"
+
+ newPrivateChannel, resp := Client.UpdateChannel(private)
+ CheckNoError(t, resp)
+
+ if newPrivateChannel.DisplayName != private.DisplayName {
+ t.Fatal("Update failed for DisplayName in private channel")
+ }
+
+ if newPrivateChannel.Header != private.Header {
+ t.Fatal("Update failed for Header in private channel")
+ }
+
+ if newPrivateChannel.Purpose != private.Purpose {
+ t.Fatal("Update failed for Purpose in private channel")
+ }
+
+ //Non existing channel
+ channel1 := &model.Channel{DisplayName: "Test API Name for apiv4", Name: GenerateTestChannelName(), Type: model.CHANNEL_OPEN, TeamId: team.Id}
+ _, resp = Client.UpdateChannel(channel1)
+ CheckNotFoundStatus(t, resp)
+
+ //Try to update with not logged user
+ Client.Logout()
+ _, resp = Client.UpdateChannel(channel)
+ CheckUnauthorizedStatus(t, resp)
+
+ //Try to update using another user
+ user := th.CreateUser()
+ Client.Login(user.Email, user.Password)
+
+ channel.DisplayName = "Should not update"
+ _, resp = Client.UpdateChannel(channel)
+ CheckNotFoundStatus(t, resp)
+
+}
+
func TestCreateDirectChannel(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -254,6 +327,324 @@ func TestGetChannel(t *testing.T) {
CheckNotFoundStatus(t, resp)
}
+func TestGetPublicChannelsForTeam(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ team := th.BasicTeam
+ publicChannel1 := th.BasicChannel
+ publicChannel2 := th.BasicChannel2
+
+ channels, resp := Client.GetPublicChannelsForTeam(team.Id, 0, 100, "")
+ CheckNoError(t, resp)
+ if len(*channels) != 4 {
+ t.Fatal("wrong length")
+ }
+
+ for i, c := range *channels {
+ if c.Type != model.CHANNEL_OPEN {
+ t.Fatal("should include open channel only")
+ }
+
+ // only check the created 2 public channels
+ if i < 2 && !(c.DisplayName == publicChannel1.DisplayName || c.DisplayName == publicChannel2.DisplayName) {
+ t.Logf("channel %v: %v", i, c.DisplayName)
+ t.Fatal("should match public channel display name only")
+ }
+ }
+
+ privateChannel := th.CreatePrivateChannel()
+ channels, resp = Client.GetPublicChannelsForTeam(team.Id, 0, 100, "")
+ CheckNoError(t, resp)
+ if len(*channels) != 4 {
+ t.Fatal("wrong length")
+ }
+
+ for _, c := range *channels {
+ if c.Type != model.CHANNEL_OPEN {
+ t.Fatal("should not include private channel")
+ }
+
+ if c.DisplayName == privateChannel.DisplayName {
+ t.Fatal("should not match private channel display name")
+ }
+ }
+
+ channels, resp = Client.GetPublicChannelsForTeam(team.Id, 0, 1, "")
+ CheckNoError(t, resp)
+ if len(*channels) != 1 {
+ t.Fatal("should be one channel per page")
+ }
+
+ channels, resp = Client.GetPublicChannelsForTeam(team.Id, 1, 1, "")
+ CheckNoError(t, resp)
+ if len(*channels) != 1 {
+ t.Fatal("should be one channel per page")
+ }
+
+ channels, resp = Client.GetPublicChannelsForTeam(team.Id, 10000, 100, "")
+ CheckNoError(t, resp)
+ if len(*channels) != 0 {
+ t.Fatal("should be no channel")
+ }
+
+ _, resp = Client.GetPublicChannelsForTeam("junk", 0, 100, "")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetPublicChannelsForTeam(model.NewId(), 0, 100, "")
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetPublicChannelsForTeam(team.Id, 0, 100, "")
+ CheckUnauthorizedStatus(t, resp)
+
+ user := th.CreateUser()
+ Client.Login(user.Email, user.Password)
+ _, resp = Client.GetPublicChannelsForTeam(team.Id, 0, 100, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.GetPublicChannelsForTeam(team.Id, 0, 100, "")
+ CheckNoError(t, resp)
+}
+
+func TestDeleteChannel(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ team := th.BasicTeam
+ user := th.BasicUser
+ user2 := th.BasicUser2
+
+ // successful delete of public channel
+ publicChannel1 := th.CreatePublicChannel()
+ pass, resp := Client.DeleteChannel(publicChannel1.Id)
+ CheckNoError(t, resp)
+
+ if !pass {
+ t.Fatal("should have passed")
+ }
+
+ if ch, err := app.GetChannel(publicChannel1.Id); err == nil && ch.DeleteAt == 0 {
+ t.Fatal("should have failed to get deleted channel")
+ } else if err := app.JoinChannel(ch, user2.Id, ""); err == nil {
+ t.Fatal("should have failed to join deleted channel")
+ }
+
+ post1 := &model.Post{ChannelId: publicChannel1.Id, Message: "a" + GenerateTestId() + "a"}
+ if _, err := Client.CreatePost(post1); err == nil {
+ t.Fatal("should have failed to post to deleted channel")
+ }
+
+ // successful delete of private channel
+ privateChannel2 := th.CreatePrivateChannel()
+ _, resp = Client.DeleteChannel(privateChannel2.Id)
+ CheckNoError(t, resp)
+
+ // successful delete of channel with multiple members
+ publicChannel3 := th.CreatePublicChannel()
+ app.AddUserToChannel(user2, publicChannel3)
+ _, resp = Client.DeleteChannel(publicChannel3.Id)
+ CheckNoError(t, resp)
+
+ // successful delete by TeamAdmin of channel created by user
+ publicChannel4 := th.CreatePublicChannel()
+ th.LoginTeamAdmin()
+ _, resp = Client.DeleteChannel(publicChannel4.Id)
+ CheckNoError(t, resp)
+
+ // default channel cannot be deleted.
+ defaultChannel, _ := app.GetChannelByName(model.DEFAULT_CHANNEL, team.Id)
+ pass, resp = Client.DeleteChannel(defaultChannel.Id)
+ CheckBadRequestStatus(t, resp)
+
+ if pass {
+ t.Fatal("should have failed")
+ }
+
+ th.LoginBasic()
+ publicChannel5 := th.CreatePublicChannel()
+ Client.Logout()
+
+ Client.Login(user2.Id, user2.Password)
+ _, resp = Client.DeleteChannel(publicChannel5.Id)
+ CheckUnauthorizedStatus(t, resp)
+
+ _, resp = Client.DeleteChannel("junk")
+ CheckUnauthorizedStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.DeleteChannel(GenerateTestId())
+ CheckUnauthorizedStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.DeleteChannel(publicChannel5.Id)
+ CheckNoError(t, resp)
+
+ isLicensed := utils.IsLicensed
+ license := utils.License
+ restrictPublicChannel := *utils.Cfg.TeamSettings.RestrictPublicChannelManagement
+ restrictPrivateChannel := *utils.Cfg.TeamSettings.RestrictPrivateChannelManagement
+ defer func() {
+ *utils.Cfg.TeamSettings.RestrictPublicChannelManagement = restrictPublicChannel
+ *utils.Cfg.TeamSettings.RestrictPrivateChannelManagement = restrictPrivateChannel
+ utils.IsLicensed = isLicensed
+ utils.License = license
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ *utils.Cfg.TeamSettings.RestrictPublicChannelManagement = model.PERMISSIONS_ALL
+ *utils.Cfg.TeamSettings.RestrictPrivateChannelManagement = model.PERMISSIONS_ALL
+ utils.IsLicensed = true
+ utils.License = &model.License{Features: &model.Features{}}
+ utils.License.Features.SetDefaults()
+ utils.SetDefaultRolesBasedOnConfig()
+
+ th = Setup().InitBasic().InitSystemAdmin()
+ Client = th.Client
+ team = th.BasicTeam
+ user = th.BasicUser
+
+ // channels created by SystemAdmin
+ publicChannel6 := th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_OPEN)
+ privateChannel7 := th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_PRIVATE)
+ app.AddUserToChannel(user, publicChannel6)
+ app.AddUserToChannel(user, privateChannel7)
+
+ // successful delete by user
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckNoError(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckNoError(t, resp)
+
+ *utils.Cfg.TeamSettings.RestrictPublicChannelDeletion = model.PERMISSIONS_CHANNEL_ADMIN
+ *utils.Cfg.TeamSettings.RestrictPrivateChannelDeletion = model.PERMISSIONS_CHANNEL_ADMIN
+ utils.SetDefaultRolesBasedOnConfig()
+
+ // channels created by SystemAdmin
+ publicChannel6 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_OPEN)
+ privateChannel7 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_PRIVATE)
+ app.AddUserToChannel(user, publicChannel6)
+ app.AddUserToChannel(user, privateChannel7)
+
+ // cannot delete by user
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // successful delete by channel admin
+ MakeUserChannelAdmin(user, publicChannel6)
+ MakeUserChannelAdmin(user, privateChannel7)
+ store.ClearChannelCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckNoError(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckNoError(t, resp)
+
+ // // channels created by SystemAdmin
+ publicChannel6 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_OPEN)
+ privateChannel7 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_PRIVATE)
+ app.AddUserToChannel(user, publicChannel6)
+ app.AddUserToChannel(user, privateChannel7)
+
+ // successful delete by team admin
+ UpdateUserToTeamAdmin(user, team)
+ app.InvalidateAllCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckNoError(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckNoError(t, resp)
+
+ *utils.Cfg.TeamSettings.RestrictPublicChannelDeletion = model.PERMISSIONS_TEAM_ADMIN
+ *utils.Cfg.TeamSettings.RestrictPrivateChannelDeletion = model.PERMISSIONS_TEAM_ADMIN
+ utils.SetDefaultRolesBasedOnConfig()
+ UpdateUserToNonTeamAdmin(user, team)
+ app.InvalidateAllCaches()
+
+ // channels created by SystemAdmin
+ publicChannel6 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_OPEN)
+ privateChannel7 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_PRIVATE)
+ app.AddUserToChannel(user, publicChannel6)
+ app.AddUserToChannel(user, privateChannel7)
+
+ // cannot delete by user
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // // cannot delete by channel admin
+ MakeUserChannelAdmin(user, publicChannel6)
+ MakeUserChannelAdmin(user, privateChannel7)
+ store.ClearChannelCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // successful delete by team admin
+ UpdateUserToTeamAdmin(th.BasicUser, team)
+ app.InvalidateAllCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckNoError(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckNoError(t, resp)
+
+ *utils.Cfg.TeamSettings.RestrictPublicChannelDeletion = model.PERMISSIONS_SYSTEM_ADMIN
+ *utils.Cfg.TeamSettings.RestrictPrivateChannelDeletion = model.PERMISSIONS_SYSTEM_ADMIN
+ utils.SetDefaultRolesBasedOnConfig()
+
+ // channels created by SystemAdmin
+ publicChannel6 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_OPEN)
+ privateChannel7 = th.CreateChannelWithClient(th.SystemAdminClient, model.CHANNEL_PRIVATE)
+ app.AddUserToChannel(user, publicChannel6)
+ app.AddUserToChannel(user, privateChannel7)
+
+ // cannot delete by user
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // cannot delete by channel admin
+ MakeUserChannelAdmin(user, publicChannel6)
+ MakeUserChannelAdmin(user, privateChannel7)
+ store.ClearChannelCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // cannot delete by team admin
+ UpdateUserToTeamAdmin(th.BasicUser, team)
+ app.InvalidateAllCaches()
+
+ _, resp = Client.DeleteChannel(publicChannel6.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.DeleteChannel(privateChannel7.Id)
+ CheckForbiddenStatus(t, resp)
+
+ // successful delete by SystemAdmin
+ _, resp = th.SystemAdminClient.DeleteChannel(publicChannel6.Id)
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.DeleteChannel(privateChannel7.Id)
+ CheckNoError(t, resp)
+}
+
func TestGetChannelByName(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -368,6 +759,53 @@ func TestGetChannelMembers(t *testing.T) {
CheckNoError(t, resp)
}
+func TestGetChannelMembersByIds(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ cm, resp := Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{th.BasicUser.Id})
+ CheckNoError(t, resp)
+
+ if (*cm)[0].UserId != th.BasicUser.Id {
+ t.Fatal("returned wrong user")
+ }
+
+ _, resp = Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{})
+ CheckBadRequestStatus(t, resp)
+
+ cm1, resp := Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{"junk"})
+ CheckNoError(t, resp)
+ if len(*cm1) > 0 {
+ t.Fatal("no users should be returned")
+ }
+
+ cm1, resp = Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{"junk", th.BasicUser.Id})
+ CheckNoError(t, resp)
+ if len(*cm1) != 1 {
+ t.Fatal("1 member should be returned")
+ }
+
+ cm1, resp = Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{th.BasicUser2.Id, th.BasicUser.Id})
+ CheckNoError(t, resp)
+ if len(*cm1) != 2 {
+ t.Fatal("2 members should be returned")
+ }
+
+ _, resp = Client.GetChannelMembersByIds("junk", []string{th.BasicUser.Id})
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetChannelMembersByIds(model.NewId(), []string{th.BasicUser.Id})
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{th.BasicUser.Id})
+ CheckUnauthorizedStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.GetChannelMembersByIds(th.BasicChannel.Id, []string{th.BasicUser2.Id, th.BasicUser.Id})
+ CheckNoError(t, resp)
+}
+
func TestGetChannelMember(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -523,6 +961,84 @@ func TestViewChannel(t *testing.T) {
CheckNoError(t, resp)
}
+func TestGetChannelUnread(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ user := th.BasicUser
+ channel := th.BasicChannel
+
+ channelUnread, resp := Client.GetChannelUnread(channel.Id, user.Id)
+ CheckNoError(t, resp)
+ if channelUnread.TeamId != th.BasicTeam.Id {
+ t.Fatal("wrong team id returned for a regular user call")
+ } else if channelUnread.ChannelId != channel.Id {
+ t.Fatal("wrong team id returned for a regular user call")
+ }
+
+ _, resp = Client.GetChannelUnread("junk", user.Id)
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetChannelUnread(channel.Id, "junk")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetChannelUnread(channel.Id, model.NewId())
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.GetChannelUnread(model.NewId(), user.Id)
+ CheckForbiddenStatus(t, resp)
+
+ newUser := th.CreateUser()
+ Client.Login(newUser.Email, newUser.Password)
+ _, resp = Client.GetChannelUnread(th.BasicChannel.Id, user.Id)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+
+ _, resp = th.SystemAdminClient.GetChannelUnread(channel.Id, user.Id)
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.GetChannelUnread(model.NewId(), user.Id)
+ CheckNotFoundStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.GetChannelUnread(channel.Id, model.NewId())
+ CheckNotFoundStatus(t, resp)
+}
+
+func TestGetChannelStats(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ channel := th.CreatePrivateChannel()
+
+ stats, resp := Client.GetChannelStats(channel.Id, "")
+ CheckNoError(t, resp)
+
+ if stats.ChannelId != channel.Id {
+ t.Fatal("couldnt't get extra info")
+ } else if stats.MemberCount != 1 {
+ t.Fatal("got incorrect member count")
+ }
+
+ _, resp = Client.GetChannelStats("junk", "")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetChannelStats(model.NewId(), "")
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetChannelStats(channel.Id, "")
+ CheckUnauthorizedStatus(t, resp)
+
+ th.LoginBasic2()
+
+ _, resp = Client.GetChannelStats(channel.Id, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.GetChannelStats(channel.Id, "")
+ CheckNoError(t, resp)
+}
+
func TestUpdateChannelRoles(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
diff --git a/api4/cluster.go b/api4/cluster.go
new file mode 100644
index 000000000..dbf198590
--- /dev/null
+++ b/api4/cluster.go
@@ -0,0 +1,29 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitCluster() {
+ l4g.Debug(utils.T("api.cluster.init.debug"))
+
+ BaseRoutes.Cluster.Handle("/status", ApiSessionRequired(getClusterStatus)).Methods("GET")
+}
+
+func getClusterStatus(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ infos := app.GetClusterStatus()
+ w.Write([]byte(model.ClusterInfosToJson(infos)))
+}
diff --git a/api4/cluster_test.go b/api4/cluster_test.go
new file mode 100644
index 000000000..6d44ca209
--- /dev/null
+++ b/api4/cluster_test.go
@@ -0,0 +1,22 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "testing"
+)
+
+func TestGetClusterStatus(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+
+ _, resp := th.Client.GetClusterStatus()
+ CheckForbiddenStatus(t, resp)
+
+ infos, resp := th.SystemAdminClient.GetClusterStatus()
+ CheckNoError(t, resp)
+
+ if infos == nil {
+ t.Fatal("should not be nil")
+ }
+}
diff --git a/api4/compliance.go b/api4/compliance.go
new file mode 100644
index 000000000..37196c853
--- /dev/null
+++ b/api4/compliance.go
@@ -0,0 +1,127 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+ "strconv"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+ "github.com/mssola/user_agent"
+)
+
+func InitCompliance() {
+ l4g.Debug(utils.T("api.compliance.init.debug"))
+
+ BaseRoutes.Compliance.Handle("/reports", ApiSessionRequired(createComplianceReport)).Methods("POST")
+ BaseRoutes.Compliance.Handle("/reports", ApiSessionRequired(getComplianceReports)).Methods("GET")
+ BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}", ApiSessionRequired(getComplianceReport)).Methods("GET")
+ BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}/download", ApiSessionRequired(downloadComplianceReport)).Methods("GET")
+}
+
+func createComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
+ job := model.ComplianceFromJson(r.Body)
+ if job == nil {
+ c.SetInvalidParam("compliance")
+ return
+ }
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ job.UserId = c.Session.UserId
+
+ rjob, err := app.SaveComplianceReport(job)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ c.LogAudit("")
+ w.WriteHeader(http.StatusCreated)
+ w.Write([]byte(rjob.ToJson()))
+}
+
+func getComplianceReports(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ crs, err := app.GetComplianceReports(c.Params.Page, c.Params.PerPage)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(crs.ToJson()))
+}
+
+func getComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireReportId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ job, err := app.GetComplianceReport(c.Params.ReportId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(job.ToJson()))
+}
+
+func downloadComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireReportId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ job, err := app.GetComplianceReport(c.Params.ReportId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ reportBytes, err := app.GetComplianceFile(job)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ c.LogAudit("downloaded " + job.Desc)
+
+ w.Header().Set("Cache-Control", "max-age=2592000, public")
+ w.Header().Set("Content-Length", strconv.Itoa(len(reportBytes)))
+ w.Header().Del("Content-Type") // Content-Type will be set automatically by the http writer
+
+ // attach extra headers to trigger a download on IE, Edge, and Safari
+ ua := user_agent.New(r.UserAgent())
+ bname, _ := ua.Browser()
+
+ w.Header().Set("Content-Disposition", "attachment;filename=\""+job.JobName()+".zip\"")
+
+ if bname == "Edge" || bname == "Internet Explorer" || bname == "Safari" {
+ // trim off anything before the final / so we just get the file's name
+ w.Header().Set("Content-Type", "application/octet-stream")
+ }
+
+ w.Write(reportBytes)
+}
diff --git a/api4/context.go b/api4/context.go
index c30a975f2..fe2e8d35b 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -396,6 +396,17 @@ func (c *Context) RequireFileId() *Context {
return c
}
+func (c *Context) RequireReportId() *Context {
+ if c.Err != nil {
+ return c
+ }
+
+ if len(c.Params.ReportId) != 26 {
+ c.SetInvalidUrlParam("report_id")
+ }
+ return c
+}
+
func (c *Context) RequireTeamName() *Context {
if c.Err != nil {
return c
@@ -455,3 +466,15 @@ func (c *Context) RequirePreferenceName() *Context {
return c
}
+
+func (c *Context) RequireHookId() *Context {
+ if c.Err != nil {
+ return c
+ }
+
+ if len(c.Params.HookId) != 26 {
+ c.SetInvalidUrlParam("hook_id")
+ }
+
+ return c
+}
diff --git a/api4/context_test.go b/api4/context_test.go
new file mode 100644
index 000000000..302b7b24b
--- /dev/null
+++ b/api4/context_test.go
@@ -0,0 +1,31 @@
+package api4
+
+import (
+ "net/http"
+ "testing"
+)
+
+func TestRequireHookId(t *testing.T) {
+ c := &Context{}
+ t.Run("WhenHookIdIsValid", func(t *testing.T) {
+ c.Params = &ApiParams{HookId: "abcdefghijklmnopqrstuvwxyz"}
+ c.RequireHookId()
+
+ if c.Err != nil {
+ t.Fatal("Hook Id is Valid. Should not have set error in context")
+ }
+ })
+
+ t.Run("WhenHookIdIsInvalid", func(t *testing.T) {
+ c.Params = &ApiParams{HookId: "abc"}
+ c.RequireHookId()
+
+ if c.Err == nil {
+ t.Fatal("Should have set Error in context")
+ }
+
+ if c.Err.StatusCode != http.StatusBadRequest {
+ t.Fatal("Should have set status as 400")
+ }
+ })
+}
diff --git a/api4/file.go b/api4/file.go
index 924f7e416..6b649918f 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -24,6 +24,11 @@ func InitFile() {
BaseRoutes.Files.Handle("", ApiSessionRequired(uploadFile)).Methods("POST")
BaseRoutes.File.Handle("", ApiSessionRequired(getFile)).Methods("GET")
BaseRoutes.File.Handle("/thumbnail", ApiSessionRequired(getFileThumbnail)).Methods("GET")
+ BaseRoutes.File.Handle("/link", ApiSessionRequired(getFileLink)).Methods("GET")
+ BaseRoutes.File.Handle("/preview", ApiSessionRequired(getFilePreview)).Methods("GET")
+ BaseRoutes.File.Handle("/info", ApiSessionRequired(getFileInfo)).Methods("GET")
+
+ BaseRoutes.PublicFile.Handle("", ApiHandler(getPublicFile)).Methods("GET")
}
@@ -125,6 +130,135 @@ func getFileThumbnail(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func getFileLink(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireFileId()
+ if c.Err != nil {
+ return
+ }
+
+ if !utils.Cfg.FileSettings.EnablePublicLink {
+ c.Err = model.NewLocAppError("getPublicLink", "api.file.get_public_link.disabled.app_error", nil, "")
+ c.Err.StatusCode = http.StatusNotImplemented
+ return
+ }
+
+ info, err := app.GetFileInfo(c.Params.FileId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ if len(info.PostId) == 0 {
+ c.Err = model.NewLocAppError("getPublicLink", "api.file.get_public_link.no_post.app_error", nil, "file_id="+info.Id)
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+
+ resp := make(map[string]string)
+ resp["link"] = app.GeneratePublicLink(c.GetSiteURL(), info)
+
+ w.Write([]byte(model.MapToJson(resp)))
+}
+
+func getFilePreview(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireFileId()
+ if c.Err != nil {
+ return
+ }
+
+ info, err := app.GetFileInfo(c.Params.FileId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ if info.PreviewPath == "" {
+ c.Err = model.NewLocAppError("getFilePreview", "api.file.get_file_preview.no_preview.app_error", nil, "file_id="+info.Id)
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+
+ if data, err := app.ReadFile(info.PreviewPath); err != nil {
+ c.Err = err
+ c.Err.StatusCode = http.StatusNotFound
+ } else if err := writeFileResponse(info.Name, info.MimeType, data, w, r); err != nil {
+ c.Err = err
+ return
+ }
+}
+
+func getFileInfo(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireFileId()
+ if c.Err != nil {
+ return
+ }
+
+ info, err := app.GetFileInfo(c.Params.FileId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ w.Header().Set("Cache-Control", "max-age=2592000, public")
+ w.Write([]byte(info.ToJson()))
+}
+
+func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireFileId()
+ if c.Err != nil {
+ return
+ }
+
+ if !utils.Cfg.FileSettings.EnablePublicLink {
+ c.Err = model.NewLocAppError("getPublicFile", "api.file.get_public_link.disabled.app_error", nil, "")
+ c.Err.StatusCode = http.StatusNotImplemented
+ return
+ }
+
+ info, err := app.GetFileInfo(c.Params.FileId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ hash := r.URL.Query().Get("h")
+
+ if len(hash) == 0 {
+ c.Err = model.NewLocAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "")
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+
+ if hash != app.GeneratePublicLinkHash(info.Id, *utils.Cfg.FileSettings.PublicLinkSalt) {
+ c.Err = model.NewLocAppError("getPublicFile", "api.file.get_file.public_invalid.app_error", nil, "")
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
+
+ if data, err := app.ReadFile(info.Path); err != nil {
+ c.Err = err
+ c.Err.StatusCode = http.StatusNotFound
+ } else if err := writeFileResponse(info.Name, info.MimeType, data, w, r); err != nil {
+ c.Err = err
+ return
+ }
+}
+
func writeFileResponse(filename string, contentType string, bytes []byte, w http.ResponseWriter, r *http.Request) *model.AppError {
w.Header().Set("Cache-Control", "max-age=2592000, public")
w.Header().Set("Content-Length", strconv.Itoa(len(bytes)))
diff --git a/api4/file_test.go b/api4/file_test.go
index f8f57cdb8..5e0824d45 100644
--- a/api4/file_test.go
+++ b/api4/file_test.go
@@ -5,11 +5,14 @@ package api4
import (
"fmt"
+ "net/http"
+ "strings"
"testing"
"time"
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
)
@@ -201,3 +204,269 @@ func TestGetFileThumbnail(t *testing.T) {
_, resp = th.SystemAdminClient.GetFileThumbnail(fileId)
CheckNoError(t, resp)
}
+
+func TestGetFileLink(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ channel := th.BasicChannel
+
+ if utils.Cfg.FileSettings.DriverName == "" {
+ t.Skip("skipping because no file driver is enabled")
+ }
+
+ enablePublicLink := utils.Cfg.FileSettings.EnablePublicLink
+ publicLinkSalt := *utils.Cfg.FileSettings.PublicLinkSalt
+ defer func() {
+ utils.Cfg.FileSettings.EnablePublicLink = enablePublicLink
+ *utils.Cfg.FileSettings.PublicLinkSalt = publicLinkSalt
+ }()
+ utils.Cfg.FileSettings.EnablePublicLink = true
+ *utils.Cfg.FileSettings.PublicLinkSalt = model.NewId()
+
+ fileId := ""
+ if data, err := readTestFile("test.png"); err != nil {
+ t.Fatal(err)
+ } else {
+ fileResp, resp := Client.UploadFile(data, channel.Id, "test.png")
+ CheckNoError(t, resp)
+
+ fileId = fileResp.FileInfos[0].Id
+ }
+
+ link, resp := Client.GetFileLink(fileId)
+ CheckBadRequestStatus(t, resp)
+
+ // Hacky way to assign file to a post (usually would be done by CreatePost call)
+ store.Must(app.Srv.Store.FileInfo().AttachToPost(fileId, th.BasicPost.Id))
+
+ utils.Cfg.FileSettings.EnablePublicLink = false
+ _, resp = Client.GetFileLink(fileId)
+ CheckNotImplementedStatus(t, resp)
+
+ // Wait a bit for files to ready
+ time.Sleep(2 * time.Second)
+
+ utils.Cfg.FileSettings.EnablePublicLink = true
+ link, resp = Client.GetFileLink(fileId)
+ CheckNoError(t, resp)
+ if link == "" {
+ t.Fatal("should've received public link")
+ }
+
+ _, resp = Client.GetFileLink("junk")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetFileLink(model.NewId())
+ CheckNotFoundStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetFileLink(fileId)
+ CheckUnauthorizedStatus(t, resp)
+
+ otherUser := th.CreateUser()
+ Client.Login(otherUser.Email, otherUser.Password)
+ _, resp = Client.GetFileLink(fileId)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = th.SystemAdminClient.GetFileLink(fileId)
+ CheckNoError(t, resp)
+
+ if result := <-app.Srv.Store.FileInfo().Get(fileId); result.Err != nil {
+ t.Fatal(result.Err)
+ } else {
+ cleanupTestFile(result.Data.(*model.FileInfo))
+ }
+}
+
+func TestGetFilePreview(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ channel := th.BasicChannel
+
+ if utils.Cfg.FileSettings.DriverName == "" {
+ t.Skip("skipping because no file driver is enabled")
+ }
+
+ fileId := ""
+ var sent []byte
+ var err error
+ if sent, err = readTestFile("test.png"); err != nil {
+ t.Fatal(err)
+ } else {
+ fileResp, resp := Client.UploadFile(sent, channel.Id, "test.png")
+ CheckNoError(t, resp)
+
+ fileId = fileResp.FileInfos[0].Id
+ }
+
+ // Wait a bit for files to ready
+ time.Sleep(2 * time.Second)
+
+ data, resp := Client.GetFilePreview(fileId)
+ CheckNoError(t, resp)
+
+ if data == nil || len(data) == 0 {
+ t.Fatal("should not be empty")
+ }
+
+ _, resp = Client.GetFilePreview("junk")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetFilePreview(model.NewId())
+ CheckNotFoundStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetFilePreview(fileId)
+ CheckUnauthorizedStatus(t, resp)
+
+ otherUser := th.CreateUser()
+ Client.Login(otherUser.Email, otherUser.Password)
+ _, resp = Client.GetFilePreview(fileId)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = th.SystemAdminClient.GetFilePreview(fileId)
+ CheckNoError(t, resp)
+}
+
+func TestGetFileInfo(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ user := th.BasicUser
+ channel := th.BasicChannel
+
+ if utils.Cfg.FileSettings.DriverName == "" {
+ t.Skip("skipping because no file driver is enabled")
+ }
+
+ fileId := ""
+ var sent []byte
+ var err error
+ if sent, err = readTestFile("test.png"); err != nil {
+ t.Fatal(err)
+ } else {
+ fileResp, resp := Client.UploadFile(sent, channel.Id, "test.png")
+ CheckNoError(t, resp)
+
+ fileId = fileResp.FileInfos[0].Id
+ }
+
+ // Wait a bit for files to ready
+ time.Sleep(2 * time.Second)
+
+ info, resp := Client.GetFileInfo(fileId)
+ CheckNoError(t, resp)
+
+ if err != nil {
+ t.Fatal(err)
+ } else if info.Id != fileId {
+ t.Fatal("got incorrect file")
+ } else if info.CreatorId != user.Id {
+ t.Fatal("file should be assigned to user")
+ } else if info.PostId != "" {
+ t.Fatal("file shouldn't have a post")
+ } else if info.Path != "" {
+ t.Fatal("file path shouldn't have been returned to client")
+ } else if info.ThumbnailPath != "" {
+ t.Fatal("file thumbnail path shouldn't have been returned to client")
+ } else if info.PreviewPath != "" {
+ t.Fatal("file preview path shouldn't have been returned to client")
+ } else if info.MimeType != "image/png" {
+ t.Fatal("mime type should've been image/png")
+ }
+
+ _, resp = Client.GetFileInfo("junk")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetFileInfo(model.NewId())
+ CheckNotFoundStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetFileInfo(fileId)
+ CheckUnauthorizedStatus(t, resp)
+
+ otherUser := th.CreateUser()
+ Client.Login(otherUser.Email, otherUser.Password)
+ _, resp = Client.GetFileInfo(fileId)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = th.SystemAdminClient.GetFileInfo(fileId)
+ CheckNoError(t, resp)
+}
+
+func TestGetPublicFile(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ channel := th.BasicChannel
+
+ if utils.Cfg.FileSettings.DriverName == "" {
+ t.Skip("skipping because no file driver is enabled")
+ }
+
+ enablePublicLink := utils.Cfg.FileSettings.EnablePublicLink
+ publicLinkSalt := *utils.Cfg.FileSettings.PublicLinkSalt
+ defer func() {
+ utils.Cfg.FileSettings.EnablePublicLink = enablePublicLink
+ *utils.Cfg.FileSettings.PublicLinkSalt = publicLinkSalt
+ }()
+ utils.Cfg.FileSettings.EnablePublicLink = true
+ *utils.Cfg.FileSettings.PublicLinkSalt = GenerateTestId()
+
+ fileId := ""
+ if data, err := readTestFile("test.png"); err != nil {
+ t.Fatal(err)
+ } else {
+ fileResp, resp := Client.UploadFile(data, channel.Id, "test.png")
+ CheckNoError(t, resp)
+
+ fileId = fileResp.FileInfos[0].Id
+ }
+
+ // Hacky way to assign file to a post (usually would be done by CreatePost call)
+ store.Must(app.Srv.Store.FileInfo().AttachToPost(fileId, th.BasicPost.Id))
+
+ result := <-app.Srv.Store.FileInfo().Get(fileId)
+ info := result.Data.(*model.FileInfo)
+ link := app.GeneratePublicLink(Client.Url, info)
+
+ // Wait a bit for files to ready
+ time.Sleep(2 * time.Second)
+
+ if resp, err := http.Get(link); err != nil || resp.StatusCode != http.StatusOK {
+ t.Log(link)
+ t.Fatal("failed to get image with public link", err)
+ }
+
+ if resp, err := http.Get(link[:strings.LastIndex(link, "?")]); err == nil && resp.StatusCode != http.StatusBadRequest {
+ t.Fatal("should've failed to get image with public link without hash", resp.Status)
+ }
+
+ utils.Cfg.FileSettings.EnablePublicLink = false
+ if resp, err := http.Get(link); err == nil && resp.StatusCode != http.StatusNotImplemented {
+ t.Fatal("should've failed to get image with disabled public link")
+ }
+
+ // test after the salt has changed
+ utils.Cfg.FileSettings.EnablePublicLink = true
+ *utils.Cfg.FileSettings.PublicLinkSalt = GenerateTestId()
+
+ if resp, err := http.Get(link); err == nil && resp.StatusCode != http.StatusBadRequest {
+ t.Fatal("should've failed to get image with public link after salt changed")
+ }
+
+ if resp, err := http.Get(link); err == nil && resp.StatusCode != http.StatusBadRequest {
+ t.Fatal("should've failed to get image with public link after salt changed")
+ }
+
+ if err := cleanupTestFile(store.Must(app.Srv.Store.FileInfo().Get(fileId)).(*model.FileInfo)); err != nil {
+ t.Fatal(err)
+ }
+
+ cleanupTestFile(info)
+}
diff --git a/api4/ldap.go b/api4/ldap.go
new file mode 100644
index 000000000..e138fdc97
--- /dev/null
+++ b/api4/ldap.go
@@ -0,0 +1,45 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitLdap() {
+ l4g.Debug(utils.T("api.ldap.init.debug"))
+
+ BaseRoutes.LDAP.Handle("/sync", ApiSessionRequired(syncLdap)).Methods("POST")
+ BaseRoutes.LDAP.Handle("/test", ApiSessionRequired(testLdap)).Methods("POST")
+}
+
+func syncLdap(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ app.SyncLdap()
+
+ ReturnStatusOK(w)
+}
+
+func testLdap(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ if err := app.TestLdap(); err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+}
diff --git a/api4/ldap_test.go b/api4/ldap_test.go
new file mode 100644
index 000000000..d8eaedc50
--- /dev/null
+++ b/api4/ldap_test.go
@@ -0,0 +1,30 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "testing"
+)
+
+func TestLdapTest(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+
+ _, resp := th.Client.TestLdap()
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.TestLdap()
+ CheckNotImplementedStatus(t, resp)
+}
+
+func TestLdapSync(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+
+ _, resp := th.SystemAdminClient.SyncLdap()
+ CheckNoError(t, resp)
+
+ _, resp = th.Client.SyncLdap()
+ CheckForbiddenStatus(t, resp)
+}
diff --git a/api4/params.go b/api4/params.go
index b1688a859..15f632195 100644
--- a/api4/params.go
+++ b/api4/params.go
@@ -24,6 +24,7 @@ type ApiParams struct {
FileId string
CommandId string
HookId string
+ ReportId string
EmojiId string
Email string
Username string
@@ -68,6 +69,10 @@ func ApiParamsFromRequest(r *http.Request) *ApiParams {
params.HookId = val
}
+ if val, ok := props["report_id"]; ok {
+ params.ReportId = val
+ }
+
if val, ok := props["emoji_id"]; ok {
params.EmojiId = val
}
diff --git a/api4/saml.go b/api4/saml.go
new file mode 100644
index 000000000..e2c35f30d
--- /dev/null
+++ b/api4/saml.go
@@ -0,0 +1,171 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "mime/multipart"
+ "net/http"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitSaml() {
+ l4g.Debug(utils.T("api.saml.init.debug"))
+
+ BaseRoutes.SAML.Handle("/metadata", ApiHandler(getSamlMetadata)).Methods("GET")
+
+ BaseRoutes.SAML.Handle("/certificate/public", ApiSessionRequired(addSamlPublicCertificate)).Methods("POST")
+ BaseRoutes.SAML.Handle("/certificate/private", ApiSessionRequired(addSamlPrivateCertificate)).Methods("POST")
+ BaseRoutes.SAML.Handle("/certificate/idp", ApiSessionRequired(addSamlIdpCertificate)).Methods("POST")
+
+ BaseRoutes.SAML.Handle("/certificate/public", ApiSessionRequired(removeSamlPublicCertificate)).Methods("DELETE")
+ BaseRoutes.SAML.Handle("/certificate/private", ApiSessionRequired(removeSamlPrivateCertificate)).Methods("DELETE")
+ BaseRoutes.SAML.Handle("/certificate/idp", ApiSessionRequired(removeSamlIdpCertificate)).Methods("DELETE")
+
+ BaseRoutes.SAML.Handle("/certificate/status", ApiSessionRequired(getSamlCertificateStatus)).Methods("GET")
+}
+
+func getSamlMetadata(c *Context, w http.ResponseWriter, r *http.Request) {
+ metadata, err := app.GetSamlMetadata()
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Header().Set("Content-Type", "application/xml")
+ w.Header().Set("Content-Disposition", "attachment; filename=\"metadata.xml\"")
+ w.Write([]byte(metadata))
+}
+
+func parseSamlCertificateRequest(r *http.Request) (*multipart.FileHeader, *model.AppError) {
+ err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize)
+ if err != nil {
+ return nil, model.NewAppError("addSamlCertificate", "api.admin.add_certificate.no_file.app_error", nil, err.Error(), http.StatusBadRequest)
+ }
+
+ m := r.MultipartForm
+
+ fileArray, ok := m.File["certificate"]
+ if !ok {
+ return nil, model.NewAppError("addSamlCertificate", "api.admin.add_certificate.no_file.app_error", nil, "", http.StatusBadRequest)
+ }
+
+ if len(fileArray) <= 0 {
+ return nil, model.NewAppError("addSamlCertificate", "api.admin.add_certificate.array.app_error", nil, "", http.StatusBadRequest)
+ }
+
+ return fileArray[0], nil
+}
+
+func addSamlPublicCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ fileData, err := parseSamlCertificateRequest(r)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if err := app.AddSamlPublicCertificate(fileData); err != nil {
+ c.Err = err
+ return
+ }
+ ReturnStatusOK(w)
+}
+
+func addSamlPrivateCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ fileData, err := parseSamlCertificateRequest(r)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if err := app.AddSamlPrivateCertificate(fileData); err != nil {
+ c.Err = err
+ return
+ }
+ ReturnStatusOK(w)
+}
+
+func addSamlIdpCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ fileData, err := parseSamlCertificateRequest(r)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if err := app.AddSamlIdpCertificate(fileData); err != nil {
+ c.Err = err
+ return
+ }
+ ReturnStatusOK(w)
+}
+
+func removeSamlPublicCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ if err := app.RemoveSamlPublicCertificate(); err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+}
+
+func removeSamlPrivateCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ if err := app.RemoveSamlPrivateCertificate(); err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+}
+
+func removeSamlIdpCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ if err := app.RemoveSamlIdpCertificate(); err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+}
+
+func getSamlCertificateStatus(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ status := app.GetSamlCertificateStatus()
+ w.Write([]byte(status.ToJson()))
+}
diff --git a/api4/saml_test.go b/api4/saml_test.go
new file mode 100644
index 000000000..7e4722a3b
--- /dev/null
+++ b/api4/saml_test.go
@@ -0,0 +1,19 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "testing"
+)
+
+func TestGetSamlMetadata(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ _, resp := Client.GetSamlMetadata()
+ CheckNotImplementedStatus(t, resp)
+
+ // Rest is tested by enterprise tests
+}
diff --git a/api4/system.go b/api4/system.go
index 94f4718a2..f12d802ef 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -7,6 +7,8 @@ import (
"net/http"
l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
)
@@ -14,8 +16,98 @@ func InitSystem() {
l4g.Debug(utils.T("api.system.init.debug"))
BaseRoutes.System.Handle("/ping", ApiHandler(getSystemPing)).Methods("GET")
+ BaseRoutes.ApiRoot.Handle("/config", ApiSessionRequired(getConfig)).Methods("GET")
+ BaseRoutes.ApiRoot.Handle("/config/reload", ApiSessionRequired(configReload)).Methods("POST")
+ BaseRoutes.ApiRoot.Handle("/email/test", ApiSessionRequired(testEmail)).Methods("POST")
+ BaseRoutes.ApiRoot.Handle("/database/recycle", ApiSessionRequired(databaseRecycle)).Methods("POST")
+ BaseRoutes.ApiRoot.Handle("/caches/invalidate", ApiSessionRequired(invalidateCaches)).Methods("POST")
+
+ BaseRoutes.ApiRoot.Handle("/logs", ApiSessionRequired(getLogs)).Methods("GET")
}
func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
ReturnStatusOK(w)
}
+
+func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ err := app.TestEmail(c.Session.UserId, utils.Cfg)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+}
+
+func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ cfg := app.GetConfig()
+
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+ w.Write([]byte(cfg.ToJson()))
+}
+
+func configReload(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ app.ReloadConfig()
+
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+ ReturnStatusOK(w)
+}
+
+func databaseRecycle(c *Context, w http.ResponseWriter, r *http.Request) {
+
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ app.RecycleDatabaseConnection()
+
+ ReturnStatusOK(w)
+}
+
+func invalidateCaches(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ err := app.InvalidateAllCaches()
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+ ReturnStatusOK(w)
+}
+
+func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ lines, err := app.GetLogs(c.Params.Page, c.Params.PerPage)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(model.ArrayToJson(lines)))
+}
diff --git a/api4/system_test.go b/api4/system_test.go
index d9514eabc..80b4996ca 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -1,7 +1,12 @@
package api4
import (
+ "strings"
"testing"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
)
func TestGetPing(t *testing.T) {
@@ -10,9 +15,174 @@ func TestGetPing(t *testing.T) {
Client := th.Client
b, _ := Client.GetPing()
- if b == false {
+ if b == false {
t.Fatal()
}
}
+func TestGetConfig(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ _, resp := Client.GetConfig()
+ CheckForbiddenStatus(t, resp)
+
+ cfg, resp := th.SystemAdminClient.GetConfig()
+ CheckNoError(t, resp)
+
+ if len(cfg.TeamSettings.SiteName) == 0 {
+ t.Fatal()
+ }
+
+ if *cfg.LdapSettings.BindPassword != model.FAKE_SETTING && len(*cfg.LdapSettings.BindPassword) != 0 {
+ t.Fatal("did not sanitize properly")
+ }
+ if *cfg.FileSettings.PublicLinkSalt != model.FAKE_SETTING {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.FileSettings.AmazonS3SecretAccessKey != model.FAKE_SETTING && len(cfg.FileSettings.AmazonS3SecretAccessKey) != 0 {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.EmailSettings.PasswordResetSalt != model.FAKE_SETTING {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(cfg.EmailSettings.SMTPPassword) != 0 {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.GitLabSettings.Secret != model.FAKE_SETTING && len(cfg.GitLabSettings.Secret) != 0 {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.SqlSettings.DataSource != model.FAKE_SETTING {
+ t.Fatal("did not sanitize properly")
+ }
+ if cfg.SqlSettings.AtRestEncryptKey != model.FAKE_SETTING {
+ t.Fatal("did not sanitize properly")
+ }
+ if !strings.Contains(strings.Join(cfg.SqlSettings.DataSourceReplicas, " "), model.FAKE_SETTING) && len(cfg.SqlSettings.DataSourceReplicas) != 0 {
+ t.Fatal("did not sanitize properly")
+ }
+}
+
+func TestReloadConfig(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ flag, resp := Client.ReloadConfig()
+ CheckForbiddenStatus(t, resp)
+ if flag == true {
+ t.Fatal("should not Reload the config due no permission.")
+ }
+
+ flag, resp = th.SystemAdminClient.ReloadConfig()
+ CheckNoError(t, resp)
+ if flag == false {
+ t.Fatal("should Reload the config")
+ }
+
+ utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
+ *utils.Cfg.TeamSettings.EnableOpenServer = true
+}
+
+func TestEmailTest(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ SendEmailNotifications := utils.Cfg.EmailSettings.SendEmailNotifications
+ SMTPServer := utils.Cfg.EmailSettings.SMTPServer
+ SMTPPort := utils.Cfg.EmailSettings.SMTPPort
+ FeedbackEmail := utils.Cfg.EmailSettings.FeedbackEmail
+ defer func() {
+ utils.Cfg.EmailSettings.SendEmailNotifications = SendEmailNotifications
+ utils.Cfg.EmailSettings.SMTPServer = SMTPServer
+ utils.Cfg.EmailSettings.SMTPPort = SMTPPort
+ utils.Cfg.EmailSettings.FeedbackEmail = FeedbackEmail
+ }()
+
+ utils.Cfg.EmailSettings.SendEmailNotifications = false
+ utils.Cfg.EmailSettings.SMTPServer = ""
+ utils.Cfg.EmailSettings.SMTPPort = ""
+ utils.Cfg.EmailSettings.FeedbackEmail = ""
+ _, resp := Client.TestEmail()
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.TestEmail()
+ CheckErrorMessage(t, resp, "api.admin.test_email.missing_server")
+ CheckInternalErrorStatus(t, resp)
+}
+
+func TestDatabaseRecycle(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ _, resp := Client.DatabaseRecycle()
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = th.SystemAdminClient.DatabaseRecycle()
+ CheckNoError(t, resp)
+}
+
+func TestInvalidateCaches(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ flag, resp := Client.InvalidateCaches()
+ CheckForbiddenStatus(t, resp)
+ if flag == true {
+ t.Fatal("should not clean the cache due no permission.")
+ }
+
+ flag, resp = th.SystemAdminClient.InvalidateCaches()
+ CheckNoError(t, resp)
+ if flag == false {
+ t.Fatal("should clean the cache")
+ }
+}
+
+func TestGetLogs(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ for i := 0; i < 20; i++ {
+ l4g.Info(i)
+ }
+
+ logs, resp := th.SystemAdminClient.GetLogs(0, 10)
+ CheckNoError(t, resp)
+
+ if len(logs) != 10 {
+ t.Log(len(logs))
+ t.Fatal("wrong length")
+ }
+
+ logs, resp = th.SystemAdminClient.GetLogs(1, 10)
+ CheckNoError(t, resp)
+
+ if len(logs) != 10 {
+ t.Log(len(logs))
+ t.Fatal("wrong length")
+ }
+
+ logs, resp = th.SystemAdminClient.GetLogs(-1, -1)
+ CheckNoError(t, resp)
+
+ if len(logs) != 0 {
+ t.Fatal("should not be empty")
+ }
+
+ _, resp = Client.GetLogs(0, 10)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetLogs(0, 10)
+ CheckUnauthorizedStatus(t, resp)
+}
diff --git a/api4/team.go b/api4/team.go
index 71046c790..1e63273e6 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -21,11 +21,16 @@ func InitTeam() {
BaseRoutes.TeamsForUser.Handle("/unread", ApiSessionRequired(getTeamsUnreadForUser)).Methods("GET")
BaseRoutes.Team.Handle("", ApiSessionRequired(getTeam)).Methods("GET")
+ BaseRoutes.Team.Handle("", ApiSessionRequired(updateTeam)).Methods("PUT")
BaseRoutes.Team.Handle("/stats", ApiSessionRequired(getTeamStats)).Methods("GET")
- BaseRoutes.Team.Handle("/members", ApiSessionRequired(getTeamMembers)).Methods("GET")
+ BaseRoutes.TeamMembers.Handle("", ApiSessionRequired(getTeamMembers)).Methods("GET")
+ BaseRoutes.TeamMembers.Handle("/ids", ApiSessionRequired(getTeamMembersByIds)).Methods("POST")
+
+ BaseRoutes.TeamForUser.Handle("/unread", ApiSessionRequired(getTeamUnread)).Methods("GET")
BaseRoutes.TeamByName.Handle("", ApiSessionRequired(getTeamByName)).Methods("GET")
BaseRoutes.TeamMember.Handle("", ApiSessionRequired(getTeamMember)).Methods("GET")
+ BaseRoutes.TeamByName.Handle("/exists", ApiSessionRequired(teamExists)).Methods("GET")
BaseRoutes.TeamMember.Handle("/roles", ApiSessionRequired(updateTeamMemberRoles)).Methods("PUT")
}
@@ -72,6 +77,11 @@ func getTeam(c *Context, w http.ResponseWriter, r *http.Request) {
}
func getTeamByName(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamName()
+ if c.Err != nil {
+ return
+ }
+
if team, err := app.GetTeamByName(c.Params.TeamName); err != nil {
c.Err = err
return
@@ -86,6 +96,36 @@ func getTeamByName(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamId()
+ if c.Err != nil {
+ return
+ }
+
+ team := model.TeamFromJson(r.Body)
+
+ if team == nil {
+ c.SetInvalidParam("team")
+ return
+ }
+
+ team.Id = c.Params.TeamId
+
+ if !app.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_MANAGE_TEAM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_TEAM)
+ return
+ }
+
+ updatedTeam, err := app.UpdateTeam(team)
+
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(updatedTeam.ToJson()))
+}
+
func getTeamsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireUserId()
if c.Err != nil {
@@ -168,6 +208,58 @@ func getTeamMembers(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func getTeamMembersByIds(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamId()
+ if c.Err != nil {
+ return
+ }
+
+ userIds := model.ArrayFromJson(r.Body)
+
+ if len(userIds) == 0 {
+ c.SetInvalidParam("user_ids")
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_VIEW_TEAM) {
+ c.SetPermissionError(model.PERMISSION_VIEW_TEAM)
+ return
+ }
+
+ members, err := app.GetTeamMembersByIds(c.Params.TeamId, userIds)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(model.TeamMembersToJson(members)))
+}
+
+func getTeamUnread(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamId().RequireUserId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionToUser(c.Session, c.Params.UserId) {
+ c.SetPermissionError(model.PERMISSION_EDIT_OTHER_USERS)
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_VIEW_TEAM) {
+ c.SetPermissionError(model.PERMISSION_VIEW_TEAM)
+ return
+ }
+
+ unreadTeam, err := app.GetTeamUnread(c.Params.TeamId, c.Params.UserId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(unreadTeam.ToJson()))
+}
+
func getTeamStats(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireTeamId()
if c.Err != nil {
@@ -232,3 +324,21 @@ func getAllTeams(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(model.TeamListToJson(teams)))
}
+
+func teamExists(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireTeamName()
+ if c.Err != nil {
+ return
+ }
+
+ resp := make(map[string]bool)
+
+ if _, err := app.GetTeamByName(c.Params.TeamName); err != nil {
+ resp["exists"] = false
+ } else {
+ resp["exists"] = true
+ }
+
+ w.Write([]byte(model.MapBoolToJson(resp)))
+ return
+}
diff --git a/api4/team_test.go b/api4/team_test.go
index e54cf4414..4b69f5b62 100644
--- a/api4/team_test.go
+++ b/api4/team_test.go
@@ -114,6 +114,138 @@ func TestGetTeam(t *testing.T) {
CheckNoError(t, resp)
}
+func TestGetTeamUnread(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ teamUnread, resp := Client.GetTeamUnread(th.BasicTeam.Id, th.BasicUser.Id)
+ CheckNoError(t, resp)
+ if teamUnread.TeamId != th.BasicTeam.Id {
+ t.Fatal("wrong team id returned for regular user call")
+ }
+
+ _, resp = Client.GetTeamUnread("junk", th.BasicUser.Id)
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetTeamUnread(th.BasicTeam.Id, "junk")
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.GetTeamUnread(model.NewId(), th.BasicUser.Id)
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.GetTeamUnread(th.BasicTeam.Id, model.NewId())
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetTeamUnread(th.BasicTeam.Id, th.BasicUser.Id)
+ CheckUnauthorizedStatus(t, resp)
+
+ teamUnread, resp = th.SystemAdminClient.GetTeamUnread(th.BasicTeam.Id, th.BasicUser.Id)
+ CheckNoError(t, resp)
+ if teamUnread.TeamId != th.BasicTeam.Id {
+ t.Fatal("wrong team id returned")
+ }
+}
+
+func TestUpdateTeam(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ team := &model.Team{DisplayName: "Name", Description: "Some description", AllowOpenInvite: false, InviteId: "inviteid0", Name: "z-z-" + model.NewId() + "a", Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TEAM_OPEN}
+ team, _ = Client.CreateTeam(team)
+
+ team.Description = "updated description"
+ uteam, resp := Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.Description != "updated description" {
+ t.Fatal("Update failed")
+ }
+
+ team.DisplayName = "Updated Name"
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.DisplayName != "Updated Name" {
+ t.Fatal("Update failed")
+ }
+
+ team.AllowOpenInvite = true
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.AllowOpenInvite != true {
+ t.Fatal("Update failed")
+ }
+
+ team.InviteId = "inviteid1"
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.InviteId != "inviteid1" {
+ t.Fatal("Update failed")
+ }
+
+ team.Name = "Updated name"
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.Name == "Updated name" {
+ t.Fatal("Should not update name")
+ }
+
+ team.Email = "test@domain.com"
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.Email == "test@domain.com" {
+ t.Fatal("Should not update email")
+ }
+
+ team.Type = model.TEAM_INVITE
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.Type == model.TEAM_INVITE {
+ t.Fatal("Should not update type")
+ }
+
+ team.AllowedDomains = "domain"
+ uteam, resp = Client.UpdateTeam(team)
+ CheckNoError(t, resp)
+
+ if uteam.AllowedDomains == "domain" {
+ t.Fatal("Should not update allowed_domains")
+ }
+
+ originalTeamId := team.Id
+ team.Id = model.NewId()
+
+ if r, err := Client.DoApiPut(Client.GetTeamRoute(originalTeamId), team.ToJson()); err != nil {
+ t.Fatal(err)
+ } else {
+ uteam = model.TeamFromJson(r.Body)
+ }
+
+ if uteam.Id != originalTeamId {
+ t.Fatal("wrong team id")
+ }
+
+ team.Id = "fake"
+ _, resp = Client.UpdateTeam(team)
+ CheckBadRequestStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.UpdateTeam(team)
+ CheckUnauthorizedStatus(t, resp)
+
+ team.Id = originalTeamId
+ _, resp = th.SystemAdminClient.UpdateTeam(team)
+ CheckNoError(t, resp)
+}
+
func TestGetAllTeams(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -123,10 +255,11 @@ func TestGetAllTeams(t *testing.T) {
_, resp := Client.CreateTeam(team)
CheckNoError(t, resp)
- rrteams, resp := Client.GetAllTeams("", 1, 1)
+ rrteams, resp := Client.GetAllTeams("", 0, 1)
CheckNoError(t, resp)
- if (len(rrteams) != 1) {
+ if len(rrteams) != 1 {
+ t.Log(len(rrteams))
t.Fatal("wrong number of teams - should be 1")
}
@@ -139,21 +272,21 @@ func TestGetAllTeams(t *testing.T) {
rrteams1, resp := Client.GetAllTeams("", 1, 0)
CheckNoError(t, resp)
- if (len(rrteams1) != 0) {
+ if len(rrteams1) != 0 {
t.Fatal("wrong number of teams - should be 0")
}
rrteams2, resp := th.SystemAdminClient.GetAllTeams("", 1, 1)
CheckNoError(t, resp)
- if (len(rrteams2) != 1) {
+ if len(rrteams2) != 1 {
t.Fatal("wrong number of teams - should be 1")
}
rrteams2, resp = Client.GetAllTeams("", 1, 0)
CheckNoError(t, resp)
- if (len(rrteams2) != 0) {
+ if len(rrteams2) != 0 {
t.Fatal("wrong number of teams - should be 0")
}
@@ -331,6 +464,44 @@ func TestGetTeamMembers(t *testing.T) {
CheckNoError(t, resp)
}
+func TestGetTeamMembersByIds(t *testing.T) {
+ th := Setup().InitBasic()
+ defer TearDown()
+ Client := th.Client
+
+ tm, resp := Client.GetTeamMembersByIds(th.BasicTeam.Id, []string{th.BasicUser.Id})
+ CheckNoError(t, resp)
+
+ if tm[0].UserId != th.BasicUser.Id {
+ t.Fatal("returned wrong user")
+ }
+
+ _, resp = Client.GetTeamMembersByIds(th.BasicTeam.Id, []string{})
+ CheckBadRequestStatus(t, resp)
+
+ tm1, resp := Client.GetTeamMembersByIds(th.BasicTeam.Id, []string{"junk"})
+ CheckNoError(t, resp)
+ if len(tm1) > 0 {
+ t.Fatal("no users should be returned")
+ }
+
+ tm1, resp = Client.GetTeamMembersByIds(th.BasicTeam.Id, []string{"junk", th.BasicUser.Id})
+ CheckNoError(t, resp)
+ if len(tm1) != 1 {
+ t.Fatal("1 user should be returned")
+ }
+
+ tm1, resp = Client.GetTeamMembersByIds("junk", []string{th.BasicUser.Id})
+ CheckBadRequestStatus(t, resp)
+
+ tm1, resp = Client.GetTeamMembersByIds(model.NewId(), []string{th.BasicUser.Id})
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetTeamMembersByIds(th.BasicTeam.Id, []string{th.BasicUser.Id})
+ CheckUnauthorizedStatus(t, resp)
+}
+
func TestGetTeamStats(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -493,4 +664,29 @@ func TestGetMyTeamsUnread(t *testing.T) {
Client.Logout()
_, resp = Client.GetTeamsUnreadForUser(user.Id, "")
CheckUnauthorizedStatus(t, resp)
-} \ No newline at end of file
+}
+
+func TestTeamExists(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ team := th.BasicTeam
+
+ th.LoginBasic()
+
+ exists, resp := Client.TeamExists(team.Name, "")
+ CheckNoError(t, resp)
+ if exists != true {
+ t.Fatal("team should exist")
+ }
+
+ exists, resp = Client.TeamExists("testingteam", "")
+ CheckNoError(t, resp)
+ if exists != false {
+ t.Fatal("team should not exist")
+ }
+
+ Client.Logout()
+ _, resp = Client.TeamExists(team.Name, "")
+ CheckUnauthorizedStatus(t, resp)
+}
diff --git a/api4/user.go b/api4/user.go
index d2cc1034a..1668f9c2c 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -11,6 +11,7 @@ import (
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
)
@@ -20,12 +21,14 @@ func InitUser() {
BaseRoutes.Users.Handle("", ApiHandler(createUser)).Methods("POST")
BaseRoutes.Users.Handle("", ApiSessionRequired(getUsers)).Methods("GET")
BaseRoutes.Users.Handle("/ids", ApiSessionRequired(getUsersByIds)).Methods("POST")
+ BaseRoutes.Users.Handle("/autocomplete", ApiSessionRequired(autocompleteUsers)).Methods("GET")
BaseRoutes.User.Handle("", ApiSessionRequired(getUser)).Methods("GET")
BaseRoutes.User.Handle("/image", ApiSessionRequired(getProfileImage)).Methods("GET")
BaseRoutes.User.Handle("/image", ApiSessionRequired(setProfileImage)).Methods("POST")
BaseRoutes.User.Handle("", ApiSessionRequired(updateUser)).Methods("PUT")
BaseRoutes.User.Handle("/patch", ApiSessionRequired(patchUser)).Methods("PUT")
+ BaseRoutes.User.Handle("/mfa", ApiSessionRequired(updateUserMfa)).Methods("PUT")
BaseRoutes.User.Handle("", ApiSessionRequired(deleteUser)).Methods("DELETE")
BaseRoutes.User.Handle("/roles", ApiSessionRequired(updateUserRoles)).Methods("PUT")
BaseRoutes.User.Handle("/password", ApiSessionRequired(updatePassword)).Methods("PUT")
@@ -331,6 +334,56 @@ func getUsersByIds(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
+ channelId := r.URL.Query().Get("in_channel")
+ teamId := r.URL.Query().Get("in_team")
+ name := r.URL.Query().Get("name")
+
+ autocomplete := new(model.UserAutocomplete)
+ var err *model.AppError
+
+ searchOptions := map[string]bool{}
+
+ hideFullName := !utils.Cfg.PrivacySettings.ShowFullName
+ if hideFullName && !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY_NO_FULL_NAME] = true
+ } else {
+ searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY] = true
+ }
+
+ if len(teamId) > 0 {
+ if len(channelId) > 0 {
+ if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ result, _ := app.AutocompleteUsersInChannel(teamId, channelId, name, searchOptions, c.IsSystemAdmin())
+ autocomplete.Users = result.InChannel
+ autocomplete.OutOfChannel = result.OutOfChannel
+ } else {
+ if !app.SessionHasPermissionToTeam(c.Session, teamId, model.PERMISSION_VIEW_TEAM) {
+ c.SetPermissionError(model.PERMISSION_VIEW_TEAM)
+ return
+ }
+
+ result, _ := app.AutocompleteUsersInTeam(teamId, name, searchOptions, c.IsSystemAdmin())
+ autocomplete.Users = result.InTeam
+ }
+ } else {
+ // No permission check required
+ result, _ := app.SearchUsersInTeam("", name, searchOptions, c.IsSystemAdmin())
+ autocomplete.Users = result
+ }
+
+ if err != nil {
+ c.Err = err
+ return
+ } else {
+ w.Write([]byte((autocomplete.ToJson())))
+ }
+}
+
func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireUserId()
if c.Err != nil {
@@ -441,6 +494,45 @@ func updateUserRoles(c *Context, w http.ResponseWriter, r *http.Request) {
ReturnStatusOK(w)
}
+func updateUserMfa(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireUserId()
+ if c.Err != nil {
+ return
+ }
+
+ if !app.SessionHasPermissionToUser(c.Session, c.Params.UserId) {
+ c.SetPermissionError(model.PERMISSION_EDIT_OTHER_USERS)
+ return
+ }
+
+ props := model.StringInterfaceFromJson(r.Body)
+
+ activate, ok := props["activate"].(bool)
+ if !ok {
+ c.SetInvalidParam("activate")
+ return
+ }
+
+ code := ""
+ if activate {
+ code, ok = props["code"].(string)
+ if !ok || len(code) == 0 {
+ c.SetInvalidParam("code")
+ return
+ }
+ }
+
+ c.LogAudit("attempt")
+
+ if err := app.UpdateMfa(activate, c.Params.UserId, code, c.GetSiteURL()); err != nil {
+ c.Err = err
+ return
+ }
+
+ c.LogAudit("success - mfa updated")
+ ReturnStatusOK(w)
+}
+
func updatePassword(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireUserId()
if c.Err != nil {
diff --git a/api4/user_test.go b/api4/user_test.go
index c03169c72..4805a1a51 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -267,6 +267,127 @@ func TestGetUserByEmail(t *testing.T) {
}
}
+func TestAutocompleteUsers(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+ teamId := th.BasicTeam.Id
+ channelId := th.BasicChannel.Id
+ username := th.BasicUser.Username
+
+ rusers, resp := Client.AutocompleteUsersInChannel(teamId, channelId, username, "")
+ CheckNoError(t, resp)
+
+ if len(rusers.Users) != 1 {
+ t.Fatal("should have returned 1 user")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInChannel(teamId, channelId, "amazonses", "")
+ CheckNoError(t, resp)
+ if len(rusers.Users) != 0 {
+ t.Fatal("should have returned 0 users")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInChannel(teamId, channelId, "", "")
+ CheckNoError(t, resp)
+ if len(rusers.Users) < 2 {
+ t.Fatal("should have many users")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInTeam(teamId, username, "")
+ CheckNoError(t, resp)
+
+ if len(rusers.Users) != 1 {
+ t.Fatal("should have returned 1 user")
+ }
+
+ rusers, resp = Client.AutocompleteUsers(username, "")
+ CheckNoError(t, resp)
+
+ if len(rusers.Users) != 1 {
+ t.Fatal("should have returned 1 users")
+ }
+
+ rusers, resp = Client.AutocompleteUsers("", "")
+ CheckNoError(t, resp)
+
+ if len(rusers.Users) < 2 {
+ t.Fatal("should have returned many users")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInTeam(teamId, "amazonses", "")
+ CheckNoError(t, resp)
+ if len(rusers.Users) != 0 {
+ t.Fatal("should have returned 0 users")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInTeam(teamId, "", "")
+ CheckNoError(t, resp)
+ if len(rusers.Users) < 2 {
+ t.Fatal("should have many users")
+ }
+
+ Client.Logout()
+ _, resp = Client.AutocompleteUsersInChannel(teamId, channelId, username, "")
+ CheckUnauthorizedStatus(t, resp)
+
+ _, resp = Client.AutocompleteUsersInTeam(teamId, username, "")
+ CheckUnauthorizedStatus(t, resp)
+
+ _, resp = Client.AutocompleteUsers(username, "")
+ CheckUnauthorizedStatus(t, resp)
+
+ user := th.CreateUser()
+ Client.Login(user.Email, user.Password)
+ _, resp = Client.AutocompleteUsersInChannel(teamId, channelId, username, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.AutocompleteUsersInTeam(teamId, username, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.AutocompleteUsers(username, "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.AutocompleteUsersInChannel(teamId, channelId, username, "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.AutocompleteUsersInTeam(teamId, username, "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.AutocompleteUsers(username, "")
+ CheckNoError(t, resp)
+
+ // Check against privacy config settings
+ namePrivacy := utils.Cfg.PrivacySettings.ShowFullName
+ defer func() {
+ utils.Cfg.PrivacySettings.ShowFullName = namePrivacy
+ }()
+ utils.Cfg.PrivacySettings.ShowFullName = false
+
+ th.LoginBasic()
+
+ rusers, resp = Client.AutocompleteUsers(username, "")
+ CheckNoError(t, resp)
+
+ if rusers.Users[0].FirstName != "" || rusers.Users[0].LastName != "" {
+ t.Fatal("should not show first/last name")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInChannel(teamId, channelId, username, "")
+ CheckNoError(t, resp)
+
+ if rusers.Users[0].FirstName != "" || rusers.Users[0].LastName != "" {
+ t.Fatal("should not show first/last name")
+ }
+
+ rusers, resp = Client.AutocompleteUsersInTeam(teamId, username, "")
+ CheckNoError(t, resp)
+
+ if rusers.Users[0].FirstName != "" || rusers.Users[0].LastName != "" {
+ t.Fatal("should not show first/last name")
+ }
+}
+
func TestGetProfileImage(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -682,6 +803,48 @@ func TestGetUsersNotInChannel(t *testing.T) {
CheckNoError(t, resp)
}
+/*func TestUpdateUserMfa(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ isLicensed := utils.IsLicensed
+ license := utils.License
+ enableMfa := *utils.Cfg.ServiceSettings.EnableMultifactorAuthentication
+ defer func() {
+ utils.IsLicensed = isLicensed
+ utils.License = license
+ *utils.Cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa
+ }()
+ utils.IsLicensed = true
+ utils.License = &model.License{Features: &model.Features{}}
+ utils.License.Features.SetDefaults()
+
+ team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
+ rteam, _ := Client.CreateTeam(&team)
+
+ user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", Password: "passwd1"}
+ ruser, _ := Client.CreateUser(&user)
+ LinkUserToTeam(ruser, rteam)
+ store.Must(app.Srv.Store.User().VerifyEmail(ruser.Id))
+
+ Client.Logout()
+ _, resp := Client.UpdateUserMfa(ruser.Id, "12334", true)
+ CheckUnauthorizedStatus(t, resp)
+
+ Client.Login(user.Email, user.Password)
+ _, resp = Client.UpdateUserMfa("fail", "56789", false)
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.UpdateUserMfa(ruser.Id, "", true)
+ CheckErrorMessage(t, resp, "api.context.invalid_body_param.app_error")
+
+ *utils.Cfg.ServiceSettings.EnableMultifactorAuthentication = true
+
+ _, resp = Client.UpdateUserMfa(ruser.Id, "123456", false)
+ CheckNotImplementedStatus(t, resp)
+}*/
+
func TestUpdateUserPassword(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
@@ -789,14 +952,26 @@ func TestResetPassword(t *testing.T) {
}
// Check if the email was send to the right email address and the recovery key match
- if resultsMailbox, err := utils.GetMailBox(user.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], user.Email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
- t.Log(resultsEmail.Body.Text)
- t.Log(recovery.Code)
- t.Fatal("Received wrong recovery code")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(user.Email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], user.Email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
+ t.Log(resultsEmail.Body.Text)
+ t.Log(recovery.Code)
+ t.Fatal("Received wrong recovery code")
+ }
}
}
}
diff --git a/api4/webhook.go b/api4/webhook.go
index 9efab6ae2..feecdbd0f 100644
--- a/api4/webhook.go
+++ b/api4/webhook.go
@@ -17,12 +17,18 @@ func InitWebhook() {
BaseRoutes.IncomingHooks.Handle("", ApiSessionRequired(createIncomingHook)).Methods("POST")
BaseRoutes.IncomingHooks.Handle("", ApiSessionRequired(getIncomingHooks)).Methods("GET")
+ BaseRoutes.IncomingHook.Handle("", ApiSessionRequired(getIncomingHook)).Methods("GET")
+ BaseRoutes.IncomingHook.Handle("", ApiSessionRequired(updateIncomingHook)).Methods("PUT")
+ BaseRoutes.IncomingHook.Handle("", ApiSessionRequired(deleteIncomingHook)).Methods("DELETE")
+
+ BaseRoutes.OutgoingHooks.Handle("", ApiSessionRequired(createOutgoingHook)).Methods("POST")
+ BaseRoutes.OutgoingHooks.Handle("", ApiSessionRequired(getOutgoingHooks)).Methods("GET")
}
func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
hook := model.IncomingWebhookFromJson(r.Body)
if hook == nil {
- c.SetInvalidParam("webhook")
+ c.SetInvalidParam("incoming_webhook")
return
}
@@ -50,6 +56,67 @@ func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
c.LogAudit("success")
+ w.WriteHeader(http.StatusCreated)
+ w.Write([]byte(incomingHook.ToJson()))
+ }
+}
+
+func updateIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireHookId()
+ if c.Err != nil {
+ return
+ }
+
+ hookID := c.Params.HookId
+
+ updatedHook := model.IncomingWebhookFromJson(r.Body)
+ if updatedHook == nil {
+ c.SetInvalidParam("incoming_webhook")
+ return
+ }
+
+ c.LogAudit("attempt")
+
+ oldHook, err := app.GetIncomingWebhook(hookID)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if updatedHook.TeamId != oldHook.TeamId {
+ c.Err = model.NewAppError("updateIncomingHook", "api.webhook.team_mismatch.app_error", nil, "user_id="+c.Session.UserId, http.StatusBadRequest)
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, updatedHook.TeamId, model.PERMISSION_MANAGE_WEBHOOKS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ }
+
+ if c.Session.UserId != updatedHook.UserId && !app.SessionHasPermissionToTeam(c.Session, updatedHook.TeamId, model.PERMISSION_MANAGE_OTHERS_WEBHOOKS) {
+ c.LogAudit("fail - inappropriate permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_OTHERS_WEBHOOKS)
+ return
+ }
+
+ channel, err := app.GetChannel(updatedHook.ChannelId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if channel.Type != model.CHANNEL_OPEN && !app.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_READ_CHANNEL) {
+ c.LogAudit("fail - bad channel permissions")
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
+ return
+ }
+
+ if incomingHook, err := app.UpdateIncomingWebhook(oldHook, updatedHook); err != nil {
+ c.Err = err
+ return
+ } else {
+ c.LogAudit("success")
+ w.WriteHeader(http.StatusCreated)
w.Write([]byte(incomingHook.ToJson()))
}
}
@@ -83,3 +150,140 @@ func getIncomingHooks(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(model.IncomingWebhookListToJson(hooks)))
}
+
+func getIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireHookId()
+ if c.Err != nil {
+ return
+ }
+
+ hookID := c.Params.HookId
+
+ var err *model.AppError
+ var hook *model.IncomingWebhook
+ var channel *model.Channel
+
+ if hook, err = app.GetIncomingWebhook(hookID); err != nil {
+ c.Err = err
+ return
+ } else {
+ channel, err = app.GetChannel(hook.ChannelId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, hook.TeamId, model.PERMISSION_MANAGE_WEBHOOKS) ||
+ (channel.Type != model.CHANNEL_OPEN && !app.SessionHasPermissionToChannel(c.Session, hook.ChannelId, model.PERMISSION_READ_CHANNEL)) {
+ c.LogAudit("fail - bad permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ } else {
+ w.Write([]byte(hook.ToJson()))
+ return
+ }
+ }
+}
+
+func deleteIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
+ c.RequireHookId()
+ if c.Err != nil {
+ return
+ }
+
+ hookID := c.Params.HookId
+
+ var err *model.AppError
+ var hook *model.IncomingWebhook
+ var channel *model.Channel
+
+ if hook, err = app.GetIncomingWebhook(hookID); err != nil {
+ c.Err = err
+ return
+ } else {
+ channel, err = app.GetChannel(hook.ChannelId)
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ if !app.SessionHasPermissionToTeam(c.Session, hook.TeamId, model.PERMISSION_MANAGE_WEBHOOKS) ||
+ (channel.Type != model.CHANNEL_OPEN && !app.SessionHasPermissionToChannel(c.Session, hook.ChannelId, model.PERMISSION_READ_CHANNEL)) {
+ c.LogAudit("fail - bad permissions")
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ } else {
+ if err = app.DeleteIncomingWebhook(hookID); err != nil {
+ c.Err = err
+ return
+ }
+
+ ReturnStatusOK(w)
+ }
+ }
+}
+
+func createOutgoingHook(c *Context, w http.ResponseWriter, r *http.Request) {
+ hook := model.OutgoingWebhookFromJson(r.Body)
+ if hook == nil {
+ c.SetInvalidParam("outgoing_webhook")
+ return
+ }
+
+ c.LogAudit("attempt")
+
+ hook.CreatorId = c.Session.UserId
+
+ if !app.SessionHasPermissionToTeam(c.Session, hook.TeamId, model.PERMISSION_MANAGE_WEBHOOKS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ }
+
+ if rhook, err := app.CreateOutgoingWebhook(hook); err != nil {
+ c.LogAudit("fail")
+ c.Err = err
+ return
+ } else {
+ c.LogAudit("success")
+ w.WriteHeader(http.StatusCreated)
+ w.Write([]byte(rhook.ToJson()))
+ }
+}
+
+func getOutgoingHooks(c *Context, w http.ResponseWriter, r *http.Request) {
+ channelId := r.URL.Query().Get("channel_id")
+ teamId := r.URL.Query().Get("team_id")
+
+ var hooks []*model.OutgoingWebhook
+ var err *model.AppError
+
+ if len(channelId) > 0 {
+ if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_MANAGE_WEBHOOKS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ }
+
+ hooks, err = app.GetOutgoingWebhooksForChannelPage(channelId, c.Params.Page, c.Params.PerPage)
+ } else if len(teamId) > 0 {
+ if !app.SessionHasPermissionToTeam(c.Session, teamId, model.PERMISSION_MANAGE_WEBHOOKS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ }
+
+ hooks, err = app.GetOutgoingWebhooksForTeamPage(teamId, c.Params.Page, c.Params.PerPage)
+ } else {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_WEBHOOKS) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_WEBHOOKS)
+ return
+ }
+
+ hooks, err = app.GetOutgoingWebhooksPage(c.Params.Page, c.Params.PerPage)
+ }
+
+ if err != nil {
+ c.Err = err
+ return
+ }
+
+ w.Write([]byte(model.OutgoingWebhookListToJson(hooks)))
+}
diff --git a/api4/webhook_test.go b/api4/webhook_test.go
index a6705f6e1..b488f432c 100644
--- a/api4/webhook_test.go
+++ b/api4/webhook_test.go
@@ -148,3 +148,439 @@ func TestGetIncomingWebhooks(t *testing.T) {
_, resp = Client.GetIncomingWebhooks(0, 1000, "")
CheckUnauthorizedStatus(t, resp)
}
+
+func TestGetIncomingWebhook(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.SystemAdminClient
+
+ enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
+ enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = enableIncomingHooks
+ utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = true
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ var resp *model.Response
+ var rhook *model.IncomingWebhook
+ var hook *model.IncomingWebhook
+
+ t.Run("WhenHookExists", func(t *testing.T) {
+ hook = &model.IncomingWebhook{ChannelId: th.BasicChannel.Id}
+ rhook, resp = Client.CreateIncomingWebhook(hook)
+ CheckNoError(t, resp)
+
+ hook, resp = Client.GetIncomingWebhook(rhook.Id, "")
+ CheckOKStatus(t, resp)
+ })
+
+ t.Run("WhenHookDoesNotExist", func(t *testing.T) {
+ hook, resp = Client.GetIncomingWebhook(model.NewId(), "")
+ CheckNotFoundStatus(t, resp)
+ })
+
+ t.Run("WhenInvalidHookID", func(t *testing.T) {
+ hook, resp = Client.GetIncomingWebhook("abc", "")
+ CheckBadRequestStatus(t, resp)
+ })
+
+ t.Run("WhenUserDoesNotHavePemissions", func(t *testing.T) {
+ th.LoginBasic()
+ Client = th.Client
+
+ _, resp = Client.GetIncomingWebhook(rhook.Id, "")
+ CheckForbiddenStatus(t, resp)
+ })
+}
+
+func TestDeleteIncomingWebhook(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.SystemAdminClient
+
+ enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
+ enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = enableIncomingHooks
+ utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = true
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ var resp *model.Response
+ var rhook *model.IncomingWebhook
+ var hook *model.IncomingWebhook
+ var status bool
+
+ t.Run("WhenInvalidHookID", func(t *testing.T) {
+ status, resp = Client.DeleteIncomingWebhook("abc")
+ CheckBadRequestStatus(t, resp)
+ })
+
+ t.Run("WhenHookDoesNotExist", func(t *testing.T) {
+ status, resp = Client.DeleteIncomingWebhook(model.NewId())
+ CheckNotFoundStatus(t, resp)
+ })
+
+ t.Run("WhenHookExists", func(t *testing.T) {
+ hook = &model.IncomingWebhook{ChannelId: th.BasicChannel.Id}
+ rhook, resp = Client.CreateIncomingWebhook(hook)
+ CheckNoError(t, resp)
+
+ if status, resp = Client.DeleteIncomingWebhook(rhook.Id); !status {
+ t.Fatal("Delete should have succeeded")
+ } else {
+ CheckOKStatus(t, resp)
+ }
+
+ // Get now should not return this deleted hook
+ _, resp = Client.GetIncomingWebhook(rhook.Id, "")
+ CheckNotFoundStatus(t, resp)
+ })
+
+ t.Run("WhenUserDoesNotHavePemissions", func(t *testing.T) {
+ hook = &model.IncomingWebhook{ChannelId: th.BasicChannel.Id}
+ rhook, resp = Client.CreateIncomingWebhook(hook)
+ CheckNoError(t, resp)
+
+ th.LoginBasic()
+ Client = th.Client
+
+ _, resp = Client.DeleteIncomingWebhook(rhook.Id)
+ CheckForbiddenStatus(t, resp)
+ })
+}
+
+func TestCreateOutgoingWebhook(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
+ enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = enableOutgoingHooks
+ utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = true
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ hook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId, CallbackURLs: []string{"http://nowhere.com"}}
+
+ rhook, resp := th.SystemAdminClient.CreateOutgoingWebhook(hook)
+ CheckNoError(t, resp)
+
+ if rhook.ChannelId != hook.ChannelId {
+ t.Fatal("channel ids didn't match")
+ } else if rhook.CreatorId != th.SystemAdminUser.Id {
+ t.Fatal("user ids didn't match")
+ } else if rhook.TeamId != th.BasicChannel.TeamId {
+ t.Fatal("team ids didn't match")
+ }
+
+ hook.ChannelId = "junk"
+ _, resp = th.SystemAdminClient.CreateOutgoingWebhook(hook)
+ CheckNotFoundStatus(t, resp)
+
+ hook.ChannelId = th.BasicChannel.Id
+ th.LoginTeamAdmin()
+ _, resp = Client.CreateOutgoingWebhook(hook)
+ CheckNoError(t, resp)
+
+ th.LoginBasic()
+ _, resp = Client.CreateOutgoingWebhook(hook)
+ CheckForbiddenStatus(t, resp)
+
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false
+ utils.SetDefaultRolesBasedOnConfig()
+
+ _, resp = Client.CreateOutgoingWebhook(hook)
+ CheckNoError(t, resp)
+
+ utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = false
+ _, resp = Client.CreateOutgoingWebhook(hook)
+ CheckNotImplementedStatus(t, resp)
+}
+
+func TestGetOutgoingWebhooks(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
+ enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = enableOutgoingHooks
+ utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = true
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ hook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId, CallbackURLs: []string{"http://nowhere.com"}}
+ rhook, resp := th.SystemAdminClient.CreateOutgoingWebhook(hook)
+ CheckNoError(t, resp)
+
+ hooks, resp := th.SystemAdminClient.GetOutgoingWebhooks(0, 1000, "")
+ CheckNoError(t, resp)
+
+ found := false
+ for _, h := range hooks {
+ if rhook.Id == h.Id {
+ found = true
+ }
+ }
+
+ if !found {
+ t.Fatal("missing hook")
+ }
+
+ hooks, resp = th.SystemAdminClient.GetOutgoingWebhooks(0, 1, "")
+ CheckNoError(t, resp)
+
+ if len(hooks) != 1 {
+ t.Fatal("should only be 1")
+ }
+
+ hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForTeam(th.BasicTeam.Id, 0, 1000, "")
+ CheckNoError(t, resp)
+
+ found = false
+ for _, h := range hooks {
+ if rhook.Id == h.Id {
+ found = true
+ }
+ }
+
+ if !found {
+ t.Fatal("missing hook")
+ }
+
+ hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForTeam(model.NewId(), 0, 1000, "")
+ CheckNoError(t, resp)
+
+ if len(hooks) != 0 {
+ t.Fatal("no hooks should be returned")
+ }
+
+ hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForChannel(th.BasicChannel.Id, 0, 1000, "")
+ CheckNoError(t, resp)
+
+ found = false
+ for _, h := range hooks {
+ if rhook.Id == h.Id {
+ found = true
+ }
+ }
+
+ if !found {
+ t.Fatal("missing hook")
+ }
+
+ hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForChannel(model.NewId(), 0, 1000, "")
+ CheckNoError(t, resp)
+
+ if len(hooks) != 0 {
+ t.Fatal("no hooks should be returned")
+ }
+
+ _, resp = Client.GetOutgoingWebhooks(0, 1000, "")
+ CheckForbiddenStatus(t, resp)
+
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false
+ utils.SetDefaultRolesBasedOnConfig()
+
+ _, resp = Client.GetOutgoingWebhooksForTeam(th.BasicTeam.Id, 0, 1000, "")
+ CheckNoError(t, resp)
+
+ _, resp = Client.GetOutgoingWebhooksForTeam(model.NewId(), 0, 1000, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.GetOutgoingWebhooksForChannel(th.BasicChannel.Id, 0, 1000, "")
+ CheckNoError(t, resp)
+
+ _, resp = Client.GetOutgoingWebhooksForChannel(model.NewId(), 0, 1000, "")
+ CheckForbiddenStatus(t, resp)
+
+ _, resp = Client.GetOutgoingWebhooks(0, 1000, "")
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetOutgoingWebhooks(0, 1000, "")
+ CheckUnauthorizedStatus(t, resp)
+}
+
+func TestUpdateIncomingHook(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
+ enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = enableIncomingHooks
+ utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
+ utils.SetDefaultRolesBasedOnConfig()
+ }()
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = true
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ hook1 := &model.IncomingWebhook{ChannelId: th.BasicChannel.Id}
+
+ createdHook, resp := th.SystemAdminClient.CreateIncomingWebhook(hook1)
+ CheckNoError(t, resp)
+
+ t.Run("UpdateIncomingHook", func(t *testing.T) {
+ createdHook.DisplayName = "hook2"
+ createdHook.Description = "description"
+ createdHook.ChannelId = th.BasicChannel2.Id
+
+ updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
+ CheckNoError(t, resp)
+ if updatedHook != nil {
+ if updatedHook.DisplayName != "hook2" {
+ t.Fatal("Hook name is not updated")
+ }
+
+ if updatedHook.Description != "description" {
+ t.Fatal("Hook description is not updated")
+ }
+
+ if updatedHook.ChannelId != th.BasicChannel2.Id {
+ t.Fatal("Hook channel is not updated")
+ }
+ } else {
+ t.Fatal("should not be nil")
+ }
+ })
+
+ t.Run("RetainCreateAt", func(t *testing.T) {
+ hook2 := &model.IncomingWebhook{ChannelId: th.BasicChannel.Id, CreateAt: 100}
+
+ createdHook, resp := th.SystemAdminClient.CreateIncomingWebhook(hook2)
+ CheckNoError(t, resp)
+
+ createdHook.DisplayName = "Name2"
+
+ updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
+ CheckNoError(t, resp)
+ if updatedHook != nil {
+ if updatedHook.CreateAt != createdHook.CreateAt {
+ t.Fatal("failed - hook create at should not be changed")
+ }
+ } else {
+ t.Fatal("should not be nil")
+ }
+ })
+
+ t.Run("ModifyUpdateAt", func(t *testing.T) {
+ createdHook.DisplayName = "Name3"
+
+ updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
+ CheckNoError(t, resp)
+ if updatedHook != nil {
+ if updatedHook.UpdateAt == createdHook.UpdateAt {
+ t.Fatal("failed - hook updateAt is not updated")
+ }
+ } else {
+ t.Fatal("should not be nil")
+ }
+ })
+
+ t.Run("UpdateNonExistentHook", func(t *testing.T) {
+ nonExistentHook := &model.IncomingWebhook{ChannelId: th.BasicChannel.Id}
+
+ _, resp := th.SystemAdminClient.UpdateIncomingWebhook(nonExistentHook)
+ CheckNotFoundStatus(t, resp)
+
+ nonExistentHook.Id = model.NewId()
+ _, resp = th.SystemAdminClient.UpdateIncomingWebhook(nonExistentHook)
+ CheckNotFoundStatus(t, resp)
+ })
+
+ t.Run("UserIsNotAdminOfTeam", func(t *testing.T) {
+ _, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckForbiddenStatus(t, resp)
+ })
+
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = true
+
+ t.Run("OnlyAdminIntegrationsDisabled", func(t *testing.T) {
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false
+ utils.SetDefaultRolesBasedOnConfig()
+
+ t.Run("UpdateHookOfSameUser", func(t *testing.T) {
+ sameUserHook := &model.IncomingWebhook{ChannelId: th.BasicChannel.Id, UserId: th.BasicUser2.Id}
+
+ sameUserHook, resp := Client.CreateIncomingWebhook(sameUserHook)
+ CheckNoError(t, resp)
+
+ _, resp = Client.UpdateIncomingWebhook(sameUserHook)
+ CheckNoError(t, resp)
+ })
+
+ t.Run("UpdateHookOfDifferentUser", func(t *testing.T) {
+ _, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckForbiddenStatus(t, resp)
+ })
+ })
+
+ *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
+ utils.SetDefaultRolesBasedOnConfig()
+
+ Client.Logout()
+ UpdateUserToTeamAdmin(th.BasicUser2, th.BasicTeam)
+ th.LoginBasic2()
+ t.Run("UpdateByDifferentUser", func(t *testing.T) {
+ updatedHook, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckNoError(t, resp)
+ if updatedHook.UserId == th.BasicUser2.Id {
+ t.Fatal("Hook's creator userId is not retained")
+ }
+ })
+
+ t.Run("IncomingHooksDisabled", func(t *testing.T) {
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = false
+ _, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckNotImplementedStatus(t, resp)
+ CheckErrorMessage(t, resp, "api.incoming_webhook.disabled.app_error")
+ })
+
+ utils.Cfg.ServiceSettings.EnableIncomingWebhooks = true
+
+ t.Run("PrivateChannel", func(t *testing.T) {
+ privateChannel := th.CreatePrivateChannel()
+ Client.Logout()
+ th.LoginBasic()
+ createdHook.ChannelId = privateChannel.Id
+
+ _, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckForbiddenStatus(t, resp)
+ })
+
+ t.Run("UpdateToNonExistentChannel", func(t *testing.T) {
+ createdHook.ChannelId = "junk"
+ _, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
+ CheckNotFoundStatus(t, resp)
+ })
+
+ team := th.CreateTeamWithClient(Client)
+ user := th.CreateUserWithClient(Client)
+ LinkUserToTeam(user, team)
+ Client.Logout()
+ Client.Login(user.Id, user.Password)
+ t.Run("UpdateToADifferentTeam", func(t *testing.T) {
+ _, resp := Client.UpdateIncomingWebhook(createdHook)
+ CheckUnauthorizedStatus(t, resp)
+ })
+}
diff --git a/app/admin.go b/app/admin.go
index c551da50c..509d81840 100644
--- a/app/admin.go
+++ b/app/admin.go
@@ -18,14 +18,14 @@ import (
"github.com/mattermost/platform/utils"
)
-func GetLogs() ([]string, *model.AppError) {
- lines, err := GetLogsSkipSend()
+func GetLogs(page, perPage int) ([]string, *model.AppError) {
+ lines, err := GetLogsSkipSend(page, perPage)
if err != nil {
return nil, err
}
if einterfaces.GetClusterInterface() != nil {
- clines, err := einterfaces.GetClusterInterface().GetLogs()
+ clines, err := einterfaces.GetClusterInterface().GetLogs(page, perPage)
if err != nil {
return nil, err
}
@@ -36,7 +36,7 @@ func GetLogs() ([]string, *model.AppError) {
return lines, nil
}
-func GetLogsSkipSend() ([]string, *model.AppError) {
+func GetLogsSkipSend(page, perPage int) ([]string, *model.AppError) {
var lines []string
if utils.Cfg.LogSettings.EnableFile {
@@ -47,9 +47,20 @@ func GetLogsSkipSend() ([]string, *model.AppError) {
defer file.Close()
+ offsetCount := 0
+ limitCount := 0
scanner := bufio.NewScanner(file)
for scanner.Scan() {
- lines = append(lines, scanner.Text())
+ if limitCount >= perPage {
+ break
+ }
+
+ if offsetCount >= page*perPage {
+ lines = append(lines, scanner.Text())
+ limitCount++
+ } else {
+ offsetCount++
+ }
}
} else {
lines = append(lines, "")
diff --git a/api/auto_channels.go b/app/auto_channels.go
index 1d0f0e7d9..3945a5a4f 100644
--- a/api/auto_channels.go
+++ b/app/auto_channels.go
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
diff --git a/api/auto_constants.go b/app/auto_constants.go
index a10ae99f2..c8c903e32 100644
--- a/api/auto_constants.go
+++ b/app/auto_constants.go
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
diff --git a/api/auto_environment.go b/app/auto_environment.go
index 6c7bc2d0a..b0a4f54b8 100644
--- a/api/auto_environment.go
+++ b/app/auto_environment.go
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
diff --git a/api/auto_posts.go b/app/auto_posts.go
index bb20aadae..b32407539 100644
--- a/api/auto_posts.go
+++ b/app/auto_posts.go
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"bytes"
diff --git a/api/auto_teams.go b/app/auto_teams.go
index b2e1ace85..6e66f4446 100644
--- a/api/auto_teams.go
+++ b/app/auto_teams.go
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
diff --git a/api/auto_users.go b/app/auto_users.go
index d8cd8d3a3..7a99cc90b 100644
--- a/api/auto_users.go
+++ b/app/auto_users.go
@@ -1,10 +1,9 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
@@ -50,8 +49,8 @@ func CreateBasicUser(client *model.Client) *model.AppError {
return err
}
ruser := result.Data.(*model.User)
- store.Must(app.Srv.Store.User().VerifyEmail(ruser.Id))
- store.Must(app.Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: basicteam.Id, UserId: ruser.Id}))
+ store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
+ store.Must(Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: basicteam.Id, UserId: ruser.Id}))
}
return nil
}
@@ -82,14 +81,14 @@ func (cfg *AutoUserCreator) createRandomUser() (*model.User, bool) {
ruser := result.Data.(*model.User)
status := &model.Status{UserId: ruser.Id, Status: model.STATUS_ONLINE, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: ""}
- if result := <-app.Srv.Store.Status().SaveOrUpdate(status); result.Err != nil {
+ if result := <-Srv.Store.Status().SaveOrUpdate(status); result.Err != nil {
result.Err.Translate(utils.T)
l4g.Error(result.Err.Error())
return nil, false
}
// We need to cheat to verify the user's email
- store.Must(app.Srv.Store.User().VerifyEmail(ruser.Id))
+ store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
return result.Data.(*model.User), true
}
diff --git a/app/brand.go b/app/brand.go
index aeecc6972..9b3df3145 100644
--- a/app/brand.go
+++ b/app/brand.go
@@ -13,11 +13,13 @@ import (
)
func SaveBrandImage(imageData *multipart.FileHeader) *model.AppError {
+ if len(utils.Cfg.FileSettings.DriverName) == 0 {
+ return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
+ }
+
brandInterface := einterfaces.GetBrandInterface()
if brandInterface == nil {
- err := model.NewLocAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return err
+ return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if err := brandInterface.SaveBrandImage(imageData); err != nil {
@@ -29,16 +31,12 @@ func SaveBrandImage(imageData *multipart.FileHeader) *model.AppError {
func GetBrandImage() ([]byte, *model.AppError) {
if len(utils.Cfg.FileSettings.DriverName) == 0 {
- err := model.NewLocAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return nil, err
+ return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
}
brandInterface := einterfaces.GetBrandInterface()
if brandInterface == nil {
- err := model.NewLocAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return nil, err
+ return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if img, err := brandInterface.GetBrandImage(); err != nil {
diff --git a/app/channel.go b/app/channel.go
index 7c63cbc6b..af7596ae1 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -313,7 +313,7 @@ func UpdateChannelMemberNotifyProps(data map[string]string, channelId string, us
func DeleteChannel(channel *model.Channel, userId string, siteURL string) *model.AppError {
uc := Srv.Store.User().Get(userId)
ihc := Srv.Store.Webhook().GetIncomingByChannel(channel.Id)
- ohc := Srv.Store.Webhook().GetOutgoingByChannel(channel.Id)
+ ohc := Srv.Store.Webhook().GetOutgoingByChannel(channel.Id, -1, -1)
if uresult := <-uc; uresult.Err != nil {
return uresult.Err
@@ -646,6 +646,14 @@ func GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (
}
}
+func GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError) {
+ if result := <-Srv.Store.Channel().GetPublicChannelsForTeam(teamId, offset, limit); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.ChannelList), nil
+ }
+}
+
func GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) {
if result := <-Srv.Store.Channel().GetMember(channelId, userId); result.Err != nil {
return nil, result.Err
@@ -694,7 +702,25 @@ func GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *mode
}
}
+func GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError) {
+ result := <-Srv.Store.Channel().GetChannelUnread(channelId, userId)
+ if result.Err != nil {
+ return nil, result.Err
+ }
+ channelUnread := result.Data.(*model.ChannelUnread)
+
+ if channelUnread.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_MARK_UNREAD_MENTION {
+ channelUnread.MsgCount = 0
+ }
+
+ return channelUnread, nil
+}
+
func JoinChannel(channel *model.Channel, userId string, siteURL string) *model.AppError {
+ if channel.DeleteAt > 0 {
+ return model.NewLocAppError("JoinChannel", "api.channel.join_channel.already_deleted.app_error", nil, "")
+ }
+
userChan := Srv.Store.User().Get(userId)
memberChan := Srv.Store.Channel().GetMember(channel.Id, userId)
diff --git a/app/command.go b/app/command.go
index 4d344915d..4583cf81b 100644
--- a/app/command.go
+++ b/app/command.go
@@ -4,9 +4,40 @@
package app
import (
+ "crypto/tls"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "strings"
+
+ l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
+type CommandProvider interface {
+ GetTrigger() string
+ GetCommand(T goi18n.TranslateFunc) *model.Command
+ DoCommand(args *model.CommandArgs, message string) *model.CommandResponse
+}
+
+var commandProviders = make(map[string]CommandProvider)
+
+func RegisterCommandProvider(newProvider CommandProvider) {
+ commandProviders[newProvider.GetTrigger()] = newProvider
+}
+
+func GetCommandProvider(name string) CommandProvider {
+ provider, ok := commandProviders[name]
+ if ok {
+ return provider
+ }
+
+ return nil
+}
+
func CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, siteURL string) (*model.Post, *model.AppError) {
post.Message = parseSlackLinksToMarkdown(response.Text)
post.CreateAt = model.GetMillis()
@@ -29,3 +60,276 @@ func CreateCommandPost(post *model.Post, teamId string, response *model.CommandR
return post, nil
}
+
+func ListCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError) {
+ commands := make([]*model.Command, 0, 32)
+ seen := make(map[string]bool)
+ for _, value := range commandProviders {
+ cpy := *value.GetCommand(T)
+ if cpy.AutoComplete && !seen[cpy.Id] {
+ cpy.Sanitize()
+ seen[cpy.Trigger] = true
+ commands = append(commands, &cpy)
+ }
+ }
+
+ if *utils.Cfg.ServiceSettings.EnableCommands {
+ if result := <-Srv.Store.Command().GetByTeam(teamId); result.Err != nil {
+ return nil, result.Err
+ } else {
+ teamCmds := result.Data.([]*model.Command)
+ for _, cmd := range teamCmds {
+ if cmd.AutoComplete && !seen[cmd.Id] {
+ cmd.Sanitize()
+ seen[cmd.Trigger] = true
+ commands = append(commands, cmd)
+ }
+ }
+ }
+ }
+
+ return commands, nil
+}
+
+func ListTeamCommands(teamId string) ([]*model.Command, *model.AppError) {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("ListTeamCommands", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ if result := <-Srv.Store.Command().GetByTeam(teamId); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.([]*model.Command), nil
+ }
+}
+
+func ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {
+ parts := strings.Split(args.Command, " ")
+ trigger := parts[0][1:]
+ trigger = strings.ToLower(trigger)
+ message := strings.Join(parts[1:], " ")
+ provider := GetCommandProvider(trigger)
+
+ if provider != nil {
+ response := provider.DoCommand(args, message)
+ return HandleCommandResponse(provider.GetCommand(args.T), args, response, true)
+ } else {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("ExecuteCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ chanChan := Srv.Store.Channel().Get(args.ChannelId, true)
+ teamChan := Srv.Store.Team().Get(args.TeamId)
+ userChan := Srv.Store.User().Get(args.UserId)
+
+ if result := <-Srv.Store.Command().GetByTeam(args.TeamId); result.Err != nil {
+ return nil, result.Err
+ } else {
+
+ var team *model.Team
+ if tr := <-teamChan; tr.Err != nil {
+ return nil, tr.Err
+ } else {
+ team = tr.Data.(*model.Team)
+ }
+
+ var user *model.User
+ if ur := <-userChan; ur.Err != nil {
+ return nil, ur.Err
+ } else {
+ user = ur.Data.(*model.User)
+ }
+
+ var channel *model.Channel
+ if cr := <-chanChan; cr.Err != nil {
+ return nil, cr.Err
+ } else {
+ channel = cr.Data.(*model.Channel)
+ }
+
+ teamCmds := result.Data.([]*model.Command)
+ for _, cmd := range teamCmds {
+ if trigger == cmd.Trigger {
+ l4g.Debug(fmt.Sprintf(utils.T("api.command.execute_command.debug"), trigger, args.UserId))
+
+ p := url.Values{}
+ p.Set("token", cmd.Token)
+
+ p.Set("team_id", cmd.TeamId)
+ p.Set("team_domain", team.Name)
+
+ p.Set("channel_id", args.ChannelId)
+ p.Set("channel_name", channel.Name)
+
+ p.Set("user_id", args.UserId)
+ p.Set("user_name", user.Username)
+
+ p.Set("command", "/"+trigger)
+ p.Set("text", message)
+ p.Set("response_url", "not supported yet")
+
+ method := "POST"
+ if cmd.Method == model.COMMAND_METHOD_GET {
+ method = "GET"
+ }
+
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections},
+ }
+ client := &http.Client{Transport: tr}
+
+ req, _ := http.NewRequest(method, cmd.URL, strings.NewReader(p.Encode()))
+ req.Header.Set("Accept", "application/json")
+ if cmd.Method == model.COMMAND_METHOD_POST {
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ }
+
+ if resp, err := client.Do(req); err != nil {
+ return nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": trigger}, err.Error(), http.StatusInternalServerError)
+ } else {
+ if resp.StatusCode == http.StatusOK {
+ response := model.CommandResponseFromJson(resp.Body)
+ if response == nil {
+ return nil, model.NewAppError("command", "api.command.execute_command.failed_empty.app_error", map[string]interface{}{"Trigger": trigger}, "", http.StatusInternalServerError)
+ } else {
+ return HandleCommandResponse(cmd, args, response, false)
+ }
+ } else {
+ defer resp.Body.Close()
+ body, _ := ioutil.ReadAll(resp.Body)
+ return nil, model.NewAppError("command", "api.command.execute_command.failed_resp.app_error", map[string]interface{}{"Trigger": trigger, "Status": resp.Status}, string(body), http.StatusInternalServerError)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return nil, model.NewAppError("command", "api.command.execute_command.not_found.app_error", map[string]interface{}{"Trigger": trigger}, "", http.StatusNotFound)
+}
+
+func HandleCommandResponse(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError) {
+ post := &model.Post{}
+ post.ChannelId = args.ChannelId
+ post.RootId = args.RootId
+ post.ParentId = args.ParentId
+ post.UserId = args.UserId
+
+ if !builtIn {
+ post.AddProp("from_webhook", "true")
+ }
+
+ if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
+ if len(command.Username) != 0 {
+ post.AddProp("override_username", command.Username)
+ } else if len(response.Username) != 0 {
+ post.AddProp("override_username", response.Username)
+ }
+ }
+
+ if utils.Cfg.ServiceSettings.EnablePostIconOverride {
+ if len(command.IconURL) != 0 {
+ post.AddProp("override_icon_url", command.IconURL)
+ } else if len(response.IconURL) != 0 {
+ post.AddProp("override_icon_url", response.IconURL)
+ } else {
+ post.AddProp("override_icon_url", "")
+ }
+ }
+
+ if _, err := CreateCommandPost(post, args.TeamId, response, args.SiteURL); err != nil {
+ l4g.Error(err.Error())
+ }
+
+ return response, nil
+}
+
+func CreateCommand(cmd *model.Command) (*model.Command, *model.AppError) {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("CreateCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ cmd.Trigger = strings.ToLower(cmd.Trigger)
+
+ if result := <-Srv.Store.Command().GetByTeam(cmd.TeamId); result.Err != nil {
+ return nil, result.Err
+ } else {
+ teamCmds := result.Data.([]*model.Command)
+ for _, existingCommand := range teamCmds {
+ if cmd.Trigger == existingCommand.Trigger {
+ return nil, model.NewAppError("CreateCommand", "api.command.duplicate_trigger.app_error", nil, "", http.StatusBadRequest)
+ }
+ }
+ for _, builtInProvider := range commandProviders {
+ builtInCommand := *builtInProvider.GetCommand(utils.T)
+ if cmd.Trigger == builtInCommand.Trigger {
+ return nil, model.NewAppError("CreateCommand", "api.command.duplicate_trigger.app_error", nil, "", http.StatusBadRequest)
+ }
+ }
+ }
+
+ if result := <-Srv.Store.Command().Save(cmd); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.Command), nil
+ }
+}
+
+func GetCommand(commandId string) (*model.Command, *model.AppError) {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("GetCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ if result := <-Srv.Store.Command().Get(commandId); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.Command), nil
+ }
+}
+
+func UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError) {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("UpdateCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ updatedCmd.Trigger = strings.ToLower(updatedCmd.Trigger)
+ updatedCmd.Id = oldCmd.Id
+ updatedCmd.Token = oldCmd.Token
+ updatedCmd.CreateAt = oldCmd.CreateAt
+ updatedCmd.UpdateAt = model.GetMillis()
+ updatedCmd.DeleteAt = oldCmd.DeleteAt
+ updatedCmd.CreatorId = oldCmd.CreatorId
+ updatedCmd.TeamId = oldCmd.TeamId
+
+ if result := <-Srv.Store.Command().Update(updatedCmd); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.Command), nil
+ }
+}
+
+func RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppError) {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return nil, model.NewAppError("RegenCommandToken", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ cmd.Token = model.NewId()
+
+ if result := <-Srv.Store.Command().Update(cmd); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.Command), nil
+ }
+}
+
+func DeleteCommand(commandId string) *model.AppError {
+ if !*utils.Cfg.ServiceSettings.EnableCommands {
+ return model.NewAppError("DeleteCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ if err := (<-Srv.Store.Command().Delete(commandId, model.GetMillis())).Err; err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/api/command_away.go b/app/command_away.go
index 6a488c081..55553fa3f 100644
--- a/api/command_away.go
+++ b/app/command_away.go
@@ -1,11 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type AwayProvider struct {
@@ -23,21 +23,21 @@ func (me *AwayProvider) GetTrigger() string {
return CMD_AWAY
}
-func (me *AwayProvider) GetCommand(c *Context) *model.Command {
+func (me *AwayProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_AWAY,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_away.desc"),
- DisplayName: c.T("api.command_away.name"),
+ AutoCompleteDesc: T("api.command_away.desc"),
+ DisplayName: T("api.command_away.name"),
}
}
-func (me *AwayProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- rmsg := c.T("api.command_away.success")
+func (me *AwayProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ rmsg := args.T("api.command_away.success")
if len(message) > 0 {
rmsg = message + " " + rmsg
}
- app.SetStatusAwayIfNeeded(c.Session.UserId, true)
+ SetStatusAwayIfNeeded(args.UserId, true)
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg}
}
diff --git a/api/command_echo.go b/app/command_echo.go
index 38e8e07b5..3bfe67cd7 100644
--- a/api/command_echo.go
+++ b/app/command_echo.go
@@ -1,7 +1,7 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"strconv"
@@ -9,8 +9,8 @@ import (
"time"
l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
var echoSem chan bool
@@ -30,19 +30,19 @@ func (me *EchoProvider) GetTrigger() string {
return CMD_ECHO
}
-func (me *EchoProvider) GetCommand(c *Context) *model.Command {
+func (me *EchoProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_ECHO,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_echo.desc"),
- AutoCompleteHint: c.T("api.command_echo.hint"),
- DisplayName: c.T("api.command_echo.name"),
+ AutoCompleteDesc: T("api.command_echo.desc"),
+ AutoCompleteHint: T("api.command_echo.hint"),
+ DisplayName: T("api.command_echo.name"),
}
}
-func (me *EchoProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
+func (me *EchoProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
if len(message) == 0 {
- return &model.CommandResponse{Text: c.T("api.command_echo.message.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ return &model.CommandResponse{Text: args.T("api.command_echo.message.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
maxThreads := 100
@@ -64,7 +64,7 @@ func (me *EchoProvider) DoCommand(c *Context, args *model.CommandArgs, message s
}
if delay > 10000 {
- return &model.CommandResponse{Text: c.T("api.command_echo.delay.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ return &model.CommandResponse{Text: args.T("api.command_echo.delay.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
if echoSem == nil {
@@ -73,7 +73,7 @@ func (me *EchoProvider) DoCommand(c *Context, args *model.CommandArgs, message s
}
if len(echoSem) >= maxThreads {
- return &model.CommandResponse{Text: c.T("api.command_echo.high_volume.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ return &model.CommandResponse{Text: args.T("api.command_echo.high_volume.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
echoSem <- true
@@ -84,12 +84,12 @@ func (me *EchoProvider) DoCommand(c *Context, args *model.CommandArgs, message s
post.RootId = args.RootId
post.ParentId = args.ParentId
post.Message = message
- post.UserId = c.Session.UserId
+ post.UserId = args.UserId
time.Sleep(time.Duration(delay) * time.Second)
- if _, err := app.CreatePost(post, c.TeamId, true, c.GetSiteURL()); err != nil {
- l4g.Error(c.T("api.command_echo.create.app_error"), err)
+ if _, err := CreatePost(post, args.TeamId, true, args.SiteURL); err != nil {
+ l4g.Error(args.T("api.command_echo.create.app_error"), err)
}
}()
diff --git a/app/command_expand_collapse.go b/app/command_expand_collapse.go
new file mode 100644
index 000000000..a4a152c60
--- /dev/null
+++ b/app/command_expand_collapse.go
@@ -0,0 +1,87 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "strconv"
+
+ "github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
+)
+
+type ExpandProvider struct {
+}
+
+type CollapseProvider struct {
+}
+
+const (
+ CMD_EXPAND = "expand"
+ CMD_COLLAPSE = "collapse"
+)
+
+func init() {
+ RegisterCommandProvider(&ExpandProvider{})
+ RegisterCommandProvider(&CollapseProvider{})
+}
+
+func (me *ExpandProvider) GetTrigger() string {
+ return CMD_EXPAND
+}
+
+func (me *CollapseProvider) GetTrigger() string {
+ return CMD_COLLAPSE
+}
+
+func (me *ExpandProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
+ return &model.Command{
+ Trigger: CMD_EXPAND,
+ AutoComplete: true,
+ AutoCompleteDesc: T("api.command_expand.desc"),
+ DisplayName: T("api.command_expand.name"),
+ }
+}
+
+func (me *CollapseProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
+ return &model.Command{
+ Trigger: CMD_COLLAPSE,
+ AutoComplete: true,
+ AutoCompleteDesc: T("api.command_collapse.desc"),
+ DisplayName: T("api.command_collapse.name"),
+ }
+}
+
+func (me *ExpandProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ return setCollapsePreference(args, false)
+}
+
+func (me *CollapseProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ return setCollapsePreference(args, true)
+}
+
+func setCollapsePreference(args *model.CommandArgs, isCollapse bool) *model.CommandResponse {
+ pref := model.Preference{
+ UserId: args.UserId,
+ Category: model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS,
+ Name: model.PREFERENCE_NAME_COLLAPSE_SETTING,
+ Value: strconv.FormatBool(isCollapse),
+ }
+
+ if result := <-Srv.Store.Preference().Save(&model.Preferences{pref}); result.Err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_expand_collapse.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ socketMessage := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PREFERENCE_CHANGED, "", "", args.UserId, nil)
+ socketMessage.Add("preference", pref.ToJson())
+ go Publish(socketMessage)
+
+ var rmsg string
+
+ if isCollapse {
+ rmsg = args.T("api.command_collapse.success")
+ } else {
+ rmsg = args.T("api.command_expand.success")
+ }
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg}
+}
diff --git a/api/command_invite_people.go b/app/command_invite_people.go
index b8f1827b0..12ef03f45 100644
--- a/api/command_invite_people.go
+++ b/app/command_invite_people.go
@@ -1,15 +1,15 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"strings"
l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type InvitePeopleProvider struct {
@@ -27,19 +27,19 @@ func (me *InvitePeopleProvider) GetTrigger() string {
return CMD_INVITE_PEOPLE
}
-func (me *InvitePeopleProvider) GetCommand(c *Context) *model.Command {
+func (me *InvitePeopleProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_INVITE_PEOPLE,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command.invite_people.desc"),
- AutoCompleteHint: c.T("api.command.invite_people.hint"),
- DisplayName: c.T("api.command.invite_people.name"),
+ AutoCompleteDesc: T("api.command.invite_people.desc"),
+ AutoCompleteHint: T("api.command.invite_people.hint"),
+ DisplayName: T("api.command.invite_people.name"),
}
}
-func (me *InvitePeopleProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
+func (me *InvitePeopleProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
if !utils.Cfg.EmailSettings.SendEmailNotifications {
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.email_off")}
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.email_off")}
}
emailList := strings.Fields(message)
@@ -52,13 +52,13 @@ func (me *InvitePeopleProvider) DoCommand(c *Context, args *model.CommandArgs, m
}
if len(emailList) == 0 {
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.no_email")}
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.no_email")}
}
- if err := app.InviteNewUsersToTeam(emailList, c.TeamId, c.Session.UserId, c.GetSiteURL()); err != nil {
+ if err := InviteNewUsersToTeam(emailList, args.TeamId, args.UserId, args.SiteURL); err != nil {
l4g.Error(err.Error())
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.fail")}
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.fail")}
}
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.sent")}
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.sent")}
}
diff --git a/app/command_join.go b/app/command_join.go
new file mode 100644
index 000000000..e7d25aa16
--- /dev/null
+++ b/app/command_join.go
@@ -0,0 +1,62 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
+)
+
+type JoinProvider struct {
+}
+
+const (
+ CMD_JOIN = "join"
+)
+
+func init() {
+ RegisterCommandProvider(&JoinProvider{})
+}
+
+func (me *JoinProvider) GetTrigger() string {
+ return CMD_JOIN
+}
+
+func (me *JoinProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
+ return &model.Command{
+ Trigger: CMD_JOIN,
+ AutoComplete: true,
+ AutoCompleteDesc: T("api.command_join.desc"),
+ AutoCompleteHint: T("api.command_join.hint"),
+ DisplayName: T("api.command_join.name"),
+ }
+}
+
+func (me *JoinProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ if result := <-Srv.Store.Channel().GetByName(args.TeamId, message, true); result.Err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_join.list.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ } else {
+ channel := result.Data.(*model.Channel)
+
+ if channel.Name == message {
+
+ if channel.Type != model.CHANNEL_OPEN {
+ return &model.CommandResponse{Text: args.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ if err := JoinChannel(channel, args.UserId, args.SiteURL); err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ team, err := GetTeam(channel.TeamId)
+ if err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ return &model.CommandResponse{GotoLocation: args.SiteURL + "/" + team.Name + "/channels/" + channel.Name, Text: args.T("api.command_join.success"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+ }
+
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command_join.missing.app_error")}
+}
diff --git a/api/command_loadtest.go b/app/command_loadtest.go
index cc5c19ab7..b1d89826b 100644
--- a/api/command_loadtest.go
+++ b/app/command_loadtest.go
@@ -1,7 +1,7 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"io"
@@ -11,9 +11,9 @@ import (
"strings"
l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
var usage = `Mattermost load testing commands to help configure the system
@@ -75,7 +75,7 @@ func (me *LoadTestProvider) GetTrigger() string {
return CMD_LOADTEST
}
-func (me *LoadTestProvider) GetCommand(c *Context) *model.Command {
+func (me *LoadTestProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_LOADTEST,
AutoComplete: false,
@@ -85,44 +85,42 @@ func (me *LoadTestProvider) GetCommand(c *Context) *model.Command {
}
}
-func (me *LoadTestProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- channelId := args.ChannelId
-
+func (me *LoadTestProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
//This command is only available when EnableTesting is true
if !utils.Cfg.ServiceSettings.EnableTesting {
return &model.CommandResponse{}
}
if strings.HasPrefix(message, "setup") {
- return me.SetupCommand(c, channelId, message)
+ return me.SetupCommand(args, message)
}
if strings.HasPrefix(message, "users") {
- return me.UsersCommand(c, channelId, message)
+ return me.UsersCommand(args, message)
}
if strings.HasPrefix(message, "channels") {
- return me.ChannelsCommand(c, channelId, message)
+ return me.ChannelsCommand(args, message)
}
if strings.HasPrefix(message, "posts") {
- return me.PostsCommand(c, channelId, message)
+ return me.PostsCommand(args, message)
}
if strings.HasPrefix(message, "url") {
- return me.UrlCommand(c, channelId, message)
+ return me.UrlCommand(args, message)
}
if strings.HasPrefix(message, "json") {
- return me.JsonCommand(c, channelId, message)
+ return me.JsonCommand(args, message)
}
- return me.HelpCommand(c, channelId, message)
+ return me.HelpCommand(args, message)
}
-func (me *LoadTestProvider) HelpCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) HelpCommand(args *model.CommandArgs, message string) *model.CommandResponse {
return &model.CommandResponse{Text: usage, ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) SetupCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) SetupCommand(args *model.CommandArgs, message string) *model.CommandResponse {
tokens := strings.Fields(strings.TrimPrefix(message, "setup"))
doTeams := contains(tokens, "teams")
doFuzz := contains(tokens, "fuzz")
@@ -160,7 +158,7 @@ func (me *LoadTestProvider) SetupCommand(c *Context, channelId string, message s
numPosts, _ = strconv.Atoi(tokens[numArgs+2])
}
}
- client := model.NewClient(c.GetSiteURL())
+ client := model.NewClient(args.SiteURL)
if doTeams {
if err := CreateBasicUser(client); err != nil {
@@ -186,14 +184,14 @@ func (me *LoadTestProvider) SetupCommand(c *Context, channelId string, message s
} else {
var team *model.Team
- if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil {
+ if tr := <-Srv.Store.Team().Get(args.TeamId); tr.Err != nil {
return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
} else {
team = tr.Data.(*model.Team)
}
- client.MockSession(c.Session.Token)
- client.SetTeamId(c.TeamId)
+ client.MockSession(args.Session.Token)
+ client.SetTeamId(args.TeamId)
CreateTestEnvironmentInTeam(
client,
team,
@@ -206,7 +204,7 @@ func (me *LoadTestProvider) SetupCommand(c *Context, channelId string, message s
return &model.CommandResponse{Text: "Created enviroment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) UsersCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) UsersCommand(args *model.CommandArgs, message string) *model.CommandResponse {
cmd := strings.TrimSpace(strings.TrimPrefix(message, "users"))
doFuzz := false
@@ -221,13 +219,13 @@ func (me *LoadTestProvider) UsersCommand(c *Context, channelId string, message s
}
var team *model.Team
- if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil {
+ if tr := <-Srv.Store.Team().Get(args.TeamId); tr.Err != nil {
return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
} else {
team = tr.Data.(*model.Team)
}
- client := model.NewClient(c.GetSiteURL())
+ client := model.NewClient(args.SiteURL)
client.SetTeamId(team.Id)
userCreator := NewAutoUserCreator(client, team)
userCreator.Fuzzy = doFuzz
@@ -236,7 +234,7 @@ func (me *LoadTestProvider) UsersCommand(c *Context, channelId string, message s
return &model.CommandResponse{Text: "Added users", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) ChannelsCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) ChannelsCommand(args *model.CommandArgs, message string) *model.CommandResponse {
cmd := strings.TrimSpace(strings.TrimPrefix(message, "channels"))
doFuzz := false
@@ -251,15 +249,15 @@ func (me *LoadTestProvider) ChannelsCommand(c *Context, channelId string, messag
}
var team *model.Team
- if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil {
+ if tr := <-Srv.Store.Team().Get(args.TeamId); tr.Err != nil {
return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
} else {
team = tr.Data.(*model.Team)
}
- client := model.NewClient(c.GetSiteURL())
+ client := model.NewClient(args.SiteURL)
client.SetTeamId(team.Id)
- client.MockSession(c.Session.Token)
+ client.MockSession(args.Session.Token)
channelCreator := NewAutoChannelCreator(client, team)
channelCreator.Fuzzy = doFuzz
channelCreator.CreateTestChannels(channelsr)
@@ -267,7 +265,7 @@ func (me *LoadTestProvider) ChannelsCommand(c *Context, channelId string, messag
return &model.CommandResponse{Text: "Added channels", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) PostsCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) PostsCommand(args *model.CommandArgs, message string) *model.CommandResponse {
cmd := strings.TrimSpace(strings.TrimPrefix(message, "posts"))
doFuzz := false
@@ -290,7 +288,7 @@ func (me *LoadTestProvider) PostsCommand(c *Context, channelId string, message s
}
var usernames []string
- if result := <-app.Srv.Store.User().GetProfiles(c.TeamId, 0, 1000); result.Err == nil {
+ if result := <-Srv.Store.User().GetProfiles(args.TeamId, 0, 1000); result.Err == nil {
profileUsers := result.Data.([]*model.User)
usernames = make([]string, len(profileUsers))
i := 0
@@ -300,10 +298,10 @@ func (me *LoadTestProvider) PostsCommand(c *Context, channelId string, message s
}
}
- client := model.NewClient(c.GetSiteURL())
- client.SetTeamId(c.TeamId)
- client.MockSession(c.Session.Token)
- testPoster := NewAutoPostCreator(client, channelId)
+ client := model.NewClient(args.SiteURL)
+ client.SetTeamId(args.TeamId)
+ client.MockSession(args.Session.Token)
+ testPoster := NewAutoPostCreator(client, args.ChannelId)
testPoster.Fuzzy = doFuzz
testPoster.Users = usernames
@@ -317,7 +315,7 @@ func (me *LoadTestProvider) PostsCommand(c *Context, channelId string, message s
return &model.CommandResponse{Text: "Added posts", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) UrlCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) UrlCommand(args *model.CommandArgs, message string) *model.CommandResponse {
url := strings.TrimSpace(strings.TrimPrefix(message, "url"))
if len(url) == 0 {
return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
@@ -356,10 +354,10 @@ func (me *LoadTestProvider) UrlCommand(c *Context, channelId string, message str
post := &model.Post{}
post.Message = string(bytes[:length])
- post.ChannelId = channelId
- post.UserId = c.Session.UserId
+ post.ChannelId = args.ChannelId
+ post.UserId = args.UserId
- if _, err := app.CreatePost(post, c.TeamId, false, c.GetSiteURL()); err != nil {
+ if _, err := CreatePost(post, args.TeamId, false, args.SiteURL); err != nil {
return &model.CommandResponse{Text: "Unable to create post", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
}
@@ -367,7 +365,7 @@ func (me *LoadTestProvider) UrlCommand(c *Context, channelId string, message str
return &model.CommandResponse{Text: "Loaded data", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
-func (me *LoadTestProvider) JsonCommand(c *Context, channelId string, message string) *model.CommandResponse {
+func (me *LoadTestProvider) JsonCommand(args *model.CommandArgs, message string) *model.CommandResponse {
url := strings.TrimSpace(strings.TrimPrefix(message, "json"))
if len(url) == 0 {
return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
@@ -392,13 +390,13 @@ func (me *LoadTestProvider) JsonCommand(c *Context, channelId string, message st
}
post := model.PostFromJson(contents)
- post.ChannelId = channelId
- post.UserId = c.Session.UserId
+ post.ChannelId = args.ChannelId
+ post.UserId = args.UserId
if post.Message == "" {
post.Message = message
}
- if _, err := app.CreatePost(post, c.TeamId, false, c.GetSiteURL()); err != nil {
+ if _, err := CreatePost(post, args.TeamId, false, args.SiteURL); err != nil {
return &model.CommandResponse{Text: "Unable to create post", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
return &model.CommandResponse{Text: "Loaded data", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
diff --git a/api/command_logout.go b/app/command_logout.go
index 0eaa9a0ba..1a353056e 100644
--- a/api/command_logout.go
+++ b/app/command_logout.go
@@ -1,11 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type LogoutProvider struct {
@@ -23,23 +23,23 @@ func (me *LogoutProvider) GetTrigger() string {
return CMD_LOGOUT
}
-func (me *LogoutProvider) GetCommand(c *Context) *model.Command {
+func (me *LogoutProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_LOGOUT,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_logout.desc"),
+ AutoCompleteDesc: T("api.command_logout.desc"),
AutoCompleteHint: "",
- DisplayName: c.T("api.command_logout.name"),
+ DisplayName: T("api.command_logout.name"),
}
}
-func (me *LogoutProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- FAIL := &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_logout.fail_message")}
+func (me *LogoutProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ FAIL := &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command_logout.fail_message")}
SUCCESS := &model.CommandResponse{GotoLocation: "/login"}
// We can't actually remove the user's cookie from here so we just dump their session and let the browser figure it out
- if c.Session.Id != "" {
- if err := app.RevokeSessionById(c.Session.Id); err != nil {
+ if args.Session.Id != "" {
+ if err := RevokeSessionById(args.Session.Id); err != nil {
return FAIL
}
return SUCCESS
diff --git a/api/command_me.go b/app/command_me.go
index a3cda472a..bb29ec1e0 100644
--- a/api/command_me.go
+++ b/app/command_me.go
@@ -1,10 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type MeProvider struct {
@@ -22,16 +23,16 @@ func (me *MeProvider) GetTrigger() string {
return CMD_ME
}
-func (me *MeProvider) GetCommand(c *Context) *model.Command {
+func (me *MeProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_ME,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_me.desc"),
- AutoCompleteHint: c.T("api.command_me.hint"),
- DisplayName: c.T("api.command_me.name"),
+ AutoCompleteDesc: T("api.command_me.desc"),
+ AutoCompleteHint: T("api.command_me.hint"),
+ DisplayName: T("api.command_me.name"),
}
}
-func (me *MeProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
+func (me *MeProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL, Text: "*" + message + "*"}
}
diff --git a/app/command_msg.go b/app/command_msg.go
new file mode 100644
index 000000000..06b17fdc4
--- /dev/null
+++ b/app/command_msg.go
@@ -0,0 +1,110 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "strings"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
+)
+
+type msgProvider struct {
+}
+
+const (
+ CMD_MSG = "msg"
+)
+
+func init() {
+ RegisterCommandProvider(&msgProvider{})
+}
+
+func (me *msgProvider) GetTrigger() string {
+ return CMD_MSG
+}
+
+func (me *msgProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
+ return &model.Command{
+ Trigger: CMD_MSG,
+ AutoComplete: true,
+ AutoCompleteDesc: T("api.command_msg.desc"),
+ AutoCompleteHint: T("api.command_msg.hint"),
+ DisplayName: T("api.command_msg.name"),
+ }
+}
+
+func (me *msgProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+
+ splitMessage := strings.SplitN(message, " ", 2)
+
+ parsedMessage := ""
+ targetUsername := ""
+ teamId := ""
+
+ if len(splitMessage) > 1 {
+ parsedMessage = strings.SplitN(message, " ", 2)[1]
+ }
+ targetUsername = strings.SplitN(message, " ", 2)[0]
+ targetUsername = strings.TrimPrefix(targetUsername, "@")
+
+ var userProfile *model.User
+ if result := <-Srv.Store.User().GetByUsername(targetUsername); result.Err != nil {
+ l4g.Error(result.Err.Error())
+ return &model.CommandResponse{Text: args.T("api.command_msg.missing.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ } else {
+ userProfile = result.Data.(*model.User)
+ }
+
+ if userProfile.Id == args.UserId {
+ return &model.CommandResponse{Text: args.T("api.command_msg.missing.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ // Find the channel based on this user
+ channelName := model.GetDMNameFromIds(args.UserId, userProfile.Id)
+
+ targetChannelId := ""
+ if channel := <-Srv.Store.Channel().GetByName(args.TeamId, channelName, true); channel.Err != nil {
+ if channel.Err.Id == "store.sql_channel.get_by_name.missing.app_error" {
+ if directChannel, err := CreateDirectChannel(args.UserId, userProfile.Id); err != nil {
+ l4g.Error(err.Error())
+ return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ } else {
+ targetChannelId = directChannel.Id
+ }
+ } else {
+ l4g.Error(channel.Err.Error())
+ return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+ } else {
+ channel := channel.Data.(*model.Channel)
+ targetChannelId = channel.Id
+ teamId = channel.TeamId
+ }
+
+ if len(parsedMessage) > 0 {
+ post := &model.Post{}
+ post.Message = parsedMessage
+ post.ChannelId = targetChannelId
+ post.UserId = args.UserId
+ if _, err := CreatePost(post, args.TeamId, true, args.SiteURL); err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+ }
+
+ if teamId == "" {
+ if len(args.Session.TeamMembers) == 0 {
+ return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+ teamId = args.Session.TeamMembers[0].TeamId
+ }
+
+ team, err := GetTeam(teamId)
+ if err != nil {
+ return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+ }
+
+ return &model.CommandResponse{GotoLocation: args.SiteURL + "/" + team.Name + "/channels/" + channelName, Text: "", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
+}
diff --git a/api/command_offline.go b/app/command_offline.go
index a4bcdf8a5..6e2c125f8 100644
--- a/api/command_offline.go
+++ b/app/command_offline.go
@@ -1,11 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type OfflineProvider struct {
@@ -23,21 +23,21 @@ func (me *OfflineProvider) GetTrigger() string {
return CMD_OFFLINE
}
-func (me *OfflineProvider) GetCommand(c *Context) *model.Command {
+func (me *OfflineProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_OFFLINE,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_offline.desc"),
- DisplayName: c.T("api.command_offline.name"),
+ AutoCompleteDesc: T("api.command_offline.desc"),
+ DisplayName: T("api.command_offline.name"),
}
}
-func (me *OfflineProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- rmsg := c.T("api.command_offline.success")
+func (me *OfflineProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ rmsg := args.T("api.command_offline.success")
if len(message) > 0 {
rmsg = message + " " + rmsg
}
- app.SetStatusOffline(c.Session.UserId, true)
+ SetStatusOffline(args.UserId, true)
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg}
}
diff --git a/api/command_online.go b/app/command_online.go
index 81d3e1fd6..bd6fbab60 100644
--- a/api/command_online.go
+++ b/app/command_online.go
@@ -1,11 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
- "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type OnlineProvider struct {
@@ -23,21 +23,21 @@ func (me *OnlineProvider) GetTrigger() string {
return CMD_ONLINE
}
-func (me *OnlineProvider) GetCommand(c *Context) *model.Command {
+func (me *OnlineProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_ONLINE,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_online.desc"),
- DisplayName: c.T("api.command_online.name"),
+ AutoCompleteDesc: T("api.command_online.desc"),
+ DisplayName: T("api.command_online.name"),
}
}
-func (me *OnlineProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
- rmsg := c.T("api.command_online.success")
+func (me *OnlineProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
+ rmsg := args.T("api.command_online.success")
if len(message) > 0 {
rmsg = message + " " + rmsg
}
- app.SetStatusOnline(c.Session.UserId, c.Session.Id, true)
+ SetStatusOnline(args.UserId, args.Session.Id, true)
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: rmsg}
}
diff --git a/api/command_shortcuts.go b/app/command_shortcuts.go
index 1664221c1..93e5f0f51 100644
--- a/api/command_shortcuts.go
+++ b/app/command_shortcuts.go
@@ -1,13 +1,14 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"bytes"
"strings"
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type ShortcutsProvider struct {
@@ -25,17 +26,17 @@ func (me *ShortcutsProvider) GetTrigger() string {
return CMD_SHORTCUTS
}
-func (me *ShortcutsProvider) GetCommand(c *Context) *model.Command {
+func (me *ShortcutsProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_SHORTCUTS,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_shortcuts.desc"),
+ AutoCompleteDesc: T("api.command_shortcuts.desc"),
AutoCompleteHint: "",
- DisplayName: c.T("api.command_shortcuts.name"),
+ DisplayName: T("api.command_shortcuts.name"),
}
}
-func (me *ShortcutsProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
+func (me *ShortcutsProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
shortcutIds := [28]string{
"api.command_shortcuts.header",
// Nav shortcuts
@@ -73,21 +74,21 @@ func (me *ShortcutsProvider) DoCommand(c *Context, args *model.CommandArgs, mess
var osDependentWords map[string]interface{}
if strings.Contains(message, "mac") {
osDependentWords = map[string]interface{}{
- "CmdOrCtrl": c.T("api.command_shortcuts.cmd"),
- "ChannelPrevCmd": c.T("api.command_shortcuts.browser.channel_prev.cmd_mac"),
- "ChannelNextCmd": c.T("api.command_shortcuts.browser.channel_next.cmd_mac"),
+ "CmdOrCtrl": args.T("api.command_shortcuts.cmd"),
+ "ChannelPrevCmd": args.T("api.command_shortcuts.browser.channel_prev.cmd_mac"),
+ "ChannelNextCmd": args.T("api.command_shortcuts.browser.channel_next.cmd_mac"),
}
} else {
osDependentWords = map[string]interface{}{
- "CmdOrCtrl": c.T("api.command_shortcuts.ctrl"),
- "ChannelPrevCmd": c.T("api.command_shortcuts.browser.channel_prev.cmd"),
- "ChannelNextCmd": c.T("api.command_shortcuts.browser.channel_next.cmd"),
+ "CmdOrCtrl": args.T("api.command_shortcuts.ctrl"),
+ "ChannelPrevCmd": args.T("api.command_shortcuts.browser.channel_prev.cmd"),
+ "ChannelNextCmd": args.T("api.command_shortcuts.browser.channel_next.cmd"),
}
}
var buffer bytes.Buffer
for _, element := range shortcutIds {
- buffer.WriteString(c.T(element, osDependentWords))
+ buffer.WriteString(args.T(element, osDependentWords))
}
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: buffer.String()}
diff --git a/api/command_shrug.go b/app/command_shrug.go
index 899fcab33..12d1039ec 100644
--- a/api/command_shrug.go
+++ b/app/command_shrug.go
@@ -1,10 +1,11 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-package api
+package app
import (
"github.com/mattermost/platform/model"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type ShrugProvider struct {
@@ -22,17 +23,17 @@ func (me *ShrugProvider) GetTrigger() string {
return CMD_SHRUG
}
-func (me *ShrugProvider) GetCommand(c *Context) *model.Command {
+func (me *ShrugProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
return &model.Command{
Trigger: CMD_SHRUG,
AutoComplete: true,
- AutoCompleteDesc: c.T("api.command_shrug.desc"),
- AutoCompleteHint: c.T("api.command_shrug.hint"),
- DisplayName: c.T("api.command_shrug.name"),
+ AutoCompleteDesc: T("api.command_shrug.desc"),
+ AutoCompleteHint: T("api.command_shrug.hint"),
+ DisplayName: T("api.command_shrug.name"),
}
}
-func (me *ShrugProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
+func (me *ShrugProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
rmsg := `¯\\\_(ツ)\_/¯`
if len(message) > 0 {
rmsg = message + " " + rmsg
diff --git a/app/compliance.go b/app/compliance.go
index ffef69b44..966b9b523 100644
--- a/app/compliance.go
+++ b/app/compliance.go
@@ -11,12 +11,12 @@ import (
"github.com/mattermost/platform/utils"
)
-func GetComplianceReports() (model.Compliances, *model.AppError) {
+func GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError) {
if !*utils.Cfg.ComplianceSettings.Enable || !utils.IsLicensed || !*utils.License.Features.Compliance {
return nil, model.NewLocAppError("GetComplianceReports", "ent.compliance.licence_disable.app_error", nil, "")
}
- if result := <-Srv.Store.Compliance().GetAll(); result.Err != nil {
+ if result := <-Srv.Store.Compliance().GetAll(page*perPage, perPage); result.Err != nil {
return nil, result.Err
} else {
return result.Data.(model.Compliances), nil
diff --git a/app/email_test.go b/app/email_test.go
index 6cd46fee0..17b892585 100644
--- a/app/email_test.go
+++ b/app/email_test.go
@@ -30,17 +30,29 @@ func TestSendChangeUsernameEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(emailTo); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(emailTo)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -66,21 +78,33 @@ func TestSendEmailChangeVerifyEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(newUserEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], newUserEmail) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(newUserEmail, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
- }
- if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(newUserEmail)) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong new email in the message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(newUserEmail)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], newUserEmail) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(newUserEmail, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(newUserEmail)) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong new email in the message")
+ }
}
}
}
@@ -106,17 +130,29 @@ func TestSendEmailChangeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(oldEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], oldEmail) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(oldEmail, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(oldEmail)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], oldEmail) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(oldEmail, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -142,21 +178,33 @@ func TestSendVerifyEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(userEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], userEmail) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(userEmail, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
- }
- if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(userEmail)) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong new email in the message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(userEmail)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], userEmail) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(userEmail, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(userEmail)) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong new email in the message")
+ }
}
}
}
@@ -182,17 +230,29 @@ func TestSendSignInChangeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -219,17 +279,29 @@ func TestSendWelcomeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -244,25 +316,37 @@ func TestSendWelcomeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Subject, expectedSubject) {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedVerifyEmail) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
- }
- if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(email)) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong email in the message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Subject, expectedSubject) {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedVerifyEmail) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(email)) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong email in the message")
+ }
}
}
}
@@ -288,17 +372,29 @@ func TestSendPasswordChangeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -324,17 +420,29 @@ func TestSendMfaChangeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -349,17 +457,29 @@ func TestSendMfaChangeEmail(t *testing.T) {
t.Fatal("Should send change username email")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Subject, expectedSubject) {
- t.Log(resultsEmail.Subject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Subject, expectedSubject) {
+ t.Log(resultsEmail.Subject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
@@ -385,35 +505,58 @@ func TestSendInviteEmails(t *testing.T) {
SendInviteEmails(th.BasicTeam, senderName, invites, siteURL)
//Check if the email was send to the rigth email address to email1
- if resultsMailbox, err := utils.GetMailBox(email1); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email1) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email1, resultsMailbox[0].ID); err == nil {
- if resultsEmail.Subject != expectedSubject {
- t.Log(resultsEmail.Subject)
- t.Log(expectedSubject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email1)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email1) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email1, resultsMailbox[0].ID); err == nil {
+ if resultsEmail.Subject != expectedSubject {
+ t.Log(resultsEmail.Subject)
+ t.Log(expectedSubject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
//Check if the email was send to the rigth email address to email2
- if resultsMailbox, err := utils.GetMailBox(email2); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email2) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(email2, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Subject, expectedSubject) {
- t.Log(resultsEmail.Subject)
- t.Log(expectedSubject)
- t.Fatal("Wrong Subject")
- }
- if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Wrong Body message")
+ err = utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(email2)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], email2) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(email2, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Subject, expectedSubject) {
+ t.Log(resultsEmail.Subject)
+ t.Log(expectedSubject)
+ t.Fatal("Wrong Subject")
+ }
+ if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Wrong Body message")
+ }
}
}
}
diff --git a/app/file.go b/app/file.go
index b678475c9..8c0960fe8 100644
--- a/app/file.go
+++ b/app/file.go
@@ -360,6 +360,11 @@ func MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo {
func GeneratePublicLink(siteURL string, info *model.FileInfo) string {
hash := GeneratePublicLinkHash(info.Id, *utils.Cfg.FileSettings.PublicLinkSalt)
+ return fmt.Sprintf("%s/files/%v/public?h=%s", siteURL, info.Id, hash)
+}
+
+func GeneratePublicLinkV3(siteURL string, info *model.FileInfo) string {
+ hash := GeneratePublicLinkHash(info.Id, *utils.Cfg.FileSettings.PublicLinkSalt)
return fmt.Sprintf("%s%s/public/files/%v/get?h=%s", siteURL, model.API_URL_SUFFIX_V3, info.Id, hash)
}
diff --git a/app/saml.go b/app/saml.go
index cc39d4540..92f0e1f0e 100644
--- a/app/saml.go
+++ b/app/saml.go
@@ -16,21 +16,19 @@ import (
func GetSamlMetadata() (string, *model.AppError) {
samlInterface := einterfaces.GetSamlInterface()
-
if samlInterface == nil {
- err := model.NewLocAppError("GetSamlMetadata", "api.admin.saml.not_available.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
+ err := model.NewAppError("GetSamlMetadata", "api.admin.saml.not_available.app_error", nil, "", http.StatusNotImplemented)
return "", err
}
if result, err := samlInterface.GetMetadata(); err != nil {
- return "", model.NewLocAppError("GetSamlMetadata", "api.admin.saml.metadata.app_error", nil, "err="+err.Message)
+ return "", model.NewAppError("GetSamlMetadata", "api.admin.saml.metadata.app_error", nil, "err="+err.Message, err.StatusCode)
} else {
return result, nil
}
}
-func AddSamlCertificate(fileData *multipart.FileHeader) *model.AppError {
+func WriteSamlFile(fileData *multipart.FileHeader) *model.AppError {
file, err := fileData.Open()
defer file.Close()
if err != nil {
@@ -47,7 +45,67 @@ func AddSamlCertificate(fileData *multipart.FileHeader) *model.AppError {
return nil
}
-func RemoveSamlCertificate(filename string) *model.AppError {
+func AddSamlPublicCertificate(fileData *multipart.FileHeader) *model.AppError {
+ if err := WriteSamlFile(fileData); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.PublicCertificateFile = fileData.Filename
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func AddSamlPrivateCertificate(fileData *multipart.FileHeader) *model.AppError {
+ if err := WriteSamlFile(fileData); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.PrivateKeyFile = fileData.Filename
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppError {
+ if err := WriteSamlFile(fileData); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.IdpCertificateFile = fileData.Filename
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func RemoveSamlFile(filename string) *model.AppError {
if err := os.Remove(utils.FindConfigFile(filename)); err != nil {
return model.NewLocAppError("removeCertificate", "api.admin.remove_certificate.delete.app_error",
map[string]interface{}{"Filename": filename}, err.Error())
@@ -56,12 +114,75 @@ func RemoveSamlCertificate(filename string) *model.AppError {
return nil
}
-func GetSamlCertificateStatus() map[string]interface{} {
- status := make(map[string]interface{})
+func RemoveSamlPublicCertificate() *model.AppError {
+ if err := RemoveSamlFile(*utils.Cfg.SamlSettings.PublicCertificateFile); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.PublicCertificateFile = ""
+ *cfg.SamlSettings.Encrypt = false
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func RemoveSamlPrivateCertificate() *model.AppError {
+ if err := RemoveSamlFile(*utils.Cfg.SamlSettings.PrivateKeyFile); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.PrivateKeyFile = ""
+ *cfg.SamlSettings.Encrypt = false
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func RemoveSamlIdpCertificate() *model.AppError {
+ if err := RemoveSamlFile(*utils.Cfg.SamlSettings.IdpCertificateFile); err != nil {
+ return err
+ }
+
+ cfg := &model.Config{}
+ *cfg = *utils.Cfg
+
+ *cfg.SamlSettings.IdpCertificateFile = ""
+ *cfg.SamlSettings.Enable = false
+
+ if err := cfg.IsValid(); err != nil {
+ return err
+ }
+
+ utils.SaveConfig(utils.CfgFileName, cfg)
+ utils.LoadConfig(utils.CfgFileName)
+
+ return nil
+}
+
+func GetSamlCertificateStatus() *model.SamlCertificateStatus {
+ status := &model.SamlCertificateStatus{}
- status["IdpCertificateFile"] = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.IdpCertificateFile)
- status["PrivateKeyFile"] = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.PrivateKeyFile)
- status["PublicCertificateFile"] = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.PublicCertificateFile)
+ status.IdpCertificateFile = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.IdpCertificateFile)
+ status.PrivateKeyFile = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.PrivateKeyFile)
+ status.PublicCertificateFile = utils.FileExistsInConfigFolder(*utils.Cfg.SamlSettings.PublicCertificateFile)
return status
}
diff --git a/app/team.go b/app/team.go
index 875dedfd0..d0d907731 100644
--- a/app/team.go
+++ b/app/team.go
@@ -391,6 +391,30 @@ func GetTeamMembersByIds(teamId string, userIds []string) ([]*model.TeamMember,
}
}
+func GetTeamUnread(teamId, userId string) (*model.TeamUnread, *model.AppError) {
+ result := <-Srv.Store.Team().GetChannelUnreadsForTeam(teamId, userId)
+ if result.Err != nil {
+ return nil, result.Err
+ }
+
+ channelUnreads := result.Data.([]*model.ChannelUnread)
+ var teamUnread = &model.TeamUnread{
+ MsgCount: 0,
+ MentionCount: 0,
+ TeamId: teamId,
+ }
+
+ for _, cu := range channelUnreads {
+ teamUnread.MentionCount += cu.MentionCount
+
+ if cu.NotifyProps["mark_unread"] != model.CHANNEL_MARK_UNREAD_MENTION {
+ teamUnread.MsgCount += cu.MsgCount
+ }
+ }
+
+ return teamUnread, nil
+}
+
func RemoveUserFromTeam(teamId string, userId string) *model.AppError {
tchan := Srv.Store.Team().Get(teamId)
uchan := Srv.Store.User().Get(userId)
@@ -511,8 +535,8 @@ func FindTeamByName(name string) bool {
}
}
-func GetTeamsUnreadForUser(teamId string, userId string) ([]*model.TeamUnread, *model.AppError) {
- if result := <-Srv.Store.Team().GetTeamsUnreadForUser(teamId, userId); result.Err != nil {
+func GetTeamsUnreadForUser(excludeTeamId string, userId string) ([]*model.TeamUnread, *model.AppError) {
+ if result := <-Srv.Store.Team().GetChannelUnreadsForAllTeams(excludeTeamId, userId); result.Err != nil {
return nil, result.Err
} else {
data := result.Data.([]*model.ChannelUnread)
@@ -523,7 +547,7 @@ func GetTeamsUnreadForUser(teamId string, userId string) ([]*model.TeamUnread, *
tu.MentionCount += cu.MentionCount
if cu.NotifyProps["mark_unread"] != model.CHANNEL_MARK_UNREAD_MENTION {
- tu.MsgCount += (cu.TotalMsgCount - cu.MsgCount)
+ tu.MsgCount += cu.MsgCount
}
return tu
diff --git a/app/user.go b/app/user.go
index d050e1524..c877640d6 100644
--- a/app/user.go
+++ b/app/user.go
@@ -949,6 +949,34 @@ func UpdateUserNotifyProps(userId string, props map[string]string, siteURL strin
return ruser, nil
}
+func UpdateMfa(activate bool, userId, token, siteUrl string) *model.AppError {
+ if activate {
+ if err := ActivateMfa(userId, token); err != nil {
+ return err
+ }
+ } else {
+ if err := DeactivateMfa(userId); err != nil {
+ return err
+ }
+ }
+
+ go func() {
+ var user *model.User
+ var err *model.AppError
+
+ if user, err = GetUser(userId); err != nil {
+ l4g.Error(err.Error())
+ return
+ }
+
+ if err := SendMfaChangeEmail(user.Email, activate, user.Locale, siteUrl); err != nil {
+ l4g.Error(err.Error())
+ }
+ }()
+
+ return nil
+}
+
func UpdatePasswordByUserIdSendEmail(userId, newPassword, method, siteURL string) *model.AppError {
var user *model.User
var err *model.AppError
@@ -1183,31 +1211,49 @@ func VerifyUserEmail(userId string) *model.AppError {
return nil
}
-func SearchUsersInChannel(channelId string, term string, searchOptions map[string]bool) ([]*model.User, *model.AppError) {
+func SearchUsersInChannel(channelId string, term string, searchOptions map[string]bool, asAdmin bool) ([]*model.User, *model.AppError) {
if result := <-Srv.Store.User().SearchInChannel(channelId, term, searchOptions); result.Err != nil {
return nil, result.Err
} else {
- return result.Data.([]*model.User), nil
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ return users, nil
}
}
-func SearchUsersNotInChannel(teamId string, channelId string, term string, searchOptions map[string]bool) ([]*model.User, *model.AppError) {
+func SearchUsersNotInChannel(teamId string, channelId string, term string, searchOptions map[string]bool, asAdmin bool) ([]*model.User, *model.AppError) {
if result := <-Srv.Store.User().SearchNotInChannel(teamId, channelId, term, searchOptions); result.Err != nil {
return nil, result.Err
} else {
- return result.Data.([]*model.User), nil
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ return users, nil
}
}
-func SearchUsersInTeam(teamId string, term string, searchOptions map[string]bool) ([]*model.User, *model.AppError) {
+func SearchUsersInTeam(teamId string, term string, searchOptions map[string]bool, asAdmin bool) ([]*model.User, *model.AppError) {
if result := <-Srv.Store.User().Search(teamId, term, searchOptions); result.Err != nil {
return nil, result.Err
} else {
- return result.Data.([]*model.User), nil
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ return users, nil
}
}
-func AutocompleteUsersInChannel(teamId string, channelId string, term string, searchOptions map[string]bool) (*model.UserAutocompleteInChannel, *model.AppError) {
+func AutocompleteUsersInChannel(teamId string, channelId string, term string, searchOptions map[string]bool, asAdmin bool) (*model.UserAutocompleteInChannel, *model.AppError) {
uchan := Srv.Store.User().SearchInChannel(channelId, term, searchOptions)
nuchan := Srv.Store.User().SearchNotInChannel(teamId, channelId, term, searchOptions)
@@ -1216,25 +1262,43 @@ func AutocompleteUsersInChannel(teamId string, channelId string, term string, se
if result := <-uchan; result.Err != nil {
return nil, result.Err
} else {
- autocomplete.InChannel = result.Data.([]*model.User)
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ autocomplete.InChannel = users
}
if result := <-nuchan; result.Err != nil {
return nil, result.Err
} else {
- autocomplete.OutOfChannel = result.Data.([]*model.User)
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ autocomplete.OutOfChannel = users
}
return autocomplete, nil
}
-func AutocompleteUsersInTeam(teamId string, term string, searchOptions map[string]bool) (*model.UserAutocompleteInTeam, *model.AppError) {
+func AutocompleteUsersInTeam(teamId string, term string, searchOptions map[string]bool, asAdmin bool) (*model.UserAutocompleteInTeam, *model.AppError) {
autocomplete := &model.UserAutocompleteInTeam{}
if result := <-Srv.Store.User().Search(teamId, term, searchOptions); result.Err != nil {
return nil, result.Err
} else {
- autocomplete.InTeam = result.Data.([]*model.User)
+ users := result.Data.([]*model.User)
+
+ for _, user := range users {
+ SanitizeProfile(user, asAdmin)
+ }
+
+ autocomplete.InTeam = users
}
return autocomplete, nil
diff --git a/app/webhook.go b/app/webhook.go
index 98e1080b6..c3853b97b 100644
--- a/app/webhook.go
+++ b/app/webhook.go
@@ -33,7 +33,7 @@ func handleWebhookEvents(post *model.Post, team *model.Team, channel *model.Chan
return nil
}
- hchan := Srv.Store.Webhook().GetOutgoingByTeam(team.Id)
+ hchan := Srv.Store.Webhook().GetOutgoingByTeam(team.Id, -1, -1)
result := <-hchan
if result.Err != nil {
return result.Err
@@ -186,6 +186,7 @@ func UpdateIncomingWebhook(oldHook, updatedHook *model.IncomingWebhook) (*model.
return nil, model.NewAppError("UpdateIncomingWebhook", "api.incoming_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
}
+ updatedHook.Id = oldHook.Id
updatedHook.UserId = oldHook.UserId
updatedHook.CreateAt = oldHook.CreateAt
updatedHook.UpdateAt = model.GetMillis()
@@ -275,7 +276,7 @@ func CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook,
return nil, model.NewAppError("CreateOutgoingWebhook", "api.webhook.create_outgoing.triggers.app_error", nil, "", http.StatusBadRequest)
}
- if result := <-Srv.Store.Webhook().GetOutgoingByTeam(hook.TeamId); result.Err != nil {
+ if result := <-Srv.Store.Webhook().GetOutgoingByTeam(hook.TeamId, -1, -1); result.Err != nil {
return nil, result.Err
} else {
allHooks := result.Data.([]*model.OutgoingWebhook)
@@ -320,7 +321,7 @@ func UpdateOutgoingWebhook(oldHook, updatedHook *model.OutgoingWebhook) (*model.
}
var result store.StoreResult
- if result = <-Srv.Store.Webhook().GetOutgoingByTeam(oldHook.TeamId); result.Err != nil {
+ if result = <-Srv.Store.Webhook().GetOutgoingByTeam(oldHook.TeamId, -1, -1); result.Err != nil {
return nil, result.Err
}
@@ -360,12 +361,36 @@ func GetOutgoingWebhook(hookId string) (*model.OutgoingWebhook, *model.AppError)
}
}
+func GetOutgoingWebhooksPage(page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) {
+ if !utils.Cfg.ServiceSettings.EnableOutgoingWebhooks {
+ return nil, model.NewAppError("GetOutgoingWebhooksPage", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ if result := <-Srv.Store.Webhook().GetOutgoingList(page*perPage, perPage); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.([]*model.OutgoingWebhook), nil
+ }
+}
+
+func GetOutgoingWebhooksForChannelPage(channelId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) {
+ if !utils.Cfg.ServiceSettings.EnableOutgoingWebhooks {
+ return nil, model.NewAppError("GetOutgoingWebhooksForChannelPage", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
+ if result := <-Srv.Store.Webhook().GetOutgoingByChannel(channelId, page*perPage, perPage); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.([]*model.OutgoingWebhook), nil
+ }
+}
+
func GetOutgoingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) {
if !utils.Cfg.ServiceSettings.EnableOutgoingWebhooks {
return nil, model.NewAppError("GetOutgoingWebhooksForTeamPage", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
}
- if result := <-Srv.Store.Webhook().GetOutgoingByTeam(teamId); result.Err != nil {
+ if result := <-Srv.Store.Webhook().GetOutgoingByTeam(teamId, page*perPage, perPage); result.Err != nil {
return nil, result.Err
} else {
return result.Data.([]*model.OutgoingWebhook), nil
diff --git a/einterfaces/cluster.go b/einterfaces/cluster.go
index b7ba55144..1c6b1e071 100644
--- a/einterfaces/cluster.go
+++ b/einterfaces/cluster.go
@@ -23,7 +23,7 @@ type ClusterInterface interface {
InvalidateCacheForReactions(postId string)
Publish(event *model.WebSocketEvent)
UpdateStatus(status *model.Status)
- GetLogs() ([]string, *model.AppError)
+ GetLogs(page, perPage int) ([]string, *model.AppError)
GetClusterId() string
ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError
InvalidateAllCaches() *model.AppError
diff --git a/glide.lock b/glide.lock
index edc45220e..ec3b9aed6 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,5 +1,5 @@
-hash: 42839eb256dd5b5607d93cd50372cf55881de6e874a63525862ed3f0ac47682b
-updated: 2017-02-01T10:22:19.702548922-05:00
+hash: cd23f3578895da94079e79ec355cca1eb64867c5b58f02fc5ec00dd88576d575
+updated: 2017-03-13T15:29:09.097298322-04:00
imports:
- name: github.com/alecthomas/log4go
version: e5dc62318d9bd58682f1dceb53a4b24e8253682f
@@ -21,18 +21,13 @@ imports:
version: 8168ee085ee43257585e50c6441aadf54ecb2c9f
- name: github.com/go-sql-driver/mysql
version: a0583e0143b1624142adab07e0e97fe106d99561
-- name: github.com/goamz/goamz
- version: b2c2eaf25cbb87f41087aa796facf82113809ed5
- subpackages:
- - aws
- - s3
- name: github.com/golang/freetype
version: d9be45aaf7452cc30c0ceb1b1bf7efe1d17b7c87
subpackages:
- raster
- truetype
- name: github.com/golang/protobuf
- version: 8ee79997227bf9b34611aee7946ae64735e6fd93
+ version: c9c7427a2a70d2eb3bafa0ab2dc163e45f143317
subpackages:
- proto
- name: github.com/gorilla/context
@@ -49,10 +44,12 @@ imports:
- simplelru
- name: github.com/inconshreveable/mousetrap
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
+- name: github.com/jaytaylor/html2text
+ version: f3b8a7ca0a23f0a806b2e1ad1247de39ecde54bf
- name: github.com/jehiah/go-strftime
version: 834e15c05a45371503440cc195bbd05c9a0968d9
- name: github.com/lib/pq
- version: a6657b2386e9b8be76484c08711b02c7cf867ead
+ version: e4af84aab01e159ca479940dbde304519e8e8811
subpackages:
- oid
- name: github.com/mattermost/rsc
@@ -66,7 +63,7 @@ imports:
subpackages:
- pbutil
- name: github.com/miekg/dns
- version: 99f84ae56e75126dd77e5de4fae2ea034a468ca1
+ version: c862b7e359850847d4945cce311db2ea90cab7c0
- name: github.com/minio/minio-go
version: 52cc94e879db78c2e2c6e160869df943137ec4cd
subpackages:
@@ -84,7 +81,7 @@ imports:
- i18n/language
- i18n/translation
- name: github.com/NYTimes/gziphandler
- version: 6710af535839f57c687b62c4c23d649f9545d885
+ version: fb3533722e14198abe471546c9798fd556531451
- name: github.com/pborman/uuid
version: a97ce2ca70fa5a848076093f05e639a89ca34d06
- name: github.com/prometheus/client_golang
@@ -92,15 +89,15 @@ imports:
subpackages:
- prometheus
- name: github.com/prometheus/client_model
- version: fa8ad6fec33561be4280a8f0514318c79d7f6cb6
+ version: 6f3806018612930941127f2a7c6c453ba2c527d2
subpackages:
- go
- name: github.com/prometheus/common
- version: dd2f054febf4a6c00f2343686efb775948a8bff4
+ version: 49fee292b27bfff7f354ee0f64e1bc4850462edf
subpackages:
- expfmt
- name: github.com/prometheus/procfs
- version: 1878d9fbb537119d24b21ca07effd591627cd160
+ version: a1dba9ce8baed984a2495b658c82687f8157b98f
- name: github.com/rsc/letsencrypt
version: 76104d26167d38b6a0010f42bfc8ec5487742e8b
- name: github.com/rwcarlsen/goexif
@@ -113,25 +110,25 @@ imports:
- name: github.com/segmentio/backo-go
version: 204274ad699c0983a70203a566887f17a717fef4
- name: github.com/spf13/cobra
- version: 35136c09d8da66b901337c6e86fd8e88a1a255bd
+ version: 16c014f1a19d865b765b420e74508f80eb831ada
- name: github.com/spf13/pflag
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
- name: github.com/tylerb/graceful
- version: 0e9129e9c6d47da90dc0c188b26bd7bb1dab53cd
+ version: d72b0151351a13d0421b763b88f791469c4f5dc7
- name: github.com/xenolf/lego
- version: f5d538caab6dc0c167d4e32990c79bbf9eff578c
+ version: 6cac0ea7d8b28c889f709ec7fa92e92b82f490dd
subpackages:
- acme
- name: github.com/xtgo/uuid
version: a0b114877d4caeffbd7f87e3757c17fce570fea7
- name: golang.org/x/crypto
- version: dc137beb6cce2043eb6b5f223ab8bf51c32459f4
+ version: 728b753d0135da6801d45a38e6f43ff55779c5c2
subpackages:
- bcrypt
- blowfish
- ocsp
- name: golang.org/x/image
- version: 83686c547965220f8b5d75e83ddc67d73420a89f
+ version: 793f3be7dac93749dec06ae3fbe7d0ded4bdcf3d
subpackages:
- bmp
- font
@@ -139,14 +136,14 @@ imports:
- tiff
- tiff/lzw
- name: golang.org/x/net
- version: f2499483f923065a842d38eb4c7f1927e6fc6e6d
+ version: a6577fac2d73be281a500b310739095313165611
subpackages:
- context
- html
- html/atom
- publicsuffix
- name: golang.org/x/sys
- version: 7a6e5648d140666db5d920909e082ca00a87ba2c
+ version: 99f16d856c9836c42d24e7ab64ea72916925fa97
subpackages:
- unix
- name: golang.org/x/time
@@ -157,6 +154,8 @@ imports:
version: 4e86f4367175e39f69d9358a5f17b4dda270378d
- name: gopkg.in/fsnotify.v1
version: 629574ca2a5df945712d3079857300b5e4da0236
+- name: gopkg.in/gomail.v2
+ version: 41f3572897373c5538c50a2402db15db079fa4fd
- name: gopkg.in/square/go-jose.v1
version: aa2e30fdd1fe9dd3394119af66451ae790d50e0d
subpackages:
@@ -168,5 +167,5 @@ imports:
- store
- store/memstore
- name: gopkg.in/yaml.v2
- version: 4c78c975fe7c825c6d1466c42be594d1d6f3aba6
+ version: a3f3340b5840cee44f372bddb5880fcbc419b46a
testImports: []
diff --git a/glide.yaml b/glide.yaml
index 07b5be25e..58b5dced5 100644
--- a/glide.yaml
+++ b/glide.yaml
@@ -4,16 +4,13 @@ import:
- package: github.com/alecthomas/log4go
- package: github.com/dgryski/dgoogauth
- package: github.com/disintegration/imaging
+ version: v1.0.0
- package: github.com/go-gorp/gorp
version: 0c9bc0918534d133cedb439a24adc7cbe66e4a9d
- package: github.com/go-ldap/ldap
version: v2.5.0
- package: github.com/go-sql-driver/mysql
version: v1.3
-- package: github.com/goamz/goamz
- subpackages:
- - aws
- - s3
- package: github.com/golang/freetype
- package: github.com/gorilla/handlers
version: v1.2
@@ -79,3 +76,6 @@ import:
- package: github.com/dyatlov/go-opengraph
subpackages:
- opengraph
+- package: github.com/jaytaylor/html2text
+- package: gopkg.in/gomail.v2
+ version: 2.0.0
diff --git a/i18n/en.json b/i18n/en.json
index a975ade79..9c8921985 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,6 +4,14 @@
"translation": "April"
},
{
+ "id": "api.post.link_preview_disabled.app_error",
+ "translation": "Link previews have been disabled by the system administrator."
+ },
+ {
+ "id": "model.client.upload_saml_cert.app_error",
+ "translation": "Error creating SAML certificate multipart form request"
+ },
+ {
"id": "August",
"translation": "August"
},
@@ -28,6 +36,10 @@
"translation": "June"
},
{
+ "id": "store.sql_channel.get_unread.app_error",
+ "translation": "We couldn't get the channel unread messages"
+ },
+ {
"id": "March",
"translation": "March"
},
@@ -64,6 +76,10 @@
"translation": "Error reading log file"
},
{
+ "id": "api.cluster.init.debug",
+ "translation": "Initializing cluster API routes"
+ },
+ {
"id": "api.admin.get_brand_image.not_available.app_error",
"translation": "Custom branding is not configured or supported on this server"
},
@@ -72,10 +88,18 @@
"translation": "Image storage is not configured."
},
{
+ "id": "api.ldap.init.debug",
+ "translation": "Initializing LDAP API routes"
+ },
+ {
"id": "api.admin.init.debug",
"translation": "Initializing admin API routes"
},
{
+ "id": "api.compliance.init.debug",
+ "translation": "Initializing compliance API routes"
+ },
+ {
"id": "api.admin.recycle_db_end.warn",
"translation": "Finished recycling the database connection"
},
@@ -132,6 +156,10 @@
"translation": "Unable to upload file. File is too large."
},
{
+ "id": "api.brand.init.debug",
+ "translation": "Initializing brand API routes"
+ },
+ {
"id": "api.api.init.parsing_templates.debug",
"translation": "Parsing server templates at %v"
},
@@ -288,6 +316,10 @@
"translation": "You do not have the appropriate permissions"
},
{
+ "id": "api.channel.join_channel.already_deleted.app_error",
+ "translation": "Channel is already deleted"
+ },
+ {
"id": "api.channel.join_channel.post_and_forget",
"translation": "%v has joined the channel."
},
@@ -1010,7 +1042,7 @@
"translation": "The public link does not appear to be valid"
},
{
- "id": "api.file.get_file_preview.no_thumbnail.app_error",
+ "id": "api.file.get_file_preview.no_preview.app_error",
"translation": "File doesn't have a preview image"
},
{
@@ -4624,6 +4656,10 @@
"translation": "Problem updating members last updated time"
},
{
+ "id": "store.sql_channel.pinned_posts.app_error",
+ "translation": "We couldn't find the pinned posts"
+ },
+ {
"id": "store.sql_channel.get.existing.app_error",
"translation": "We couldn't find the existing channel"
},
@@ -4700,6 +4736,10 @@
"translation": "We couldn't get the channels"
},
{
+ "id": "store.sql_channel.get_public_channels.get.app_error",
+ "translation": "We couldn't get public channels"
+ },
+ {
"id": "store.sql_channel.increment_mention_count.app_error",
"translation": "We couldn't increment the mention count"
},
diff --git a/manualtesting/manual_testing.go b/manualtesting/manual_testing.go
index 33192ff5e..677b9999d 100644
--- a/manualtesting/manual_testing.go
+++ b/manualtesting/manual_testing.go
@@ -92,7 +92,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
user := &model.User{
Email: "success+" + model.NewId() + "simulator.amazonses.com",
Nickname: username[0],
- Password: api.USER_PASSWORD}
+ Password: app.USER_PASSWORD}
result, err := client.CreateUser(user, "")
if err != nil {
@@ -107,7 +107,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
userID = newuser.Id
// Login as user to generate auth token
- _, err = client.LoginById(newuser.Id, api.USER_PASSWORD)
+ _, err = client.LoginById(newuser.Id, app.USER_PASSWORD)
if err != nil {
c.Err = err
return
diff --git a/model/channel_member.go b/model/channel_member.go
index 5de58bc4f..32ffaf606 100644
--- a/model/channel_member.go
+++ b/model/channel_member.go
@@ -19,11 +19,11 @@ const (
)
type ChannelUnread struct {
- TeamId string
- TotalMsgCount int64
- MsgCount int64
- MentionCount int64
- NotifyProps StringMap
+ TeamId string `json:"team_id"`
+ ChannelId string `json:"channel_id"`
+ MsgCount int64 `json:"msg_count"`
+ MentionCount int64 `json:"mention_count"`
+ NotifyProps StringMap `json:"-"`
}
type ChannelMember struct {
@@ -47,6 +47,15 @@ func (o *ChannelMembers) ToJson() string {
}
}
+func (o *ChannelUnread) ToJson() string {
+ b, err := json.Marshal(o)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
func ChannelMembersFromJson(data io.Reader) *ChannelMembers {
decoder := json.NewDecoder(data)
var o ChannelMembers
@@ -58,6 +67,17 @@ func ChannelMembersFromJson(data io.Reader) *ChannelMembers {
}
}
+func ChannelUnreadFromJson(data io.Reader) *ChannelUnread {
+ decoder := json.NewDecoder(data)
+ var o ChannelUnread
+ err := decoder.Decode(&o)
+ if err == nil {
+ return &o
+ } else {
+ return nil
+ }
+}
+
func (o *ChannelMember) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
diff --git a/model/channel_member_test.go b/model/channel_member_test.go
index e43560cee..6fb666300 100644
--- a/model/channel_member_test.go
+++ b/model/channel_member_test.go
@@ -69,3 +69,17 @@ func TestChannelMemberIsValid(t *testing.T) {
t.Fatal(err)
}
}
+
+func TestChannelUnreadJson(t *testing.T) {
+ o := ChannelUnread{ChannelId: NewId(), TeamId: NewId(), MsgCount: 5, MentionCount: 3}
+ json := o.ToJson()
+ ro := ChannelUnreadFromJson(strings.NewReader(json))
+
+ if o.TeamId != ro.TeamId {
+ t.Fatal("Team Ids do not match")
+ }
+
+ if o.MentionCount != ro.MentionCount {
+ t.Fatal("MentionCount do not match")
+ }
+}
diff --git a/model/client.go b/model/client.go
index 24ee2c2bf..772265843 100644
--- a/model/client.go
+++ b/model/client.go
@@ -1533,6 +1533,16 @@ func (c *Client) GetFlaggedPosts(offset int, limit int) (*Result, *AppError) {
}
}
+func (c *Client) GetPinnedPosts(channelId string) (*Result, *AppError) {
+ if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/pinned", "", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), PostListFromJson(r.Body)}, nil
+ }
+}
+
func (c *Client) UploadProfileFile(data []byte, contentType string) (*Result, *AppError) {
return c.uploadFile(c.ApiUrl+"/users/newimage", data, contentType)
}
@@ -2389,3 +2399,23 @@ func (c *Client) UpdateChannelRoles(channelId string, userId string, roles strin
}
}
}
+
+func (c *Client) PinPost(channelId string, postId string) (*Result, *AppError) {
+ if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/posts/"+postId+"/pin", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), PostFromJson(r.Body)}, nil
+ }
+}
+
+func (c *Client) UnpinPost(channelId string, postId string) (*Result, *AppError) {
+ if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/posts/"+postId+"/unpin", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), PostFromJson(r.Body)}, nil
+ }
+}
diff --git a/model/client4.go b/model/client4.go
index d3bb6534d..a2878df6f 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -98,6 +98,10 @@ func (c *Client4) GetChannelsRoute() string {
return fmt.Sprintf("/channels")
}
+func (c *Client4) GetPublicChannelsForTeamRoute(teamId string) string {
+ return fmt.Sprintf(c.GetTeamRoute(teamId) + "/channels")
+}
+
func (c *Client4) GetChannelRoute(channelId string) string {
return fmt.Sprintf(c.GetChannelsRoute()+"/%v", channelId)
}
@@ -122,6 +126,10 @@ func (c *Client4) GetPostsRoute() string {
return fmt.Sprintf("/posts")
}
+func (c *Client4) GetConfigRoute() string {
+ return fmt.Sprintf("/config")
+}
+
func (c *Client4) GetPostRoute(postId string) string {
return fmt.Sprintf(c.GetPostsRoute()+"/%v", postId)
}
@@ -138,14 +146,58 @@ func (c *Client4) GetSystemRoute() string {
return fmt.Sprintf("/system")
}
+func (c *Client4) GetTestEmailRoute() string {
+ return fmt.Sprintf("/email/test")
+}
+
+func (c *Client4) GetDatabaseRoute() string {
+ return fmt.Sprintf("/database")
+}
+
+func (c *Client4) GetCacheRoute() string {
+ return fmt.Sprintf("/caches")
+}
+
+func (c *Client4) GetClusterRoute() string {
+ return fmt.Sprintf("/cluster")
+}
+
func (c *Client4) GetIncomingWebhooksRoute() string {
return fmt.Sprintf("/hooks/incoming")
}
+func (c *Client4) GetIncomingWebhookRoute(hookID string) string {
+ return fmt.Sprintf(c.GetIncomingWebhooksRoute()+"/%v", hookID)
+}
+
+func (c *Client4) GetComplianceReportsRoute() string {
+ return fmt.Sprintf("/compliance/reports")
+}
+
+func (c *Client4) GetComplianceReportRoute(reportId string) string {
+ return fmt.Sprintf("/compliance/reports/%v", reportId)
+}
+
+func (c *Client4) GetOutgoingWebhooksRoute() string {
+ return fmt.Sprintf("/hooks/outgoing")
+}
+
func (c *Client4) GetPreferencesRoute(userId string) string {
return fmt.Sprintf(c.GetUserRoute(userId) + "/preferences")
}
+func (c *Client4) GetSamlRoute() string {
+ return fmt.Sprintf("/saml")
+}
+
+func (c *Client4) GetLdapRoute() string {
+ return fmt.Sprintf("/ldap")
+}
+
+func (c *Client4) GetBrandRoute() string {
+ return fmt.Sprintf("/brand")
+}
+
func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) {
return c.DoApiRequest(http.MethodGet, url, "", etag)
}
@@ -323,6 +375,39 @@ func (c *Client4) GetUserByEmail(email, etag string) (*User, *Response) {
}
}
+// AutocompleteUsersInTeam returns the users on a team based on search term.
+func (c *Client4) AutocompleteUsersInTeam(teamId string, username string, etag string) (*UserAutocomplete, *Response) {
+ query := fmt.Sprintf("?in_team=%v&name=%v", teamId, username)
+ if r, err := c.DoApiGet(c.GetUsersRoute()+"/autocomplete"+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return UserAutocompleteFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// AutocompleteUsersInChannel returns the users in a channel based on search term.
+func (c *Client4) AutocompleteUsersInChannel(teamId string, channelId string, username string, etag string) (*UserAutocomplete, *Response) {
+ query := fmt.Sprintf("?in_team=%v&in_channel=%v&name=%v", teamId, channelId, username)
+ if r, err := c.DoApiGet(c.GetUsersRoute()+"/autocomplete"+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return UserAutocompleteFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// AutocompleteUsers returns the users in the system based on search term.
+func (c *Client4) AutocompleteUsers(username string, etag string) (*UserAutocomplete, *Response) {
+ query := fmt.Sprintf("?name=%v", username)
+ if r, err := c.DoApiGet(c.GetUsersRoute()+"/autocomplete"+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return UserAutocompleteFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetProfileImage gets user's profile image. Must be logged in or be a system administrator.
func (c *Client4) GetProfileImage(userId, etag string) ([]byte, *Response) {
if r, err := c.DoApiGet(c.GetUserRoute(userId)+"/image", etag); err != nil {
@@ -408,6 +493,22 @@ func (c *Client4) PatchUser(userId string, patch *UserPatch) (*User, *Response)
}
}
+// UpdateUserMfa activates multi-factor authentication for a user if activate
+// is true and a valid code is provided. If activate is false, then code is not
+// required and multi-factor authentication is disabled for the user.
+func (c *Client4) UpdateUserMfa(userId, code string, activate bool) (bool, *Response) {
+ requestBody := make(map[string]interface{})
+ requestBody["activate"] = activate
+ requestBody["code"] = code
+
+ if r, err := c.DoApiPut(c.GetUserRoute(userId)+"/mfa", StringInterfaceToJson(requestBody)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
// UpdateUserPassword updates a user's password. Must be logged in as the user or be a system administrator.
func (c *Client4) UpdateUserPassword(userId, currentPassword, newPassword string) (bool, *Response) {
requestBody := map[string]string{"current_password": currentPassword, "new_password": newPassword}
@@ -484,8 +585,8 @@ func (c *Client4) RevokeSession(userId, sessionId string) (bool, *Response) {
}
}
-// getTeamsUnreadForUser will return an array with TeamUnread objects that contain the amount of
-// unread messages and mentions the current user has for the teams it belongs to.
+// GetTeamsUnreadForUser will return an array with TeamUnread objects that contain the amount
+// of unread messages and mentions the current user has for the teams it belongs to.
// An optional team ID can be set to exclude that team from the results. Must be authenticated.
func (c *Client4) GetTeamsUnreadForUser(userId, teamIdToExclude string) ([]*TeamUnread, *Response) {
optional := ""
@@ -600,6 +701,16 @@ func (c *Client4) GetTeamByName(name, etag string) (*Team, *Response) {
}
}
+// TeamExists returns true or false if the team exist or not.
+func (c *Client4) TeamExists(name, etag string) (bool, *Response) {
+ if r, err := c.DoApiGet(c.GetTeamByNameRoute(name)+"/exists", etag); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return MapBoolFromJson(r.Body)["exists"], BuildResponse(r)
+ }
+}
+
// GetTeamsForUser returns a list of teams a user is on. Must be logged in as the user
// or be a system administrator.
func (c *Client4) GetTeamsForUser(userId, etag string) ([]*Team, *Response) {
@@ -621,7 +732,7 @@ func (c *Client4) GetTeamMember(teamId, userId, etag string) (*TeamMember, *Resp
}
}
-// UpdateTeamMemberRoles will update the roles on a team for a user
+// UpdateTeamMemberRoles will update the roles on a team for a user.
func (c *Client4) UpdateTeamMemberRoles(teamId, userId, newRoles string) (bool, *Response) {
requestBody := map[string]string{"roles": newRoles}
if r, err := c.DoApiPut(c.GetTeamMemberRoute(teamId, userId)+"/roles", MapToJson(requestBody)); err != nil {
@@ -632,6 +743,16 @@ func (c *Client4) UpdateTeamMemberRoles(teamId, userId, newRoles string) (bool,
}
}
+// UpdateTeam will update a team.
+func (c *Client4) UpdateTeam(team *Team) (*Team, *Response) {
+ if r, err := c.DoApiPut(c.GetTeamRoute(team.Id), team.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return TeamFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetTeamMembers returns team members based on the provided team id string.
func (c *Client4) GetTeamMembers(teamId string, page int, perPage int, etag string) ([]*TeamMember, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
@@ -643,6 +764,17 @@ func (c *Client4) GetTeamMembers(teamId string, page int, perPage int, etag stri
}
}
+// GetTeamMembersByIds will return an array of team members based on the
+// team id and a list of user ids provided. Must be authenticated.
+func (c *Client4) GetTeamMembersByIds(teamId string, userIds []string) ([]*TeamMember, *Response) {
+ if r, err := c.DoApiPost(fmt.Sprintf("/teams/%v/members/ids", teamId), ArrayToJson(userIds)); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return TeamMembersFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetTeamStats returns a team stats based on the team id string.
// Must be authenticated.
func (c *Client4) GetTeamStats(teamId, etag string) (*TeamStats, *Response) {
@@ -654,6 +786,18 @@ func (c *Client4) GetTeamStats(teamId, etag string) (*TeamStats, *Response) {
}
}
+// GetTeamUnread will return a TeamUnread object that contains the amount of
+// unread messages and mentions the user has for the specified team.
+// Must be authenticated.
+func (c *Client4) GetTeamUnread(teamId, userId string) (*TeamUnread, *Response) {
+ if r, err := c.DoApiGet(c.GetUserRoute(userId)+c.GetTeamRoute(teamId)+"/unread", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return TeamUnreadFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Channel Section
// CreateChannel creates a channel based on the provided channel struct.
@@ -666,6 +810,16 @@ func (c *Client4) CreateChannel(channel *Channel) (*Channel, *Response) {
}
}
+// UpdateChannel update a channel based on the provided channel struct.
+func (c *Client4) UpdateChannel(channel *Channel) (*Channel, *Response) {
+ if r, err := c.DoApiPut(c.GetChannelRoute(channel.Id), channel.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// CreateDirectChannel creates a direct message channel based on the two user
// ids provided.
func (c *Client4) CreateDirectChannel(userId1, userId2 string) (*Channel, *Response) {
@@ -688,6 +842,37 @@ func (c *Client4) GetChannel(channelId, etag string) (*Channel, *Response) {
}
}
+// GetChannelStats returns statistics for a channel.
+func (c *Client4) GetChannelStats(channelId string, etag string) (*ChannelStats, *Response) {
+ if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/stats", etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelStatsFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetPublicChannelsForTeam returns a channel based on the provided team id string.
+func (c *Client4) GetPublicChannelsForTeam(teamId string, page int, perPage int, etag string) (*ChannelList, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
+ if r, err := c.DoApiGet(c.GetPublicChannelsForTeamRoute(teamId)+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelListFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// DeleteChannel deletes channel based on the provided channel id string.
+func (c *Client4) DeleteChannel(channelId string) (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetChannelRoute(channelId)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
// GetChannelByName returns a channel based on the provided channel name and team id strings.
func (c *Client4) GetChannelByName(channelName, teamId string, etag string) (*Channel, *Response) {
if r, err := c.DoApiGet(c.GetChannelByNameRoute(channelName, teamId), etag); err != nil {
@@ -719,6 +904,17 @@ func (c *Client4) GetChannelMembers(channelId string, page, perPage int, etag st
}
}
+// GetChannelMembersByIds gets the channel members in a channel for a list of user ids.
+func (c *Client4) GetChannelMembersByIds(channelId string, userIds []string) (*ChannelMembers, *Response) {
+ if r, err := c.DoApiPost(c.GetChannelMembersRoute(channelId)+"/ids", ArrayToJson(userIds)); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelMembersFromJson(r.Body), BuildResponse(r)
+
+ }
+}
+
// GetChannelMember gets a channel member.
func (c *Client4) GetChannelMember(channelId, userId, etag string) (*ChannelMember, *Response) {
if r, err := c.DoApiGet(c.GetChannelMemberRoute(channelId, userId), etag); err != nil {
@@ -750,6 +946,17 @@ func (c *Client4) ViewChannel(userId string, view *ChannelView) (bool, *Response
}
}
+// GetChannelUnread will return a ChannelUnread object that contains the number of
+// unread messages and mentions for a user.
+func (c *Client4) GetChannelUnread(channelId, userId string) (*ChannelUnread, *Response) {
+ if r, err := c.DoApiGet(c.GetUserRoute(userId)+c.GetChannelRoute(channelId)+"/unread", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelUnreadFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// UpdateChannelRoles will update the roles on a channel for a user.
func (c *Client4) UpdateChannelRoles(channelId, userId, roles string) (bool, *Response) {
requestBody := map[string]string{"roles": roles}
@@ -893,6 +1100,36 @@ func (c *Client4) GetFileThumbnail(fileId string) ([]byte, *Response) {
}
}
+// GetFileLink gets the public link of a file by id.
+func (c *Client4) GetFileLink(fileId string) (string, *Response) {
+ if r, err := c.DoApiGet(c.GetFileRoute(fileId)+"/link", ""); err != nil {
+ return "", &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ return MapFromJson(r.Body)["link"], BuildResponse(r)
+ }
+}
+
+// GetFilePreview gets the bytes for a file by id.
+func (c *Client4) GetFilePreview(fileId string) ([]byte, *Response) {
+ if r, err := c.DoApiGet(c.GetFileRoute(fileId)+"/preview", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else if data, err := ioutil.ReadAll(r.Body); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: NewAppError("GetFilePreview", "model.client.read_file.app_error", nil, err.Error(), r.StatusCode)}
+ } else {
+ return data, BuildResponse(r)
+ }
+}
+
+// GetFileInfo gets all the file info objects.
+func (c *Client4) GetFileInfo(fileId string) (*FileInfo, *Response) {
+ if r, err := c.DoApiGet(c.GetFileRoute(fileId)+"/info", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return FileInfoFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetFileInfosForPost gets all the file info objects attached to a post.
func (c *Client4) GetFileInfosForPost(postId string, etag string) ([]*FileInfo, *Response) {
if r, err := c.DoApiGet(c.GetPostRoute(postId)+"/files/info", etag); err != nil {
@@ -915,6 +1152,54 @@ func (c *Client4) GetPing() (bool, *Response) {
}
}
+func (c *Client4) TestEmail() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetTestEmailRoute(), ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// GetConfig will retrieve the server config with some sanitized items.
+func (c *Client4) GetConfig() (*Config, *Response) {
+ if r, err := c.DoApiGet(c.GetConfigRoute(), ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ConfigFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// ReloadConfig will reload the server configuration.
+func (c *Client4) ReloadConfig() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetConfigRoute()+"/reload", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// DatabaseRecycle will recycle the connections. Discard current connection and get new one.
+func (c *Client4) DatabaseRecycle() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetDatabaseRoute()+"/recycle", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+func (c *Client4) InvalidateCaches() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetCacheRoute()+"/invalidate", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
// Webhooks Section
// CreateIncomingWebhook creates an incoming webhook for a channel.
@@ -927,6 +1212,16 @@ func (c *Client4) CreateIncomingWebhook(hook *IncomingWebhook) (*IncomingWebhook
}
}
+// UpdateIncomingWebhook updates an incoming webhook for a channel.
+func (c *Client4) UpdateIncomingWebhook(hook *IncomingWebhook) (*IncomingWebhook, *Response) {
+ if r, err := c.DoApiPut(c.GetIncomingWebhookRoute(hook.Id), hook.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return IncomingWebhookFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetIncomingWebhooks returns a page of incoming webhooks on the system. Page counting starts at 0.
func (c *Client4) GetIncomingWebhooks(page int, perPage int, etag string) ([]*IncomingWebhook, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
@@ -949,9 +1244,72 @@ func (c *Client4) GetIncomingWebhooksForTeam(teamId string, page int, perPage in
}
}
+// GetIncomingWebhook returns an Incoming webhook given the hook ID
+func (c *Client4) GetIncomingWebhook(hookID string, etag string) (*IncomingWebhook, *Response) {
+ if r, err := c.DoApiGet(c.GetIncomingWebhookRoute(hookID), etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return IncomingWebhookFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// DeleteIncomingWebhook deletes and Incoming Webhook given the hook ID
+func (c *Client4) DeleteIncomingWebhook(hookID string) (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetIncomingWebhookRoute(hookID)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// CreateOutgoingWebhook creates an outgoing webhook for a team or channel.
+func (c *Client4) CreateOutgoingWebhook(hook *OutgoingWebhook) (*OutgoingWebhook, *Response) {
+ if r, err := c.DoApiPost(c.GetOutgoingWebhooksRoute(), hook.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return OutgoingWebhookFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetOutgoingWebhooks returns a page of outgoing webhooks on the system. Page counting starts at 0.
+func (c *Client4) GetOutgoingWebhooks(page int, perPage int, etag string) ([]*OutgoingWebhook, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
+ if r, err := c.DoApiGet(c.GetOutgoingWebhooksRoute()+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return OutgoingWebhookListFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetOutgoingWebhooksForChannel returns a page of outgoing webhooks for a channel. Page counting starts at 0.
+func (c *Client4) GetOutgoingWebhooksForChannel(channelId string, page int, perPage int, etag string) ([]*OutgoingWebhook, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v&channel_id=%v", page, perPage, channelId)
+ if r, err := c.DoApiGet(c.GetOutgoingWebhooksRoute()+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return OutgoingWebhookListFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetOutgoingWebhooksForTeam returns a page of outgoing webhooks for a team. Page counting starts at 0.
+func (c *Client4) GetOutgoingWebhooksForTeam(teamId string, page int, perPage int, etag string) ([]*OutgoingWebhook, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v&team_id=%v", page, perPage, teamId)
+ if r, err := c.DoApiGet(c.GetOutgoingWebhooksRoute()+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return OutgoingWebhookListFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Preferences Section
-// GetPreferences returns the user's preferences
+// GetPreferences returns the user's preferences.
func (c *Client4) GetPreferences(userId string) (Preferences, *Response) {
if r, err := c.DoApiGet(c.GetPreferencesRoute(userId), ""); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
@@ -962,7 +1320,7 @@ func (c *Client4) GetPreferences(userId string) (Preferences, *Response) {
}
}
-// UpdatePreferences saves the user's preferences
+// UpdatePreferences saves the user's preferences.
func (c *Client4) UpdatePreferences(userId string, preferences *Preferences) (bool, *Response) {
if r, err := c.DoApiPut(c.GetPreferencesRoute(userId), preferences.ToJson()); err != nil {
return false, &Response{StatusCode: r.StatusCode, Error: err}
@@ -972,7 +1330,7 @@ func (c *Client4) UpdatePreferences(userId string, preferences *Preferences) (bo
}
}
-// DeletePreferences deletes the user's preferences
+// DeletePreferences deletes the user's preferences.
func (c *Client4) DeletePreferences(userId string, preferences *Preferences) (bool, *Response) {
if r, err := c.DoApiPost(c.GetPreferencesRoute(userId)+"/delete", preferences.ToJson()); err != nil {
return false, &Response{StatusCode: r.StatusCode, Error: err}
@@ -982,7 +1340,7 @@ func (c *Client4) DeletePreferences(userId string, preferences *Preferences) (bo
}
}
-// GetPreferencesByCategory returns the user's preferences from the provided category string
+// GetPreferencesByCategory returns the user's preferences from the provided category string.
func (c *Client4) GetPreferencesByCategory(userId string, category string) (Preferences, *Response) {
url := fmt.Sprintf(c.GetPreferencesRoute(userId)+"/%s", category)
if r, err := c.DoApiGet(url, ""); err != nil {
@@ -994,7 +1352,7 @@ func (c *Client4) GetPreferencesByCategory(userId string, category string) (Pref
}
}
-// GetPreferenceByCategoryAndName returns the user's preferences from the provided category and preference name string
+// GetPreferenceByCategoryAndName returns the user's preferences from the provided category and preference name string.
func (c *Client4) GetPreferenceByCategoryAndName(userId string, category string, preferenceName string) (*Preference, *Response) {
url := fmt.Sprintf(c.GetPreferencesRoute(userId)+"/%s/name/%v", category, preferenceName)
if r, err := c.DoApiGet(url, ""); err != nil {
@@ -1004,3 +1362,258 @@ func (c *Client4) GetPreferenceByCategoryAndName(userId string, category string,
return PreferenceFromJson(r.Body), BuildResponse(r)
}
}
+
+// SAML Section
+
+// GetSamlMetadata returns metadata for the SAML configuration.
+func (c *Client4) GetSamlMetadata() (string, *Response) {
+ if r, err := c.DoApiGet(c.GetSamlRoute()+"/metadata", ""); err != nil {
+ return "", &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ buf := new(bytes.Buffer)
+ buf.ReadFrom(r.Body)
+ return buf.String(), BuildResponse(r)
+ }
+}
+
+func samlFileToMultipart(data []byte, filename string) ([]byte, *multipart.Writer, error) {
+ body := &bytes.Buffer{}
+ writer := multipart.NewWriter(body)
+
+ if part, err := writer.CreateFormFile("certificate", filename); err != nil {
+ return nil, nil, err
+ } else if _, err = io.Copy(part, bytes.NewBuffer(data)); err != nil {
+ return nil, nil, err
+ }
+
+ if err := writer.Close(); err != nil {
+ return nil, nil, err
+ }
+
+ return body.Bytes(), writer, nil
+}
+
+// UploadSamlIdpCertificate will upload an IDP certificate for SAML and set the config to use it.
+func (c *Client4) UploadSamlIdpCertificate(data []byte, filename string) (bool, *Response) {
+ body, writer, err := samlFileToMultipart(data, filename)
+ if err != nil {
+ return false, &Response{Error: NewAppError("UploadSamlIdpCertificate", "model.client.upload_saml_cert.app_error", nil, err.Error(), http.StatusBadRequest)}
+ }
+
+ _, resp := c.DoUploadFile(c.GetSamlRoute()+"/certificate/idp", body, writer.FormDataContentType())
+ return resp.Error == nil, resp
+}
+
+// UploadSamlPublicCertificate will upload a public certificate for SAML and set the config to use it.
+func (c *Client4) UploadSamlPublicCertificate(data []byte, filename string) (bool, *Response) {
+ body, writer, err := samlFileToMultipart(data, filename)
+ if err != nil {
+ return false, &Response{Error: NewAppError("UploadSamlPublicCertificate", "model.client.upload_saml_cert.app_error", nil, err.Error(), http.StatusBadRequest)}
+ }
+
+ _, resp := c.DoUploadFile(c.GetSamlRoute()+"/certificate/public", body, writer.FormDataContentType())
+ return resp.Error == nil, resp
+}
+
+// UploadSamlPrivateCertificate will upload a private key for SAML and set the config to use it.
+func (c *Client4) UploadSamlPrivateCertificate(data []byte, filename string) (bool, *Response) {
+ body, writer, err := samlFileToMultipart(data, filename)
+ if err != nil {
+ return false, &Response{Error: NewAppError("UploadSamlPrivateCertificate", "model.client.upload_saml_cert.app_error", nil, err.Error(), http.StatusBadRequest)}
+ }
+
+ _, resp := c.DoUploadFile(c.GetSamlRoute()+"/certificate/private", body, writer.FormDataContentType())
+ return resp.Error == nil, resp
+}
+
+// DeleteSamlIdpCertificate deletes the SAML IDP certificate from the server and updates the config to not use it and disable SAML.
+func (c *Client4) DeleteSamlIdpCertificate() (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetSamlRoute() + "/certificate/idp"); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// DeleteSamlPublicCertificate deletes the SAML IDP certificate from the server and updates the config to not use it and disable SAML.
+func (c *Client4) DeleteSamlPublicCertificate() (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetSamlRoute() + "/certificate/public"); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// DeleteSamlPrivateCertificate deletes the SAML IDP certificate from the server and updates the config to not use it and disable SAML.
+func (c *Client4) DeleteSamlPrivateCertificate() (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetSamlRoute() + "/certificate/private"); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// GetSamlCertificateStatus returns metadata for the SAML configuration.
+func (c *Client4) GetSamlCertificateStatus() (*SamlCertificateStatus, *Response) {
+ if r, err := c.DoApiGet(c.GetSamlRoute()+"/certificate/status", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return SamlCertificateStatusFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// Compliance Section
+
+// CreateComplianceReport creates an incoming webhook for a channel.
+func (c *Client4) CreateComplianceReport(report *Compliance) (*Compliance, *Response) {
+ if r, err := c.DoApiPost(c.GetComplianceReportsRoute(), report.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ComplianceFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetComplianceReports returns list of compliance reports.
+func (c *Client4) GetComplianceReports(page, perPage int) (Compliances, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
+ if r, err := c.DoApiGet(c.GetComplianceReportsRoute()+query, ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CompliancesFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// GetComplianceReport returns a compliance report.
+func (c *Client4) GetComplianceReport(reportId string) (*Compliance, *Response) {
+ if r, err := c.DoApiGet(c.GetComplianceReportRoute(reportId), ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ComplianceFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// DownloadComplianceReport returns a full compliance report as a file.
+func (c *Client4) DownloadComplianceReport(reportId string) ([]byte, *Response) {
+ var rq *http.Request
+ rq, _ = http.NewRequest("GET", c.ApiUrl+c.GetComplianceReportRoute(reportId), nil)
+ rq.Close = true
+
+ if len(c.AuthToken) > 0 {
+ rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
+ }
+
+ if rp, err := c.HttpClient.Do(rq); err != nil {
+ return nil, &Response{Error: NewAppError("DownloadComplianceReport", "model.client.connecting.app_error", nil, err.Error(), http.StatusBadRequest)}
+ } else if rp.StatusCode >= 300 {
+ defer rp.Body.Close()
+ return nil, &Response{StatusCode: rp.StatusCode, Error: AppErrorFromJson(rp.Body)}
+ } else if data, err := ioutil.ReadAll(rp.Body); err != nil {
+ defer closeBody(rp)
+ return nil, &Response{StatusCode: rp.StatusCode, Error: NewAppError("DownloadComplianceReport", "model.client.read_file.app_error", nil, err.Error(), rp.StatusCode)}
+ } else {
+ defer closeBody(rp)
+ return data, BuildResponse(rp)
+ }
+}
+
+// Cluster Section
+
+// GetClusterStatus returns the status of all the configured cluster nodes.
+func (c *Client4) GetClusterStatus() ([]*ClusterInfo, *Response) {
+ if r, err := c.DoApiGet(c.GetClusterRoute()+"/status", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ClusterInfosFromJson(r.Body), BuildResponse(r)
+ }
+}
+
+// LDAP Section
+
+// SyncLdap will force a sync with the configured LDAP server.
+func (c *Client4) SyncLdap() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetLdapRoute()+"/sync", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// TestLdap will attempt to connect to the configured LDAP server and return OK if configured
+// correctly.
+func (c *Client4) TestLdap() (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetLdapRoute()+"/test", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// Brand Section
+
+// GetBrandImage retrieves the previously uploaded brand image.
+func (c *Client4) GetBrandImage() ([]byte, *Response) {
+ if r, err := c.DoApiGet(c.GetBrandRoute()+"/image", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else if data, err := ioutil.ReadAll(r.Body); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: NewAppError("GetBrandImage", "model.client.read_file.app_error", nil, err.Error(), r.StatusCode)}
+ } else {
+ return data, BuildResponse(r)
+ }
+}
+
+// UploadBrandImage sets the brand image for the system.
+func (c *Client4) UploadBrandImage(data []byte) (bool, *Response) {
+ body := &bytes.Buffer{}
+ writer := multipart.NewWriter(body)
+
+ if part, err := writer.CreateFormFile("image", "brand.png"); err != nil {
+ return false, &Response{Error: NewAppError("UploadBrandImage", "model.client.set_profile_user.no_file.app_error", nil, err.Error(), http.StatusBadRequest)}
+ } else if _, err = io.Copy(part, bytes.NewBuffer(data)); err != nil {
+ return false, &Response{Error: NewAppError("UploadBrandImage", "model.client.set_profile_user.no_file.app_error", nil, err.Error(), http.StatusBadRequest)}
+ }
+
+ if err := writer.Close(); err != nil {
+ return false, &Response{Error: NewAppError("UploadBrandImage", "model.client.set_profile_user.writer.app_error", nil, err.Error(), http.StatusBadRequest)}
+ }
+
+ rq, _ := http.NewRequest("POST", c.ApiUrl+c.GetBrandRoute()+"/image", bytes.NewReader(body.Bytes()))
+ rq.Header.Set("Content-Type", writer.FormDataContentType())
+ rq.Close = true
+
+ if len(c.AuthToken) > 0 {
+ rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
+ }
+
+ if rp, err := c.HttpClient.Do(rq); err != nil {
+ return false, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(c.GetBrandRoute()+"/image", "model.client.connecting.app_error", nil, err.Error(), http.StatusForbidden)}
+ } else if rp.StatusCode >= 300 {
+ return false, &Response{StatusCode: rp.StatusCode, Error: AppErrorFromJson(rp.Body)}
+ } else {
+ defer closeBody(rp)
+ return CheckStatusOK(rp), BuildResponse(rp)
+ }
+}
+
+// Logs Section
+
+// GetLogs page of logs as a string array.
+func (c *Client4) GetLogs(page, perPage int) ([]string, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
+ if r, err := c.DoApiGet("/logs"+query, ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ArrayFromJson(r.Body), BuildResponse(r)
+ }
+}
diff --git a/model/command_args.go b/model/command_args.go
index 4da5dc760..f512410a3 100644
--- a/model/command_args.go
+++ b/model/command_args.go
@@ -6,13 +6,20 @@ package model
import (
"encoding/json"
"io"
+
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type CommandArgs struct {
- ChannelId string `json:"channel_id"`
- RootId string `json:"root_id"`
- ParentId string `json:"parent_id"`
- Command string `json:"command"`
+ UserId string `json:"user_id"`
+ ChannelId string `json:"channel_id"`
+ TeamId string `json:"team_id"`
+ RootId string `json:"root_id"`
+ ParentId string `json:"parent_id"`
+ Command string `json:"command"`
+ SiteURL string `json:"-"`
+ T goi18n.TranslateFunc `json:"-"`
+ Session Session `json:"-"`
}
func (o *CommandArgs) ToJson() string {
diff --git a/model/post.go b/model/post.go
index a7729e0c4..c419deb56 100644
--- a/model/post.go
+++ b/model/post.go
@@ -38,6 +38,7 @@ type Post struct {
UpdateAt int64 `json:"update_at"`
EditAt int64 `json:"edit_at"`
DeleteAt int64 `json:"delete_at"`
+ IsPinned bool `json:"is_pinned"`
UserId string `json:"user_id"`
ChannelId string `json:"channel_id"`
RootId string `json:"root_id"`
diff --git a/model/saml.go b/model/saml.go
index 16d3845da..1371c433f 100644
--- a/model/saml.go
+++ b/model/saml.go
@@ -3,6 +3,11 @@
package model
+import (
+ "encoding/json"
+ "io"
+)
+
const (
USER_AUTH_SERVICE_SAML = "saml"
USER_AUTH_SERVICE_SAML_TEXT = "With SAML"
@@ -16,3 +21,29 @@ type SamlAuthRequest struct {
URL string
RelayState string
}
+
+type SamlCertificateStatus struct {
+ IdpCertificateFile bool `json:"idp_certificate_file"`
+ PrivateKeyFile bool `json:"private_key_file"`
+ PublicCertificateFile bool `json:"public_certificate_file"`
+}
+
+func (s *SamlCertificateStatus) ToJson() string {
+ b, err := json.Marshal(s)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func SamlCertificateStatusFromJson(data io.Reader) *SamlCertificateStatus {
+ decoder := json.NewDecoder(data)
+ var status SamlCertificateStatus
+ err := decoder.Decode(&status)
+ if err == nil {
+ return &status
+ } else {
+ return nil
+ }
+}
diff --git a/model/saml_test.go b/model/saml_test.go
new file mode 100644
index 000000000..578e78da5
--- /dev/null
+++ b/model/saml_test.go
@@ -0,0 +1,24 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestSamlCertificateStatusJson(t *testing.T) {
+ status := &SamlCertificateStatus{IdpCertificateFile: true, PrivateKeyFile: true, PublicCertificateFile: true}
+ json := status.ToJson()
+ rstatus := SamlCertificateStatusFromJson(strings.NewReader(json))
+
+ if status.IdpCertificateFile != rstatus.IdpCertificateFile {
+ t.Fatal("IdpCertificateFile do not match")
+ }
+
+ rstatus = SamlCertificateStatusFromJson(strings.NewReader("junk"))
+ if rstatus != nil {
+ t.Fatal("should be nil")
+ }
+}
diff --git a/model/team_member.go b/model/team_member.go
index 36a567a45..efd77e7ec 100644
--- a/model/team_member.go
+++ b/model/team_member.go
@@ -31,6 +31,15 @@ func (o *TeamMember) ToJson() string {
}
}
+func (o *TeamUnread) ToJson() string {
+ b, err := json.Marshal(o)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
func TeamMemberFromJson(data io.Reader) *TeamMember {
decoder := json.NewDecoder(data)
var o TeamMember
@@ -42,6 +51,17 @@ func TeamMemberFromJson(data io.Reader) *TeamMember {
}
}
+func TeamUnreadFromJson(data io.Reader) *TeamUnread {
+ decoder := json.NewDecoder(data)
+ var o TeamUnread
+ err := decoder.Decode(&o)
+ if err == nil {
+ return &o
+ } else {
+ return nil
+ }
+}
+
func TeamMembersToJson(o []*TeamMember) string {
if b, err := json.Marshal(o); err != nil {
return "[]"
diff --git a/model/team_member_test.go b/model/team_member_test.go
index eac07c646..e957ffd4f 100644
--- a/model/team_member_test.go
+++ b/model/team_member_test.go
@@ -41,3 +41,17 @@ func TestTeamMemberIsValid(t *testing.T) {
t.Fatal(err)
}*/
}
+
+func TestUnreadMemberJson(t *testing.T) {
+ o := TeamUnread{TeamId: NewId(), MsgCount: 5, MentionCount: 3}
+ json := o.ToJson()
+
+ r := TeamUnreadFromJson(strings.NewReader(json))
+ if o.TeamId != r.TeamId {
+ t.Fatal("Ids do not match")
+ }
+
+ if o.MsgCount != r.MsgCount {
+ t.Fatal("MsgCount do not match")
+ }
+}
diff --git a/model/user_autocomplete.go b/model/user_autocomplete.go
index b7449a792..b80c6f992 100644
--- a/model/user_autocomplete.go
+++ b/model/user_autocomplete.go
@@ -17,6 +17,31 @@ type UserAutocompleteInTeam struct {
InTeam []*User `json:"in_team"`
}
+type UserAutocomplete struct {
+ Users []*User `json:"users"`
+ OutOfChannel []*User `json:"out_of_channel,omitempty"`
+}
+
+func (o *UserAutocomplete) ToJson() string {
+ b, err := json.Marshal(o)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func UserAutocompleteFromJson(data io.Reader) *UserAutocomplete {
+ decoder := json.NewDecoder(data)
+ autocomplete := new(UserAutocomplete)
+ err := decoder.Decode(&autocomplete)
+ if err == nil {
+ return autocomplete
+ } else {
+ return nil
+ }
+}
+
func (o *UserAutocompleteInChannel) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
diff --git a/model/utils.go b/model/utils.go
index 08809a47f..8ae45b140 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -156,6 +156,15 @@ func MapToJson(objmap map[string]string) string {
}
}
+// MapToJson converts a map to a json string
+func MapBoolToJson(objmap map[string]bool) string {
+ if b, err := json.Marshal(objmap); err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
// MapFromJson will decode the key/value pair map
func MapFromJson(data io.Reader) map[string]string {
decoder := json.NewDecoder(data)
@@ -168,6 +177,18 @@ func MapFromJson(data io.Reader) map[string]string {
}
}
+// MapFromJson will decode the key/value pair map
+func MapBoolFromJson(data io.Reader) map[string]bool {
+ decoder := json.NewDecoder(data)
+
+ var objmap map[string]bool
+ if err := decoder.Decode(&objmap); err != nil {
+ return make(map[string]bool)
+ } else {
+ return objmap
+ }
+}
+
func ArrayToJson(objmap []string) string {
if b, err := json.Marshal(objmap); err != nil {
return ""
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index ff1716957..d72722f7c 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -309,18 +309,79 @@ func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel {
return storeChannel
}
+func (s SqlChannelStore) GetChannelUnread(channelId, userId string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ var unreadChannel model.ChannelUnread
+ err := s.GetReplica().SelectOne(&unreadChannel,
+ `SELECT
+ Channels.TeamId TeamId, Channels.Id ChannelId, (Channels.TotalMsgCount - ChannelMembers.MsgCount) MsgCount, ChannelMembers.MentionCount MentionCount, ChannelMembers.NotifyProps NotifyProps
+ FROM
+ Channels, ChannelMembers
+ WHERE
+ Id = ChannelId
+ AND Id = :ChannelId
+ AND UserId = :UserId
+ AND DeleteAt = 0`,
+ map[string]interface{}{"ChannelId": channelId, "UserId": userId})
+
+ if err != nil {
+ result.Err = model.NewAppError("SqlChannelStore.GetChannelUnread", "store.sql_channel.get_unread.app_error", nil, "channelId="+channelId+" "+err.Error(), http.StatusInternalServerError)
+ if err == sql.ErrNoRows {
+ result.Err.StatusCode = http.StatusNotFound
+ }
+ } else {
+ result.Data = &unreadChannel
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
func (us SqlChannelStore) InvalidateChannel(id string) {
channelCache.Remove(id)
}
func (us SqlChannelStore) InvalidateChannelByName(teamId, name string) {
- channelCache.Remove(teamId + name)
+ channelByNameCache.Remove(teamId + name)
}
func (s SqlChannelStore) Get(id string, allowFromCache bool) StoreChannel {
return s.get(id, false, allowFromCache)
}
+func (s SqlChannelStore) GetPinnedPosts(channelId string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+ pl := &model.PostList{}
+
+ var posts []*model.Post
+ if _, err := s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE IsPinned = true AND ChannelId = :ChannelId AND DeleteAt = 0 ORDER BY CreateAt ASC", map[string]interface{}{"ChannelId": channelId}); err != nil {
+ result.Err = model.NewLocAppError("SqlPostStore.GetPinnedPosts", "store.sql_channel.pinned_posts.app_error", nil, err.Error())
+ } else {
+ for _, post := range posts {
+ pl.AddPost(post)
+ pl.AddOrder(post.Id)
+ }
+ }
+
+ result.Data = pl
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
func (s SqlChannelStore) GetFromMaster(id string) StoreChannel {
return s.get(id, true, false)
}
@@ -360,9 +421,9 @@ func (s SqlChannelStore) get(id string, master bool, allowFromCache bool) StoreC
}
if obj, err := db.Get(model.Channel{}, id); err != nil {
- result.Err = model.NewLocAppError("SqlChannelStore.Get", "store.sql_channel.get.find.app_error", nil, "id="+id+", "+err.Error())
+ result.Err = model.NewAppError("SqlChannelStore.Get", "store.sql_channel.get.find.app_error", nil, "id="+id+", "+err.Error(), http.StatusInternalServerError)
} else if obj == nil {
- result.Err = model.NewAppError("SqlChannelStore.Get", "store.sql_channel.get.existing.app_error", nil, "id="+id, http.StatusBadRequest)
+ result.Err = model.NewAppError("SqlChannelStore.Get", "store.sql_channel.get.existing.app_error", nil, "id="+id, http.StatusNotFound)
} else {
result.Data = obj.(*model.Channel)
channelCache.AddWithExpiresInSecs(id, obj.(*model.Channel), CHANNEL_CACHE_SEC)
@@ -524,6 +585,40 @@ func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset in
return storeChannel
}
+func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ data := &model.ChannelList{}
+ _, err := s.GetReplica().Select(data,
+ `SELECT
+ *
+ FROM
+ Channels
+ WHERE
+ TeamId = :TeamId
+ AND Type = 'O'
+ AND DeleteAt = 0
+ ORDER BY DisplayName
+ LIMIT :Limit
+ OFFSET :Offset`,
+ map[string]interface{}{"TeamId": teamId, "Limit": limit, "Offset": offset})
+
+ if err != nil {
+ result.Err = model.NewLocAppError("SqlChannelStore.GetPublicChannelsForTeam", "store.sql_channel.get_public_channels.get.app_error", nil, "teamId="+teamId+", err="+err.Error())
+ } else {
+ result.Data = data
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
type channelIdWithCountAndUpdateAt struct {
Id string
TotalMsgCount int64
@@ -624,7 +719,6 @@ func (s SqlChannelStore) getByName(teamId string, name string, includeDeleted bo
}
}
}
-
if err := s.GetReplica().SelectOne(&channel, query, map[string]interface{}{"TeamId": teamId, "Name": name}); err != nil {
if err == sql.ErrNoRows {
result.Err = model.NewLocAppError("SqlChannelStore.GetByName", MISSING_CHANNEL_ERROR, nil, "teamId="+teamId+", "+"name="+name+", "+err.Error())
diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go
index df9c76905..f347fa438 100644
--- a/store/sql_channel_store_test.go
+++ b/store/sql_channel_store_test.go
@@ -171,6 +171,80 @@ func TestChannelStoreUpdate(t *testing.T) {
}
}
+func TestGetChannelUnread(t *testing.T) {
+ Setup()
+
+ teamId1 := model.NewId()
+ teamId2 := model.NewId()
+
+ uid := model.NewId()
+ m1 := &model.TeamMember{TeamId: teamId1, UserId: uid}
+ m2 := &model.TeamMember{TeamId: teamId2, UserId: uid}
+ Must(store.Team().SaveMember(m1))
+ Must(store.Team().SaveMember(m2))
+ notifyPropsModel := model.GetDefaultChannelNotifyProps()
+
+ // Setup Channel 1
+ c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Downtown", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
+ Must(store.Channel().Save(c1))
+ cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: notifyPropsModel, MsgCount: 90}
+ Must(store.Channel().SaveMember(cm1))
+
+ // Setup Channel 2
+ c2 := &model.Channel{TeamId: m2.TeamId, Name: model.NewId(), DisplayName: "Cultural", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
+ Must(store.Channel().Save(c2))
+ cm2 := &model.ChannelMember{ChannelId: c2.Id, UserId: m2.UserId, NotifyProps: notifyPropsModel, MsgCount: 90, MentionCount: 5}
+ Must(store.Channel().SaveMember(cm2))
+
+ // Check for Channel 1
+ if resp := <-store.Channel().GetChannelUnread(c1.Id, uid); resp.Err != nil {
+ t.Fatal(resp.Err)
+ } else {
+ ch := resp.Data.(*model.ChannelUnread)
+ if c1.Id != ch.ChannelId {
+ t.Fatal("wrong channel id")
+ }
+
+ if teamId1 != ch.TeamId {
+ t.Fatal("wrong team id for channel 1")
+ }
+
+ if ch.NotifyProps == nil {
+ t.Fatal("wrong props for channel 1")
+ }
+
+ if ch.MentionCount != 0 {
+ t.Fatal("wrong MentionCount for channel 1")
+ }
+
+ if ch.MsgCount != 10 {
+ t.Fatal("wrong MsgCount for channel 1")
+ }
+ }
+
+ // Check for Channel 2
+ if resp2 := <-store.Channel().GetChannelUnread(c2.Id, uid); resp2.Err != nil {
+ t.Fatal(resp2.Err)
+ } else {
+ ch2 := resp2.Data.(*model.ChannelUnread)
+ if c2.Id != ch2.ChannelId {
+ t.Fatal("wrong channel id")
+ }
+
+ if teamId2 != ch2.TeamId {
+ t.Fatal("wrong team id")
+ }
+
+ if ch2.MentionCount != 5 {
+ t.Fatal("wrong MentionCount for channel 2")
+ }
+
+ if ch2.MsgCount != 10 {
+ t.Fatal("wrong MsgCount for channel 2")
+ }
+ }
+}
+
func TestChannelStoreGet(t *testing.T) {
Setup()
@@ -775,6 +849,91 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
}
}
+func TestChannelStoreGetPublicChannelsForTeam(t *testing.T) {
+ Setup()
+
+ o1 := model.Channel{}
+ o1.TeamId = model.NewId()
+ o1.DisplayName = "OpenChannel1Team1"
+ o1.Name = "a" + model.NewId() + "b"
+ o1.Type = model.CHANNEL_OPEN
+ Must(store.Channel().Save(&o1))
+
+ o2 := model.Channel{}
+ o2.TeamId = model.NewId()
+ o2.DisplayName = "OpenChannel1Team2"
+ o2.Name = "a" + model.NewId() + "b"
+ o2.Type = model.CHANNEL_OPEN
+ Must(store.Channel().Save(&o2))
+
+ o3 := model.Channel{}
+ o3.TeamId = o1.TeamId
+ o3.DisplayName = "PrivateChannel1Team1"
+ o3.Name = "a" + model.NewId() + "b"
+ o3.Type = model.CHANNEL_PRIVATE
+ Must(store.Channel().Save(&o3))
+
+ cresult := <-store.Channel().GetPublicChannelsForTeam(o1.TeamId, 0, 100)
+ if cresult.Err != nil {
+ t.Fatal(cresult.Err)
+ }
+ list := cresult.Data.(*model.ChannelList)
+
+ if len(*list) != 1 {
+ t.Fatal("wrong list")
+ }
+
+ if (*list)[0].Name != o1.Name {
+ t.Fatal("missing channel")
+ }
+
+ o4 := model.Channel{}
+ o4.TeamId = o1.TeamId
+ o4.DisplayName = "OpenChannel2Team1"
+ o4.Name = "a" + model.NewId() + "b"
+ o4.Type = model.CHANNEL_OPEN
+ Must(store.Channel().Save(&o4))
+
+ cresult = <-store.Channel().GetPublicChannelsForTeam(o1.TeamId, 0, 100)
+ list = cresult.Data.(*model.ChannelList)
+
+ if len(*list) != 2 {
+ t.Fatal("wrong list length")
+ }
+
+ cresult = <-store.Channel().GetPublicChannelsForTeam(o1.TeamId, 0, 1)
+ list = cresult.Data.(*model.ChannelList)
+
+ if len(*list) != 1 {
+ t.Fatal("wrong list length")
+ }
+
+ cresult = <-store.Channel().GetPublicChannelsForTeam(o1.TeamId, 1, 1)
+ list = cresult.Data.(*model.ChannelList)
+
+ if len(*list) != 1 {
+ t.Fatal("wrong list length")
+ }
+
+ if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_OPEN); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(int64) != 2 {
+ t.Log(r1.Data)
+ t.Fatal("wrong value")
+ }
+ }
+
+ if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_PRIVATE); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(int64) != 1 {
+ t.Log(r1.Data)
+ t.Fatal("wrong value")
+ }
+ }
+}
+
func TestChannelStoreGetChannelCounts(t *testing.T) {
Setup()
@@ -1493,3 +1652,46 @@ func TestChannelStoreAnalyticsDeletedTypeCount(t *testing.T) {
}
}
}
+
+func TestChannelStoreGetPinnedPosts(t *testing.T) {
+ Setup()
+
+ o1 := Must(store.Channel().Save(&model.Channel{
+ TeamId: model.NewId(),
+ DisplayName: "Name",
+ Name: "a" + model.NewId() + "b",
+ Type: model.CHANNEL_OPEN,
+ })).(*model.Channel)
+
+ p1 := Must(store.Post().Save(&model.Post{
+ UserId: model.NewId(),
+ ChannelId: o1.Id,
+ Message: "test",
+ IsPinned: true,
+ })).(*model.Post)
+
+ if r1 := <-store.Channel().GetPinnedPosts(o1.Id); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else if r1.Data.(*model.PostList).Posts[p1.Id] == nil {
+ t.Fatal("didn't return relevant pinned posts")
+ }
+
+ o2 := Must(store.Channel().Save(&model.Channel{
+ TeamId: model.NewId(),
+ DisplayName: "Name",
+ Name: "a" + model.NewId() + "b",
+ Type: model.CHANNEL_OPEN,
+ })).(*model.Channel)
+
+ Must(store.Post().Save(&model.Post{
+ UserId: model.NewId(),
+ ChannelId: o2.Id,
+ Message: "test",
+ }))
+
+ if r2 := <-store.Channel().GetPinnedPosts(o2.Id); r2.Err != nil {
+ t.Fatal(r2.Err)
+ } else if len(r2.Data.(*model.PostList).Posts) != 0 {
+ t.Fatal("wasn't supposed to return posts")
+ }
+}
diff --git a/store/sql_compliance_store.go b/store/sql_compliance_store.go
index 0a131d289..2307a98cf 100644
--- a/store/sql_compliance_store.go
+++ b/store/sql_compliance_store.go
@@ -87,17 +87,17 @@ func (us SqlComplianceStore) Update(compliance *model.Compliance) StoreChannel {
return storeChannel
}
-func (s SqlComplianceStore) GetAll() StoreChannel {
+func (s SqlComplianceStore) GetAll(offset, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
- query := "SELECT * FROM Compliances ORDER BY CreateAt DESC"
+ query := "SELECT * FROM Compliances ORDER BY CreateAt DESC LIMIT :Limit OFFSET :Offset"
var compliances model.Compliances
- if _, err := s.GetReplica().Select(&compliances, query); err != nil {
+ if _, err := s.GetReplica().Select(&compliances, query, map[string]interface{}{"Offset": offset, "Limit": limit}); err != nil {
result.Err = model.NewLocAppError("SqlComplianceStore.Get", "store.sql_compliance.get.finding.app_error", nil, err.Error())
} else {
result.Data = compliances
diff --git a/store/sql_compliance_store_test.go b/store/sql_compliance_store_test.go
index 25b6f2dce..e9b0cf94a 100644
--- a/store/sql_compliance_store_test.go
+++ b/store/sql_compliance_store_test.go
@@ -20,7 +20,7 @@ func TestSqlComplianceStore(t *testing.T) {
Must(store.Compliance().Save(compliance2))
time.Sleep(100 * time.Millisecond)
- c := store.Compliance().GetAll()
+ c := store.Compliance().GetAll(0, 1000)
result := <-c
compliances := result.Data.(model.Compliances)
@@ -31,7 +31,7 @@ func TestSqlComplianceStore(t *testing.T) {
compliance2.Status = model.COMPLIANCE_STATUS_FAILED
Must(store.Compliance().Update(compliance2))
- c = store.Compliance().GetAll()
+ c = store.Compliance().GetAll(0, 1000)
result = <-c
compliances = result.Data.(model.Compliances)
@@ -39,6 +39,22 @@ func TestSqlComplianceStore(t *testing.T) {
t.Fatal()
}
+ c = store.Compliance().GetAll(0, 1)
+ result = <-c
+ compliances = result.Data.(model.Compliances)
+
+ if len(compliances) != 1 {
+ t.Fatal("should only have returned 1")
+ }
+
+ c = store.Compliance().GetAll(1, 1)
+ result = <-c
+ compliances = result.Data.(model.Compliances)
+
+ if len(compliances) != 1 {
+ t.Fatal("should only have returned 1")
+ }
+
rc2 := (<-store.Compliance().Get(compliance2.Id)).Data.(*model.Compliance)
if rc2.Status != compliance2.Status {
t.Fatal()
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index eefd251e5..eb14a66a2 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -64,6 +64,7 @@ func (s SqlPostStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_posts_channel_id", "Posts", "ChannelId")
s.CreateIndexIfNotExists("idx_posts_root_id", "Posts", "RootId")
s.CreateIndexIfNotExists("idx_posts_user_id", "Posts", "UserId")
+ s.CreateIndexIfNotExists("idx_posts_is_pinned", "Posts", "IsPinned")
s.CreateFullTextIndexIfNotExists("idx_posts_message_txt", "Posts", "Message")
s.CreateFullTextIndexIfNotExists("idx_posts_hashtags_txt", "Posts", "Hashtags")
diff --git a/store/sql_team_store.go b/store/sql_team_store.go
index bd99ed95c..7d843b030 100644
--- a/store/sql_team_store.go
+++ b/store/sql_team_store.go
@@ -663,7 +663,7 @@ func (s SqlTeamStore) GetTeamsForUser(userId string) StoreChannel {
return storeChannel
}
-func (s SqlTeamStore) GetTeamsUnreadForUser(teamId, userId string) StoreChannel {
+func (s SqlTeamStore) GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
@@ -672,15 +672,50 @@ func (s SqlTeamStore) GetTeamsUnreadForUser(teamId, userId string) StoreChannel
var data []*model.ChannelUnread
_, err := s.GetReplica().Select(&data,
`SELECT
- Channels.TeamId, Channels.TotalMsgCount, ChannelMembers.MsgCount, ChannelMembers.MentionCount, ChannelMembers.NotifyProps
+ Channels.TeamId TeamId, Channels.Id ChannelId, (Channels.TotalMsgCount - ChannelMembers.MsgCount) MsgCount, ChannelMembers.MentionCount MentionCount, ChannelMembers.NotifyProps NotifyProps
FROM
Channels, ChannelMembers
WHERE
- Id = ChannelId AND UserId = :UserId AND DeleteAt = 0 AND TeamId != :TeamId`,
- map[string]interface{}{"UserId": userId, "TeamId": teamId})
+ Id = ChannelId
+ AND UserId = :UserId
+ AND DeleteAt = 0
+ AND TeamId != :TeamId`,
+ map[string]interface{}{"UserId": userId, "TeamId": excludeTeamId})
if err != nil {
- result.Err = model.NewLocAppError("SqlTeamStore.GetTeamsUnreadForUser", "store.sql_team.get_unread.app_error", nil, "userId="+userId+" "+err.Error())
+ result.Err = model.NewLocAppError("SqlTeamStore.GetChannelUnreadsForAllTeams", "store.sql_team.get_unread.app_error", nil, "userId="+userId+" "+err.Error())
+ } else {
+ result.Data = data
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
+func (s SqlTeamStore) GetChannelUnreadsForTeam(teamId, userId string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ var data []*model.ChannelUnread
+ _, err := s.GetReplica().Select(&data,
+ `SELECT
+ Channels.TeamId TeamId, Channels.Id ChannelId, (Channels.TotalMsgCount - ChannelMembers.MsgCount) MsgCount, ChannelMembers.MentionCount MentionCount, ChannelMembers.NotifyProps NotifyProps
+ FROM
+ Channels, ChannelMembers
+ WHERE
+ Id = ChannelId
+ AND UserId = :UserId
+ AND TeamId = :TeamId
+ AND DeleteAt = 0`,
+ map[string]interface{}{"TeamId": teamId, "UserId": userId})
+
+ if err != nil {
+ result.Err = model.NewLocAppError("SqlTeamStore.GetChannelUnreadsForTeam", "store.sql_team.get_unread.app_error", nil, "teamId="+teamId+" "+err.Error())
} else {
result.Data = data
}
diff --git a/store/sql_team_store_test.go b/store/sql_team_store_test.go
index 58ac74fc0..3aeb14c9c 100644
--- a/store/sql_team_store_test.go
+++ b/store/sql_team_store_test.go
@@ -554,7 +554,7 @@ func TestTeamStoreMemberCount(t *testing.T) {
}
}
-func TestMyTeamMembersUnread(t *testing.T) {
+func TestGetChannelUnreadsForAllTeams(t *testing.T) {
Setup()
teamId1 := model.NewId()
@@ -566,17 +566,17 @@ func TestMyTeamMembersUnread(t *testing.T) {
Must(store.Team().SaveMember(m1))
Must(store.Team().SaveMember(m2))
- c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN}
+ c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
Must(store.Channel().Save(c1))
- c2 := &model.Channel{TeamId: m2.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN}
+ c2 := &model.Channel{TeamId: m2.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
Must(store.Channel().Save(c2))
- cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps()}
+ cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
Must(store.Channel().SaveMember(cm1))
- cm2 := &model.ChannelMember{ChannelId: c2.Id, UserId: m2.UserId, NotifyProps: model.GetDefaultChannelNotifyProps()}
+ cm2 := &model.ChannelMember{ChannelId: c2.Id, UserId: m2.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
Must(store.Channel().SaveMember(cm2))
- if r1 := <-store.Team().GetTeamsUnreadForUser("", uid); r1.Err != nil {
+ if r1 := <-store.Team().GetChannelUnreadsForAllTeams("", uid); r1.Err != nil {
t.Fatal(r1.Err)
} else {
ms := r1.Data.([]*model.ChannelUnread)
@@ -590,9 +590,13 @@ func TestMyTeamMembersUnread(t *testing.T) {
if len(membersMap) != 2 {
t.Fatal("Should be the unreads for all the teams")
}
+
+ if ms[0].MsgCount != 10 {
+ t.Fatal("subtraction failed")
+ }
}
- if r2 := <-store.Team().GetTeamsUnreadForUser(teamId1, uid); r2.Err != nil {
+ if r2 := <-store.Team().GetChannelUnreadsForAllTeams(teamId1, uid); r2.Err != nil {
t.Fatal(r2.Err)
} else {
ms := r2.Data.([]*model.ChannelUnread)
@@ -607,9 +611,46 @@ func TestMyTeamMembersUnread(t *testing.T) {
if len(membersMap) != 1 {
t.Fatal("Should be the unreads for just one team")
}
+
+ if ms[0].MsgCount != 10 {
+ t.Fatal("subtraction failed")
+ }
}
if r1 := <-store.Team().RemoveAllMembersByUser(uid); r1.Err != nil {
t.Fatal(r1.Err)
}
}
+
+func TestGetChannelUnreadsForTeam(t *testing.T) {
+ Setup()
+
+ teamId1 := model.NewId()
+
+ uid := model.NewId()
+ m1 := &model.TeamMember{TeamId: teamId1, UserId: uid}
+ Must(store.Team().SaveMember(m1))
+
+ c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
+ Must(store.Channel().Save(c1))
+ c2 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.CHANNEL_OPEN, TotalMsgCount: 100}
+ Must(store.Channel().Save(c2))
+
+ cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
+ Must(store.Channel().SaveMember(cm1))
+ cm2 := &model.ChannelMember{ChannelId: c2.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
+ Must(store.Channel().SaveMember(cm2))
+
+ if r1 := <-store.Team().GetChannelUnreadsForTeam(m1.TeamId, m1.UserId); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ ms := r1.Data.([]*model.ChannelUnread)
+ if len(ms) != 2 {
+ t.Fatal("wrong length")
+ }
+
+ if ms[0].MsgCount != 10 {
+ t.Fatal("subtraction failed")
+ }
+ }
+}
diff --git a/store/sql_upgrade.go b/store/sql_upgrade.go
index 1402c0eb1..45981c5c8 100644
--- a/store/sql_upgrade.go
+++ b/store/sql_upgrade.go
@@ -15,6 +15,7 @@ import (
)
const (
+ VERSION_3_8_0 = "3.8.0"
VERSION_3_7_0 = "3.7.0"
VERSION_3_6_0 = "3.6.0"
VERSION_3_5_0 = "3.5.0"
@@ -41,6 +42,7 @@ func UpgradeDatabase(sqlStore *SqlStore) {
UpgradeDatabaseToVersion35(sqlStore)
UpgradeDatabaseToVersion36(sqlStore)
UpgradeDatabaseToVersion37(sqlStore)
+ UpgradeDatabaseToVersion38(sqlStore)
// If the SchemaVersion is empty this this is the first time it has ran
// so lets set it to the current version.
@@ -240,3 +242,14 @@ func UpgradeDatabaseToVersion37(sqlStore *SqlStore) {
saveSchemaVersion(sqlStore, VERSION_3_7_0)
}
}
+
+func UpgradeDatabaseToVersion38(sqlStore *SqlStore) {
+ // TODO: Uncomment following condition when version 3.8.0 is released
+ // if shouldPerformUpgrade(sqlStore, VERSION_3_7_0, VERSION_3_8_0) {
+
+ // Add the IsPinned column to posts.
+ sqlStore.CreateColumnIfNotExists("Posts", "IsPinned", "boolean", "boolean", "0")
+
+ // saveSchemaVersion(sqlStore, VERSION_3_8_0)
+ // }
+}
diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go
index 355678064..67290c983 100644
--- a/store/sql_webhook_store.go
+++ b/store/sql_webhook_store.go
@@ -6,6 +6,8 @@ package store
import (
"net/http"
+ "database/sql"
+
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
@@ -155,6 +157,9 @@ func (s SqlWebhookStore) GetIncoming(id string, allowFromCache bool) StoreChanne
if err := s.GetReplica().SelectOne(&webhook, "SELECT * FROM IncomingWebhooks WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}); err != nil {
result.Err = model.NewLocAppError("SqlWebhookStore.GetIncoming", "store.sql_webhooks.get_incoming.app_error", nil, "id="+id+", err="+err.Error())
+ if err == sql.ErrNoRows {
+ result.Err.StatusCode = http.StatusNotFound
+ }
}
if result.Err == nil {
@@ -324,7 +329,28 @@ func (s SqlWebhookStore) GetOutgoing(id string) StoreChannel {
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoingList(offset, limit int) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ var webhooks []*model.OutgoingWebhook
+
+ if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE DeleteAt = 0 LIMIT :Limit OFFSET :Offset", map[string]interface{}{"Offset": offset, "Limit": limit}); err != nil {
+ result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingList", "store.sql_webhooks.get_outgoing_by_channel.app_error", nil, "err="+err.Error())
+ }
+
+ result.Data = webhooks
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
+func (s SqlWebhookStore) GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
@@ -332,7 +358,14 @@ func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel {
var webhooks []*model.OutgoingWebhook
- if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0", map[string]interface{}{"ChannelId": channelId}); err != nil {
+ query := ""
+ if limit < 0 || offset < 0 {
+ query = "SELECT * FROM OutgoingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0"
+ } else {
+ query = "SELECT * FROM OutgoingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0 LIMIT :Limit OFFSET :Offset"
+ }
+
+ if _, err := s.GetReplica().Select(&webhooks, query, map[string]interface{}{"ChannelId": channelId, "Offset": offset, "Limit": limit}); err != nil {
result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingByChannel", "store.sql_webhooks.get_outgoing_by_channel.app_error", nil, "channelId="+channelId+", err="+err.Error())
}
@@ -345,7 +378,7 @@ func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel {
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByTeam(teamId string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
@@ -353,7 +386,14 @@ func (s SqlWebhookStore) GetOutgoingByTeam(teamId string) StoreChannel {
var webhooks []*model.OutgoingWebhook
- if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil {
+ query := ""
+ if limit < 0 || offset < 0 {
+ query = "SELECT * FROM OutgoingWebhooks WHERE TeamId = :TeamId AND DeleteAt = 0"
+ } else {
+ query = "SELECT * FROM OutgoingWebhooks WHERE TeamId = :TeamId AND DeleteAt = 0 LIMIT :Limit OFFSET :Offset"
+ }
+
+ if _, err := s.GetReplica().Select(&webhooks, query, map[string]interface{}{"TeamId": teamId, "Offset": offset, "Limit": limit}); err != nil {
result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingByTeam", "store.sql_webhooks.get_outgoing_by_team.app_error", nil, "teamId="+teamId+", err="+err.Error())
}
diff --git a/store/sql_webhook_store_test.go b/store/sql_webhook_store_test.go
index e1aaad1b7..6cfe36450 100644
--- a/store/sql_webhook_store_test.go
+++ b/store/sql_webhook_store_test.go
@@ -6,6 +6,8 @@ package store
import (
"testing"
+ "net/http"
+
"github.com/mattermost/platform/model"
)
@@ -72,6 +74,10 @@ func TestWebhookStoreGetIncoming(t *testing.T) {
if err := (<-store.Webhook().GetIncoming("123", true)).Err; err == nil {
t.Fatal("Missing id should have failed")
}
+
+ if err := (<-store.Webhook().GetIncoming("123", true)).Err; err.StatusCode != http.StatusNotFound {
+ t.Fatal("Should have set the status as not found for missing id")
+ }
}
func TestWebhookStoreGetIncomingList(t *testing.T) {
@@ -234,6 +240,59 @@ func TestWebhookStoreGetOutgoing(t *testing.T) {
}
}
+func TestWebhookStoreGetOutgoingList(t *testing.T) {
+ Setup()
+
+ o1 := &model.OutgoingWebhook{}
+ o1.ChannelId = model.NewId()
+ o1.CreatorId = model.NewId()
+ o1.TeamId = model.NewId()
+ o1.CallbackURLs = []string{"http://nowhere.com/"}
+
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
+
+ o2 := &model.OutgoingWebhook{}
+ o2.ChannelId = model.NewId()
+ o2.CreatorId = model.NewId()
+ o2.TeamId = model.NewId()
+ o2.CallbackURLs = []string{"http://nowhere.com/"}
+
+ o2 = (<-store.Webhook().SaveOutgoing(o2)).Data.(*model.OutgoingWebhook)
+
+ if r1 := <-store.Webhook().GetOutgoingList(0, 1000); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ hooks := r1.Data.([]*model.OutgoingWebhook)
+ found1 := false
+ found2 := false
+
+ for _, hook := range hooks {
+ if hook.CreateAt != o1.CreateAt {
+ found1 = true
+ }
+
+ if hook.CreateAt != o2.CreateAt {
+ found2 = true
+ }
+ }
+
+ if !found1 {
+ t.Fatal("missing hook1")
+ }
+ if !found2 {
+ t.Fatal("missing hook2")
+ }
+ }
+
+ if result := <-store.Webhook().GetOutgoingList(0, 2); result.Err != nil {
+ t.Fatal(result.Err)
+ } else {
+ if len(result.Data.([]*model.OutgoingWebhook)) != 2 {
+ t.Fatal("wrong number of hooks returned")
+ }
+ }
+}
+
func TestWebhookStoreGetOutgoingByChannel(t *testing.T) {
Setup()
@@ -245,7 +304,7 @@ func TestWebhookStoreGetOutgoingByChannel(t *testing.T) {
o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoingByChannel(o1.ChannelId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoingByChannel(o1.ChannelId, 0, 100); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.OutgoingWebhook)[0].CreateAt != o1.CreateAt {
@@ -253,7 +312,7 @@ func TestWebhookStoreGetOutgoingByChannel(t *testing.T) {
}
}
- if result := <-store.Webhook().GetOutgoingByChannel("123"); result.Err != nil {
+ if result := <-store.Webhook().GetOutgoingByChannel("123", -1, -1); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.OutgoingWebhook)) != 0 {
@@ -273,7 +332,7 @@ func TestWebhookStoreGetOutgoingByTeam(t *testing.T) {
o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoingByTeam(o1.TeamId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoingByTeam(o1.TeamId, 0, 100); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.OutgoingWebhook)[0].CreateAt != o1.CreateAt {
@@ -281,7 +340,7 @@ func TestWebhookStoreGetOutgoingByTeam(t *testing.T) {
}
}
- if result := <-store.Webhook().GetOutgoingByTeam("123"); result.Err != nil {
+ if result := <-store.Webhook().GetOutgoingByTeam("123", -1, -1); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.OutgoingWebhook)) != 0 {
diff --git a/store/store.go b/store/store.go
index 7aa903f6f..72572b1e0 100644
--- a/store/store.go
+++ b/store/store.go
@@ -77,7 +77,8 @@ type TeamStore interface {
GetTotalMemberCount(teamId string) StoreChannel
GetActiveMemberCount(teamId string) StoreChannel
GetTeamsForUser(userId string) StoreChannel
- GetTeamsUnreadForUser(teamId, userId string) StoreChannel
+ GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel
+ GetChannelUnreadsForTeam(teamId, userId string) StoreChannel
RemoveMember(teamId string, userId string) StoreChannel
RemoveAllMembersByTeam(teamId string) StoreChannel
RemoveAllMembersByUser(userId string) StoreChannel
@@ -101,6 +102,7 @@ type ChannelStore interface {
GetDeletedByName(team_id string, name string) StoreChannel
GetChannels(teamId string, userId string) StoreChannel
GetMoreChannels(teamId string, userId string, offset int, limit int) StoreChannel
+ GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel
GetChannelCounts(teamId string, userId string) StoreChannel
GetTeamChannels(teamId string) StoreChannel
GetAll(teamId string) StoreChannel
@@ -118,6 +120,7 @@ type ChannelStore interface {
InvalidateMemberCount(channelId string)
GetMemberCountFromCache(channelId string) int64
GetMemberCount(channelId string, allowFromCache bool) StoreChannel
+ GetPinnedPosts(channelId string) StoreChannel
RemoveMember(channelId string, userId string) StoreChannel
PermanentDeleteMembersByUser(userId string) StoreChannel
PermanentDeleteMembersByChannel(channelId string) StoreChannel
@@ -131,6 +134,7 @@ type ChannelStore interface {
SearchMore(userId string, teamId string, term string) StoreChannel
GetMembersByIds(channelId string, userIds []string) StoreChannel
AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel
+ GetChannelUnread(channelId, userId string) StoreChannel
}
type PostStore interface {
@@ -225,7 +229,7 @@ type ComplianceStore interface {
Save(compliance *model.Compliance) StoreChannel
Update(compliance *model.Compliance) StoreChannel
Get(id string) StoreChannel
- GetAll() StoreChannel
+ GetAll(offset, limit int) StoreChannel
ComplianceExport(compliance *model.Compliance) StoreChannel
}
@@ -270,8 +274,9 @@ type WebhookStore interface {
SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel
GetOutgoing(id string) StoreChannel
- GetOutgoingByChannel(channelId string) StoreChannel
- GetOutgoingByTeam(teamId string) StoreChannel
+ GetOutgoingList(offset, limit int) StoreChannel
+ GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel
+ GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel
DeleteOutgoing(webhookId string, time int64) StoreChannel
PermanentDeleteOutgoingByUser(userId string) StoreChannel
UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel
diff --git a/tests/test-links.md b/tests/test-links.md
index fd627eb86..55be2f27b 100644
--- a/tests/test-links.md
+++ b/tests/test-links.md
@@ -83,7 +83,6 @@ https://example.com links to `https://example.com` and not `http://example.com`
https://en.wikipedia.org/wiki/🐬 links to the Wikipedia article on dolphins
https://en.wikipedia.org/wiki/URLs#Syntax links to the Syntax section of the Wikipedia article on URLs
test@example.com links to `mailto:test@example.com`
-mailto:test@example.com links to `mailto:test@example.com`
[email link](mailto:test@example.com) links to `mailto:test@example.com` and not `http://mailto:test@example.com`
[other link](ts3server://example.com) links to `ts3server://example.com` and not `http://ts3server://example.com`
test_underscore@example.com links to `mailto:test_underscore@example.com`
diff --git a/utils/inbucket.go b/utils/inbucket.go
index 1c747cee8..f80d16efd 100644
--- a/utils/inbucket.go
+++ b/utils/inbucket.go
@@ -3,8 +3,10 @@ package utils
import (
"encoding/json"
"fmt"
+ "io"
"net/http"
"strings"
+ "time"
)
const (
@@ -58,11 +60,22 @@ func GetMailBox(email string) (results JSONMessageHeaderInbucket, err error) {
}
defer resp.Body.Close()
+ if resp.Body == nil {
+ return nil, fmt.Errorf("No Mailbox")
+ }
+
var record JSONMessageHeaderInbucket
- if err := json.NewDecoder(resp.Body).Decode(&record); err != nil {
- fmt.Println(err)
- return nil, err
+ err = json.NewDecoder(resp.Body).Decode(&record)
+ switch {
+ case err == io.EOF:
+ return nil, fmt.Errorf("Error: %s", err)
+ case err != nil:
+ return nil, fmt.Errorf("Error: %s", err)
+ }
+ if len(record) == 0 {
+ return nil, fmt.Errorf("No mailbox")
}
+
return record, nil
}
@@ -87,7 +100,6 @@ func GetMessageFromMailbox(email, id string) (results JSONMessageInbucket, err e
defer resp.Body.Close()
if err := json.NewDecoder(resp.Body).Decode(&record); err != nil {
- fmt.Println(err)
return record, err
}
return record, nil
@@ -113,3 +125,21 @@ func DeleteMailBox(email string) (err error) {
return nil
}
+
+func RetryInbucket(attempts int, callback func() error) (err error) {
+ for i := 0; ; i++ {
+ err = callback()
+ if err == nil {
+ return nil
+ }
+
+ if i >= (attempts - 1) {
+ break
+ }
+
+ time.Sleep(5 * time.Second)
+
+ fmt.Println("retrying...")
+ }
+ return fmt.Errorf("After %d attempts, last error: %s", attempts, err)
+}
diff --git a/utils/mail_test.go b/utils/mail_test.go
index 012f10d39..523ca0ba5 100644
--- a/utils/mail_test.go
+++ b/utils/mail_test.go
@@ -47,13 +47,25 @@ func TestSendMail(t *testing.T) {
t.Fatal("Should connect to the STMP Server")
} else {
//Check if the email was send to the rigth email address
- if resultsMailbox, err := GetMailBox(emailTo); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Body.Text, emailBody) {
- t.Log(resultsEmail.Body.Text)
- t.Fatal("Received message")
+ var resultsMailbox JSONMessageHeaderInbucket
+ err := RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = GetMailBox(emailTo)
+ return err
+ })
+ if err != nil {
+ t.Log(err)
+ t.Log("No email was received, maybe due load on the server. Disabling this verification")
+ }
+ if err == nil && len(resultsMailbox) > 0 {
+ if !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Body.Text, emailBody) {
+ t.Log(resultsEmail.Body.Text)
+ t.Fatal("Received message")
+ }
}
}
}
diff --git a/vendor/github.com/goamz/goamz/.gitignore b/vendor/github.com/goamz/goamz/.gitignore
deleted file mode 100644
index 1377554eb..000000000
--- a/vendor/github.com/goamz/goamz/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.swp
diff --git a/vendor/github.com/goamz/goamz/.lbox b/vendor/github.com/goamz/goamz/.lbox
deleted file mode 100644
index 75e124512..000000000
--- a/vendor/github.com/goamz/goamz/.lbox
+++ /dev/null
@@ -1 +0,0 @@
-propose -for=lp:goamz -cr
diff --git a/vendor/github.com/goamz/goamz/.travis.yml b/vendor/github.com/goamz/goamz/.travis.yml
deleted file mode 100644
index 3c26b1759..000000000
--- a/vendor/github.com/goamz/goamz/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-language: go
-
-go:
- - 1.1
- - 1.2
- - 1.3
- - 1.4
- - tip
-
-before_script:
- - FIXED=$(go fmt ./... | wc -l); if [ $FIXED -gt 0 ]; then echo "gofmt - $FIXED file(s) not formatted correctly, please run gofmt to fix this." && exit 1; fi
-
-script:
- - go test -v ./autoscaling/
- - go test -v ./aws/
- - go test -v ./cloudformation/
- - go test -v ./cloudfront/
- - go test -v ./cloudwatch/
- - go test -v ./dynamodb/
- - go test -v ./ec2/
- - go test -v ./ecs/
- - go test -v ./elb/
- - go test -v ./iam/
- - go test -v ./rds/
- - go test -v ./route53/
- - go test -v ./s3/
- - go test -v ./sqs/
- - go test -v ./sts/
- - go test -v ./exp/mturk/
- - go test -v ./exp/sdb/
- # - go test -v ./exp/ses/
- # - go test -v ./exp/sns/
diff --git a/vendor/github.com/goamz/goamz/CHANGES.md b/vendor/github.com/goamz/goamz/CHANGES.md
deleted file mode 100644
index 3d047b896..000000000
--- a/vendor/github.com/goamz/goamz/CHANGES.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Changes in this fork
-
-* Added CNNorth Region
-* Change SignV2 to SignV4
-* V4Signer.canonicalQueryString empty value must append "=" \ No newline at end of file
diff --git a/vendor/github.com/goamz/goamz/LICENSE b/vendor/github.com/goamz/goamz/LICENSE
deleted file mode 100644
index 53320c352..000000000
--- a/vendor/github.com/goamz/goamz/LICENSE
+++ /dev/null
@@ -1,185 +0,0 @@
-This software is licensed under the LGPLv3, included below.
-
-As a special exception to the GNU Lesser General Public License version 3
-("LGPL3"), the copyright holders of this Library give you permission to
-convey to a third party a Combined Work that links statically or dynamically
-to this Library without providing any Minimal Corresponding Source or
-Minimal Application Code as set out in 4d or providing the installation
-information set out in section 4e, provided that you comply with the other
-provisions of LGPL3 and provided that you meet, for the Application the
-terms and conditions of the license(s) which apply to the Application.
-
-Except as stated in this special exception, the provisions of LGPL3 will
-continue to comply in full to this Library. If you modify this Library, you
-may apply this exception to your version of this Library, but you are not
-obliged to do so. If you do not wish to do so, delete this exception
-statement from your version. This exception does not (and cannot) modify any
-license terms which apply to the Application, with which you must still
-comply.
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/vendor/github.com/goamz/goamz/README.md b/vendor/github.com/goamz/goamz/README.md
deleted file mode 100644
index e1b617484..000000000
--- a/vendor/github.com/goamz/goamz/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# goamz - An Amazon Library for Go
-
-[![Build Status](http://travis-ci.org/goamz/goamz.png?branch=master)](https://travis-ci.org/goamz/goamz)
-
-The _goamz_ package enables Go programs to interact with Amazon Web Services.
-
-This is a fork of the version [developed within Canonical](https://wiki.ubuntu.com/goamz) with additional functionality and services from [a number of contributors](https://github.com/goamz/goamz/contributors)!
-
-The API of AWS is very comprehensive, though, and goamz doesn't even scratch the surface of it. That said, it's fairly well tested, and is the foundation in which further calls can easily be integrated. We'll continue extending the API as necessary - Pull Requests are _very_ welcome!
-
-The following packages are available at the moment:
-
-```
-github.com/goamz/goamz/autoscaling
-github.com/goamz/goamz/aws
-github.com/goamz/goamz/cloudformation
-github.com/goamz/goamz/cloudfront
-github.com/goamz/goamz/cloudwatch
-github.com/goamz/goamz/dynamodb
-github.com/goamz/goamz/ecs
-github.com/goamz/goamz/ec2
-github.com/goamz/goamz/elb
-github.com/goamz/goamz/iam
-github.com/goamz/goamz/rds
-github.com/goamz/goamz/route53
-github.com/goamz/goamz/s3
-github.com/goamz/goamz/sqs
-github.com/goamz/goamz/sts
-
-github.com/goamz/goamz/exp/mturk
-github.com/goamz/goamz/exp/sdb
-github.com/goamz/goamz/exp/sns
-```
-
-Packages under `exp/` are still in an experimental or unfinished/unpolished state.
-
-## API documentation
-
-The API documentation is currently available at:
-
-[http://godoc.org/github.com/goamz/goamz](http://godoc.org/github.com/goamz/goamz)
-
-## How to build and install goamz
-
-Just use `go get` with any of the available packages. For example:
-
-* `$ go get github.com/goamz/goamz/ec2`
-* `$ go get github.com/goamz/goamz/s3`
-
-## Running tests
-
-To run tests, first install gocheck with:
-
-`$ go get gopkg.in/check.v1`
-
-Then run go test as usual:
-
-`$ go test github.com/goamz/goamz/...`
-
-_Note:_ running all tests with the command `go test ./...` will currently fail as tests do not tear down their HTTP listeners.
-
-If you want to run integration tests (costs money), set up the EC2 environment variables as usual, and run:
-
-$ gotest -i
diff --git a/vendor/github.com/goamz/goamz/autoscaling/autoscaling.go b/vendor/github.com/goamz/goamz/autoscaling/autoscaling.go
deleted file mode 100644
index 8e9f8ab02..000000000
--- a/vendor/github.com/goamz/goamz/autoscaling/autoscaling.go
+++ /dev/null
@@ -1,1768 +0,0 @@
-//
-// autoscaling: This package provides types and functions to interact with the AWS Auto Scale API
-//
-// Depends on https://wiki.ubuntu.com/goamz
-//
-
-package autoscaling
-
-import (
- "encoding/base64"
- "encoding/xml"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-const debug = false
-
-var timeNow = time.Now
-
-// AutoScaling contains the details of the AWS region to perform operations against.
-type AutoScaling struct {
- aws.Auth
- aws.Region
-}
-
-// New creates a new AutoScaling Client.
-func New(auth aws.Auth, region aws.Region) *AutoScaling {
- return &AutoScaling{auth, region}
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by the AWS Auto Scaling API.
-//
-// See http://goo.gl/VZGuC for more details.
-type Error struct {
- // HTTP status code (200, 403, ...)
- StatusCode int
- // AutoScaling error code ("UnsupportedOperation", ...)
- Code string
- // The error type
- Type string
- // The human-oriented error message
- Message string
- RequestId string `xml:"RequestID"`
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-type xmlErrors struct {
- RequestId string `xml:"RequestId"`
- Errors []Error `xml:"Error"`
-}
-
-func (as *AutoScaling) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2011-01-01"
- data := strings.NewReader(multimap(params).Encode())
-
- hreq, err := http.NewRequest("POST", as.Region.AutoScalingEndpoint+"/", data)
- if err != nil {
- return err
- }
-
- hreq.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
-
- token := as.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(as.Auth, "autoscaling", as.Region)
- signer.Sign(hreq)
-
- if debug {
- log.Printf("%v -> {\n", hreq)
- }
- r, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- log.Printf("Error calling Amazon %v", err)
- return err
- }
-
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
-
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func addParamsList(params map[string]string, label string, ids []string) {
- for i, id := range ids {
- params[label+"."+strconv.Itoa(i+1)] = id
- }
-}
-
-// ----------------------------------------------------------------------------
-// Filtering helper.
-
-// Filter builds filtering parameters to be used in an autoscaling query which supports
-// filtering. For example:
-//
-// filter := NewFilter()
-// filter.Add("architecture", "i386")
-// filter.Add("launch-index", "0")
-// resp, err := as.DescribeTags(filter,nil,nil)
-//
-type Filter struct {
- m map[string][]string
-}
-
-// NewFilter creates a new Filter.
-func NewFilter() *Filter {
- return &Filter{make(map[string][]string)}
-}
-
-// Add appends a filtering parameter with the given name and value(s).
-func (f *Filter) Add(name string, value ...string) {
- f.m[name] = append(f.m[name], value...)
-}
-
-func (f *Filter) addParams(params map[string]string) {
- if f != nil {
- a := make([]string, len(f.m))
- i := 0
- for k := range f.m {
- a[i] = k
- i++
- }
- sort.StringSlice(a).Sort()
- for i, k := range a {
- prefix := "Filters.member." + strconv.Itoa(i+1)
- params[prefix+".Name"] = k
- for j, v := range f.m[k] {
- params[prefix+".Values.member."+strconv.Itoa(j+1)] = v
- }
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// Auto Scaling base types and related functions.
-
-// SimpleResp is the basic response from most actions.
-type SimpleResp struct {
- XMLName xml.Name
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// EnabledMetric encapsulates a metric associated with an Auto Scaling Group
-//
-// See http://goo.gl/hXiH17 for more details
-type EnabledMetric struct {
- Granularity string `xml:"Granularity"` // The granularity of the enabled metric.
- Metric string `xml:"Metric"` // The name of the enabled metric.
-}
-
-// Instance encapsulates an instance type as returned by the Auto Scaling API
-//
-// See http://goo.gl/NwBxGh and http://goo.gl/OuoqhS for more details.
-type Instance struct {
- // General instance information
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- AvailabilityZone string `xml:"AvailabilityZone"`
- HealthStatus string `xml:"HealthStatus"`
- InstanceId string `xml:"InstanceId"`
- LaunchConfigurationName string `xml:"LaunchConfigurationName"`
- LifecycleState string `xml:"LifecycleState"`
-}
-
-// SuspenedProcess encapsulates an Auto Scaling process that has been suspended
-//
-// See http://goo.gl/iObPgF for more details
-type SuspendedProcess struct {
- ProcessName string `xml:"ProcessName"`
- SuspensionReason string `xml:"SuspensionReason"`
-}
-
-// Tag encapsulates tag applied to an Auto Scaling group.
-//
-// See http://goo.gl/MG1hqs for more details
-type Tag struct {
- Key string `xml:"Key"`
- PropagateAtLaunch bool `xml:"PropagateAtLaunch"` // Specifies whether the new tag will be applied to instances launched after the tag is created
- ResourceId string `xml:"ResourceId"` // the name of the Auto Scaling group - not required if creating ASG
- ResourceType string `xml:"ResourceType"` // currently only auto-scaling-group is supported - not required if creating ASG
- Value string `xml:"Value"`
-}
-
-// AutoScalingGroup encapsulates an Auto Scaling Group object
-//
-// See http://goo.gl/fJdYhg for more details.
-type AutoScalingGroup struct {
- AutoScalingGroupARN string `xml:"AutoScalingGroupARN"`
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- AvailabilityZones []string `xml:"AvailabilityZones>member"`
- CreatedTime time.Time `xml:"CreatedTime"`
- DefaultCooldown int `xml:"DefaultCooldown"`
- DesiredCapacity int `xml:"DesiredCapacity"`
- EnabledMetrics []EnabledMetric `xml:"EnabledMetric>member"`
- HealthCheckGracePeriod int `xml:"HealthCheckGracePeriod"`
- HealthCheckType string `xml:"HealthCheckType"`
- Instances []Instance `xml:"Instances>member"`
- LaunchConfigurationName string `xml:"LaunchConfigurationName"`
- LoadBalancerNames []string `xml:"LoadBalancerNames>member"`
- MaxSize int `xml:"MaxSize"`
- MinSize int `xml:"MinSize"`
- PlacementGroup string `xml:"PlacementGroup"`
- Status string `xml:"Status"`
- SuspendedProcesses []SuspendedProcess `xml:"SuspendedProcesses>member"`
- Tags []Tag `xml:"Tags>member"`
- TerminationPolicies []string `xml:"TerminationPolicies>member"`
- VPCZoneIdentifier string `xml:"VPCZoneIdentifier"`
-}
-
-// CreateAutoScalingGroupParams type encapsulates options for the respective request.
-//
-// See http://goo.gl/3S13Bv for more details.
-type CreateAutoScalingGroupParams struct {
- AutoScalingGroupName string
- AvailabilityZones []string
- DefaultCooldown int
- DesiredCapacity int
- HealthCheckGracePeriod int
- HealthCheckType string
- InstanceId string
- LaunchConfigurationName string
- LoadBalancerNames []string
- MaxSize int
- MinSize int
- PlacementGroup string
- Tags []Tag
- TerminationPolicies []string
- VPCZoneIdentifier string
-}
-
-// AttachInstances Attach running instances to an autoscaling group
-//
-// See http://goo.gl/zDZbuQ for more details.
-func (as *AutoScaling) AttachInstances(name string, instanceIds []string) (resp *SimpleResp, err error) {
- params := makeParams("AttachInstances")
- params["AutoScalingGroupName"] = name
-
- for i, id := range instanceIds {
- key := fmt.Sprintf("InstanceIds.member.%d", i+1)
- params[key] = id
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// CreateAutoScalingGroup creates an Auto Scaling Group on AWS
-//
-// Required params: AutoScalingGroupName, MinSize, MaxSize
-//
-// See http://goo.gl/3S13Bv for more details.
-func (as *AutoScaling) CreateAutoScalingGroup(options *CreateAutoScalingGroupParams) (
- resp *SimpleResp, err error) {
- params := makeParams("CreateAutoScalingGroup")
-
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- params["MaxSize"] = strconv.Itoa(options.MaxSize)
- params["MinSize"] = strconv.Itoa(options.MinSize)
- params["DesiredCapacity"] = strconv.Itoa(options.DesiredCapacity)
-
- if options.DefaultCooldown > 0 {
- params["DefaultCooldown"] = strconv.Itoa(options.DefaultCooldown)
- }
- if options.HealthCheckGracePeriod > 0 {
- params["HealthCheckGracePeriod"] = strconv.Itoa(options.HealthCheckGracePeriod)
- }
- if options.HealthCheckType != "" {
- params["HealthCheckType"] = options.HealthCheckType
- }
- if options.InstanceId != "" {
- params["InstanceId"] = options.InstanceId
- }
- if options.LaunchConfigurationName != "" {
- params["LaunchConfigurationName"] = options.LaunchConfigurationName
- }
- if options.PlacementGroup != "" {
- params["PlacementGroup"] = options.PlacementGroup
- }
- if options.VPCZoneIdentifier != "" {
- params["VPCZoneIdentifier"] = options.VPCZoneIdentifier
- }
- if len(options.LoadBalancerNames) > 0 {
- addParamsList(params, "LoadBalancerNames.member", options.LoadBalancerNames)
- }
- if len(options.AvailabilityZones) > 0 {
- addParamsList(params, "AvailabilityZones.member", options.AvailabilityZones)
- }
- if len(options.TerminationPolicies) > 0 {
- addParamsList(params, "TerminationPolicies.member", options.TerminationPolicies)
- }
- for i, t := range options.Tags {
- key := "Tags.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "Key")] = t.Key
- params[fmt.Sprintf(key, index, "Value")] = t.Value
- params[fmt.Sprintf(key, index, "PropagateAtLaunch")] = strconv.FormatBool(t.PropagateAtLaunch)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// EBS represents the AWS EBS volume data type
-//
-// See http://goo.gl/nDUL2h for more details
-type EBS struct {
- DeleteOnTermination bool `xml:"DeleteOnTermination"`
- Iops int `xml:"Iops"`
- SnapshotId string `xml:"SnapshotId"`
- VolumeSize int `xml:"VolumeSize"`
- VolumeType string `xml:"VolumeType"`
-}
-
-// BlockDeviceMapping represents the association of a block device with ebs volume.
-//
-// See http://goo.gl/wEGwkU for more details.
-type BlockDeviceMapping struct {
- DeviceName string `xml:"DeviceName"`
- Ebs EBS `xml:"Ebs"`
- NoDevice bool `xml:"NoDevice"`
- VirtualName string `xml:"VirtualName"`
-}
-
-// InstanceMonitoring data type
-//
-// See http://goo.gl/TfaPwz for more details
-type InstanceMonitoring struct {
- Enabled bool `xml:"Enabled"`
-}
-
-// LaunchConfiguration encapsulates the LaunchConfiguration Data Type
-//
-// See http://goo.gl/TOJunp
-type LaunchConfiguration struct {
- AssociatePublicIpAddress bool `xml:"AssociatePublicIpAddress"`
- BlockDeviceMappings []BlockDeviceMapping `xml:"BlockDeviceMappings>member"`
- CreatedTime time.Time `xml:"CreatedTime"`
- EbsOptimized bool `xml:"EbsOptimized"`
- IamInstanceProfile string `xml:"IamInstanceProfile"`
- ImageId string `xml:"ImageId"`
- InstanceId string `xml:"InstanceId"`
- InstanceMonitoring InstanceMonitoring `xml:"InstanceMonitoring"`
- InstanceType string `xml:"InstanceType"`
- KernelId string `xml:"KernelId"`
- KeyName string `xml:"KeyName"`
- LaunchConfigurationARN string `xml:"LaunchConfigurationARN"`
- LaunchConfigurationName string `xml:"LaunchConfigurationName"`
- RamdiskId string `xml:"RamdiskId"`
- SecurityGroups []string `xml:"SecurityGroups>member"`
- SpotPrice string `xml:"SpotPrice"`
- UserData string `xml:"UserData"`
-}
-
-// CreateLaunchConfiguration creates a launch configuration
-//
-// Required params: AutoScalingGroupName, MinSize, MaxSize
-//
-// See http://goo.gl/8e0BSF for more details.
-func (as *AutoScaling) CreateLaunchConfiguration(lc *LaunchConfiguration) (
- resp *SimpleResp, err error) {
-
- var b64 = base64.StdEncoding
-
- params := makeParams("CreateLaunchConfiguration")
- params["LaunchConfigurationName"] = lc.LaunchConfigurationName
-
- if lc.AssociatePublicIpAddress {
- params["AssociatePublicIpAddress"] = strconv.FormatBool(lc.AssociatePublicIpAddress)
- }
- if lc.EbsOptimized {
- params["EbsOptimized"] = strconv.FormatBool(lc.EbsOptimized)
- }
- if lc.IamInstanceProfile != "" {
- params["IamInstanceProfile"] = lc.IamInstanceProfile
- }
- if lc.ImageId != "" {
- params["ImageId"] = lc.ImageId
- }
- if lc.InstanceId != "" {
- params["InstanceId"] = lc.InstanceId
- }
- if lc.InstanceMonitoring != (InstanceMonitoring{}) {
- params["InstanceMonitoring.Enabled"] = strconv.FormatBool(lc.InstanceMonitoring.Enabled)
- }
- if lc.InstanceType != "" {
- params["InstanceType"] = lc.InstanceType
- }
- if lc.KernelId != "" {
- params["KernelId"] = lc.KernelId
- }
- if lc.KeyName != "" {
- params["KeyName"] = lc.KeyName
- }
- if lc.RamdiskId != "" {
- params["RamdiskId"] = lc.RamdiskId
- }
- if lc.SpotPrice != "" {
- params["SpotPrice"] = lc.SpotPrice
- }
- if lc.UserData != "" {
- params["UserData"] = b64.EncodeToString([]byte(lc.UserData))
- }
-
- // Add our block device mappings
- for i, bdm := range lc.BlockDeviceMappings {
- key := "BlockDeviceMappings.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "DeviceName")] = bdm.DeviceName
- params[fmt.Sprintf(key, index, "VirtualName")] = bdm.VirtualName
-
- if bdm.NoDevice {
- params[fmt.Sprintf(key, index, "NoDevice")] = "true"
- }
-
- if bdm.Ebs != (EBS{}) {
- key := "BlockDeviceMappings.member.%d.Ebs.%s"
-
- // Defaults to true
- params[fmt.Sprintf(key, index, "DeleteOnTermination")] = strconv.FormatBool(bdm.Ebs.DeleteOnTermination)
-
- if bdm.Ebs.Iops > 0 {
- params[fmt.Sprintf(key, index, "Iops")] = strconv.Itoa(bdm.Ebs.Iops)
- }
- if bdm.Ebs.SnapshotId != "" {
- params[fmt.Sprintf(key, index, "SnapshotId")] = bdm.Ebs.SnapshotId
- }
- if bdm.Ebs.VolumeSize > 0 {
- params[fmt.Sprintf(key, index, "VolumeSize")] = strconv.Itoa(bdm.Ebs.VolumeSize)
- }
- if bdm.Ebs.VolumeType != "" {
- params[fmt.Sprintf(key, index, "VolumeType")] = bdm.Ebs.VolumeType
- }
- }
- }
-
- if len(lc.SecurityGroups) > 0 {
- addParamsList(params, "SecurityGroups.member", lc.SecurityGroups)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// CreateOrUpdateTags creates or updates Auto Scaling Group Tags
-//
-// See http://goo.gl/e1UIXb for more details.
-func (as *AutoScaling) CreateOrUpdateTags(tags []Tag) (resp *SimpleResp, err error) {
- params := makeParams("CreateOrUpdateTags")
-
- for i, t := range tags {
- key := "Tags.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "Key")] = t.Key
- params[fmt.Sprintf(key, index, "Value")] = t.Value
- params[fmt.Sprintf(key, index, "PropagateAtLaunch")] = strconv.FormatBool(t.PropagateAtLaunch)
- params[fmt.Sprintf(key, index, "ResourceId")] = t.ResourceId
- if t.ResourceType != "" {
- params[fmt.Sprintf(key, index, "ResourceType")] = t.ResourceType
- } else {
- params[fmt.Sprintf(key, index, "ResourceType")] = "auto-scaling-group"
- }
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type CompleteLifecycleActionParams struct {
- AutoScalingGroupName string
- LifecycleActionResult string
- LifecycleActionToken string
- LifecycleHookName string
-}
-
-// CompleteLifecycleAction completes the lifecycle action for the associated token initiated under the given lifecycle hook with the specified result.
-//
-// Part of the basic sequence for adding a lifecycle hook to an Auto Scaling group:
-// 1) Create a notification target (SQS queue || SNS Topic)
-// 2) Create an IAM role to allow the ASG topublish lifecycle notifications to the designated SQS queue or SNS topic
-// 3) Create the lifecycle hook. You can create a hook that acts when instances launch or when instances terminate
-// 4) If necessary, record the lifecycle action heartbeat to keep the instance in a pending state
-// 5) ***Complete the lifecycle action***
-//
-// See http://goo.gl/k4fl0p for more details
-func (as *AutoScaling) CompleteLifecycleAction(options *CompleteLifecycleActionParams) (
- resp *SimpleResp, err error) {
- params := makeParams("CompleteLifecycleAction")
-
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- params["LifecycleActionResult"] = options.LifecycleActionResult
- params["LifecycleActionToken"] = options.LifecycleActionToken
- params["LifecycleHookName"] = options.LifecycleHookName
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteAutoScalingGroup deletes an Auto Scaling Group
-//
-// See http://goo.gl/us7VSffor for more details.
-func (as *AutoScaling) DeleteAutoScalingGroup(asgName string, forceDelete bool) (
- resp *SimpleResp, err error) {
- params := makeParams("DeleteAutoScalingGroup")
- params["AutoScalingGroupName"] = asgName
-
- if forceDelete {
- params["ForceDelete"] = "true"
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteLaunchConfiguration deletes a Launch Configuration
-//
-// See http://goo.gl/xksfyR for more details.
-func (as *AutoScaling) DeleteLaunchConfiguration(name string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteLaunchConfiguration")
- params["LaunchConfigurationName"] = name
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteLifecycleHook eletes the specified lifecycle hook.
-// If there are any outstanding lifecycle actions, they are completed first
-//
-// See http://goo.gl/MwX1vG for more details.
-func (as *AutoScaling) DeleteLifecycleHook(asgName, lifecycleHookName string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteLifecycleHook")
- params["AutoScalingGroupName"] = asgName
- params["LifecycleHookName"] = lifecycleHookName
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteNotificationConfiguration deletes notifications created by PutNotificationConfiguration.
-//
-// See http://goo.gl/jTqoYz for more details
-func (as *AutoScaling) DeleteNotificationConfiguration(asgName string, topicARN string) (
- resp *SimpleResp, err error) {
- params := makeParams("DeleteNotificationConfiguration")
- params["AutoScalingGroupName"] = asgName
- params["TopicARN"] = topicARN
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeletePolicy deletes a policy created by PutScalingPolicy.
-//
-// policyName might be the policy name or ARN
-//
-// See http://goo.gl/aOQPH2 for more details
-func (as *AutoScaling) DeletePolicy(asgName string, policyName string) (resp *SimpleResp, err error) {
- params := makeParams("DeletePolicy")
- params["AutoScalingGroupName"] = asgName
- params["PolicyName"] = policyName
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteScheduledAction deletes a scheduled action previously created using the PutScheduledUpdateGroupAction.
-//
-// See http://goo.gl/Zss9CH for more details
-func (as *AutoScaling) DeleteScheduledAction(asgName string, scheduledActionName string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteScheduledAction")
- params["AutoScalingGroupName"] = asgName
- params["ScheduledActionName"] = scheduledActionName
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteTags deletes autoscaling group tags
-//
-// See http://goo.gl/o8HzAk for more details.
-func (as *AutoScaling) DeleteTags(tags []Tag) (resp *SimpleResp, err error) {
- params := makeParams("DeleteTags")
-
- for i, t := range tags {
- key := "Tags.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "Key")] = t.Key
- params[fmt.Sprintf(key, index, "Value")] = t.Value
- params[fmt.Sprintf(key, index, "PropagateAtLaunch")] = strconv.FormatBool(t.PropagateAtLaunch)
- params[fmt.Sprintf(key, index, "ResourceId")] = t.ResourceId
- params[fmt.Sprintf(key, index, "ResourceType")] = "auto-scaling-group"
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-//DescribeAccountLimits response wrapper
-//
-// See http://goo.gl/tKsMN0 for more details.
-type DescribeAccountLimitsResp struct {
- MaxNumberOfAutoScalingGroups int `xml:"DescribeAccountLimitsResult>MaxNumberOfAutoScalingGroups"`
- MaxNumberOfLaunchConfigurations int `xml:"DescribeAccountLimitsResult>MaxNumberOfLaunchConfigurations"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeAccountLimits - Returns the limits for the Auto Scaling resources currently allowed for your AWS account.
-//
-// See http://goo.gl/tKsMN0 for more details.
-func (as *AutoScaling) DescribeAccountLimits() (resp *DescribeAccountLimitsResp, err error) {
- params := makeParams("DescribeAccountLimits")
-
- resp = new(DescribeAccountLimitsResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// AdjustmentType specifies whether the PutScalingPolicy ScalingAdjustment parameter is an absolute number or a percentage of the current capacity.
-//
-// See http://goo.gl/tCFqeL for more details
-type AdjustmentType struct {
- AdjustmentType string //Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
-}
-
-//DescribeAdjustmentTypes response wrapper
-//
-// See http://goo.gl/hGx3Pc for more details.
-type DescribeAdjustmentTypesResp struct {
- AdjustmentTypes []AdjustmentType `xml:"DescribeAdjustmentTypesResult>AdjustmentTypes>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeAdjustmentTypes returns policy adjustment types for use in the PutScalingPolicy action.
-//
-// See http://goo.gl/hGx3Pc for more details.
-func (as *AutoScaling) DescribeAdjustmentTypes() (resp *DescribeAdjustmentTypesResp, err error) {
- params := makeParams("DescribeAdjustmentTypes")
-
- resp = new(DescribeAdjustmentTypesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeAutoScalingGroups response wrapper
-//
-// See http://goo.gl/nW74Ut for more details.
-type DescribeAutoScalingGroupsResp struct {
- AutoScalingGroups []AutoScalingGroup `xml:"DescribeAutoScalingGroupsResult>AutoScalingGroups>member"`
- NextToken string `xml:"DescribeAutoScalingGroupsResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeAutoScalingGroups returns a full description of each Auto Scaling group in the given list
-// If no autoscaling groups are provided, returns the details of all autoscaling groups
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// See http://goo.gl/nW74Ut for more details.
-func (as *AutoScaling) DescribeAutoScalingGroups(names []string, maxRecords int, nextToken string) (
- resp *DescribeAutoScalingGroupsResp, err error) {
- params := makeParams("DescribeAutoScalingGroups")
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(names) > 0 {
- addParamsList(params, "AutoScalingGroupNames.member", names)
- }
-
- resp = new(DescribeAutoScalingGroupsResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeAutoScalingInstances response wrapper
-//
-// See http://goo.gl/ckzORt for more details.
-type DescribeAutoScalingInstancesResp struct {
- AutoScalingInstances []Instance `xml:"DescribeAutoScalingInstancesResult>AutoScalingInstances>member"`
- NextToken string `xml:"DescribeAutoScalingInstancesResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeAutoScalingInstances returns a description of each Auto Scaling instance in the InstanceIds list.
-// If a list is not provided, the service returns the full details of all instances up to a maximum of 50
-// By default, the service returns a list of 20 items.
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// See http://goo.gl/ckzORt for more details.
-func (as *AutoScaling) DescribeAutoScalingInstances(ids []string, maxRecords int, nextToken string) (
- resp *DescribeAutoScalingInstancesResp, err error) {
- params := makeParams("DescribeAutoScalingInstances")
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(ids) > 0 {
- addParamsList(params, "InstanceIds.member", ids)
- }
-
- resp = new(DescribeAutoScalingInstancesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeAutoScalingNotificationTypes response wrapper
-//
-// See http://goo.gl/pmLIoE for more details.
-type DescribeAutoScalingNotificationTypesResp struct {
- AutoScalingNotificationTypes []string `xml:"DescribeAutoScalingNotificationTypesResult>AutoScalingNotificationTypes>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeAutoScalingNotificationTypes returns a list of all notification types that are supported by Auto Scaling
-//
-// See http://goo.gl/pmLIoE for more details.
-func (as *AutoScaling) DescribeAutoScalingNotificationTypes() (resp *DescribeAutoScalingNotificationTypesResp, err error) {
- params := makeParams("DescribeAutoScalingNotificationTypes")
-
- resp = new(DescribeAutoScalingNotificationTypesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeLaunchConfigurationResp defines the basic response structure for launch configuration
-// requests
-//
-// See http://goo.gl/y31YYE for more details.
-type DescribeLaunchConfigurationsResp struct {
- LaunchConfigurations []LaunchConfiguration `xml:"DescribeLaunchConfigurationsResult>LaunchConfigurations>member"`
- NextToken string `xml:"DescribeLaunchConfigurationsResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeLaunchConfigurations returns details about the launch configurations supplied in
-// the list. If the list is nil, information is returned about all launch configurations in the
-// region.
-//
-// See http://goo.gl/y31YYE for more details.
-func (as *AutoScaling) DescribeLaunchConfigurations(names []string, maxRecords int, nextToken string) (
- resp *DescribeLaunchConfigurationsResp, err error) {
- params := makeParams("DescribeLaunchConfigurations")
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(names) > 0 {
- addParamsList(params, "LaunchConfigurationNames.member", names)
- }
-
- resp = new(DescribeLaunchConfigurationsResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
-
- return resp, nil
-}
-
-// DescribeLifecycleHookTypesResult wraps a DescribeLifecycleHookTypes response
-//
-// See http://goo.gl/qiAH31 for more details.
-type DescribeLifecycleHookTypesResult struct {
- LifecycleHookTypes []string `xml:"DescribeLifecycleHookTypesResult>LifecycleHookTypes>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeLifecycleHookTypes describes the available types of lifecycle hooks
-//
-// See http://goo.gl/E9IBtY for more information
-func (as *AutoScaling) DescribeLifecycleHookTypes() (
- resp *DescribeLifecycleHookTypesResult, err error) {
- params := makeParams("DescribeLifecycleHookTypes")
-
- resp = new(DescribeLifecycleHookTypesResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// LifecycleHook represents a lifecyclehook object
-//
-// See http://goo.gl/j62Iqu for more information
-type LifecycleHook struct {
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- DefaultResult string `xml:"DefaultResult"`
- GlobalTimeout int `xml:"GlobalTimeout"`
- HeartbeatTimeout int `xml:"HeartbeatTimeout"`
- LifecycleHookName string `xml:"LifecycleHookName"`
- LifecycleTransition string `xml:"LifecycleTransition"`
- NotificationMetadata string `xml:"NotificationMetadata"`
- NotificationTargetARN string `xml:"NotificationTargetARN"`
- RoleARN string `xml:"RoleARN"`
-}
-
-// DescribeLifecycleHooks wraps a DescribeLifecycleHooks response
-//
-// See http://goo.gl/wQkWiz for more details.
-type DescribeLifecycleHooksResult struct {
- LifecycleHooks []string `xml:"DescribeLifecycleHooksResult>LifecycleHooks>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeLifecycleHooks describes the lifecycle hooks that currently belong to the specified Auto Scaling group
-//
-// See http://goo.gl/wQkWiz for more information
-func (as *AutoScaling) DescribeLifecycleHooks(asgName string, hookNames []string) (
- resp *DescribeLifecycleHooksResult, err error) {
- params := makeParams("DescribeLifecycleHooks")
- params["AutoScalingGroupName"] = asgName
-
- if len(hookNames) > 0 {
- addParamsList(params, "LifecycleHookNames.member", hookNames)
- }
-
- resp = new(DescribeLifecycleHooksResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// MetricGranularity encapsulates the MetricGranularityType
-//
-// See http://goo.gl/WJ82AA for more details
-type MetricGranularity struct {
- Granularity string `xml:"Granularity"`
-}
-
-//MetricCollection encapsulates the MetricCollectionType
-//
-// See http://goo.gl/YrEG6h for more details
-type MetricCollection struct {
- Metric string `xml:"Metric"`
-}
-
-// DescribeMetricCollectionTypesResp response wrapper
-//
-// See http://goo.gl/UyYc3i for more details.
-type DescribeMetricCollectionTypesResp struct {
- Granularities []MetricGranularity `xml:"DescribeMetricCollectionTypesResult>Granularities>member"`
- Metrics []MetricCollection `xml:"DescribeMetricCollectionTypesResult>Metrics>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeMetricCollectionTypes returns a list of metrics and a corresponding list of granularities for each metric
-//
-// See http://goo.gl/UyYc3i for more details.
-func (as *AutoScaling) DescribeMetricCollectionTypes() (resp *DescribeMetricCollectionTypesResp, err error) {
- params := makeParams("DescribeMetricCollectionTypes")
-
- resp = new(DescribeMetricCollectionTypesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// NotificationConfiguration encapsulates the NotificationConfigurationType
-//
-// See http://goo.gl/M8xYOQ for more details
-type NotificationConfiguration struct {
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- NotificationType string `xml:"NotificationType"`
- TopicARN string `xml:"TopicARN"`
-}
-
-// DescribeNotificationConfigurations response wrapper
-//
-// See http://goo.gl/qiAH31 for more details.
-type DescribeNotificationConfigurationsResp struct {
- NotificationConfigurations []NotificationConfiguration `xml:"DescribeNotificationConfigurationsResult>NotificationConfigurations>member"`
- NextToken string `xml:"DescribeNotificationConfigurationsResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeNotificationConfigurations returns a list of notification actions associated with Auto Scaling groups for specified events.
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// http://goo.gl/qiAH31 for more details.
-func (as *AutoScaling) DescribeNotificationConfigurations(asgNames []string, maxRecords int, nextToken string) (
- resp *DescribeNotificationConfigurationsResp, err error) {
- params := makeParams("DescribeNotificationConfigurations")
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(asgNames) > 0 {
- addParamsList(params, "AutoScalingGroupNames.member", asgNames)
- }
-
- resp = new(DescribeNotificationConfigurationsResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Alarm encapsulates the Alarm data type.
-//
-// See http://goo.gl/Q0uPAB for more details
-type Alarm struct {
- AlarmARN string `xml:"AlarmARN"`
- AlarmName string `xml:"AlarmName"`
-}
-
-// ScalingPolicy encapsulates the ScalingPolicyType
-//
-// See http://goo.gl/BYAT18 for more details
-type ScalingPolicy struct {
- AdjustmentType string `xml:"AdjustmentType"` // ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity
- Alarms []Alarm `xml:"Alarms>member"` // A list of CloudWatch Alarms related to the policy
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- Cooldown int `xml:"Cooldown"`
- MinAdjustmentStep int `xml:"MinAdjustmentStep"` // Changes the DesiredCapacity of ASG by at least the specified number of instances.
- PolicyARN string `xml:"PolicyARN"`
- PolicyName string `xml:"PolicyName"`
- ScalingAdjustment int `xml:"ScalingAdjustment"`
-}
-
-// DescribePolicies response wrapper
-//
-// http://goo.gl/bN7A9T for more details.
-type DescribePoliciesResp struct {
- ScalingPolicies []ScalingPolicy `xml:"DescribePoliciesResult>ScalingPolicies>member"`
- NextToken string `xml:"DescribePoliciesResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribePolicies returns descriptions of what each policy does.
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// http://goo.gl/bN7A9Tfor more details.
-func (as *AutoScaling) DescribePolicies(asgName string, policyNames []string, maxRecords int, nextToken string) (
- resp *DescribePoliciesResp, err error) {
- params := makeParams("DescribePolicies")
-
- if asgName != "" {
- params["AutoScalingGroupName"] = asgName
- }
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(policyNames) > 0 {
- addParamsList(params, "PolicyNames.member", policyNames)
- }
-
- resp = new(DescribePoliciesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Activity encapsulates the Activity data type
-//
-// See http://goo.gl/fRaVi1 for more details
-type Activity struct {
- ActivityId string `xml:"ActivityId"`
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- Cause string `xml:"Cause"`
- Description string `xml:"Description"`
- Details string `xml:"Details"`
- EndTime time.Time `xml:"EndTime"`
- Progress int `xml:"Progress"`
- StartTime time.Time `xml:"StartTime"`
- StatusCode string `xml:"StatusCode"`
- StatusMessage string `xml:"StatusMessage"`
-}
-
-// DescribeScalingActivities response wrapper
-//
-// http://goo.gl/noOXIC for more details.
-type DescribeScalingActivitiesResp struct {
- Activities []Activity `xml:"DescribeScalingActivitiesResult>Activities>member"`
- NextToken string `xml:"DescribeScalingActivitiesResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeScalingActivities returns the scaling activities for the specified Auto Scaling group.
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// http://goo.gl/noOXIC more details.
-func (as *AutoScaling) DescribeScalingActivities(asgName string, activityIds []string, maxRecords int, nextToken string) (
- resp *DescribeScalingActivitiesResp, err error) {
- params := makeParams("DescribeScalingActivities")
-
- if asgName != "" {
- params["AutoScalingGroupName"] = asgName
- }
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
- if len(activityIds) > 0 {
- addParamsList(params, "ActivityIds.member", activityIds)
- }
-
- resp = new(DescribeScalingActivitiesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ProcessType encapsulates the Auto Scaling process data type
-//
-// See http://goo.gl/9BvNik for more details.
-type ProcessType struct {
- ProcessName string `xml:"ProcessName"`
-}
-
-// DescribeScalingProcessTypes response wrapper
-//
-// See http://goo.gl/rkp2tw for more details.
-type DescribeScalingProcessTypesResp struct {
- Processes []ProcessType `xml:"DescribeScalingProcessTypesResult>Processes>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeScalingProcessTypes returns scaling process types for use in the ResumeProcesses and SuspendProcesses actions.
-//
-// See http://goo.gl/rkp2tw for more details.
-func (as *AutoScaling) DescribeScalingProcessTypes() (resp *DescribeScalingProcessTypesResp, err error) {
- params := makeParams("DescribeScalingProcessTypes")
-
- resp = new(DescribeScalingProcessTypesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ScheduledUpdateGroupAction contains the information to be used in a scheduled update to an
-// AutoScalingGroup
-//
-// See http://goo.gl/z2Kfxe for more details
-type ScheduledUpdateGroupAction struct {
- AutoScalingGroupName string `xml:"AutoScalingGroupName"`
- DesiredCapacity int `xml:"DesiredCapacity"`
- EndTime time.Time `xml:"EndTime"`
- MaxSize int `xml:"MaxSize"`
- MinSize int `xml:"MinSize"`
- Recurrence string `xml:"Recurrence"`
- ScheduledActionARN string `xml:"ScheduledActionARN"`
- ScheduledActionName string `xml:"ScheduledActionName"`
- StartTime time.Time `xml:"StartTime"`
- Time time.Time `xml:"Time"`
-}
-
-// DescribeScheduledActionsResult contains the response from a DescribeScheduledActions.
-//
-// See http://goo.gl/zqrJLx for more details.
-type DescribeScheduledActionsResult struct {
- ScheduledUpdateGroupActions []ScheduledUpdateGroupAction `xml:"DescribeScheduledActionsResult>ScheduledUpdateGroupActions>member"`
- NextToken string `xml:"DescribeScheduledActionsResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ScheduledActionsRequestParams contains the items that can be specified when making
-// a ScheduledActions request
-type DescribeScheduledActionsParams struct {
- AutoScalingGroupName string
- EndTime time.Time
- MaxRecords int
- ScheduledActionNames []string
- StartTime time.Time
- NextToken string
-}
-
-// DescribeScheduledActions returns a list of the current scheduled actions. If the
-// AutoScalingGroup name is provided it will list all the scheduled actions for that group.
-//
-// See http://goo.gl/zqrJLx for more details.
-func (as *AutoScaling) DescribeScheduledActions(options *DescribeScheduledActionsParams) (
- resp *DescribeScheduledActionsResult, err error) {
- params := makeParams("DescribeScheduledActions")
-
- if options.AutoScalingGroupName != "" {
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- }
- if !options.StartTime.IsZero() {
- params["StartTime"] = options.StartTime.Format(time.RFC3339)
- }
- if !options.EndTime.IsZero() {
- params["EndTime"] = options.EndTime.Format(time.RFC3339)
- }
- if options.MaxRecords > 0 {
- params["MaxRecords"] = strconv.Itoa(options.MaxRecords)
- }
- if options.NextToken != "" {
- params["NextToken"] = options.NextToken
- }
- if len(options.ScheduledActionNames) > 0 {
- addParamsList(params, "ScheduledActionNames.member", options.ScheduledActionNames)
- }
-
- resp = new(DescribeScheduledActionsResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeTags response wrapper
-//
-// See http://goo.gl/ZTEU3G for more details.
-type DescribeTagsResp struct {
- Tags []Tag `xml:"DescribeTagsResult>Tags>member"`
- NextToken string `xml:"DescribeTagsResult>NextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeTags lists the Auto Scaling group tags.
-// Supports pagination by using the returned "NextToken" parameter for subsequent calls
-//
-// See http://goo.gl/ZTEU3G for more details.
-func (as *AutoScaling) DescribeTags(filter *Filter, maxRecords int, nextToken string) (
- resp *DescribeTagsResp, err error) {
- params := makeParams("DescribeTags")
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- filter.addParams(params)
-
- resp = new(DescribeTagsResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeTerminationPolicyTypes response wrapper
-//
-// See http://goo.gl/ZTEU3G for more details.
-type DescribeTerminationPolicyTypesResp struct {
- TerminationPolicyTypes []string `xml:"DescribeTerminationPolicyTypesResult>TerminationPolicyTypes>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeTerminationPolicyTypes returns a list of all termination policies supported by Auto Scaling
-//
-// See http://goo.gl/ZTEU3G for more details.
-func (as *AutoScaling) DescribeTerminationPolicyTypes() (resp *DescribeTerminationPolicyTypesResp, err error) {
- params := makeParams("DescribeTerminationPolicyTypes")
-
- resp = new(DescribeTerminationPolicyTypesResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DetachInstancesResult wraps a DetachInstances response
-type DetachInstancesResult struct {
- Activities []Activity `xml:"DetachInstancesResult>Activities>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DetachInstances removes an instance from an Auto Scaling group
-//
-// See http://goo.gl/cNwrqF for more details
-func (as *AutoScaling) DetachInstances(asgName string, instanceIds []string, decrementCapacity bool) (
- resp *DetachInstancesResult, err error) {
- params := makeParams("DetachInstances")
- params["AutoScalingGroupName"] = asgName
- params["ShouldDecrementDesiredCapacity"] = strconv.FormatBool(decrementCapacity)
-
- if len(instanceIds) > 0 {
- addParamsList(params, "InstanceIds.member", instanceIds)
- }
-
- resp = new(DetachInstancesResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DisableMetricsCollection disables monitoring of group metrics for the Auto Scaling group specified in asgName.
-// You can specify the list of affected metrics with the metrics parameter. If no metrics are specified, all metrics are disabled
-//
-// See http://goo.gl/kAvzQw for more details.
-func (as *AutoScaling) DisableMetricsCollection(asgName string, metrics []string) (
- resp *SimpleResp, err error) {
- params := makeParams("DisableMetricsCollection")
- params["AutoScalingGroupName"] = asgName
-
- if len(metrics) > 0 {
- addParamsList(params, "Metrics.member", metrics)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// EnableMetricsCollection enables monitoring of group metrics for the Auto Scaling group specified in asNmae.
-// You can specify the list of affected metrics with the metrics parameter.
-// Auto Scaling metrics collection can be turned on only if the InstanceMonitoring flag is set to true.
-// Currently, the only legal granularity is "1Minute".
-//
-// See http://goo.gl/UcVDWn for more details.
-func (as *AutoScaling) EnableMetricsCollection(asgName string, metrics []string, granularity string) (
- resp *SimpleResp, err error) {
- params := makeParams("EnableMetricsCollection")
- params["AutoScalingGroupName"] = asgName
- params["Granularity"] = granularity
-
- if len(metrics) > 0 {
- addParamsList(params, "Metrics.member", metrics)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// EnterStandbyResult wraps an EnterStandby response
-type EnterStandbyResult struct {
- Activities []Activity `xml:"EnterStandbyResult>Activities>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// EnterStandby moves instances in an Auto Scaling group into a Standby mode.
-//
-// See http://goo.gl/BJ3lXs for more information
-func (as *AutoScaling) EnterStandby(asgName string, instanceIds []string, decrementCapacity bool) (
- resp *EnterStandbyResult, err error) {
- params := makeParams("EnterStandby")
- params["AutoScalingGroupName"] = asgName
- params["ShouldDecrementDesiredCapacity"] = strconv.FormatBool(decrementCapacity)
-
- if len(instanceIds) > 0 {
- addParamsList(params, "InstanceIds.member", instanceIds)
- }
-
- resp = new(EnterStandbyResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ExecutePolicy executes the specified policy.
-//
-// See http://goo.gl/BxHpFc for more details.
-func (as *AutoScaling) ExecutePolicy(policyName string, asgName string, honorCooldown bool) (
- resp *SimpleResp, err error) {
- params := makeParams("ExecutePolicy")
- params["PolicyName"] = policyName
-
- if asgName != "" {
- params["AutoScalingGroupName"] = asgName
- }
- if honorCooldown {
- params["HonorCooldown"] = strconv.FormatBool(honorCooldown)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ExitStandbyResult wraps an ExitStandby response
-type ExitStandbyResult struct {
- Activities []Activity `xml:"ExitStandbyResult>Activities>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ExitStandby moves an instance out of Standby mode.
-//
-// See http://goo.gl/9zQV4G for more information
-func (as *AutoScaling) ExitStandby(asgName string, instanceIds []string) (
- resp *ExitStandbyResult, err error) {
- params := makeParams("ExitStandby")
- params["AutoScalingGroupName"] = asgName
-
- if len(instanceIds) > 0 {
- addParamsList(params, "InstanceIds.member", instanceIds)
- }
-
- resp = new(ExitStandbyResult)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// PutLifecycleHookParams wraps a PutLifecycleHook request
-//
-// See http://goo.gl/zsNqp5 for more details
-type PutLifecycleHookParams struct {
- AutoScalingGroupName string
- DefaultResult string
- HeartbeatTimeout int
- LifecycleHookName string
- LifecycleTransition string
- NotificationMetadata string
- NotificationTargetARN string
- RoleARN string
-}
-
-// PutLifecycleHook Creates or updates a lifecycle hook for an Auto Scaling Group.
-//
-// Part of the basic sequence for adding a lifecycle hook to an Auto Scaling group:
-// 1) Create a notification target (SQS queue || SNS Topic)
-// 2) Create an IAM role to allow the ASG topublish lifecycle notifications to the designated SQS queue or SNS topic
-// 3) *** Create the lifecycle hook. You can create a hook that acts when instances launch or when instances terminate***
-// 4) If necessary, record the lifecycle action heartbeat to keep the instance in a pending state
-// 5) Complete the lifecycle action
-//
-// See http://goo.gl/9XrROq for more details.
-func (as *AutoScaling) PutLifecycleHook(options *PutLifecycleHookParams) (
- resp *SimpleResp, err error) {
- params := makeParams("PutLifecycleHook")
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- params["LifecycleHookName"] = options.LifecycleHookName
-
- if options.DefaultResult != "" {
- params["DefaultResult"] = options.DefaultResult
- }
- if options.HeartbeatTimeout != 0 {
- params["HeartbeatTimeout"] = strconv.Itoa(options.HeartbeatTimeout)
- }
- if options.LifecycleTransition != "" {
- params["LifecycleTransition"] = options.LifecycleTransition
- }
- if options.NotificationMetadata != "" {
- params["NotificationMetadata"] = options.NotificationMetadata
- }
- if options.NotificationTargetARN != "" {
- params["NotificationTargetARN"] = options.NotificationTargetARN
- }
- if options.RoleARN != "" {
- params["RoleARN"] = options.RoleARN
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// PutNotificationConfiguration configures an Auto Scaling group to send notifications when specified events take place.
-//
-// See http://goo.gl/9XrROq for more details.
-func (as *AutoScaling) PutNotificationConfiguration(asgName string, notificationTypes []string, topicARN string) (
- resp *SimpleResp, err error) {
- params := makeParams("PutNotificationConfiguration")
- params["AutoScalingGroupName"] = asgName
- params["TopicARN"] = topicARN
-
- if len(notificationTypes) > 0 {
- addParamsList(params, "NotificationTypes.member", notificationTypes)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// PutScalingPolicyParams wraps a PutScalingPolicyParams request
-//
-// See http://goo.gl/o0E8hl for more details.
-type PutScalingPolicyParams struct {
- AutoScalingGroupName string
- PolicyName string
- ScalingAdjustment int
- AdjustmentType string
- Cooldown int
- MinAdjustmentStep int
-}
-
-// PutScalingPolicy response wrapper
-//
-// See http://goo.gl/o0E8hl for more details.
-type PutScalingPolicyResp struct {
- PolicyARN string `xml:"PutScalingPolicyResult>PolicyARN"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// PutScalingPolicy creates or updates a policy for an Auto Scaling group
-//
-// See http://goo.gl/o0E8hl for more details.
-func (as *AutoScaling) PutScalingPolicy(options *PutScalingPolicyParams) (
- resp *PutScalingPolicyResp, err error) {
- params := makeParams("PutScalingPolicy")
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- params["PolicyName"] = options.PolicyName
- params["ScalingAdjustment"] = strconv.Itoa(options.ScalingAdjustment)
- params["AdjustmentType"] = options.AdjustmentType
-
- if options.Cooldown != 0 {
- params["Cooldown"] = strconv.Itoa(options.Cooldown)
- }
- if options.MinAdjustmentStep != 0 {
- params["MinAdjustmentStep"] = strconv.Itoa(options.MinAdjustmentStep)
- }
-
- resp = new(PutScalingPolicyResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// PutScheduledUpdateGroupActionParams contains the details of the ScheduledAction to be added.
-//
-// See http://goo.gl/sLPi0d for more details
-type PutScheduledUpdateGroupActionParams struct {
- AutoScalingGroupName string
- DesiredCapacity int
- EndTime time.Time
- MaxSize int
- MinSize int
- Recurrence string
- ScheduledActionName string
- StartTime time.Time
-}
-
-// PutScheduledUpdateGroupAction creates or updates a scheduled scaling action for an
-// AutoScaling group. Scheduled actions can be made up to thirty days in advance. When updating
-// a scheduled scaling action, if you leave a parameter unspecified, the corresponding value
-// remains unchanged in the affected AutoScaling group.
-//
-// Auto Scaling supports the date and time expressed in "YYYY-MM-DDThh:mm:ssZ" format in UTC/GMT
-// only.
-//
-// See http://goo.gl/sLPi0d for more details.
-func (as *AutoScaling) PutScheduledUpdateGroupAction(options *PutScheduledUpdateGroupActionParams) (
- resp *SimpleResp, err error) {
- params := makeParams("PutScheduledUpdateGroupAction")
- params["AutoScalingGroupName"] = options.AutoScalingGroupName
- params["ScheduledActionName"] = options.ScheduledActionName
- params["MinSize"] = strconv.Itoa(options.MinSize)
- params["MaxSize"] = strconv.Itoa(options.MaxSize)
- params["DesiredCapacity"] = strconv.Itoa(options.DesiredCapacity)
-
- if !options.StartTime.IsZero() {
- params["StartTime"] = options.StartTime.Format(time.RFC3339)
- }
- if !options.EndTime.IsZero() {
- params["EndTime"] = options.EndTime.Format(time.RFC3339)
- }
- if options.Recurrence != "" {
- params["Recurrence"] = options.Recurrence
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// RecordLifecycleActionHeartbeat ecords a heartbeat for the lifecycle action associated with a specific token.
-// This extends the timeout by the length of time defined by the HeartbeatTimeout parameter of the
-// PutLifecycleHook operation.
-//
-// Part of the basic sequence for adding a lifecycle hook to an Auto Scaling group:
-// 1) Create a notification target (SQS queue || SNS Topic)
-// 2) Create an IAM role to allow the ASG topublish lifecycle notifications to the designated SQS queue or SNS topic
-// 3) Create the lifecycle hook. You can create a hook that acts when instances launch or when instances terminate
-// 4) ***If necessary, record the lifecycle action heartbeat to keep the instance in a pending state***
-// 5) Complete the lifecycle action
-//
-// See http://goo.gl/jc70xp for more details.
-func (as *AutoScaling) RecordLifecycleActionHeartbeat(asgName, lifecycleActionToken, hookName string) (
- resp *SimpleResp, err error) {
- params := makeParams("RecordLifecycleActionHeartbeat")
- params["AutoScalingGroupName"] = asgName
- params["LifecycleActionToken"] = lifecycleActionToken
- params["LifecycleHookName"] = hookName
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ResumeProcesses resumes the scaling processes for the scaling group. If no processes are
-// provided, all processes are resumed.
-//
-// See http://goo.gl/XWIIg1 for more details.
-func (as *AutoScaling) ResumeProcesses(asgName string, processes []string) (
- resp *SimpleResp, err error) {
- params := makeParams("ResumeProcesses")
- params["AutoScalingGroupName"] = asgName
-
- if len(processes) > 0 {
- addParamsList(params, "ScalingProcesses.member", processes)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SetDesiredCapacity changes the DesiredCapacity of an AutoScaling group.
-//
-// See http://goo.gl/3WGZbI for more details.
-func (as *AutoScaling) SetDesiredCapacity(asgName string, desiredCapacity int, honorCooldown bool) (
- resp *SimpleResp, err error) {
- params := makeParams("SetDesiredCapacity")
- params["AutoScalingGroupName"] = asgName
- params["DesiredCapacity"] = strconv.Itoa(desiredCapacity)
- params["HonorCooldown"] = strconv.FormatBool(honorCooldown)
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SetInstanceHealth sets the health status of a specified instance that belongs to any of your Auto Scaling groups.
-//
-// See http://goo.gl/j4ZRxh for more details.
-func (as *AutoScaling) SetInstanceHealth(id string, healthStatus string, respectGracePeriod bool) (
- resp *SimpleResp, err error) {
- params := makeParams("SetInstanceHealth")
- params["HealthStatus"] = healthStatus
- params["InstanceId"] = id
- // Default is true
- params["ShouldRespectGracePeriod"] = strconv.FormatBool(respectGracePeriod)
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SuspendProcesses suspends the processes for the autoscaling group. If no processes are
-// provided, all processes are suspended.
-//
-// If you suspend either of the two primary processes (Launch or Terminate), this can prevent other
-// process types from functioning properly.
-//
-// See http://goo.gl/DUJpQy for more details.
-func (as *AutoScaling) SuspendProcesses(asgName string, processes []string) (
- resp *SimpleResp, err error) {
- params := makeParams("SuspendProcesses")
- params["AutoScalingGroupName"] = asgName
-
- if len(processes) > 0 {
- addParamsList(params, "ScalingProcesses.member", processes)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// TerminateInstanceInAutoScalingGroupResp response wrapper
-//
-// See http://goo.gl/ki5hMh for more details.
-type TerminateInstanceInAutoScalingGroupResp struct {
- Activity Activity `xml:"TerminateInstanceInAutoScalingGroupResult>Activity"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// TerminateInstanceInAutoScalingGroup terminates the specified instance.
-// Optionally, the desired group size can be adjusted by setting decrCap to true
-//
-// See http://goo.gl/ki5hMh for more details.
-func (as *AutoScaling) TerminateInstanceInAutoScalingGroup(id string, decrCap bool) (
- resp *TerminateInstanceInAutoScalingGroupResp, err error) {
- params := makeParams("TerminateInstanceInAutoScalingGroup")
- params["InstanceId"] = id
- params["ShouldDecrementDesiredCapacity"] = strconv.FormatBool(decrCap)
-
- resp = new(TerminateInstanceInAutoScalingGroupResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// UpdateAutoScalingGroup updates the scaling group.
-//
-// To update an auto scaling group with a launch configuration that has the InstanceMonitoring
-// flag set to False, you must first ensure that collection of group metrics is disabled.
-// Otherwise calls to UpdateAutoScalingGroup will fail.
-//
-// See http://goo.gl/rqrmxy for more details.
-func (as *AutoScaling) UpdateAutoScalingGroup(asg *AutoScalingGroup) (resp *SimpleResp, err error) {
- params := makeParams("UpdateAutoScalingGroup")
-
- params["AutoScalingGroupName"] = asg.AutoScalingGroupName
- params["MaxSize"] = strconv.Itoa(asg.MaxSize)
- params["MinSize"] = strconv.Itoa(asg.MinSize)
- params["DesiredCapacity"] = strconv.Itoa(asg.DesiredCapacity)
-
- if asg.DefaultCooldown > 0 {
- params["DefaultCooldown"] = strconv.Itoa(asg.DefaultCooldown)
- }
- if asg.HealthCheckGracePeriod > 0 {
- params["HealthCheckGracePeriod"] = strconv.Itoa(asg.HealthCheckGracePeriod)
- }
- if asg.HealthCheckType != "" {
- params["HealthCheckType"] = asg.HealthCheckType
- }
- if asg.LaunchConfigurationName != "" {
- params["LaunchConfigurationName"] = asg.LaunchConfigurationName
- }
- if asg.PlacementGroup != "" {
- params["PlacementGroup"] = asg.PlacementGroup
- }
- if asg.VPCZoneIdentifier != "" {
- params["VPCZoneIdentifier"] = asg.VPCZoneIdentifier
- }
-
- if len(asg.AvailabilityZones) > 0 {
- addParamsList(params, "AvailabilityZones.member", asg.AvailabilityZones)
- }
- if len(asg.TerminationPolicies) > 0 {
- addParamsList(params, "TerminationPolicies.member", asg.TerminationPolicies)
- }
-
- resp = new(SimpleResp)
- if err := as.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
diff --git a/vendor/github.com/goamz/goamz/autoscaling/autoscaling_test.go b/vendor/github.com/goamz/goamz/autoscaling/autoscaling_test.go
deleted file mode 100644
index b728a1cf4..000000000
--- a/vendor/github.com/goamz/goamz/autoscaling/autoscaling_test.go
+++ /dev/null
@@ -1,1180 +0,0 @@
-package autoscaling
-
-import (
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/testutil"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- as *AutoScaling
-}
-
-var testServer = testutil.NewHTTPServer()
-
-var mockTest bool
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.as = New(auth, aws.Region{AutoScalingEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func TestBasicGroupRequest(t *testing.T) {
- var as *AutoScaling
- awsAuth, err := aws.EnvAuth()
- if err != nil {
- mockTest = true
- t.Log("Running mock tests as AWS environment variables are not set")
- awsAuth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- as = New(awsAuth, aws.Region{AutoScalingEndpoint: testServer.URL})
- testServer.Start()
- go testServer.WaitRequest()
- testServer.Response(200, nil, BasicGroupResponse)
- } else {
- as = New(awsAuth, aws.USWest2)
- }
-
- groupResp, err := as.DescribeAutoScalingGroups(nil, 10, "")
-
- if err != nil {
- t.Fatal(err)
- }
- if len(groupResp.AutoScalingGroups) > 0 {
- firstGroup := groupResp.AutoScalingGroups[0]
- if len(firstGroup.AutoScalingGroupName) > 0 {
- t.Logf("Found AutoScaling group %s\n",
- firstGroup.AutoScalingGroupName)
- }
- }
- testServer.Flush()
-}
-
-func TestAutoScalingGroup(t *testing.T) {
- var as *AutoScaling
- // Launch configuration test config
- lc := new(LaunchConfiguration)
- lc.LaunchConfigurationName = "LConf1"
- lc.ImageId = "ami-03e47533" // Octave debian ami
- lc.KernelId = "aki-98e26fa8"
- lc.KeyName = "testAWS" // Replace with valid key for your account
- lc.InstanceType = "m1.small"
-
- // CreateAutoScalingGroup params test config
- asgReq := new(CreateAutoScalingGroupParams)
- asgReq.AutoScalingGroupName = "ASGTest1"
- asgReq.LaunchConfigurationName = lc.LaunchConfigurationName
- asgReq.DefaultCooldown = 300
- asgReq.HealthCheckGracePeriod = 300
- asgReq.DesiredCapacity = 1
- asgReq.MinSize = 1
- asgReq.MaxSize = 5
- asgReq.AvailabilityZones = []string{"us-west-2a"}
-
- asg := new(AutoScalingGroup)
- asg.AutoScalingGroupName = "ASGTest1"
- asg.LaunchConfigurationName = lc.LaunchConfigurationName
- asg.DefaultCooldown = 300
- asg.HealthCheckGracePeriod = 300
- asg.DesiredCapacity = 1
- asg.MinSize = 1
- asg.MaxSize = 5
- asg.AvailabilityZones = []string{"us-west-2a"}
-
- awsAuth, err := aws.EnvAuth()
- if err != nil {
- mockTest = true
- t.Log("Running mock tests as AWS environment variables are not set")
- awsAuth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- as = New(awsAuth, aws.Region{AutoScalingEndpoint: testServer.URL})
- } else {
- as = New(awsAuth, aws.USWest2)
- }
-
- // Create the launch configuration
- if mockTest {
- testServer.Response(200, nil, CreateLaunchConfigurationResponse)
- }
- _, err = as.CreateLaunchConfiguration(lc)
- if err != nil {
- t.Fatal(err)
- }
-
- // Check that we can get the launch configuration details
- if mockTest {
- testServer.Response(200, nil, DescribeLaunchConfigurationsResponse)
- }
- _, err = as.DescribeLaunchConfigurations([]string{lc.LaunchConfigurationName}, 10, "")
- if err != nil {
- t.Fatal(err)
- }
-
- // Create the AutoScalingGroup
- if mockTest {
- testServer.Response(200, nil, CreateAutoScalingGroupResponse)
- }
- _, err = as.CreateAutoScalingGroup(asgReq)
- if err != nil {
- t.Fatal(err)
- }
-
- // Check that we can get the autoscaling group details
- if mockTest {
- testServer.Response(200, nil, DescribeAutoScalingGroupsResponse)
- }
- _, err = as.DescribeAutoScalingGroups(nil, 10, "")
- if err != nil {
- t.Fatal(err)
- }
-
- // Suspend the scaling processes for the test AutoScalingGroup
- if mockTest {
- testServer.Response(200, nil, SuspendProcessesResponse)
- }
- _, err = as.SuspendProcesses(asg.AutoScalingGroupName, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // Resume scaling processes for the test AutoScalingGroup
- if mockTest {
- testServer.Response(200, nil, ResumeProcessesResponse)
- }
- _, err = as.ResumeProcesses(asg.AutoScalingGroupName, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // Change the desired capacity from 1 to 2. This will launch a second instance
- if mockTest {
- testServer.Response(200, nil, SetDesiredCapacityResponse)
- }
- _, err = as.SetDesiredCapacity(asg.AutoScalingGroupName, 2, false)
- if err != nil {
- t.Fatal(err)
- }
-
- // Change the desired capacity from 2 to 1. This will terminate one of the instances
- if mockTest {
- testServer.Response(200, nil, SetDesiredCapacityResponse)
- }
-
- _, err = as.SetDesiredCapacity(asg.AutoScalingGroupName, 1, false)
- if err != nil {
- t.Fatal(err)
- }
-
- // Update the max capacity for the scaling group
- if mockTest {
- testServer.Response(200, nil, UpdateAutoScalingGroupResponse)
- }
- asg.MinSize = 1
- asg.MaxSize = 6
- asg.DesiredCapacity = 1
- _, err = as.UpdateAutoScalingGroup(asg)
- if err != nil {
- t.Fatal(err)
- }
-
- // Add a scheduled action to the group
- psar := new(PutScheduledUpdateGroupActionParams)
- psar.AutoScalingGroupName = asg.AutoScalingGroupName
- psar.MaxSize = 4
- psar.ScheduledActionName = "SATest1"
- psar.Recurrence = "30 0 1 1,6,12 *"
- if mockTest {
- testServer.Response(200, nil, PutScheduledUpdateGroupActionResponse)
- }
- _, err = as.PutScheduledUpdateGroupAction(psar)
- if err != nil {
- t.Fatal(err)
- }
-
- // List the scheduled actions for the group
- sar := new(DescribeScheduledActionsParams)
- sar.AutoScalingGroupName = asg.AutoScalingGroupName
- if mockTest {
- testServer.Response(200, nil, DescribeScheduledActionsResponse)
- }
- _, err = as.DescribeScheduledActions(sar)
- if err != nil {
- t.Fatal(err)
- }
-
- // Delete the test scheduled action from the group
- if mockTest {
- testServer.Response(200, nil, DeleteScheduledActionResponse)
- }
- _, err = as.DeleteScheduledAction(asg.AutoScalingGroupName, psar.ScheduledActionName)
- if err != nil {
- t.Fatal(err)
- }
- testServer.Flush()
-}
-
-// --------------------------------------------------------------------------
-// Detailed Unit Tests
-
-func (s *S) TestAttachInstances(c *C) {
- testServer.Response(200, nil, AttachInstancesResponse)
- resp, err := s.as.AttachInstances("my-test-asg", []string{"i-21321afs", "i-baaffg23"})
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "AttachInstances")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("InstanceIds.member.1"), Equals, "i-21321afs")
- c.Assert(values.Get("InstanceIds.member.2"), Equals, "i-baaffg23")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestCreateAutoScalingGroup(c *C) {
- testServer.Response(200, nil, CreateAutoScalingGroupResponse)
- testServer.Response(200, nil, DeleteAutoScalingGroupResponse)
-
- createAS := &CreateAutoScalingGroupParams{
- AutoScalingGroupName: "my-test-asg",
- AvailabilityZones: []string{"us-east-1a", "us-east-1b"},
- MinSize: 3,
- MaxSize: 3,
- DefaultCooldown: 600,
- DesiredCapacity: 0,
- LaunchConfigurationName: "my-test-lc",
- LoadBalancerNames: []string{"elb-1", "elb-2"},
- Tags: []Tag{
- {
- Key: "foo",
- Value: "bar",
- },
- {
- Key: "baz",
- Value: "qux",
- },
- },
- VPCZoneIdentifier: "subnet-610acd08,subnet-530fc83a",
- }
- resp, err := s.as.CreateAutoScalingGroup(createAS)
- c.Assert(err, IsNil)
- defer s.as.DeleteAutoScalingGroup(createAS.AutoScalingGroupName, true)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "CreateAutoScalingGroup")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("AvailabilityZones.member.1"), Equals, "us-east-1a")
- c.Assert(values.Get("AvailabilityZones.member.2"), Equals, "us-east-1b")
- c.Assert(values.Get("MinSize"), Equals, "3")
- c.Assert(values.Get("MaxSize"), Equals, "3")
- c.Assert(values.Get("DefaultCooldown"), Equals, "600")
- c.Assert(values.Get("DesiredCapacity"), Equals, "0")
- c.Assert(values.Get("LaunchConfigurationName"), Equals, "my-test-lc")
- c.Assert(values.Get("LoadBalancerNames.member.1"), Equals, "elb-1")
- c.Assert(values.Get("LoadBalancerNames.member.2"), Equals, "elb-2")
- c.Assert(values.Get("Tags.member.1.Key"), Equals, "foo")
- c.Assert(values.Get("Tags.member.1.Value"), Equals, "bar")
- c.Assert(values.Get("Tags.member.2.Key"), Equals, "baz")
- c.Assert(values.Get("Tags.member.2.Value"), Equals, "qux")
- c.Assert(values.Get("VPCZoneIdentifier"), Equals, "subnet-610acd08,subnet-530fc83a")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestCreateLaunchConfiguration(c *C) {
- testServer.Response(200, nil, CreateLaunchConfigurationResponse)
- testServer.Response(200, nil, DeleteLaunchConfigurationResponse)
-
- launchConfig := &LaunchConfiguration{
- LaunchConfigurationName: "my-test-lc",
- AssociatePublicIpAddress: true,
- EbsOptimized: true,
- SecurityGroups: []string{"sec-grp1", "sec-grp2"},
- UserData: "1234",
- KeyName: "secretKeyPair",
- ImageId: "ami-0078da69",
- InstanceType: "m1.small",
- SpotPrice: "0.03",
- BlockDeviceMappings: []BlockDeviceMapping{
- {
- DeviceName: "/dev/sda1",
- VirtualName: "ephemeral0",
- },
- {
- DeviceName: "/dev/sdb",
- VirtualName: "ephemeral1",
- },
- {
- DeviceName: "/dev/sdf",
- Ebs: EBS{
- DeleteOnTermination: true,
- SnapshotId: "snap-2a2b3c4d",
- VolumeSize: 100,
- },
- },
- },
- InstanceMonitoring: InstanceMonitoring{
- Enabled: true,
- },
- }
- resp, err := s.as.CreateLaunchConfiguration(launchConfig)
- c.Assert(err, IsNil)
- defer s.as.DeleteLaunchConfiguration(launchConfig.LaunchConfigurationName)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "CreateLaunchConfiguration")
- c.Assert(values.Get("LaunchConfigurationName"), Equals, "my-test-lc")
- c.Assert(values.Get("AssociatePublicIpAddress"), Equals, "true")
- c.Assert(values.Get("EbsOptimized"), Equals, "true")
- c.Assert(values.Get("SecurityGroups.member.1"), Equals, "sec-grp1")
- c.Assert(values.Get("SecurityGroups.member.2"), Equals, "sec-grp2")
- c.Assert(values.Get("UserData"), Equals, "MTIzNA==")
- c.Assert(values.Get("KeyName"), Equals, "secretKeyPair")
- c.Assert(values.Get("ImageId"), Equals, "ami-0078da69")
- c.Assert(values.Get("InstanceType"), Equals, "m1.small")
- c.Assert(values.Get("SpotPrice"), Equals, "0.03")
- c.Assert(values.Get("BlockDeviceMappings.member.1.DeviceName"), Equals, "/dev/sda1")
- c.Assert(values.Get("BlockDeviceMappings.member.1.VirtualName"), Equals, "ephemeral0")
- c.Assert(values.Get("BlockDeviceMappings.member.2.DeviceName"), Equals, "/dev/sdb")
- c.Assert(values.Get("BlockDeviceMappings.member.2.VirtualName"), Equals, "ephemeral1")
- c.Assert(values.Get("BlockDeviceMappings.member.3.DeviceName"), Equals, "/dev/sdf")
- c.Assert(values.Get("BlockDeviceMappings.member.3.Ebs.DeleteOnTermination"), Equals, "true")
- c.Assert(values.Get("BlockDeviceMappings.member.3.Ebs.SnapshotId"), Equals, "snap-2a2b3c4d")
- c.Assert(values.Get("BlockDeviceMappings.member.3.Ebs.VolumeSize"), Equals, "100")
- c.Assert(values.Get("InstanceMonitoring.Enabled"), Equals, "true")
- c.Assert(resp.RequestId, Equals, "7c6e177f-f082-11e1-ac58-3714bEXAMPLE")
-}
-
-func (s *S) TestCreateOrUpdateTags(c *C) {
- testServer.Response(200, nil, CreateOrUpdateTagsResponse)
- tags := []Tag{
- {
- Key: "foo",
- Value: "bar",
- ResourceId: "my-test-asg",
- },
- {
- Key: "baz",
- Value: "qux",
- ResourceId: "my-test-asg",
- PropagateAtLaunch: true,
- },
- }
- resp, err := s.as.CreateOrUpdateTags(tags)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "CreateOrUpdateTags")
- c.Assert(values.Get("Tags.member.1.Key"), Equals, "foo")
- c.Assert(values.Get("Tags.member.1.Value"), Equals, "bar")
- c.Assert(values.Get("Tags.member.1.ResourceId"), Equals, "my-test-asg")
- c.Assert(values.Get("Tags.member.2.Key"), Equals, "baz")
- c.Assert(values.Get("Tags.member.2.Value"), Equals, "qux")
- c.Assert(values.Get("Tags.member.2.ResourceId"), Equals, "my-test-asg")
- c.Assert(values.Get("Tags.member.2.PropagateAtLaunch"), Equals, "true")
- c.Assert(resp.RequestId, Equals, "b0203919-bf1b-11e2-8a01-13263EXAMPLE")
-}
-
-func (s *S) TestDeleteAutoScalingGroup(c *C) {
- testServer.Response(200, nil, DeleteAutoScalingGroupResponse)
- resp, err := s.as.DeleteAutoScalingGroup("my-test-asg", true)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DeleteAutoScalingGroup")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(resp.RequestId, Equals, "70a76d42-9665-11e2-9fdf-211deEXAMPLE")
-}
-
-func (s *S) TestDeleteAutoScalingGroupWithExistingInstances(c *C) {
- testServer.Response(400, nil, DeleteAutoScalingGroupErrorResponse)
- resp, err := s.as.DeleteAutoScalingGroup("my-test-asg", false)
- testServer.WaitRequest()
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*Error)
- if !ok {
- c.Errorf("Unable to unmarshal error into AWS Autoscaling Error")
- }
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "You cannot delete an AutoScalingGroup while there are instances or pending Spot instance request(s) still in the group.")
- c.Assert(e.Code, Equals, "ResourceInUse")
- c.Assert(e.StatusCode, Equals, 400)
- c.Assert(e.RequestId, Equals, "70a76d42-9665-11e2-9fdf-211deEXAMPLE")
-}
-
-func (s *S) TestDeleteLaunchConfiguration(c *C) {
- testServer.Response(200, nil, DeleteLaunchConfigurationResponse)
- resp, err := s.as.DeleteLaunchConfiguration("my-test-lc")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DeleteLaunchConfiguration")
- c.Assert(values.Get("LaunchConfigurationName"), Equals, "my-test-lc")
- c.Assert(resp.RequestId, Equals, "7347261f-97df-11e2-8756-35eEXAMPLE")
-}
-
-func (s *S) TestDeleteLaunchConfigurationInUse(c *C) {
- testServer.Response(400, nil, DeleteLaunchConfigurationInUseResponse)
- resp, err := s.as.DeleteLaunchConfiguration("my-test-lc")
- testServer.WaitRequest()
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*Error)
- if !ok {
- c.Errorf("Unable to unmarshal error into AWS Autoscaling Error")
- }
- c.Logf("%v %v %v", e.Code, e.Message, e.RequestId)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "Cannot delete launch configuration my-test-lc because it is attached to AutoScalingGroup test")
- c.Assert(e.Code, Equals, "ResourceInUse")
- c.Assert(e.StatusCode, Equals, 400)
- c.Assert(e.RequestId, Equals, "7347261f-97df-11e2-8756-35eEXAMPLE")
-}
-
-func (s *S) TestDeleteTags(c *C) {
- testServer.Response(200, nil, DeleteTagsResponse)
- tags := []Tag{
- {
- Key: "foo",
- Value: "bar",
- ResourceId: "my-test-asg",
- },
- {
- Key: "baz",
- Value: "qux",
- ResourceId: "my-test-asg",
- PropagateAtLaunch: true,
- },
- }
- resp, err := s.as.DeleteTags(tags)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DeleteTags")
- c.Assert(values.Get("Tags.member.1.Key"), Equals, "foo")
- c.Assert(values.Get("Tags.member.1.Value"), Equals, "bar")
- c.Assert(values.Get("Tags.member.1.ResourceId"), Equals, "my-test-asg")
- c.Assert(values.Get("Tags.member.2.Key"), Equals, "baz")
- c.Assert(values.Get("Tags.member.2.Value"), Equals, "qux")
- c.Assert(values.Get("Tags.member.2.ResourceId"), Equals, "my-test-asg")
- c.Assert(values.Get("Tags.member.2.PropagateAtLaunch"), Equals, "true")
- c.Assert(resp.RequestId, Equals, "b0203919-bf1b-11e2-8a01-13263EXAMPLE")
-}
-
-func (s *S) TestDescribeAccountLimits(c *C) {
- testServer.Response(200, nil, DescribeAccountLimitsResponse)
-
- resp, err := s.as.DescribeAccountLimits()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeAccountLimits")
- c.Assert(resp.RequestId, Equals, "a32bd184-519d-11e3-a8a4-c1c467cbcc3b")
- c.Assert(resp.MaxNumberOfAutoScalingGroups, Equals, 20)
- c.Assert(resp.MaxNumberOfLaunchConfigurations, Equals, 100)
-
-}
-
-func (s *S) TestDescribeAdjustmentTypes(c *C) {
- testServer.Response(200, nil, DescribeAdjustmentTypesResponse)
- resp, err := s.as.DescribeAdjustmentTypes()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeAdjustmentTypes")
- c.Assert(resp.RequestId, Equals, "cc5f0337-b694-11e2-afc0-6544dEXAMPLE")
- c.Assert(resp.AdjustmentTypes, DeepEquals, []AdjustmentType{{"ChangeInCapacity"}, {"ExactCapacity"}, {"PercentChangeInCapacity"}})
-}
-
-func (s *S) TestDescribeAutoScalingGroups(c *C) {
- testServer.Response(200, nil, DescribeAutoScalingGroupsResponse)
- resp, err := s.as.DescribeAutoScalingGroups([]string{"my-test-asg-lbs"}, 0, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- t, _ := time.Parse(time.RFC3339, "2013-05-06T17:47:15.107Z")
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeAutoScalingGroups")
- c.Assert(values.Get("AutoScalingGroupNames.member.1"), Equals, "my-test-asg-lbs")
-
- expected := &DescribeAutoScalingGroupsResp{
- AutoScalingGroups: []AutoScalingGroup{
- {
- AutoScalingGroupName: "my-test-asg-lbs",
- Tags: []Tag{
- {
- Key: "foo",
- Value: "bar",
- ResourceId: "my-test-asg-lbs",
- PropagateAtLaunch: true,
- ResourceType: "auto-scaling-group",
- },
- {
- Key: "baz",
- Value: "qux",
- ResourceId: "my-test-asg-lbs",
- PropagateAtLaunch: true,
- ResourceType: "auto-scaling-group",
- },
- },
- Instances: []Instance{
- {
- AvailabilityZone: "us-east-1b",
- HealthStatus: "Healthy",
- InstanceId: "i-zb1f313",
- LaunchConfigurationName: "my-test-lc",
- LifecycleState: "InService",
- },
- {
- AvailabilityZone: "us-east-1a",
- HealthStatus: "Healthy",
- InstanceId: "i-90123adv",
- LaunchConfigurationName: "my-test-lc",
- LifecycleState: "InService",
- },
- },
- HealthCheckType: "ELB",
- CreatedTime: t,
- LaunchConfigurationName: "my-test-lc",
- DesiredCapacity: 2,
- AvailabilityZones: []string{"us-east-1b", "us-east-1a"},
- LoadBalancerNames: []string{"my-test-asg-loadbalancer"},
- MinSize: 2,
- MaxSize: 10,
- VPCZoneIdentifier: "subnet-32131da1,subnet-1312dad2",
- HealthCheckGracePeriod: 120,
- DefaultCooldown: 300,
- AutoScalingGroupARN: "arn:aws:autoscaling:us-east-1:803981987763:autoScalingGroup:ca861182-c8f9-4ca7-b1eb-cd35505f5ebb:autoScalingGroupName/my-test-asg-lbs",
- TerminationPolicies: []string{"Default"},
- },
- },
- RequestId: "0f02a07d-b677-11e2-9eb0-dd50EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeAutoScalingInstances(c *C) {
- testServer.Response(200, nil, DescribeAutoScalingInstancesResponse)
- resp, err := s.as.DescribeAutoScalingInstances([]string{"i-78e0d40b"}, 0, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeAutoScalingInstances")
- c.Assert(resp.RequestId, Equals, "df992dc3-b72f-11e2-81e1-750aa6EXAMPLE")
- c.Assert(resp.AutoScalingInstances, DeepEquals, []Instance{
- {
- AutoScalingGroupName: "my-test-asg",
- AvailabilityZone: "us-east-1a",
- HealthStatus: "Healthy",
- InstanceId: "i-78e0d40b",
- LaunchConfigurationName: "my-test-lc",
- LifecycleState: "InService",
- },
- })
-}
-
-func (s *S) TestDescribeLaunchConfigurations(c *C) {
- testServer.Response(200, nil, DescribeLaunchConfigurationsResponse)
- resp, err := s.as.DescribeLaunchConfigurations([]string{"my-test-lc"}, 0, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- t, _ := time.Parse(time.RFC3339, "2013-01-21T23:04:42.200Z")
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeLaunchConfigurations")
- c.Assert(values.Get("LaunchConfigurationNames.member.1"), Equals, "my-test-lc")
- expected := &DescribeLaunchConfigurationsResp{
- LaunchConfigurations: []LaunchConfiguration{
- {
- AssociatePublicIpAddress: true,
- BlockDeviceMappings: []BlockDeviceMapping{
- {
- DeviceName: "/dev/sdb",
- VirtualName: "ephemeral0",
- },
- {
- DeviceName: "/dev/sdf",
- Ebs: EBS{
- SnapshotId: "snap-XXXXYYY",
- VolumeSize: 100,
- Iops: 50,
- VolumeType: "io1",
- DeleteOnTermination: true,
- },
- },
- },
- EbsOptimized: false,
- CreatedTime: t,
- LaunchConfigurationName: "my-test-lc",
- InstanceType: "m1.small",
- ImageId: "ami-514ac838",
- InstanceMonitoring: InstanceMonitoring{Enabled: true},
- LaunchConfigurationARN: "arn:aws:autoscaling:us-east-1:803981987763:launchConfiguration:9dbbbf87-6141-428a-a409-0752edbe6cad:launchConfigurationName/my-test-lc",
- },
- },
- RequestId: "d05a22f8-b690-11e2-bf8e-2113fEXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeMetricCollectionTypes(c *C) {
- testServer.Response(200, nil, DescribeMetricCollectionTypesResponse)
- resp, err := s.as.DescribeMetricCollectionTypes()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeMetricCollectionTypes")
- c.Assert(resp.RequestId, Equals, "07f3fea2-bf3c-11e2-9b6f-f3cdbb80c073")
- c.Assert(resp.Metrics, DeepEquals, []MetricCollection{
- {
- Metric: "GroupMinSize",
- },
- {
- Metric: "GroupMaxSize",
- },
- {
- Metric: "GroupDesiredCapacity",
- },
- {
- Metric: "GroupInServiceInstances",
- },
- {
- Metric: "GroupPendingInstances",
- },
- {
- Metric: "GroupTerminatingInstances",
- },
- {
- Metric: "GroupTotalInstances",
- },
- })
- c.Assert(resp.Granularities, DeepEquals, []MetricGranularity{
- {
- Granularity: "1Minute",
- },
- })
-}
-
-func (s *S) TestDescribeNotificationConfigurations(c *C) {
- testServer.Response(200, nil, DescribeNotificationConfigurationsResponse)
- resp, err := s.as.DescribeNotificationConfigurations([]string{"i-78e0d40b"}, 0, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeNotificationConfigurations")
- c.Assert(resp.RequestId, Equals, "07f3fea2-bf3c-11e2-9b6f-f3cdbb80c073")
- c.Assert(resp.NotificationConfigurations, DeepEquals, []NotificationConfiguration{
- {
- AutoScalingGroupName: "my-test-asg",
- NotificationType: "autoscaling: EC2_INSTANCE_LAUNCH",
- TopicARN: "vajdoafj231j41231/topic",
- },
- })
-}
-
-func (s *S) TestDescribePolicies(c *C) {
- testServer.Response(200, nil, DescribePoliciesResponse)
- resp, err := s.as.DescribePolicies("my-test-asg", []string{}, 2, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribePolicies")
- c.Assert(values.Get("MaxRecords"), Equals, "2")
- expected := &DescribePoliciesResp{
- RequestId: "ec3bffad-b739-11e2-b38d-15fbEXAMPLE",
- NextToken: "3ef417fe-9202-12-8ddd-d13e1313413",
- ScalingPolicies: []ScalingPolicy{
- {
- PolicyARN: "arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:c322761b-3172-4d56-9a21-0ed9d6161d67:autoScalingGroupName/my-test-asg:policyName/MyScaleDownPolicy",
- AdjustmentType: "ChangeInCapacity",
- ScalingAdjustment: -1,
- PolicyName: "MyScaleDownPolicy",
- AutoScalingGroupName: "my-test-asg",
- Cooldown: 60,
- Alarms: []Alarm{
- {
- AlarmName: "TestQueue",
- AlarmARN: "arn:aws:cloudwatch:us-east-1:803981987763:alarm:TestQueue",
- },
- },
- },
- {
- PolicyARN: "arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:c55a5cdd-9be0-435b-b60b-a8dd313159f5:autoScalingGroupName/my-test-asg:policyName/MyScaleUpPolicy",
- AdjustmentType: "ChangeInCapacity",
- ScalingAdjustment: 1,
- PolicyName: "MyScaleUpPolicy",
- AutoScalingGroupName: "my-test-asg",
- Cooldown: 60,
- Alarms: []Alarm{
- {
- AlarmName: "TestQueue",
- AlarmARN: "arn:aws:cloudwatch:us-east-1:803981987763:alarm:TestQueue",
- },
- },
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeScalingActivities(c *C) {
- testServer.Response(200, nil, DescribeScalingActivitiesResponse)
- resp, err := s.as.DescribeScalingActivities("my-test-asg", []string{}, 1, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeScalingActivities")
- c.Assert(values.Get("MaxRecords"), Equals, "1")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- st, _ := time.Parse(time.RFC3339, "2012-04-12T17:32:07.882Z")
- et, _ := time.Parse(time.RFC3339, "2012-04-12T17:32:08Z")
- expected := &DescribeScalingActivitiesResp{
- RequestId: "7a641adc-84c5-11e1-a8a5-217ebEXAMPLE",
- NextToken: "3ef417fe-9202-12-8ddd-d13e1313413",
- Activities: []Activity{
- {
- StatusCode: "Failed",
- Progress: 0,
- ActivityId: "063308ae-aa22-4a9b-94f4-9faeEXAMPLE",
- StartTime: st,
- AutoScalingGroupName: "my-test-asg",
- Details: "{}",
- Cause: "At 2012-04-12T17:31:30Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2012-04-12T17:32:07Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.",
- Description: "Launching a new EC2 instance. Status Reason: The image id 'ami-4edb0327' does not exist. Launching EC2 instance failed.",
- EndTime: et,
- StatusMessage: "The image id 'ami-4edb0327' does not exist. Launching EC2 instance failed.",
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeScalingProcessTypes(c *C) {
- testServer.Response(200, nil, DescribeScalingProcessTypesResponse)
- resp, err := s.as.DescribeScalingProcessTypes()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeScalingProcessTypes")
- c.Assert(resp.RequestId, Equals, "27f2eacc-b73f-11e2-ad99-c7aba3a9c963")
- c.Assert(resp.Processes, DeepEquals, []ProcessType{
- {"AZRebalance"},
- {"AddToLoadBalancer"},
- {"AlarmNotification"},
- {"HealthCheck"},
- {"Launch"},
- {"ReplaceUnhealthy"},
- {"ScheduledActions"},
- {"Terminate"},
- })
-}
-
-func (s *S) TestDescribeScheduledActions(c *C) {
- testServer.Response(200, nil, DescribeScheduledActionsResponse)
- st, _ := time.Parse(time.RFC3339, "2014-06-01T00:30:00Z")
- request := &DescribeScheduledActionsParams{
- AutoScalingGroupName: "ASGTest1",
- MaxRecords: 1,
- StartTime: st,
- }
- resp, err := s.as.DescribeScheduledActions(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeScheduledActions")
- c.Assert(resp.RequestId, Equals, "0eb4217f-8421-11e3-9233-7100ef811766")
- c.Assert(resp.ScheduledUpdateGroupActions, DeepEquals, []ScheduledUpdateGroupAction{
- {
- AutoScalingGroupName: "ASGTest1",
- ScheduledActionARN: "arn:aws:autoscaling:us-west-2:193024542802:scheduledUpdateGroupAction:61f68b2c-bde3-4316-9a81-eb95dc246509:autoScalingGroupName/ASGTest1:scheduledActionName/SATest1",
- ScheduledActionName: "SATest1",
- Recurrence: "30 0 1 1,6,12 *",
- MaxSize: 4,
- StartTime: st,
- Time: st,
- },
- })
-}
-
-func (s *S) TestDescribeTags(c *C) {
- testServer.Response(200, nil, DescribeTagsResponse)
- filter := NewFilter()
- filter.Add("auto-scaling-group", "my-test-asg")
- resp, err := s.as.DescribeTags(filter, 1, "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeTags")
- c.Assert(values.Get("MaxRecords"), Equals, "1")
- c.Assert(values.Get("Filters.member.1.Name"), Equals, "auto-scaling-group")
- c.Assert(values.Get("Filters.member.1.Values.member.1"), Equals, "my-test-asg")
- c.Assert(resp.RequestId, Equals, "086265fd-bf3e-11e2-85fc-fbb1EXAMPLE")
- c.Assert(resp.Tags, DeepEquals, []Tag{
- {
- Key: "version",
- Value: "1.0",
- ResourceId: "my-test-asg",
- PropagateAtLaunch: true,
- ResourceType: "auto-scaling-group",
- },
- })
-}
-
-func (s *S) TestDescribeTerminationPolicyTypes(c *C) {
- testServer.Response(200, nil, DescribeTerminationPolicyTypesResponse)
- resp, err := s.as.DescribeTerminationPolicyTypes()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DescribeTerminationPolicyTypes")
- c.Assert(resp.RequestId, Equals, "d9a05827-b735-11e2-a40c-c79a5EXAMPLE")
- c.Assert(resp.TerminationPolicyTypes, DeepEquals, []string{"ClosestToNextInstanceHour", "Default", "NewestInstance", "OldestInstance", "OldestLaunchConfiguration"})
-}
-
-func (s *S) TestDetachInstances(c *C) {
- testServer.Response(200, nil, DetachInstancesResponse)
- resp, err := s.as.DetachInstances("my-asg", []string{"i-5f2e8a0d"}, true)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DetachInstances")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-asg")
- c.Assert(values.Get("ShouldDecrementDesiredCapacity"), Equals, "true")
- c.Assert(values.Get("InstanceIds.member.1"), Equals, "i-5f2e8a0d")
- st, _ := time.Parse(time.RFC3339, "2014-06-14T00:07:30.280Z")
- expected := &DetachInstancesResult{
- RequestId: "e04f3b11-f357-11e3-a434-7f10009d5849",
- Activities: []Activity{
- {
- StatusCode: "InProgress",
- Progress: 50,
- ActivityId: "e54ff599-bf05-4076-8b95-a0f090ed90bb",
- StartTime: st,
- AutoScalingGroupName: "my-asg",
- Details: "{\"Availability Zone\":\"us-east-1a\"}",
- Cause: "At 2014-06-14T00:07:30Z instance i-5f2e8a0d was detached in response to a user request, shrinking the capacity from 4 to 3.",
- Description: "Detaching EC2 instance: i-5f2e8a0d",
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDisableMetricsCollection(c *C) {
- testServer.Response(200, nil, DisableMetricsCollectionResponse)
- resp, err := s.as.DisableMetricsCollection("my-test-asg", []string{"GroupMinSize"})
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "DisableMetricsCollection")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("Metrics.member.1"), Equals, "GroupMinSize")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestEnableMetricsCollection(c *C) {
- testServer.Response(200, nil, DisableMetricsCollectionResponse)
- resp, err := s.as.EnableMetricsCollection("my-test-asg", []string{"GroupMinSize", "GroupMaxSize"}, "1Minute")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "EnableMetricsCollection")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("Granularity"), Equals, "1Minute")
- c.Assert(values.Get("Metrics.member.1"), Equals, "GroupMinSize")
- c.Assert(values.Get("Metrics.member.2"), Equals, "GroupMaxSize")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestEnterStandby(c *C) {
- testServer.Response(200, nil, EnterStandbyResponse)
- resp, err := s.as.EnterStandby("my-asg", []string{"i-5b73d709"}, true)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "EnterStandby")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-asg")
- c.Assert(values.Get("ShouldDecrementDesiredCapacity"), Equals, "true")
- c.Assert(values.Get("InstanceIds.member.1"), Equals, "i-5b73d709")
- st, _ := time.Parse(time.RFC3339, "2014-06-13T22:35:50.884Z")
- expected := &EnterStandbyResult{
- RequestId: "126f2f31-f34b-11e3-bc51-b35178f0274f",
- Activities: []Activity{
- {
- StatusCode: "InProgress",
- Progress: 50,
- ActivityId: "462b4bc3-ad3b-4e67-a58d-96cd00f02f9e",
- StartTime: st,
- AutoScalingGroupName: "my-asg",
- Details: "{\"Availability Zone\":\"us-east-1a\"}",
- Cause: "At 2014-06-13T22:35:50Z instance i-5b73d709 was moved to standby in response to a user request, shrinking the capacity from 4 to 3.",
- Description: "Moving EC2 instance to Standby: i-5b73d709",
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestExecutePolicy(c *C) {
- testServer.Response(200, nil, ExecutePolicyResponse)
- resp, err := s.as.ExecutePolicy("my-scaleout-policy", "my-test-asg", true)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "ExecutePolicy")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("PolicyName"), Equals, "my-scaleout-policy")
- c.Assert(values.Get("HonorCooldown"), Equals, "true")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestExitStandby(c *C) {
- testServer.Response(200, nil, ExitStandbyResponse)
- resp, err := s.as.ExitStandby("my-asg", []string{"i-5b73d709"})
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "ExitStandby")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-asg")
- c.Assert(values.Get("InstanceIds.member.1"), Equals, "i-5b73d709")
- st, _ := time.Parse(time.RFC3339, "2014-06-13T22:43:53.523Z")
- expected := &ExitStandbyResult{
- RequestId: "321a11c8-f34c-11e3-a434-7f10009d5849",
- Activities: []Activity{
- {
- StatusCode: "PreInService",
- Progress: 30,
- ActivityId: "dca4efcf-eea6-4844-8064-cab1fecd1aa2",
- StartTime: st,
- AutoScalingGroupName: "my-asg",
- Details: "{\"Availability Zone\":\"us-east-1a\"}",
- Cause: "At 2014-06-13T22:43:53Z instance i-5b73d709 was moved out of standby in response to a user request, increasing the capacity from 3 to 4.",
- Description: "Moving EC2 instance out of Standby: i-5b73d709",
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestPutLifecycleHook(c *C) {
- testServer.Response(200, nil, PutLifecycleHookResponse)
- request := &PutLifecycleHookParams{
- AutoScalingGroupName: "my-asg",
- LifecycleHookName: "ReadyForSoftwareInstall",
- LifecycleTransition: "autoscaling:EC2_INSTANCE_LAUNCHING",
- NotificationTargetARN: "arn:aws:sqs:us-east-1:896650972448:lifecyclehookqueue",
- RoleARN: "arn:aws:iam::896650972448:role/AutoScaling",
- }
- resp, err := s.as.PutLifecycleHook(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "PutLifecycleHook")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-asg")
- c.Assert(values.Get("LifecycleHookName"), Equals, "ReadyForSoftwareInstall")
- c.Assert(values.Get("RoleARN"), Equals, "arn:aws:iam::896650972448:role/AutoScaling")
- c.Assert(values.Get("LifecycleTransition"), Equals, "autoscaling:EC2_INSTANCE_LAUNCHING")
- c.Assert(values.Get("NotificationTargetARN"), Equals, "arn:aws:sqs:us-east-1:896650972448:lifecyclehookqueue")
- c.Assert(values.Get("DefaultResult"), Equals, "")
- c.Assert(values.Get("HeartbeatTimeout"), Equals, "")
- c.Assert(values.Get("NotificationMetadata"), Equals, "")
- c.Assert(resp.RequestId, Equals, "1952f458-f645-11e3-bc51-b35178f0274f")
-}
-
-func (s *S) TestPutNotificationConfiguration(c *C) {
- testServer.Response(200, nil, PutNotificationConfigurationResponse)
- resp, err := s.as.PutNotificationConfiguration("my-test-asg", []string{"autoscaling:EC2_INSTANCE_LAUNCH", "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"}, "myTopicARN")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "PutNotificationConfiguration")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("TopicARN"), Equals, "myTopicARN")
- c.Assert(values.Get("NotificationTypes.member.1"), Equals, "autoscaling:EC2_INSTANCE_LAUNCH")
- c.Assert(values.Get("NotificationTypes.member.2"), Equals, "autoscaling:EC2_INSTANCE_LAUNCH_ERROR")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestPutScalingPolicy(c *C) {
- testServer.Response(200, nil, PutScalingPolicyResponse)
- request := &PutScalingPolicyParams{
- AutoScalingGroupName: "my-test-asg",
- PolicyName: "my-scaleout-policy",
- ScalingAdjustment: 30,
- AdjustmentType: "PercentChangeInCapacity",
- Cooldown: 0,
- MinAdjustmentStep: 0,
- }
- resp, err := s.as.PutScalingPolicy(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "PutScalingPolicy")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("PolicyName"), Equals, "my-scaleout-policy")
- c.Assert(values.Get("AdjustmentType"), Equals, "PercentChangeInCapacity")
- c.Assert(values.Get("ScalingAdjustment"), Equals, "30")
- c.Assert(resp.RequestId, Equals, "3cfc6fef-c08b-11e2-a697-2922EXAMPLE")
- c.Assert(resp.PolicyARN, Equals, "arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:b0dcf5e8-02e6-4e31-9719-0675d0dc31ae:autoScalingGroupName/my-test-asg:policyName/my-scaleout-policy")
-}
-
-func (s *S) TestPutScheduledUpdateGroupAction(c *C) {
- testServer.Response(200, nil, PutScheduledUpdateGroupActionResponse)
- st, _ := time.Parse(time.RFC3339, "2013-05-25T08:00:00Z")
- request := &PutScheduledUpdateGroupActionParams{
- AutoScalingGroupName: "my-test-asg",
- DesiredCapacity: 3,
- ScheduledActionName: "ScaleUp",
- StartTime: st,
- }
- resp, err := s.as.PutScheduledUpdateGroupAction(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "PutScheduledUpdateGroupAction")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("ScheduledActionName"), Equals, "ScaleUp")
- c.Assert(values.Get("DesiredCapacity"), Equals, "3")
- c.Assert(values.Get("StartTime"), Equals, "2013-05-25T08:00:00Z")
- c.Assert(resp.RequestId, Equals, "3bc8c9bc-6a62-11e2-8a51-4b8a1EXAMPLE")
-}
-
-func (s *S) TestPutScheduledUpdateGroupActionCron(c *C) {
- testServer.Response(200, nil, PutScheduledUpdateGroupActionResponse)
- st, _ := time.Parse(time.RFC3339, "2013-05-25T08:00:00Z")
- request := &PutScheduledUpdateGroupActionParams{
- AutoScalingGroupName: "my-test-asg",
- DesiredCapacity: 3,
- ScheduledActionName: "scaleup-schedule-year",
- StartTime: st,
- Recurrence: "30 0 1 1,6,12 *",
- }
- resp, err := s.as.PutScheduledUpdateGroupAction(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "PutScheduledUpdateGroupAction")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("ScheduledActionName"), Equals, "scaleup-schedule-year")
- c.Assert(values.Get("DesiredCapacity"), Equals, "3")
- c.Assert(values.Get("Recurrence"), Equals, "30 0 1 1,6,12 *")
- c.Assert(resp.RequestId, Equals, "3bc8c9bc-6a62-11e2-8a51-4b8a1EXAMPLE")
-
-}
-
-func (s *S) TestResumeProcesses(c *C) {
- testServer.Response(200, nil, ResumeProcessesResponse)
- resp, err := s.as.ResumeProcesses("my-test-asg", []string{"Launch", "Terminate"})
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "ResumeProcesses")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("ScalingProcesses.member.1"), Equals, "Launch")
- c.Assert(values.Get("ScalingProcesses.member.2"), Equals, "Terminate")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-
-}
-
-func (s *S) TestSetDesiredCapacity(c *C) {
- testServer.Response(200, nil, SetDesiredCapacityResponse)
- resp, err := s.as.SetDesiredCapacity("my-test-asg", 3, true)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "SetDesiredCapacity")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("HonorCooldown"), Equals, "true")
- c.Assert(values.Get("DesiredCapacity"), Equals, "3")
- c.Assert(resp.RequestId, Equals, "9fb7e2db-6998-11e2-a985-57c82EXAMPLE")
-}
-
-func (s *S) TestSetInstanceHealth(c *C) {
- testServer.Response(200, nil, SetInstanceHealthResponse)
- resp, err := s.as.SetInstanceHealth("i-baha3121", "Unhealthy", false)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "SetInstanceHealth")
- c.Assert(values.Get("HealthStatus"), Equals, "Unhealthy")
- c.Assert(values.Get("InstanceId"), Equals, "i-baha3121")
- c.Assert(values.Get("ShouldRespectGracePeriod"), Equals, "false")
- c.Assert(resp.RequestId, Equals, "9fb7e2db-6998-11e2-a985-57c82EXAMPLE")
-}
-
-func (s *S) TestSuspendProcesses(c *C) {
- testServer.Response(200, nil, SuspendProcessesResponse)
- resp, err := s.as.SuspendProcesses("my-test-asg", []string{"Launch", "Terminate"})
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "SuspendProcesses")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("ScalingProcesses.member.1"), Equals, "Launch")
- c.Assert(values.Get("ScalingProcesses.member.2"), Equals, "Terminate")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestTerminateInstanceInAutoScalingGroup(c *C) {
- testServer.Response(200, nil, TerminateInstanceInAutoScalingGroupResponse)
- st, _ := time.Parse(time.RFC3339, "2014-01-26T14:08:30.560Z")
- resp, err := s.as.TerminateInstanceInAutoScalingGroup("i-br234123", false)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "TerminateInstanceInAutoScalingGroup")
- c.Assert(values.Get("InstanceId"), Equals, "i-br234123")
- c.Assert(values.Get("ShouldDecrementDesiredCapacity"), Equals, "false")
- expected := &TerminateInstanceInAutoScalingGroupResp{
- Activity: Activity{
- ActivityId: "cczc44a87-7d04-dsa15-31-d27c219864c5",
- Cause: "At 2014-01-26T14:08:30Z instance i-br234123 was taken out of service in response to a user request.",
- Description: "Terminating EC2 instance: i-br234123",
- Details: "{\"Availability Zone\":\"us-east-1b\"}",
- Progress: 0,
- StartTime: st,
- StatusCode: "InProgress",
- },
- RequestId: "8d798a29-f083-11e1-bdfb-cb223EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestUpdateAutoScalingGroup(c *C) {
- testServer.Response(200, nil, UpdateAutoScalingGroupResponse)
-
- asg := &AutoScalingGroup{
- AutoScalingGroupName: "my-test-asg",
- AvailabilityZones: []string{"us-east-1a", "us-east-1b"},
- MinSize: 3,
- MaxSize: 3,
- DefaultCooldown: 600,
- DesiredCapacity: 3,
- LaunchConfigurationName: "my-test-lc",
- VPCZoneIdentifier: "subnet-610acd08,subnet-530fc83a",
- }
- resp, err := s.as.UpdateAutoScalingGroup(asg)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2011-01-01")
- c.Assert(values.Get("Action"), Equals, "UpdateAutoScalingGroup")
- c.Assert(values.Get("AutoScalingGroupName"), Equals, "my-test-asg")
- c.Assert(values.Get("AvailabilityZones.member.1"), Equals, "us-east-1a")
- c.Assert(values.Get("AvailabilityZones.member.2"), Equals, "us-east-1b")
- c.Assert(values.Get("MinSize"), Equals, "3")
- c.Assert(values.Get("MaxSize"), Equals, "3")
- c.Assert(values.Get("DefaultCooldown"), Equals, "600")
- c.Assert(values.Get("DesiredCapacity"), Equals, "3")
- c.Assert(values.Get("LaunchConfigurationName"), Equals, "my-test-lc")
- c.Assert(values.Get("VPCZoneIdentifier"), Equals, "subnet-610acd08,subnet-530fc83a")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
diff --git a/vendor/github.com/goamz/goamz/autoscaling/responses_test.go b/vendor/github.com/goamz/goamz/autoscaling/responses_test.go
deleted file mode 100644
index 935231aa2..000000000
--- a/vendor/github.com/goamz/goamz/autoscaling/responses_test.go
+++ /dev/null
@@ -1,627 +0,0 @@
-package autoscaling
-
-var AttachInstancesResponse = `
-<AttachInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</AttachInstancesResponse>
-`
-var BasicGroupResponse = `
-<DescribeAutoScalingGroupsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeAutoScalingGroupsResult>
- <AutoScalingGroups/>
- </DescribeAutoScalingGroupsResult>
- <ResponseMetadata>
- <RequestId>08c3bedc-8421-11e3-9bb5-bfa219b29cce</RequestId>
- </ResponseMetadata>
-</DescribeAutoScalingGroupsResponse>
-`
-var CreateAutoScalingGroupResponse = `
-<CreateAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateAutoScalingGroupResponse>
-`
-var CreateLaunchConfigurationResponse = `
-<CreateLaunchConfigurationResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
-<ResponseMetadata>
- <RequestId>7c6e177f-f082-11e1-ac58-3714bEXAMPLE</RequestId>
-</ResponseMetadata>
-</CreateLaunchConfigurationResponse>
-`
-var CreateOrUpdateTagsResponse = `
-<CreateOrUpdateTagsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>b0203919-bf1b-11e2-8a01-13263EXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateOrUpdateTagsResponse>
-`
-var DeleteAutoScalingGroupResponse = `
- <DeleteAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>70a76d42-9665-11e2-9fdf-211deEXAMPLE</RequestId>
- </ResponseMetadata>
- </DeleteAutoScalingGroupResponse>
-`
-var DeleteAutoScalingGroupErrorResponse = `
-<ErrorResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <Error>
- <Type>Sender</Type>
- <Code>ResourceInUse</Code>
- <Message>You cannot delete an AutoScalingGroup while there are instances or pending Spot instance request(s) still in the group.</Message>
- </Error>
- <RequestId>70a76d42-9665-11e2-9fdf-211deEXAMPLE</RequestId>
-</ErrorResponse>
-`
-var DeleteLaunchConfigurationResponse = `
-<DeleteLaunchConfigurationResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>7347261f-97df-11e2-8756-35eEXAMPLE</RequestId>
- </ResponseMetadata>
-</DeleteLaunchConfigurationResponse>
-`
-var DeleteLaunchConfigurationInUseResponse = `
-<ErrorResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <Error>
- <Type>Sender</Type>
- <Code>ResourceInUse</Code>
- <Message>Cannot delete launch configuration my-test-lc because it is attached to AutoScalingGroup test</Message>
- </Error>
- <RequestId>7347261f-97df-11e2-8756-35eEXAMPLE</RequestId>
-</ErrorResponse>
-`
-var DeleteScheduledActionResponse = `
-<DeleteScheduledActionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>0f38bb02-8421-11e3-9bb5-bfa219b29cce</RequestId>
- </ResponseMetadata>
-</DeleteScheduledActionResponse>
-`
-var DeleteTagsResponse = `
-<CreateOrUpdateTagsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>b0203919-bf1b-11e2-8a01-13263EXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateOrUpdateTagsResponse>
-`
-var DescribeAccountLimitsResponse = `
-<DescribeAccountLimitsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeAccountLimitsResult>
- <MaxNumberOfLaunchConfigurations>100</MaxNumberOfLaunchConfigurations>
- <MaxNumberOfAutoScalingGroups>20</MaxNumberOfAutoScalingGroups>
- </DescribeAccountLimitsResult>
- <ResponseMetadata>
- <RequestId>a32bd184-519d-11e3-a8a4-c1c467cbcc3b</RequestId>
- </ResponseMetadata>
-</DescribeAccountLimitsResponse>
-`
-var DescribeAdjustmentTypesResponse = `
-<DescribeAdjustmentTypesResponse xmlns="http://autoscaling.amazonaws.com/doc/201-01-01/">
- <DescribeAdjustmentTypesResult>
- <AdjustmentTypes>
- <member>
- <AdjustmentType>ChangeInCapacity</AdjustmentType>
- </member>
- <member>
- <AdjustmentType>ExactCapacity</AdjustmentType>
- </member>
- <member>
- <AdjustmentType>PercentChangeInCapacity</AdjustmentType>
- </member>
- </AdjustmentTypes>
- </DescribeAdjustmentTypesResult>
- <ResponseMetadata>
- <RequestId>cc5f0337-b694-11e2-afc0-6544dEXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeAdjustmentTypesResponse>
-`
-var DescribeAutoScalingGroupsResponse = `
-<DescribeAutoScalingGroupsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
-<DescribeAutoScalingGroupsResult>
- <AutoScalingGroups>
- <member>
- <Tags>
- <member>
- <ResourceId>my-test-asg-lbs</ResourceId>
- <PropagateAtLaunch>true</PropagateAtLaunch>
- <Value>bar</Value>
- <Key>foo</Key>
- <ResourceType>auto-scaling-group</ResourceType>
- </member>
- <member>
- <ResourceId>my-test-asg-lbs</ResourceId>
- <PropagateAtLaunch>true</PropagateAtLaunch>
- <Value>qux</Value>
- <Key>baz</Key>
- <ResourceType>auto-scaling-group</ResourceType>
- </member>
- </Tags>
- <SuspendedProcesses/>
- <AutoScalingGroupName>my-test-asg-lbs</AutoScalingGroupName>
- <HealthCheckType>ELB</HealthCheckType>
- <CreatedTime>2013-05-06T17:47:15.107Z</CreatedTime>
- <EnabledMetrics/>
- <LaunchConfigurationName>my-test-lc</LaunchConfigurationName>
- <Instances>
- <member>
- <HealthStatus>Healthy</HealthStatus>
- <AvailabilityZone>us-east-1b</AvailabilityZone>
- <InstanceId>i-zb1f313</InstanceId>
- <LaunchConfigurationName>my-test-lc</LaunchConfigurationName>
- <LifecycleState>InService</LifecycleState>
- </member>
- <member>
- <HealthStatus>Healthy</HealthStatus>
- <AvailabilityZone>us-east-1a</AvailabilityZone>
- <InstanceId>i-90123adv</InstanceId>
- <LaunchConfigurationName>my-test-lc</LaunchConfigurationName>
- <LifecycleState>InService</LifecycleState>
- </member>
- </Instances>
- <DesiredCapacity>2</DesiredCapacity>
- <AvailabilityZones>
- <member>us-east-1b</member>
- <member>us-east-1a</member>
- </AvailabilityZones>
- <LoadBalancerNames>
- <member>my-test-asg-loadbalancer</member>
- </LoadBalancerNames>
- <MinSize>2</MinSize>
- <VPCZoneIdentifier>subnet-32131da1,subnet-1312dad2</VPCZoneIdentifier>
- <HealthCheckGracePeriod>120</HealthCheckGracePeriod>
- <DefaultCooldown>300</DefaultCooldown>
- <AutoScalingGroupARN>arn:aws:autoscaling:us-east-1:803981987763:autoScalingGroup:ca861182-c8f9-4ca7-b1eb-cd35505f5ebb:autoScalingGroupName/my-test-asg-lbs</AutoScalingGroupARN>
- <TerminationPolicies>
- <member>Default</member>
- </TerminationPolicies>
- <MaxSize>10</MaxSize>
- </member>
- </AutoScalingGroups>
- </DescribeAutoScalingGroupsResult>
- <ResponseMetadata>
- <RequestId>0f02a07d-b677-11e2-9eb0-dd50EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeAutoScalingGroupsResponse>
-`
-var DescribeAutoScalingInstancesResponse = `
-<DescribeAutoScalingInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeAutoScalingInstancesResult>
- <AutoScalingInstances>
- <member>
- <HealthStatus>Healthy</HealthStatus>
- <AutoScalingGroupName>my-test-asg</AutoScalingGroupName>
- <AvailabilityZone>us-east-1a</AvailabilityZone>
- <InstanceId>i-78e0d40b</InstanceId>
- <LaunchConfigurationName>my-test-lc</LaunchConfigurationName>
- <LifecycleState>InService</LifecycleState>
- </member>
- </AutoScalingInstances>
- </DescribeAutoScalingInstancesResult>
- <ResponseMetadata>
- <RequestId>df992dc3-b72f-11e2-81e1-750aa6EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeAutoScalingInstancesResponse>
-`
-var DescribeLaunchConfigurationsResponse = `
-<DescribeLaunchConfigurationsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeLaunchConfigurationsResult>
- <LaunchConfigurations>
- <member>
- <AssociatePublicIpAddress>true</AssociatePublicIpAddress>
- <SecurityGroups/>
- <CreatedTime>2013-01-21T23:04:42.200Z</CreatedTime>
- <KernelId/>
- <LaunchConfigurationName>my-test-lc</LaunchConfigurationName>
- <UserData/>
- <InstanceType>m1.small</InstanceType>
- <LaunchConfigurationARN>arn:aws:autoscaling:us-east-1:803981987763:launchConfiguration:9dbbbf87-6141-428a-a409-0752edbe6cad:launchConfigurationName/my-test-lc</LaunchConfigurationARN>
- <BlockDeviceMappings>
- <member>
- <VirtualName>ephemeral0</VirtualName>
- <DeviceName>/dev/sdb</DeviceName>
- </member>
- <member>
- <Ebs>
- <SnapshotId>snap-XXXXYYY</SnapshotId>
- <VolumeSize>100</VolumeSize>
- <Iops>50</Iops>
- <VolumeType>io1</VolumeType>
- <DeleteOnTermination>true</DeleteOnTermination>
- </Ebs>
- <DeviceName>/dev/sdf</DeviceName>
- </member>
- </BlockDeviceMappings>
- <ImageId>ami-514ac838</ImageId>
- <KeyName/>
- <RamdiskId/>
- <InstanceMonitoring>
- <Enabled>true</Enabled>
- </InstanceMonitoring>
- <EbsOptimized>false</EbsOptimized>
- </member>
- </LaunchConfigurations>
- </DescribeLaunchConfigurationsResult>
- <ResponseMetadata>
- <RequestId>d05a22f8-b690-11e2-bf8e-2113fEXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeLaunchConfigurationsResponse>
-`
-var DescribeMetricCollectionTypesResponse = `
-<DescribeMetricCollectionTypesResponse xmlns="http://autoscaling.amazonaws.co
-oc/2011-01-01/">
- <DescribeMetricCollectionTypesResult>
- <Metrics>
- <member>
- <Metric>GroupMinSize</Metric>
- </member>
- <member>
- <Metric>GroupMaxSize</Metric>
- </member>
- <member>
- <Metric>GroupDesiredCapacity</Metric>
- </member>
- <member>
- <Metric>GroupInServiceInstances</Metric>
- </member>
- <member>
- <Metric>GroupPendingInstances</Metric>
- </member>
- <member>
- <Metric>GroupTerminatingInstances</Metric>
- </member>
- <member>
- <Metric>GroupTotalInstances</Metric>
- </member>
- </Metrics>
- <Granularities>
- <member>
- <Granularity>1Minute</Granularity>
- </member>
- </Granularities>
- </DescribeMetricCollectionTypesResult>
- <ResponseMetadata>
- <RequestId>07f3fea2-bf3c-11e2-9b6f-f3cdbb80c073</RequestId>
- </ResponseMetadata>
-</DescribeMetricCollectionTypesResponse>
-`
-var DescribeNotificationConfigurationsResponse = `
-<DescribeNotificationConfigurationsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeNotificationConfigurationsResult>
- <NotificationConfigurations>
- <member>
- <AutoScalingGroupName>my-test-asg</AutoScalingGroupName>
- <NotificationType>autoscaling: EC2_INSTANCE_LAUNCH</NotificationType>
- <TopicARN>vajdoafj231j41231/topic</TopicARN>
- </member>
- </NotificationConfigurations>
- </DescribeNotificationConfigurationsResult>
- <ResponseMetadata>
- <RequestId>07f3fea2-bf3c-11e2-9b6f-f3cdbb80c073</RequestId>
- </ResponseMetadata>
-</DescribeNotificationConfigurationsResponse>
-`
-var DescribePoliciesResponse = `
-<DescribePoliciesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribePoliciesResult>
- <NextToken>3ef417fe-9202-12-8ddd-d13e1313413</NextToken>
- <ScalingPolicies>
- <member>
- <PolicyARN>arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:c322761b-3172-4d56-9a21-0ed9d6161d67:autoScalingGroupName/my-test-asg:policyName/MyScaleDownPolicy</PolicyARN>
- <AdjustmentType>ChangeInCapacity</AdjustmentType>
- <ScalingAdjustment>-1</ScalingAdjustment>
- <PolicyName>MyScaleDownPolicy</PolicyName>
- <AutoScalingGroupName>my-test-asg</AutoScalingGroupName>
- <Cooldown>60</Cooldown>
- <Alarms>
- <member>
- <AlarmName>TestQueue</AlarmName>
- <AlarmARN>arn:aws:cloudwatch:us-east-1:803981987763:alarm:TestQueue</AlarmARN>
- </member>
- </Alarms>
- </member>
- <member>
- <PolicyARN>arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:c55a5cdd-9be0-435b-b60b-a8dd313159f5:autoScalingGroupName/my-test-asg:policyName/MyScaleUpPolicy</PolicyARN>
- <AdjustmentType>ChangeInCapacity</AdjustmentType>
- <ScalingAdjustment>1</ScalingAdjustment>
- <PolicyName>MyScaleUpPolicy</PolicyName>
- <AutoScalingGroupName>my-test-asg</AutoScalingGroupName>
- <Cooldown>60</Cooldown>
- <Alarms>
- <member>
- <AlarmName>TestQueue</AlarmName>
- <AlarmARN>arn:aws:cloudwatch:us-east-1:803981987763:alarm:TestQueue</AlarmARN>
- </member>
- </Alarms>
- </member>
- </ScalingPolicies>
- </DescribePoliciesResult>
- <ResponseMetadata>
- <RequestId>ec3bffad-b739-11e2-b38d-15fbEXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribePoliciesResponse>
-`
-var DescribeScalingActivitiesResponse = `
-<DescribeScalingActivitiesResponse xmlns="http://ec2.amazonaws.com/doc/2011-01-01/">
-<DescribeScalingActivitiesResult>
- <NextToken>3ef417fe-9202-12-8ddd-d13e1313413</NextToken>
-<Activities>
- <member>
- <StatusCode>Failed</StatusCode>
- <Progress>0</Progress>
- <ActivityId>063308ae-aa22-4a9b-94f4-9faeEXAMPLE</ActivityId>
- <StartTime>2012-04-12T17:32:07.882Z</StartTime>
- <AutoScalingGroupName>my-test-asg</AutoScalingGroupName>
- <Cause>At 2012-04-12T17:31:30Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2012-04-12T17:32:07Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.</Cause>
- <Details>{}</Details>
- <Description>Launching a new EC2 instance. Status Reason: The image id 'ami-4edb0327' does not exist. Launching EC2 instance failed.</Description>
- <EndTime>2012-04-12T17:32:08Z</EndTime>
- <StatusMessage>The image id 'ami-4edb0327' does not exist. Launching EC2 instance failed.</StatusMessage>
- </member>
-</Activities>
- </DescribeScalingActivitiesResult>
- <ResponseMetadata>
- <RequestId>7a641adc-84c5-11e1-a8a5-217ebEXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeScalingActivitiesResponse>
-`
-var DescribeScalingProcessTypesResponse = `
-<DescribeScalingProcessTypesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeScalingProcessTypesResult>
- <Processes>
- <member>
- <ProcessName>AZRebalance</ProcessName>
- </member>
- <member>
- <ProcessName>AddToLoadBalancer</ProcessName>
- </member>
- <member>
- <ProcessName>AlarmNotification</ProcessName>
- </member>
- <member>
- <ProcessName>HealthCheck</ProcessName>
- </member>
- <member>
- <ProcessName>Launch</ProcessName>
- </member>
- <member>
- <ProcessName>ReplaceUnhealthy</ProcessName>
- </member>
- <member>
- <ProcessName>ScheduledActions</ProcessName>
- </member>
- <member>
- <ProcessName>Terminate</ProcessName>
- </member>
- </Processes>
- </DescribeScalingProcessTypesResult>
- <ResponseMetadata>
- <RequestId>27f2eacc-b73f-11e2-ad99-c7aba3a9c963</RequestId>
- </ResponseMetadata>
-</DescribeScalingProcessTypesResponse>
-`
-var DescribeScheduledActionsResponse = `
-<DescribeScheduledActionsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeScheduledActionsResult>
- <ScheduledUpdateGroupActions>
- <member>
- <ScheduledActionName>SATest1</ScheduledActionName>
- <StartTime>2014-06-01T00:30:00Z</StartTime>
- <Time>2014-06-01T00:30:00Z</Time>
- <ScheduledActionARN>arn:aws:autoscaling:us-west-2:193024542802:scheduledUpdateGroupAction:61f68b2c-bde3-4316-9a81-eb95dc246509:autoScalingGroupName/ASGTest1:scheduledActionName/SATest1</ScheduledActionARN>
- <AutoScalingGroupName>ASGTest1</AutoScalingGroupName>
- <Recurrence>30 0 1 1,6,12 *</Recurrence>
- <MaxSize>4</MaxSize>
- </member>
- </ScheduledUpdateGroupActions>
- </DescribeScheduledActionsResult>
- <ResponseMetadata>
- <RequestId>0eb4217f-8421-11e3-9233-7100ef811766</RequestId>
- </ResponseMetadata>
-</DescribeScheduledActionsResponse>
-`
-
-var DescribeTerminationPolicyTypesResponse = `
-<DescribeTerminationPolicyTypesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeTerminationPolicyTypesResult>
- <TerminationPolicyTypes>
- <member>ClosestToNextInstanceHour</member>
- <member>Default</member>
- <member>NewestInstance</member>
- <member>OldestInstance</member>
- <member>OldestLaunchConfiguration</member>
- </TerminationPolicyTypes>
- </DescribeTerminationPolicyTypesResult>
- <ResponseMetadata>
- <RequestId>d9a05827-b735-11e2-a40c-c79a5EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeTerminationPolicyTypesResponse>
-`
-var DescribeTagsResponse = `
-<DescribeTagsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DescribeTagsResult>
- <Tags>
- <member>
- <ResourceId>my-test-asg</ResourceId>
- <PropagateAtLaunch>true</PropagateAtLaunch>
- <Value>1.0</Value>
- <Key>version</Key>
- <ResourceType>auto-scaling-group</ResourceType>
- </member>
- </Tags>
- </DescribeTagsResult>
- <ResponseMetadata>
- <RequestId>086265fd-bf3e-11e2-85fc-fbb1EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeTagsResponse>
-`
-var DetachInstancesResponse = `
-<DetachInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <DetachInstancesResult>
- <Activities>
- <member>
- <ActivityId>e54ff599-bf05-4076-8b95-a0f090ed90bb</ActivityId>
- <Progress>50</Progress>
- <StatusCode>InProgress</StatusCode>
- <StartTime>2014-06-14T00:07:30.280Z</StartTime>
- <Cause>At 2014-06-14T00:07:30Z instance i-5f2e8a0d was detached in response to a user request, shrinking the capacity from 4 to 3.</Cause>
- <AutoScalingGroupName>my-asg</AutoScalingGroupName>
- <Details>{"Availability Zone":"us-east-1a"}</Details>
- <Description>Detaching EC2 instance: i-5f2e8a0d</Description>
- </member>
- </Activities>
- </DetachInstancesResult>
- <ResponseMetadata>
- <RequestId>e04f3b11-f357-11e3-a434-7f10009d5849</RequestId>
- </ResponseMetadata>
-</DetachInstancesResponse>
-`
-var DisableMetricsCollectionResponse = `
-<DisableMetricsCollectionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DisableMetricsCollectionResponse>
-`
-var EnableMetricsCollectionResponse = `
-<EnableMetricsCollectionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</EnableMetricsCollectionResponse>
-`
-var EnterStandbyResponse = `
-<EnterStandbyResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <EnterStandbyResult>
- <Activities>
- <member>
- <ActivityId>462b4bc3-ad3b-4e67-a58d-96cd00f02f9e</ActivityId>
- <Progress>50</Progress>
- <StatusCode>InProgress</StatusCode>
- <StartTime>2014-06-13T22:35:50.884Z</StartTime>
- <Cause>At 2014-06-13T22:35:50Z instance i-5b73d709 was moved to standby in response to a user request, shrinking the capacity from 4 to 3.</Cause>
- <AutoScalingGroupName>my-asg</AutoScalingGroupName>
- <Details>{"Availability Zone":"us-east-1a"}</Details>
- <Description>Moving EC2 instance to Standby: i-5b73d709</Description>
- </member>
- </Activities>
- </EnterStandbyResult>
- <ResponseMetadata>
- <RequestId>126f2f31-f34b-11e3-bc51-b35178f0274f</RequestId>
- </ResponseMetadata>
-</EnterStandbyResponse>
-`
-var ExecutePolicyResponse = `
-<EnableMetricsCollectionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</EnableMetricsCollectionResponse>
-`
-var ExitStandbyResponse = `
-<ExitStandbyResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ExitStandbyResult>
- <Activities>
- <member>
- <ActivityId>dca4efcf-eea6-4844-8064-cab1fecd1aa2</ActivityId>
- <Progress>30</Progress>
- <StatusCode>PreInService</StatusCode>
- <StartTime>2014-06-13T22:43:53.523Z</StartTime>
- <Cause>At 2014-06-13T22:43:53Z instance i-5b73d709 was moved out of standby in response to a user request, increasing the capacity from 3 to 4.</Cause>
- <AutoScalingGroupName>my-asg</AutoScalingGroupName>
- <Details>{"Availability Zone":"us-east-1a"}</Details>
- <Description>Moving EC2 instance out of Standby: i-5b73d709</Description>
- </member>
- </Activities>
- </ExitStandbyResult>
- <ResponseMetadata>
- <RequestId>321a11c8-f34c-11e3-a434-7f10009d5849</RequestId>
- </ResponseMetadata>
-</ExitStandbyResponse>
-`
-var PutLifecycleHookResponse = `
-<PutLifecycleHookResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <PutLifecycleHookResult/>
- <ResponseMetadata>
- <RequestId>1952f458-f645-11e3-bc51-b35178f0274f</RequestId>
- </ResponseMetadata>
-</PutLifecycleHookResponse>
-`
-var PutNotificationConfigurationResponse = `
-<EnableMetricsCollectionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</EnableMetricsCollectionResponse>
-`
-var PutScalingPolicyResponse = `
-<PutScalingPolicyResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <PutScalingPolicyResult>
- <PolicyARN>arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:b0dcf5e8-02e6-4e31-9719-0675d0dc31ae:autoScalingGroupName/my-test-asg:policyName/my-scaleout-policy</PolicyARN>
- </PutScalingPolicyResult>
- <ResponseMetadata>
- <RequestId>3cfc6fef-c08b-11e2-a697-2922EXAMPLE</RequestId>
- </ResponseMetadata>
-</PutScalingPolicyResponse>
-`
-var PutScheduledUpdateGroupActionResponse = `
-<PutScheduledUpdateGroupActionResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>3bc8c9bc-6a62-11e2-8a51-4b8a1EXAMPLE</RequestId>
- </ResponseMetadata>
- </PutScheduledUpdateGroupActionResponse>
- `
-var ResumeProcessesResponse = `
-<ResumeProcessesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</ResumeProcessesResponse>
-`
-var SetDesiredCapacityResponse = `
-<SetDesiredCapacityResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>9fb7e2db-6998-11e2-a985-57c82EXAMPLE</RequestId>
- </ResponseMetadata>
-</SetDesiredCapacityResponse>
-`
-var SetInstanceHealthResponse = `
-<SetInstanceHealthResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>9fb7e2db-6998-11e2-a985-57c82EXAMPLE</RequestId>
- </ResponseMetadata>
-</SetInstanceHealthResponse>
-`
-var SuspendProcessesResponse = `
-<SuspendProcessesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</SuspendProcessesResponse>
-`
-var TerminateInstanceInAutoScalingGroupResponse = `
-<TerminateInstanceInAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <TerminateInstanceInAutoScalingGroupResult>
- <Activity>
- <StatusCode>InProgress</StatusCode>
- <ActivityId>cczc44a87-7d04-dsa15-31-d27c219864c5</ActivityId>
- <Progress>0</Progress>
- <StartTime>2014-01-26T14:08:30.560Z</StartTime>
- <Cause>At 2014-01-26T14:08:30Z instance i-br234123 was taken out of service in response to a user request.</Cause>
- <Details>{&quot;Availability Zone&quot;:&quot;us-east-1b&quot;}</Details>
- <Description>Terminating EC2 instance: i-br234123</Description>
- </Activity>
- </TerminateInstanceInAutoScalingGroupResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</TerminateInstanceInAutoScalingGroupResponse>
-`
-var UpdateAutoScalingGroupResponse = `
-<UpdateAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</UpdateAutoScalingGroupResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/aws/attempt.go b/vendor/github.com/goamz/goamz/aws/attempt.go
deleted file mode 100644
index c0654f5d8..000000000
--- a/vendor/github.com/goamz/goamz/aws/attempt.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package aws
-
-import (
- "time"
-)
-
-// AttemptStrategy represents a strategy for waiting for an action
-// to complete successfully. This is an internal type used by the
-// implementation of other goamz packages.
-type AttemptStrategy struct {
- Total time.Duration // total duration of attempt.
- Delay time.Duration // interval between each try in the burst.
- Min int // minimum number of retries; overrides Total
-}
-
-type Attempt struct {
- strategy AttemptStrategy
- last time.Time
- end time.Time
- force bool
- count int
-}
-
-// Start begins a new sequence of attempts for the given strategy.
-func (s AttemptStrategy) Start() *Attempt {
- now := time.Now()
- return &Attempt{
- strategy: s,
- last: now,
- end: now.Add(s.Total),
- force: true,
- }
-}
-
-// Next waits until it is time to perform the next attempt or returns
-// false if it is time to stop trying.
-func (a *Attempt) Next() bool {
- now := time.Now()
- sleep := a.nextSleep(now)
- if !a.force && !now.Add(sleep).Before(a.end) && a.strategy.Min <= a.count {
- return false
- }
- a.force = false
- if sleep > 0 && a.count > 0 {
- time.Sleep(sleep)
- now = time.Now()
- }
- a.count++
- a.last = now
- return true
-}
-
-func (a *Attempt) nextSleep(now time.Time) time.Duration {
- sleep := a.strategy.Delay - now.Sub(a.last)
- if sleep < 0 {
- return 0
- }
- return sleep
-}
-
-// HasNext returns whether another attempt will be made if the current
-// one fails. If it returns true, the following call to Next is
-// guaranteed to return true.
-func (a *Attempt) HasNext() bool {
- if a.force || a.strategy.Min > a.count {
- return true
- }
- now := time.Now()
- if now.Add(a.nextSleep(now)).Before(a.end) {
- a.force = true
- return true
- }
- return false
-}
diff --git a/vendor/github.com/goamz/goamz/aws/attempt_test.go b/vendor/github.com/goamz/goamz/aws/attempt_test.go
deleted file mode 100644
index 8ba497715..000000000
--- a/vendor/github.com/goamz/goamz/aws/attempt_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package aws_test
-
-import (
- "time"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-func (S) TestAttemptTiming(c *C) {
- testAttempt := aws.AttemptStrategy{
- Total: 0.25e9,
- Delay: 0.1e9,
- }
- want := []time.Duration{0, 0.1e9, 0.2e9, 0.2e9}
- got := make([]time.Duration, 0, len(want)) // avoid allocation when testing timing
- t0 := time.Now()
- for a := testAttempt.Start(); a.Next(); {
- got = append(got, time.Now().Sub(t0))
- }
- got = append(got, time.Now().Sub(t0))
- c.Assert(got, HasLen, len(want))
- const margin = 0.01e9
- for i, got := range want {
- lo := want[i] - margin
- hi := want[i] + margin
- if got < lo || got > hi {
- c.Errorf("attempt %d want %g got %g", i, want[i].Seconds(), got.Seconds())
- }
- }
-}
-
-func (S) TestAttemptNextHasNext(c *C) {
- a := aws.AttemptStrategy{}.Start()
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.Next(), Equals, false)
-
- a = aws.AttemptStrategy{}.Start()
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.HasNext(), Equals, false)
- c.Assert(a.Next(), Equals, false)
-
- a = aws.AttemptStrategy{Total: 2e8}.Start()
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.HasNext(), Equals, true)
- time.Sleep(2e8)
- c.Assert(a.HasNext(), Equals, true)
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.Next(), Equals, false)
-
- a = aws.AttemptStrategy{Total: 1e8, Min: 2}.Start()
- time.Sleep(1e8)
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.HasNext(), Equals, true)
- c.Assert(a.Next(), Equals, true)
- c.Assert(a.HasNext(), Equals, false)
- c.Assert(a.Next(), Equals, false)
-}
diff --git a/vendor/github.com/goamz/goamz/aws/aws.go b/vendor/github.com/goamz/goamz/aws/aws.go
deleted file mode 100644
index 49eed632e..000000000
--- a/vendor/github.com/goamz/goamz/aws/aws.go
+++ /dev/null
@@ -1,434 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 Canonical Ltd.
-//
-// Written by Gustavo Niemeyer <gustavo.niemeyer@canonical.com>
-//
-package aws
-
-import (
- "encoding/json"
- "encoding/xml"
- "errors"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "os"
- "time"
-
- "github.com/vaughan0/go-ini"
-)
-
-// Defines the valid signers
-const (
- V2Signature = iota
- V4Signature = iota
- Route53Signature = iota
-)
-
-// Defines the service endpoint and correct Signer implementation to use
-// to sign requests for this endpoint
-type ServiceInfo struct {
- Endpoint string
- Signer uint
-}
-
-// Region defines the URLs where AWS services may be accessed.
-//
-// See http://goo.gl/d8BP1 for more details.
-type Region struct {
- Name string // the canonical name of this region.
- EC2Endpoint string
- S3Endpoint string
- S3BucketEndpoint string // Not needed by AWS S3. Use ${bucket} for bucket name.
- S3LocationConstraint bool // true if this region requires a LocationConstraint declaration.
- S3LowercaseBucket bool // true if the region requires bucket names to be lower case.
- SDBEndpoint string
- SESEndpoint string
- SNSEndpoint string
- SQSEndpoint string
- IAMEndpoint string
- ELBEndpoint string
- DynamoDBEndpoint string
- CloudWatchServicepoint ServiceInfo
- AutoScalingEndpoint string
- RDSEndpoint ServiceInfo
- STSEndpoint string
- CloudFormationEndpoint string
- ECSEndpoint string
- DynamoDBStreamsEndpoint string
-}
-
-var Regions = map[string]Region{
- APNortheast.Name: APNortheast,
- APNortheast2.Name: APNortheast2,
- APSoutheast.Name: APSoutheast,
- APSoutheast2.Name: APSoutheast2,
- EUCentral.Name: EUCentral,
- EUWest.Name: EUWest,
- USEast.Name: USEast,
- USWest.Name: USWest,
- USWest2.Name: USWest2,
- USGovWest.Name: USGovWest,
- SAEast.Name: SAEast,
- CNNorth.Name: CNNorth,
-}
-
-// Designates a signer interface suitable for signing AWS requests, params
-// should be appropriately encoded for the request before signing.
-//
-// A signer should be initialized with Auth and the appropriate endpoint.
-type Signer interface {
- Sign(method, path string, params map[string]string)
-}
-
-// An AWS Service interface with the API to query the AWS service
-//
-// Supplied as an easy way to mock out service calls during testing.
-type AWSService interface {
- // Queries the AWS service at a given method/path with the params and
- // returns an http.Response and error
- Query(method, path string, params map[string]string) (*http.Response, error)
- // Builds an error given an XML payload in the http.Response, can be used
- // to process an error if the status code is not 200 for example.
- BuildError(r *http.Response) error
-}
-
-// Implements a Server Query/Post API to easily query AWS services and build
-// errors when desired
-type Service struct {
- service ServiceInfo
- signer Signer
-}
-
-// Create a base set of params for an action
-func MakeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-// Create a new AWS server to handle making requests
-func NewService(auth Auth, service ServiceInfo) (s *Service, err error) {
- var signer Signer
- switch service.Signer {
- case V2Signature:
- signer, err = NewV2Signer(auth, service)
- // case V4Signature:
- // signer, err = NewV4Signer(auth, service, Regions["eu-west-1"])
- default:
- err = fmt.Errorf("Unsupported signer for service")
- }
- if err != nil {
- return
- }
- s = &Service{service: service, signer: signer}
- return
-}
-
-func (s *Service) Query(method, path string, params map[string]string) (resp *http.Response, err error) {
- params["Timestamp"] = time.Now().UTC().Format(time.RFC3339)
- u, err := url.Parse(s.service.Endpoint)
- if err != nil {
- return nil, err
- }
- u.Path = path
-
- s.signer.Sign(method, path, params)
- if method == "GET" {
- u.RawQuery = multimap(params).Encode()
- resp, err = http.Get(u.String())
- } else if method == "POST" {
- resp, err = http.PostForm(u.String(), multimap(params))
- }
-
- return
-}
-
-func (s *Service) BuildError(r *http.Response) error {
- errors := ErrorResponse{}
- xml.NewDecoder(r.Body).Decode(&errors)
- var err Error
- err = errors.Errors
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-type ErrorResponse struct {
- Errors Error `xml:"Error"`
- RequestId string // A unique ID for tracking the request
-}
-
-type Error struct {
- StatusCode int
- Type string
- Code string
- Message string
- RequestId string
-}
-
-func (err *Error) Error() string {
- return fmt.Sprintf("Type: %s, Code: %s, Message: %s",
- err.Type, err.Code, err.Message,
- )
-}
-
-type Auth struct {
- AccessKey, SecretKey string
- token string
- expiration time.Time
-}
-
-func (a *Auth) Token() string {
- if a.token == "" {
- return ""
- }
- if time.Since(a.expiration) >= -30*time.Second { //in an ideal world this should be zero assuming the instance is synching it's clock
- *a, _ = GetAuth("", "", "", time.Time{})
- }
- return a.token
-}
-
-func (a *Auth) Expiration() time.Time {
- return a.expiration
-}
-
-// To be used with other APIs that return auth credentials such as STS
-func NewAuth(accessKey, secretKey, token string, expiration time.Time) *Auth {
- return &Auth{
- AccessKey: accessKey,
- SecretKey: secretKey,
- token: token,
- expiration: expiration,
- }
-}
-
-// ResponseMetadata
-type ResponseMetadata struct {
- RequestId string // A unique ID for tracking the request
-}
-
-type BaseResponse struct {
- ResponseMetadata ResponseMetadata
-}
-
-var unreserved = make([]bool, 128)
-var hex = "0123456789ABCDEF"
-
-func init() {
- // RFC3986
- u := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890-_.~"
- for _, c := range u {
- unreserved[c] = true
- }
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-type credentials struct {
- Code string
- LastUpdated string
- Type string
- AccessKeyId string
- SecretAccessKey string
- Token string
- Expiration string
-}
-
-// GetMetaData retrieves instance metadata about the current machine.
-//
-// See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html for more details.
-func GetMetaData(path string) (contents []byte, err error) {
- url := "http://169.254.169.254/latest/meta-data/" + path
-
- resp, err := RetryingClient.Get(url)
- if err != nil {
- return
- }
- defer resp.Body.Close()
-
- if resp.StatusCode != 200 {
- err = fmt.Errorf("Code %d returned for url %s", resp.StatusCode, url)
- return
- }
-
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return
- }
- return []byte(body), err
-}
-
-func getInstanceCredentials() (cred credentials, err error) {
- credentialPath := "iam/security-credentials/"
-
- // Get the instance role
- role, err := GetMetaData(credentialPath)
- if err != nil {
- return
- }
-
- // Get the instance role credentials
- credentialJSON, err := GetMetaData(credentialPath + string(role))
- if err != nil {
- return
- }
-
- err = json.Unmarshal([]byte(credentialJSON), &cred)
- return
-}
-
-// GetAuth creates an Auth based on either passed in credentials,
-// environment information or instance based role credentials.
-func GetAuth(accessKey string, secretKey, token string, expiration time.Time) (auth Auth, err error) {
- // First try passed in credentials
- if accessKey != "" && secretKey != "" {
- return Auth{accessKey, secretKey, token, expiration}, nil
- }
-
- // Next try to get auth from the shared credentials file
- auth, err = SharedAuth()
- if err == nil {
- // Found auth, return
- return
- }
-
- // Next try to get auth from the environment
- auth, err = EnvAuth()
- if err == nil {
- // Found auth, return
- return
- }
-
- // Next try getting auth from the instance role
- cred, err := getInstanceCredentials()
- if err == nil {
- // Found auth, return
- auth.AccessKey = cred.AccessKeyId
- auth.SecretKey = cred.SecretAccessKey
- auth.token = cred.Token
- exptdate, err := time.Parse("2006-01-02T15:04:05Z", cred.Expiration)
- if err != nil {
- err = fmt.Errorf("Error Parseing expiration date: cred.Expiration :%s , error: %s \n", cred.Expiration, err)
- }
- auth.expiration = exptdate
- return auth, err
- }
- err = errors.New("No valid AWS authentication found")
- return auth, err
-}
-
-// EnvAuth creates an Auth based on environment information.
-// The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment
-// variables are used.
-// AWS_SESSION_TOKEN is used if present.
-func EnvAuth() (auth Auth, err error) {
- auth.AccessKey = os.Getenv("AWS_ACCESS_KEY_ID")
- if auth.AccessKey == "" {
- auth.AccessKey = os.Getenv("AWS_ACCESS_KEY")
- }
-
- auth.SecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
- if auth.SecretKey == "" {
- auth.SecretKey = os.Getenv("AWS_SECRET_KEY")
- }
- if auth.AccessKey == "" {
- err = errors.New("AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment")
- }
- if auth.SecretKey == "" {
- err = errors.New("AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment")
- }
-
- auth.token = os.Getenv("AWS_SESSION_TOKEN")
- return
-}
-
-// SharedAuth creates an Auth based on shared credentials stored in
-// $HOME/.aws/credentials. The AWS_PROFILE environment variables is used to
-// select the profile.
-func SharedAuth() (auth Auth, err error) {
- var profileName = os.Getenv("AWS_PROFILE")
-
- if profileName == "" {
- profileName = "default"
- }
-
- var credentialsFile = os.Getenv("AWS_CREDENTIAL_FILE")
- if credentialsFile == "" {
- var homeDir = os.Getenv("HOME")
- if homeDir == "" {
- err = errors.New("Could not get HOME")
- return
- }
- credentialsFile = homeDir + "/.aws/credentials"
- }
-
- file, err := ini.LoadFile(credentialsFile)
- if err != nil {
- err = errors.New("Couldn't parse AWS credentials file")
- return
- }
-
- var profile = file[profileName]
- if profile == nil {
- err = errors.New("Couldn't find profile in AWS credentials file")
- return
- }
-
- auth.AccessKey = profile["aws_access_key_id"]
- auth.SecretKey = profile["aws_secret_access_key"]
- auth.token = profile["aws_session_token"]
-
- if auth.AccessKey == "" {
- err = errors.New("AWS_ACCESS_KEY_ID not found in environment in credentials file")
- }
- if auth.SecretKey == "" {
- err = errors.New("AWS_SECRET_ACCESS_KEY not found in credentials file")
- }
- return
-}
-
-// Encode takes a string and URI-encodes it in a way suitable
-// to be used in AWS signatures.
-func Encode(s string) string {
- encode := false
- for i := 0; i != len(s); i++ {
- c := s[i]
- if c > 127 || !unreserved[c] {
- encode = true
- break
- }
- }
- if !encode {
- return s
- }
- e := make([]byte, len(s)*3)
- ei := 0
- for i := 0; i != len(s); i++ {
- c := s[i]
- if c > 127 || !unreserved[c] {
- e[ei] = '%'
- e[ei+1] = hex[c>>4]
- e[ei+2] = hex[c&0xF]
- ei += 3
- } else {
- e[ei] = c
- ei += 1
- }
- }
- return string(e[:ei])
-}
diff --git a/vendor/github.com/goamz/goamz/aws/aws_test.go b/vendor/github.com/goamz/goamz/aws/aws_test.go
deleted file mode 100644
index 0c74a7905..000000000
--- a/vendor/github.com/goamz/goamz/aws/aws_test.go
+++ /dev/null
@@ -1,211 +0,0 @@
-package aws_test
-
-import (
- "io/ioutil"
- "os"
- "strings"
- "testing"
- "time"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- environ []string
-}
-
-func (s *S) SetUpSuite(c *C) {
- s.environ = os.Environ()
-}
-
-func (s *S) TearDownTest(c *C) {
- os.Clearenv()
- for _, kv := range s.environ {
- l := strings.SplitN(kv, "=", 2)
- os.Setenv(l[0], l[1])
- }
-}
-
-func (s *S) TestSharedAuthNoHome(c *C) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "foo")
- _, err := aws.SharedAuth()
- c.Assert(err, ErrorMatches, "Could not get HOME")
-}
-
-func (s *S) TestSharedAuthNoCredentialsFile(c *C) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "foo")
- os.Setenv("HOME", "/tmp")
- _, err := aws.SharedAuth()
- c.Assert(err, ErrorMatches, "Couldn't parse AWS credentials file")
-}
-
-func (s *S) TestSharedAuthNoProfileInFile(c *C) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "foo")
-
- d, err := ioutil.TempDir("", "")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(d)
-
- err = os.Mkdir(d+"/.aws", 0755)
- if err != nil {
- panic(err)
- }
-
- ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\n"), 0644)
- os.Setenv("HOME", d)
-
- _, err = aws.SharedAuth()
- c.Assert(err, ErrorMatches, "Couldn't find profile in AWS credentials file")
-}
-
-func (s *S) TestSharedAuthNoKeysInProfile(c *C) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "bar")
-
- d, err := ioutil.TempDir("", "")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(d)
-
- err = os.Mkdir(d+"/.aws", 0755)
- if err != nil {
- panic(err)
- }
-
- ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\nawsaccesskeyid = AK.."), 0644)
- os.Setenv("HOME", d)
-
- _, err = aws.SharedAuth()
- c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY not found in credentials file")
-}
-
-func (s *S) TestSharedAuthDefaultCredentials(c *C) {
- os.Clearenv()
-
- d, err := ioutil.TempDir("", "")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(d)
-
- err = os.Mkdir(d+"/.aws", 0755)
- if err != nil {
- panic(err)
- }
-
- ioutil.WriteFile(d+"/.aws/credentials", []byte("[default]\naws_access_key_id = access\naws_secret_access_key = secret\n"), 0644)
- os.Setenv("HOME", d)
-
- auth, err := aws.SharedAuth()
- c.Assert(err, IsNil)
- c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
-}
-
-func (s *S) TestSharedAuth(c *C) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "bar")
-
- d, err := ioutil.TempDir("", "")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(d)
-
- err = os.Mkdir(d+"/.aws", 0755)
- if err != nil {
- panic(err)
- }
-
- ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\naws_access_key_id = access\naws_secret_access_key = secret\n"), 0644)
- os.Setenv("HOME", d)
-
- auth, err := aws.SharedAuth()
- c.Assert(err, IsNil)
- c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
-}
-
-func (s *S) TestEnvAuthNoSecret(c *C) {
- os.Clearenv()
- _, err := aws.EnvAuth()
- c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment")
-}
-
-func (s *S) TestEnvAuthNoAccess(c *C) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_ACCESS_KEY", "foo")
- _, err := aws.EnvAuth()
- c.Assert(err, ErrorMatches, "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment")
-}
-
-func (s *S) TestEnvAuth(c *C) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- auth, err := aws.EnvAuth()
- c.Assert(err, IsNil)
- c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
-}
-
-func (s *S) TestEnvAuthAlt(c *C) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_KEY", "secret")
- os.Setenv("AWS_ACCESS_KEY", "access")
- auth, err := aws.EnvAuth()
- c.Assert(err, IsNil)
- c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
-}
-
-func (s *S) TestEnvAuthToken(c *C) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_KEY", "secret")
- os.Setenv("AWS_ACCESS_KEY", "access")
- os.Setenv("AWS_SESSION_TOKEN", "token")
- auth, err := aws.EnvAuth()
- c.Assert(err, IsNil)
- c.Assert(auth.SecretKey, Equals, "secret")
- c.Assert(auth.AccessKey, Equals, "access")
- c.Assert(auth.Token(), Equals, "token")
-}
-
-func (s *S) TestGetAuthStatic(c *C) {
- exptdate := time.Now().Add(time.Hour)
- auth, err := aws.GetAuth("access", "secret", "token", exptdate)
- c.Assert(err, IsNil)
- c.Assert(auth.AccessKey, Equals, "access")
- c.Assert(auth.SecretKey, Equals, "secret")
- c.Assert(auth.Token(), Equals, "token")
- c.Assert(auth.Expiration(), Equals, exptdate)
-}
-
-func (s *S) TestGetAuthEnv(c *C) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- auth, err := aws.GetAuth("", "", "", time.Time{})
- c.Assert(err, IsNil)
- c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
-}
-
-func (s *S) TestEncode(c *C) {
- c.Assert(aws.Encode("foo"), Equals, "foo")
- c.Assert(aws.Encode("/"), Equals, "%2F")
-}
-
-func (s *S) TestRegionsAreNamed(c *C) {
- for n, r := range aws.Regions {
- c.Assert(n, Equals, r.Name)
- }
-}
diff --git a/vendor/github.com/goamz/goamz/aws/client.go b/vendor/github.com/goamz/goamz/aws/client.go
deleted file mode 100644
index 86d2ccec8..000000000
--- a/vendor/github.com/goamz/goamz/aws/client.go
+++ /dev/null
@@ -1,124 +0,0 @@
-package aws
-
-import (
- "math"
- "net"
- "net/http"
- "time"
-)
-
-type RetryableFunc func(*http.Request, *http.Response, error) bool
-type WaitFunc func(try int)
-type DeadlineFunc func() time.Time
-
-type ResilientTransport struct {
- // Timeout is the maximum amount of time a dial will wait for
- // a connect to complete.
- //
- // The default is no timeout.
- //
- // With or without a timeout, the operating system may impose
- // its own earlier timeout. For instance, TCP timeouts are
- // often around 3 minutes.
- DialTimeout time.Duration
-
- // MaxTries, if non-zero, specifies the number of times we will retry on
- // failure. Retries are only attempted for temporary network errors or known
- // safe failures.
- MaxTries int
- Deadline DeadlineFunc
- ShouldRetry RetryableFunc
- Wait WaitFunc
- transport *http.Transport
-}
-
-// Convenience method for creating an http client
-func NewClient(rt *ResilientTransport) *http.Client {
- rt.transport = &http.Transport{
- Dial: func(netw, addr string) (net.Conn, error) {
- c, err := net.DialTimeout(netw, addr, rt.DialTimeout)
- if err != nil {
- return nil, err
- }
- c.SetDeadline(rt.Deadline())
- return c, nil
- },
- Proxy: http.ProxyFromEnvironment,
- }
- // TODO: Would be nice is ResilientTransport allowed clients to initialize
- // with http.Transport attributes.
- return &http.Client{
- Transport: rt,
- }
-}
-
-var retryingTransport = &ResilientTransport{
- Deadline: func() time.Time {
- return time.Now().Add(5 * time.Second)
- },
- DialTimeout: 10 * time.Second,
- MaxTries: 3,
- ShouldRetry: awsRetry,
- Wait: ExpBackoff,
-}
-
-// Exported default client
-var RetryingClient = NewClient(retryingTransport)
-
-func (t *ResilientTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- return t.tries(req)
-}
-
-// Retry a request a maximum of t.MaxTries times.
-// We'll only retry if the proper criteria are met.
-// If a wait function is specified, wait that amount of time
-// In between requests.
-func (t *ResilientTransport) tries(req *http.Request) (res *http.Response, err error) {
- for try := 0; try < t.MaxTries; try += 1 {
- res, err = t.transport.RoundTrip(req)
-
- if !t.ShouldRetry(req, res, err) {
- break
- }
- if res != nil {
- res.Body.Close()
- }
- if t.Wait != nil {
- t.Wait(try)
- }
- }
-
- return
-}
-
-func ExpBackoff(try int) {
- time.Sleep(100 * time.Millisecond *
- time.Duration(math.Exp2(float64(try))))
-}
-
-func LinearBackoff(try int) {
- time.Sleep(time.Duration(try*100) * time.Millisecond)
-}
-
-// Decide if we should retry a request.
-// In general, the criteria for retrying a request is described here
-// http://docs.aws.amazon.com/general/latest/gr/api-retries.html
-func awsRetry(req *http.Request, res *http.Response, err error) bool {
- retry := false
-
- // Retry if there's a temporary network error.
- if neterr, ok := err.(net.Error); ok {
- if neterr.Temporary() {
- retry = true
- }
- }
-
- // Retry if we get a 5xx series error.
- if res != nil {
- if res.StatusCode >= 500 && res.StatusCode < 600 {
- retry = true
- }
- }
-
- return retry
-}
diff --git a/vendor/github.com/goamz/goamz/aws/client_test.go b/vendor/github.com/goamz/goamz/aws/client_test.go
deleted file mode 100644
index c66a86333..000000000
--- a/vendor/github.com/goamz/goamz/aws/client_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package aws_test
-
-import (
- "fmt"
- "github.com/goamz/goamz/aws"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
- "time"
-)
-
-// Retrieve the response from handler using aws.RetryingClient
-func serveAndGet(handler http.HandlerFunc) (body string, err error) {
- ts := httptest.NewServer(handler)
- defer ts.Close()
- resp, err := aws.RetryingClient.Get(ts.URL)
- if err != nil {
- return
- }
- if resp.StatusCode != 200 {
- return "", fmt.Errorf("Bad status code: %d", resp.StatusCode)
- }
- greeting, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- return
- }
- return strings.TrimSpace(string(greeting)), nil
-}
-
-func TestClient_expected(t *testing.T) {
- body := "foo bar"
-
- resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, body)
- })
- if err != nil {
- t.Fatal(err)
- }
- if resp != body {
- t.Fatal("Body not as expected.")
- }
-}
-
-func TestClient_delay(t *testing.T) {
- body := "baz"
- wait := 4
- resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) {
- if wait < 0 {
- // If we dipped to zero delay and still failed.
- t.Fatal("Never succeeded.")
- }
- wait -= 1
- time.Sleep(time.Second * time.Duration(wait))
- fmt.Fprintln(w, body)
- })
- if err != nil {
- t.Fatal(err)
- }
- if resp != body {
- t.Fatal("Body not as expected.", resp)
- }
-}
-
-func TestClient_no4xxRetry(t *testing.T) {
- tries := 0
-
- // Fail once before succeeding.
- _, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) {
- tries += 1
- http.Error(w, "error", 404)
- })
-
- if err == nil {
- t.Fatal("should have error")
- }
-
- if tries != 1 {
- t.Fatalf("should only try once: %d", tries)
- }
-}
-
-func TestClient_retries(t *testing.T) {
- body := "biz"
- failed := false
- // Fail once before succeeding.
- resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) {
- if !failed {
- http.Error(w, "error", 500)
- failed = true
- } else {
- fmt.Fprintln(w, body)
- }
- })
- if failed != true {
- t.Error("We didn't retry!")
- }
- if err != nil {
- t.Fatal(err)
- }
- if resp != body {
- t.Fatal("Body not as expected.")
- }
-}
-
-func TestClient_fails(t *testing.T) {
- tries := 0
- // Fail 3 times and return the last error.
- _, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) {
- tries += 1
- http.Error(w, "error", 500)
- })
- if err == nil {
- t.Fatal(err)
- }
- if tries != 3 {
- t.Fatal("Didn't retry enough")
- }
-}
diff --git a/vendor/github.com/goamz/goamz/aws/export_test.go b/vendor/github.com/goamz/goamz/aws/export_test.go
deleted file mode 100644
index c4aca1d72..000000000
--- a/vendor/github.com/goamz/goamz/aws/export_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package aws
-
-import (
- "net/http"
- "time"
-)
-
-// V4Signer:
-// Exporting methods for testing
-
-func (s *V4Signer) RequestTime(req *http.Request) time.Time {
- return s.requestTime(req)
-}
-
-func (s *V4Signer) CanonicalRequest(req *http.Request) string {
- return s.canonicalRequest(req)
-}
-
-func (s *V4Signer) StringToSign(t time.Time, creq string) string {
- return s.stringToSign(t, creq)
-}
-
-func (s *V4Signer) Signature(t time.Time, sts string) string {
- return s.signature(t, sts)
-}
-
-func (s *V4Signer) Authorization(header http.Header, t time.Time, signature string) string {
- return s.authorization(header, t, signature)
-}
diff --git a/vendor/github.com/goamz/goamz/aws/regions.go b/vendor/github.com/goamz/goamz/aws/regions.go
deleted file mode 100644
index 94d79d46d..000000000
--- a/vendor/github.com/goamz/goamz/aws/regions.go
+++ /dev/null
@@ -1,277 +0,0 @@
-package aws
-
-var USGovWest = Region{
- "us-gov-west-1",
- "https://ec2.us-gov-west-1.amazonaws.com",
- "https://s3-fips-us-gov-west-1.amazonaws.com",
- "",
- true,
- true,
- "",
- "",
- "https://sns.us-gov-west-1.amazonaws.com",
- "https://sqs.us-gov-west-1.amazonaws.com",
- "https://iam.us-gov.amazonaws.com",
- "https://elasticloadbalancing.us-gov-west-1.amazonaws.com",
- "https://dynamodb.us-gov-west-1.amazonaws.com",
- ServiceInfo{"https://monitoring.us-gov-west-1.amazonaws.com", V2Signature},
- "https://autoscaling.us-gov-west-1.amazonaws.com",
- ServiceInfo{"https://rds.us-gov-west-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.us-gov-west-1.amazonaws.com",
- "https://ecs.us-gov-west-1.amazonaws.com",
- "https://streams.dynamodb.us-gov-west-1.amazonaws.com",
-}
-
-var USEast = Region{
- "us-east-1",
- "https://ec2.us-east-1.amazonaws.com",
- "https://s3.amazonaws.com",
- "",
- false,
- false,
- "https://sdb.amazonaws.com",
- "https://email.us-east-1.amazonaws.com",
- "https://sns.us-east-1.amazonaws.com",
- "https://sqs.us-east-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.us-east-1.amazonaws.com",
- "https://dynamodb.us-east-1.amazonaws.com",
- ServiceInfo{"https://monitoring.us-east-1.amazonaws.com", V2Signature},
- "https://autoscaling.us-east-1.amazonaws.com",
- ServiceInfo{"https://rds.us-east-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.us-east-1.amazonaws.com",
- "https://ecs.us-east-1.amazonaws.com",
- "https://streams.dynamodb.us-east-1.amazonaws.com",
-}
-
-var USWest = Region{
- "us-west-1",
- "https://ec2.us-west-1.amazonaws.com",
- "https://s3-us-west-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.us-west-1.amazonaws.com",
- "",
- "https://sns.us-west-1.amazonaws.com",
- "https://sqs.us-west-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.us-west-1.amazonaws.com",
- "https://dynamodb.us-west-1.amazonaws.com",
- ServiceInfo{"https://monitoring.us-west-1.amazonaws.com", V2Signature},
- "https://autoscaling.us-west-1.amazonaws.com",
- ServiceInfo{"https://rds.us-west-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.us-west-1.amazonaws.com",
- "https://ecs.us-west-1.amazonaws.com",
- "https://streams.dynamodb.us-west-1.amazonaws.com",
-}
-
-var USWest2 = Region{
- "us-west-2",
- "https://ec2.us-west-2.amazonaws.com",
- "https://s3-us-west-2.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.us-west-2.amazonaws.com",
- "https://email.us-west-2.amazonaws.com",
- "https://sns.us-west-2.amazonaws.com",
- "https://sqs.us-west-2.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.us-west-2.amazonaws.com",
- "https://dynamodb.us-west-2.amazonaws.com",
- ServiceInfo{"https://monitoring.us-west-2.amazonaws.com", V2Signature},
- "https://autoscaling.us-west-2.amazonaws.com",
- ServiceInfo{"https://rds.us-west-2.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.us-west-2.amazonaws.com",
- "https://ecs.us-west-2.amazonaws.com",
- "https://streams.dynamodb.us-west-2.amazonaws.com",
-}
-
-var EUWest = Region{
- "eu-west-1",
- "https://ec2.eu-west-1.amazonaws.com",
- "https://s3-eu-west-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.eu-west-1.amazonaws.com",
- "https://email.eu-west-1.amazonaws.com",
- "https://sns.eu-west-1.amazonaws.com",
- "https://sqs.eu-west-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.eu-west-1.amazonaws.com",
- "https://dynamodb.eu-west-1.amazonaws.com",
- ServiceInfo{"https://monitoring.eu-west-1.amazonaws.com", V2Signature},
- "https://autoscaling.eu-west-1.amazonaws.com",
- ServiceInfo{"https://rds.eu-west-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.eu-west-1.amazonaws.com",
- "https://ecs.eu-west-1.amazonaws.com",
- "https://streams.dynamodb.eu-west-1.amazonaws.com",
-}
-
-var EUCentral = Region{
- "eu-central-1",
- "https://ec2.eu-central-1.amazonaws.com",
- "https://s3-eu-central-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.eu-central-1.amazonaws.com",
- "https://email.eu-central-1.amazonaws.com",
- "https://sns.eu-central-1.amazonaws.com",
- "https://sqs.eu-central-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.eu-central-1.amazonaws.com",
- "https://dynamodb.eu-central-1.amazonaws.com",
- ServiceInfo{"https://monitoring.eu-central-1.amazonaws.com", V2Signature},
- "https://autoscaling.eu-central-1.amazonaws.com",
- ServiceInfo{"https://rds.eu-central-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.eu-central-1.amazonaws.com",
- "https://ecs.eu-central-1.amazonaws.com",
- "https://streams.dynamodb.eu-central-1.amazonaws.com",
-}
-
-var APSoutheast = Region{
- "ap-southeast-1",
- "https://ec2.ap-southeast-1.amazonaws.com",
- "https://s3-ap-southeast-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.ap-southeast-1.amazonaws.com",
- "",
- "https://sns.ap-southeast-1.amazonaws.com",
- "https://sqs.ap-southeast-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.ap-southeast-1.amazonaws.com",
- "https://dynamodb.ap-southeast-1.amazonaws.com",
- ServiceInfo{"https://monitoring.ap-southeast-1.amazonaws.com", V2Signature},
- "https://autoscaling.ap-southeast-1.amazonaws.com",
- ServiceInfo{"https://rds.ap-southeast-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.ap-southeast-1.amazonaws.com",
- "https://ecs.ap-southeast-1.amazonaws.com",
- "https://streams.dynamodb.ap-southeast-1.amazonaws.com",
-}
-
-var APSoutheast2 = Region{
- "ap-southeast-2",
- "https://ec2.ap-southeast-2.amazonaws.com",
- "https://s3-ap-southeast-2.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.ap-southeast-2.amazonaws.com",
- "",
- "https://sns.ap-southeast-2.amazonaws.com",
- "https://sqs.ap-southeast-2.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.ap-southeast-2.amazonaws.com",
- "https://dynamodb.ap-southeast-2.amazonaws.com",
- ServiceInfo{"https://monitoring.ap-southeast-2.amazonaws.com", V2Signature},
- "https://autoscaling.ap-southeast-2.amazonaws.com",
- ServiceInfo{"https://rds.ap-southeast-2.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.ap-southeast-2.amazonaws.com",
- "https://ecs.ap-southeast-2.amazonaws.com",
- "https://streams.dynamodb.ap-southeast-2.amazonaws.com",
-}
-
-var APNortheast = Region{
- "ap-northeast-1",
- "https://ec2.ap-northeast-1.amazonaws.com",
- "https://s3-ap-northeast-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.ap-northeast-1.amazonaws.com",
- "",
- "https://sns.ap-northeast-1.amazonaws.com",
- "https://sqs.ap-northeast-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.ap-northeast-1.amazonaws.com",
- "https://dynamodb.ap-northeast-1.amazonaws.com",
- ServiceInfo{"https://monitoring.ap-northeast-1.amazonaws.com", V2Signature},
- "https://autoscaling.ap-northeast-1.amazonaws.com",
- ServiceInfo{"https://rds.ap-northeast-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.ap-northeast-1.amazonaws.com",
- "https://ecs.ap-northeast-1.amazonaws.com",
- "https://streams.dynamodb.ap-northeast-1.amazonaws.com",
-}
-
-var APNortheast2 = Region{
- "ap-northeast-2",
- "https://ec2.ap-northeast-2.amazonaws.com",
- "https://s3-ap-northeast-2.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.ap-northeast-2.amazonaws.com",
- "",
- "https://sns.ap-northeast-2.amazonaws.com",
- "https://sqs.ap-northeast-2.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.ap-northeast-2.amazonaws.com",
- "https://dynamodb.ap-northeast-2.amazonaws.com",
- ServiceInfo{"https://monitoring.ap-northeast-2.amazonaws.com", V2Signature},
- "https://autoscaling.ap-northeast-2.amazonaws.com",
- ServiceInfo{"https://rds.ap-northeast-2.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.ap-northeast-2.amazonaws.com",
- "https://ecs.ap-northeast-2.amazonaws.com",
- "https://streams.dynamodb.ap-northeast-2.amazonaws.com",
-}
-
-var SAEast = Region{
- "sa-east-1",
- "https://ec2.sa-east-1.amazonaws.com",
- "https://s3-sa-east-1.amazonaws.com",
- "",
- true,
- true,
- "https://sdb.sa-east-1.amazonaws.com",
- "",
- "https://sns.sa-east-1.amazonaws.com",
- "https://sqs.sa-east-1.amazonaws.com",
- "https://iam.amazonaws.com",
- "https://elasticloadbalancing.sa-east-1.amazonaws.com",
- "https://dynamodb.sa-east-1.amazonaws.com",
- ServiceInfo{"https://monitoring.sa-east-1.amazonaws.com", V2Signature},
- "https://autoscaling.sa-east-1.amazonaws.com",
- ServiceInfo{"https://rds.sa-east-1.amazonaws.com", V2Signature},
- "https://sts.amazonaws.com",
- "https://cloudformation.sa-east-1.amazonaws.com",
- "https://ecs.sa-east-1.amazonaws.com",
- "https://streams.dynamodb.sa-east-1.amazonaws.com",
-}
-
-var CNNorth = Region{
- "cn-north-1",
- "https://ec2.cn-north-1.amazonaws.com.cn",
- "https://s3.cn-north-1.amazonaws.com.cn",
- "",
- true,
- true,
- "https://sdb.cn-north-1.amazonaws.com.cn",
- "",
- "https://sns.cn-north-1.amazonaws.com.cn",
- "https://sqs.cn-north-1.amazonaws.com.cn",
- "https://iam.cn-north-1.amazonaws.com.cn",
- "https://elasticloadbalancing.cn-north-1.amazonaws.com.cn",
- "https://dynamodb.cn-north-1.amazonaws.com.cn",
- ServiceInfo{"https://monitoring.cn-north-1.amazonaws.com.cn", V4Signature},
- "https://autoscaling.cn-north-1.amazonaws.com.cn",
- ServiceInfo{"https://rds.cn-north-1.amazonaws.com.cn", V4Signature},
- "https://sts.cn-north-1.amazonaws.com.cn",
- "https://cloudformation.cn-north-1.amazonaws.com.cn",
- "https://ecs.cn-north-1.amazonaws.com.cn",
- "https://streams.dynamodb.cn-north-1.amazonaws.com.cn",
-}
diff --git a/vendor/github.com/goamz/goamz/aws/sign.go b/vendor/github.com/goamz/goamz/aws/sign.go
deleted file mode 100644
index 22ce0781b..000000000
--- a/vendor/github.com/goamz/goamz/aws/sign.go
+++ /dev/null
@@ -1,357 +0,0 @@
-package aws
-
-import (
- "bytes"
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "path"
- "sort"
- "strings"
- "time"
-)
-
-type V2Signer struct {
- auth Auth
- service ServiceInfo
- host string
-}
-
-var b64 = base64.StdEncoding
-
-func NewV2Signer(auth Auth, service ServiceInfo) (*V2Signer, error) {
- u, err := url.Parse(service.Endpoint)
- if err != nil {
- return nil, err
- }
- return &V2Signer{auth: auth, service: service, host: u.Host}, nil
-}
-
-func (s *V2Signer) Sign(method, path string, params map[string]string) {
- params["AWSAccessKeyId"] = s.auth.AccessKey
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
- if s.auth.Token() != "" {
- params["SecurityToken"] = s.auth.Token()
- }
-
- // AWS specifies that the parameters in a signed request must
- // be provided in the natural order of the keys. This is distinct
- // from the natural order of the encoded value of key=value.
- // Percent and Equals affect the sorting order.
- var keys, sarray []string
- for k, _ := range params {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- sarray = append(sarray, Encode(k)+"="+Encode(params[k]))
- }
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + s.host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(s.auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
-
-// Common date formats for signing requests
-const (
- ISO8601BasicFormat = "20060102T150405Z"
- ISO8601BasicFormatShort = "20060102"
-)
-
-type Route53Signer struct {
- auth Auth
-}
-
-func NewRoute53Signer(auth Auth) *Route53Signer {
- return &Route53Signer{auth: auth}
-}
-
-// getCurrentDate fetches the date stamp from the aws servers to
-// ensure the auth headers are within 5 minutes of the server time
-func (s *Route53Signer) getCurrentDate() string {
- response, err := http.Get("https://route53.amazonaws.com/date")
- if err != nil {
- fmt.Print("Unable to get date from amazon: ", err)
- return ""
- }
-
- response.Body.Close()
- return response.Header.Get("Date")
-}
-
-// Creates the authorize signature based on the date stamp and secret key
-func (s *Route53Signer) getHeaderAuthorize(message string) string {
- hmacSha256 := hmac.New(sha256.New, []byte(s.auth.SecretKey))
- hmacSha256.Write([]byte(message))
- cryptedString := hmacSha256.Sum(nil)
-
- return base64.StdEncoding.EncodeToString(cryptedString)
-}
-
-// Adds all the required headers for AWS Route53 API to the request
-// including the authorization
-func (s *Route53Signer) Sign(req *http.Request) {
- date := s.getCurrentDate()
- authHeader := fmt.Sprintf("AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=%s,Signature=%s",
- s.auth.AccessKey, "HmacSHA256", s.getHeaderAuthorize(date))
-
- req.Header.Set("Host", req.Host)
- req.Header.Set("X-Amzn-Authorization", authHeader)
- req.Header.Set("X-Amz-Date", date)
- req.Header.Set("Content-Type", "application/xml")
-}
-
-/*
-The V4Signer encapsulates all of the functionality to sign a request with the AWS
-Signature Version 4 Signing Process. (http://goo.gl/u1OWZz)
-*/
-type V4Signer struct {
- auth Auth
- serviceName string
- region Region
-}
-
-/*
-Return a new instance of a V4Signer capable of signing AWS requests.
-*/
-func NewV4Signer(auth Auth, serviceName string, region Region) *V4Signer {
- return &V4Signer{auth: auth, serviceName: serviceName, region: region}
-}
-
-/*
-Sign a request according to the AWS Signature Version 4 Signing Process. (http://goo.gl/u1OWZz)
-
-The signed request will include an "x-amz-date" header with a current timestamp if a valid "x-amz-date"
-or "date" header was not available in the original request. In addition, AWS Signature Version 4 requires
-the "host" header to be a signed header, therefor the Sign method will manually set a "host" header from
-the request.Host.
-
-The signed request will include a new "Authorization" header indicating that the request has been signed.
-
-Any changes to the request after signing the request will invalidate the signature.
-*/
-func (s *V4Signer) Sign(req *http.Request) {
- req.Header.Set("host", req.Host) // host header must be included as a signed header
- t := s.requestTime(req) // Get requst time
- creq := s.canonicalRequest(req) // Build canonical request
- sts := s.stringToSign(t, creq) // Build string to sign
- signature := s.signature(t, sts) // Calculate the AWS Signature Version 4
- auth := s.authorization(req.Header, t, signature) // Create Authorization header value
- req.Header.Set("Authorization", auth) // Add Authorization header to request
- return
-}
-
-/*
-requestTime method will parse the time from the request "x-amz-date" or "date" headers.
-If the "x-amz-date" header is present, that will take priority over the "date" header.
-If neither header is defined or we are unable to parse either header as a valid date
-then we will create a new "x-amz-date" header with the current time.
-*/
-func (s *V4Signer) requestTime(req *http.Request) time.Time {
-
- // Get "x-amz-date" header
- date := req.Header.Get("x-amz-date")
-
- // Attempt to parse as ISO8601BasicFormat
- t, err := time.Parse(ISO8601BasicFormat, date)
- if err == nil {
- return t
- }
-
- // Attempt to parse as http.TimeFormat
- t, err = time.Parse(http.TimeFormat, date)
- if err == nil {
- req.Header.Set("x-amz-date", t.Format(ISO8601BasicFormat))
- return t
- }
-
- // Get "date" header
- date = req.Header.Get("date")
-
- // Attempt to parse as http.TimeFormat
- t, err = time.Parse(http.TimeFormat, date)
- if err == nil {
- return t
- }
-
- // Create a current time header to be used
- t = time.Now().UTC()
- req.Header.Set("x-amz-date", t.Format(ISO8601BasicFormat))
- return t
-}
-
-/*
-canonicalRequest method creates the canonical request according to Task 1 of the AWS Signature Version 4 Signing Process. (http://goo.gl/eUUZ3S)
-
- CanonicalRequest =
- HTTPRequestMethod + '\n' +
- CanonicalURI + '\n' +
- CanonicalQueryString + '\n' +
- CanonicalHeaders + '\n' +
- SignedHeaders + '\n' +
- HexEncode(Hash(Payload))
-*/
-func (s *V4Signer) canonicalRequest(req *http.Request) string {
- c := new(bytes.Buffer)
- fmt.Fprintf(c, "%s\n", req.Method)
- fmt.Fprintf(c, "%s\n", s.canonicalURI(req.URL))
- fmt.Fprintf(c, "%s\n", s.canonicalQueryString(req.URL))
- fmt.Fprintf(c, "%s\n\n", s.canonicalHeaders(req.Header))
- fmt.Fprintf(c, "%s\n", s.signedHeaders(req.Header))
- fmt.Fprintf(c, "%s", s.payloadHash(req))
- return c.String()
-}
-
-func (s *V4Signer) canonicalURI(u *url.URL) string {
- canonicalPath := u.RequestURI()
- if u.RawQuery != "" {
- canonicalPath = canonicalPath[:len(canonicalPath)-len(u.RawQuery)-1]
- }
- slash := strings.HasSuffix(canonicalPath, "/")
- canonicalPath = path.Clean(canonicalPath)
- if canonicalPath != "/" && slash {
- canonicalPath += "/"
- }
- return canonicalPath
-}
-
-func (s *V4Signer) canonicalQueryString(u *url.URL) string {
- var a []string
- for k, vs := range u.Query() {
- k = Encode(k)
- for _, v := range vs {
- if v == "" {
- a = append(a, k+"=")
- } else {
- v = Encode(v)
- a = append(a, k+"="+v)
- }
- }
- }
- sort.Strings(a)
- return strings.Join(a, "&")
-}
-
-func (s *V4Signer) canonicalHeaders(h http.Header) string {
- i, a := 0, make([]string, len(h))
- for k, v := range h {
- for j, w := range v {
- v[j] = strings.Trim(w, " ")
- }
- sort.Strings(v)
- a[i] = strings.ToLower(k) + ":" + strings.Join(v, ",")
- i++
- }
- sort.Strings(a)
- return strings.Join(a, "\n")
-}
-
-func (s *V4Signer) signedHeaders(h http.Header) string {
- i, a := 0, make([]string, len(h))
- for k, _ := range h {
- a[i] = strings.ToLower(k)
- i++
- }
- sort.Strings(a)
- return strings.Join(a, ";")
-}
-
-func (s *V4Signer) payloadHash(req *http.Request) string {
- var b []byte
- if req.Body == nil {
- b = []byte("")
- } else {
- var err error
- b, err = ioutil.ReadAll(req.Body)
- if err != nil {
- // TODO: I REALLY DON'T LIKE THIS PANIC!!!!
- panic(err)
- }
- }
- req.Body = ioutil.NopCloser(bytes.NewBuffer(b))
- return s.hash(string(b))
-}
-
-/*
-stringToSign method creates the string to sign accorting to Task 2 of the AWS Signature Version 4 Signing Process. (http://goo.gl/es1PAu)
-
- StringToSign =
- Algorithm + '\n' +
- RequestDate + '\n' +
- CredentialScope + '\n' +
- HexEncode(Hash(CanonicalRequest))
-*/
-func (s *V4Signer) stringToSign(t time.Time, creq string) string {
- w := new(bytes.Buffer)
- fmt.Fprint(w, "AWS4-HMAC-SHA256\n")
- fmt.Fprintf(w, "%s\n", t.Format(ISO8601BasicFormat))
- fmt.Fprintf(w, "%s\n", s.credentialScope(t))
- fmt.Fprintf(w, "%s", s.hash(creq))
- return w.String()
-}
-
-func (s *V4Signer) credentialScope(t time.Time) string {
- return fmt.Sprintf("%s/%s/%s/aws4_request", t.Format(ISO8601BasicFormatShort), s.region.Name, s.serviceName)
-}
-
-/*
-signature method calculates the AWS Signature Version 4 according to Task 3 of the AWS Signature Version 4 Signing Process. (http://goo.gl/j0Yqe1)
-
- signature = HexEncode(HMAC(derived-signing-key, string-to-sign))
-*/
-func (s *V4Signer) signature(t time.Time, sts string) string {
- h := s.hmac(s.derivedKey(t), []byte(sts))
- return fmt.Sprintf("%x", h)
-}
-
-/*
-derivedKey method derives a signing key to be used for signing a request.
-
- kSecret = Your AWS Secret Access Key
- kDate = HMAC("AWS4" + kSecret, Date)
- kRegion = HMAC(kDate, Region)
- kService = HMAC(kRegion, Service)
- kSigning = HMAC(kService, "aws4_request")
-*/
-func (s *V4Signer) derivedKey(t time.Time) []byte {
- h := s.hmac([]byte("AWS4"+s.auth.SecretKey), []byte(t.Format(ISO8601BasicFormatShort)))
- h = s.hmac(h, []byte(s.region.Name))
- h = s.hmac(h, []byte(s.serviceName))
- h = s.hmac(h, []byte("aws4_request"))
- return h
-}
-
-/*
-authorization method generates the authorization header value.
-*/
-func (s *V4Signer) authorization(header http.Header, t time.Time, signature string) string {
- w := new(bytes.Buffer)
- fmt.Fprint(w, "AWS4-HMAC-SHA256 ")
- fmt.Fprintf(w, "Credential=%s/%s, ", s.auth.AccessKey, s.credentialScope(t))
- fmt.Fprintf(w, "SignedHeaders=%s, ", s.signedHeaders(header))
- fmt.Fprintf(w, "Signature=%s", signature)
- return w.String()
-}
-
-// hash method calculates the sha256 hash for a given string
-func (s *V4Signer) hash(in string) string {
- h := sha256.New()
- fmt.Fprintf(h, "%s", in)
- return fmt.Sprintf("%x", h.Sum(nil))
-}
-
-// hmac method calculates the sha256 hmac for a given slice of bytes
-func (s *V4Signer) hmac(key, data []byte) []byte {
- h := hmac.New(sha256.New, key)
- h.Write(data)
- return h.Sum(nil)
-}
diff --git a/vendor/github.com/goamz/goamz/aws/sign_test.go b/vendor/github.com/goamz/goamz/aws/sign_test.go
deleted file mode 100644
index 4ce2ff9a0..000000000
--- a/vendor/github.com/goamz/goamz/aws/sign_test.go
+++ /dev/null
@@ -1,540 +0,0 @@
-package aws_test
-
-import (
- "fmt"
- "net/http"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-var _ = Suite(&V4SignerSuite{})
-
-type V4SignerSuite struct {
- auth aws.Auth
- region aws.Region
- cases []V4SignerSuiteCase
-}
-
-type V4SignerSuiteCase struct {
- label string
- request V4SignerSuiteCaseRequest
- canonicalRequest string
- stringToSign string
- signature string
- authorization string
-}
-
-type V4SignerSuiteCaseRequest struct {
- method string
- host string
- url string
- headers []string
- body string
-}
-
-func (s *V4SignerSuite) SetUpSuite(c *C) {
- s.auth = aws.Auth{AccessKey: "AKIDEXAMPLE", SecretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"}
- s.region = aws.USEast
-
- // Test cases from the Signature Version 4 Test Suite (http://goo.gl/nguvs0)
- s.cases = append(s.cases,
-
- // get-header-key-duplicate
- V4SignerSuiteCase{
- label: "get-header-key-duplicate",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT", "ZOO:zoobar", "zoo:foobar", "zoo:zoobar"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\nzoo:foobar,zoobar,zoobar\n\ndate;host;zoo\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n3c52f0eaae2b61329c0a332e3fa15842a37bc5812cf4d80eb64784308850e313",
- signature: "54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed",
- },
-
- // get-header-value-order
- V4SignerSuiteCase{
- label: "get-header-value-order",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT", "p:z", "p:a", "p:p", "p:a"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\np:a,a,p,z\n\ndate;host;p\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n94c0389fefe0988cbbedc8606f0ca0b485b48da010d09fc844b45b697c8924fe",
- signature: "d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d",
- },
-
- // get-header-value-trim
- V4SignerSuiteCase{
- label: "get-header-value-trim",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT", "p: phfft "},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\np:phfft\n\ndate;host;p\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\ndddd1902add08da1ac94782b05f9278c08dc7468db178a84f8950d93b30b1f35",
- signature: "debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592",
- },
-
- // get-relative-relative
- V4SignerSuiteCase{
- label: "get-relative-relative",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/foo/bar/../..",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // get-relative
- V4SignerSuiteCase{
- label: "get-relative",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/foo/..",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // get-slash-dot-slash
- V4SignerSuiteCase{
- label: "get-slash-dot-slash",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/./",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // get-slash-pointless-dot
- V4SignerSuiteCase{
- label: "get-slash-pointless-dot",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/./foo",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/foo\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n8021a97572ee460f87ca67f4e8c0db763216d84715f5424a843a5312a3321e2d",
- signature: "910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a",
- },
-
- // get-slash
- V4SignerSuiteCase{
- label: "get-slash",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "//",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // get-slashes
- V4SignerSuiteCase{
- label: "get-slashes",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "//foo//",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/foo/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n6bb4476ee8745730c9cb79f33a0c70baa6d8af29c0077fa12e4e8f1dd17e7098",
- signature: "b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19",
- },
-
- // get-space
- V4SignerSuiteCase{
- label: "get-space",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/%20/foo",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/%20/foo\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n69c45fb9fe3fd76442b5086e50b2e9fec8298358da957b293ef26e506fdfb54b",
- signature: "f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374",
- },
-
- // get-unreserved
- V4SignerSuiteCase{
- label: "get-unreserved",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\ndf63ee3247c0356c696a3b21f8d8490b01fa9cd5bc6550ef5ef5f4636b7b8901",
- signature: "830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e",
- },
-
- // get-utf8
- V4SignerSuiteCase{
- label: "get-utf8",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/%E1%88%B4",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/%E1%88%B4\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n27ba31df5dbc6e063d8f87d62eb07143f7f271c5330a917840586ac1c85b6f6b",
- signature: "8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74",
- },
-
- // get-vanilla-empty-query-key
- V4SignerSuiteCase{
- label: "get-vanilla-empty-query-key",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?foo=bar",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\nfoo=bar\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n0846c2945b0832deb7a463c66af5c4f8bd54ec28c438e67a214445b157c9ddf8",
- signature: "56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f",
- },
-
- // get-vanilla-space-query-parameters
- V4SignerSuiteCase{
- label: "get-vanilla-space-query-parameters",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?foo foo=bar bar",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\nfoo%20foo=bar%20bar\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n6a81658ae0a0a4f73aa72ca7d3b01c9cb0c5d4099f7a5ee897f5a571bfe6f7ff",
- signature: "c8556bc676129d0806ea8fe6ef182dc095666f4c1582c3d9751d47e4306037c9",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=c8556bc676129d0806ea8fe6ef182dc095666f4c1582c3d9751d47e4306037c9",
- },
-
- // get-vanilla-query-order-key-case
- V4SignerSuiteCase{
- label: "get-vanilla-query-order-key-case",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?foo=Zoo&foo=aha",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\nfoo=Zoo&foo=aha\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\ne25f777ba161a0f1baf778a87faf057187cf5987f17953320e3ca399feb5f00d",
- signature: "be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09",
- },
-
- // get-vanilla-query-order-key
- V4SignerSuiteCase{
- label: "get-vanilla-query-order-key",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?a=foo&b=foo",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\na=foo&b=foo\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n2f23d14fe13caebf6dfda346285c6d9c14f49eaca8f5ec55c627dd7404f7a727",
- signature: "0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b",
- },
-
- // get-vanilla-query-order-value
- V4SignerSuiteCase{
- label: "get-vanilla-query-order-value",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?foo=b&foo=a",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\nfoo=a&foo=b\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n33dffc220e89131f8f6157a35c40903daa658608d9129ff9489e5cf5bbd9b11b",
- signature: "feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc",
- },
-
- // get-vanilla-query-unreserved
- V4SignerSuiteCase{
- label: "get-vanilla-query-unreserved",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\nd2578f3156d4c9d180713d1ff20601d8a3eed0dd35447d24603d7d67414bd6b5",
- signature: "f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb",
- },
-
- // get-vanilla-query
- V4SignerSuiteCase{
- label: "get-vanilla-query",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // get-vanilla-ut8-query
- V4SignerSuiteCase{
- label: "get-vanilla-ut8-query",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/?ሴ=bar",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n%E1%88%B4=bar\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\nde5065ff39c131e6c2e2bd19cd9345a794bf3b561eab20b8d97b2093fc2a979e",
- signature: "6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c",
- },
-
- // get-vanilla
- V4SignerSuiteCase{
- label: "get-vanilla",
- request: V4SignerSuiteCaseRequest{
- method: "GET",
- host: "host.foo.com",
- url: "/",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "GET\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1",
- signature: "b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470",
- },
-
- // post-header-key-case
- V4SignerSuiteCase{
- label: "post-header-key-case",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4",
- signature: "22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726",
- },
-
- // post-header-key-sort
- V4SignerSuiteCase{
- label: "post-header-key-sort",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT", "ZOO:zoobar"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\nzoo:zoobar\n\ndate;host;zoo\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n34e1bddeb99e76ee01d63b5e28656111e210529efeec6cdfd46a48e4c734545d",
- signature: "b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a",
- },
-
- // post-header-value-case
- V4SignerSuiteCase{
- label: "post-header-value-case",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"DATE:Mon, 09 Sep 2011 23:36:00 GMT", "zoo:ZOOBAR"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\nzoo:ZOOBAR\n\ndate;host;zoo\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n3aae6d8274b8c03e2cc96fc7d6bda4b9bd7a0a184309344470b2c96953e124aa",
- signature: "273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7",
- },
-
- // post-vanilla-empty-query-value
- V4SignerSuiteCase{
- label: "post-vanilla-empty-query-value",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/?foo=bar",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "POST\n/\nfoo=bar\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\ncd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e",
- signature: "b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92",
- },
-
- // post-vanilla-query
- V4SignerSuiteCase{
- label: "post-vanilla-query",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/?foo=bar",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "POST\n/\nfoo=bar\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\ncd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e",
- signature: "b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92",
- },
-
- // post-vanilla
- V4SignerSuiteCase{
- label: "post-vanilla",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- },
- canonicalRequest: "POST\n/\n\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ndate;host\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4",
- signature: "22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726",
- },
-
- // post-x-www-form-urlencoded-parameters
- V4SignerSuiteCase{
- label: "post-x-www-form-urlencoded-parameters",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"Content-Type:application/x-www-form-urlencoded; charset=utf8", "Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- body: "foo=bar",
- },
- canonicalRequest: "POST\n/\n\ncontent-type:application/x-www-form-urlencoded; charset=utf8\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ncontent-type;date;host\n3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\nc4115f9e54b5cecf192b1eaa23b8e88ed8dc5391bd4fde7b3fff3d9c9fe0af1f",
- signature: "b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71",
- },
-
- // post-x-www-form-urlencoded
- V4SignerSuiteCase{
- label: "post-x-www-form-urlencoded",
- request: V4SignerSuiteCaseRequest{
- method: "POST",
- host: "host.foo.com",
- url: "/",
- headers: []string{"Content-Type:application/x-www-form-urlencoded", "Date:Mon, 09 Sep 2011 23:36:00 GMT"},
- body: "foo=bar",
- },
- canonicalRequest: "POST\n/\n\ncontent-type:application/x-www-form-urlencoded\ndate:Mon, 09 Sep 2011 23:36:00 GMT\nhost:host.foo.com\n\ncontent-type;date;host\n3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a",
- stringToSign: "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/host/aws4_request\n4c5c6e4b52fb5fb947a8733982a8a5a61b14f04345cbfe6e739236c76dd48f74",
- signature: "5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc",
- authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc",
- },
- )
-}
-
-func (s *V4SignerSuite) TestCases(c *C) {
- signer := aws.NewV4Signer(s.auth, "host", s.region)
-
- for _, testCase := range s.cases {
-
- req, err := http.NewRequest(testCase.request.method, "http://"+testCase.request.host+testCase.request.url, strings.NewReader(testCase.request.body))
- c.Assert(err, IsNil, Commentf("Testcase: %s", testCase.label))
- for _, v := range testCase.request.headers {
- h := strings.SplitN(v, ":", 2)
- req.Header.Add(h[0], h[1])
- }
- req.Header.Set("host", req.Host)
-
- t := signer.RequestTime(req)
-
- canonicalRequest := signer.CanonicalRequest(req)
- c.Check(canonicalRequest, Equals, testCase.canonicalRequest, Commentf("Testcase: %s", testCase.label))
-
- stringToSign := signer.StringToSign(t, canonicalRequest)
- c.Check(stringToSign, Equals, testCase.stringToSign, Commentf("Testcase: %s", testCase.label))
-
- signature := signer.Signature(t, stringToSign)
- c.Check(signature, Equals, testCase.signature, Commentf("Testcase: %s", testCase.label))
-
- authorization := signer.Authorization(req.Header, t, signature)
- c.Check(authorization, Equals, testCase.authorization, Commentf("Testcase: %s", testCase.label))
-
- signer.Sign(req)
- c.Check(req.Header.Get("Authorization"), Equals, testCase.authorization, Commentf("Testcase: %s", testCase.label))
- }
-}
-
-func ExampleV4Signer() {
- // Get auth from env vars
- auth, err := aws.EnvAuth()
- if err != nil {
- fmt.Println(err)
- }
-
- // Create a signer with the auth, name of the service, and aws region
- signer := aws.NewV4Signer(auth, "dynamodb", aws.USEast)
-
- // Create a request
- req, err := http.NewRequest("POST", aws.USEast.DynamoDBEndpoint, strings.NewReader("sample_request"))
- if err != nil {
- fmt.Println(err)
- }
-
- // Date or x-amz-date header is required to sign a request
- req.Header.Add("Date", time.Now().UTC().Format(http.TimeFormat))
-
- // Sign the request
- signer.Sign(req)
-
- // Issue signed request
- http.DefaultClient.Do(req)
-}
diff --git a/vendor/github.com/goamz/goamz/cloudformation/cloudformation.go b/vendor/github.com/goamz/goamz/cloudformation/cloudformation.go
deleted file mode 100644
index 00081d0c2..000000000
--- a/vendor/github.com/goamz/goamz/cloudformation/cloudformation.go
+++ /dev/null
@@ -1,837 +0,0 @@
-//
-// cloudformation: This package provides types and functions to interact with the AWS CloudFormation API
-//
-// Depends on https://github.com/goamz/goamz
-//
-
-package cloudformation
-
-import (
- "encoding/xml"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-// The CloudFormation type encapsulates operations within a specific EC2 region.
-type CloudFormation struct {
- aws.Auth
- aws.Region
-}
-
-// New creates a new CloudFormation Client.
-func New(auth aws.Auth, region aws.Region) *CloudFormation {
-
- return &CloudFormation{auth, region}
-
-}
-
-const debug = false
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by the AWS CloudFormation API.
-//
-// See http://goo.gl/zDZbuQ for more details.
-type Error struct {
- // HTTP status code (200, 403, ...)
- StatusCode int
- // Error type
- Type string `xml:"Type"`
- // CloudFormation error code
- Code string `xml:"Code"`
- // The human-oriented error message
- Message string `xml:"Message"`
- RequestId string `xml:"RequestID"`
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-type xmlErrors struct {
- RequestId string `xml:"RequestId"`
- Errors []Error `xml:"Error"`
-}
-
-func (c *CloudFormation) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2010-05-15"
-
- data := strings.NewReader(multimap(params).Encode())
-
- hreq, err := http.NewRequest("POST", c.Region.CloudFormationEndpoint+"/", data)
- if err != nil {
- return err
- }
-
- hreq.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
-
- token := c.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(c.Auth, "cloudformation", c.Region)
- signer.Sign(hreq)
-
- if debug {
- log.Printf("%v -> {\n", hreq)
- }
- r, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- log.Printf("Error calling Amazon")
- return err
- }
-
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
-
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-// addParamsList adds params in the form of param.member.N to the params map
-func addParamsList(params map[string]string, label string, ids []string) {
- for i, id := range ids {
- params[label+"."+strconv.Itoa(i+1)] = id
- }
-}
-
-// -----------------------------------------------------------------------
-// API Supported Types and Methods
-
-// SimpleResp is the basic response from most actions.
-type SimpleResp struct {
- XMLName xml.Name
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// CancelUpdateStack cancels an update on the specified stack.
-// If the call completes successfully, the stack will roll back the update and revert
-// to the previous stack configuration.
-//
-// See http://goo.gl/ZE6fOa for more details
-func (c *CloudFormation) CancelUpdateStack(stackName string) (resp *SimpleResp, err error) {
- params := makeParams("CancelUpdateStack")
-
- params["StackName"] = stackName
-
- resp = new(SimpleResp)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Parameter encapsulates the cloudstack paramter data type
-//
-// See http://goo.gl/2rg9eG for more details
-type Parameter struct {
- ParameterKey string `xml:"ParameterKey"`
- ParameterValue string `xml:"ParameterValue"`
- UsePreviousValue bool `xml:"UsePreviousValue"`
-}
-
-type Tag struct {
- Key string `xml:"Key"`
- Value string `xml:"Value"`
-}
-
-// CreateStackParams wraps CreateStack request options
-//
-// See http://goo.gl/yDZYuV for more information
-type CreateStackParams struct {
- Capabilities []string
- DisableRollback bool
- NotificationARNs []string
- OnFailure string
- Parameters []Parameter
- StackName string
- StackPolicyBody string
- StackPolicyURL string
- Tags []Tag
- TemplateBody string
- TemplateURL string
- TimeoutInMinutes int
-}
-
-// CreateStackResponse wraps a CreateStack call response
-//
-// See http://goo.gl/yDZYuV for more details
-type CreateStackResponse struct {
- StackId string `xml:"CreateStackResult>StackId"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// CreateStack creates a stack as specified in the template. After the call completes successfully,
-// the stack creation starts.
-//
-// Required params: StackName
-//
-// See http://goo.gl/yDZYuV for more details
-func (c *CloudFormation) CreateStack(options *CreateStackParams) (
- resp *CreateStackResponse, err error) {
- params := makeParams("CreateStack")
-
- params["StackName"] = options.StackName
-
- if options.DisableRollback {
- params["DisableRollback"] = strconv.FormatBool(options.DisableRollback)
- }
- if options.OnFailure != "" {
- params["OnFailure"] = options.OnFailure
- }
- if options.StackPolicyBody != "" {
- params["StackPolicyBody"] = options.StackPolicyBody
- }
- if options.StackPolicyURL != "" {
- params["StackPolicyURL"] = options.StackPolicyURL
- }
- if options.TemplateBody != "" {
- params["TemplateBody"] = options.TemplateBody
- }
- if options.TemplateURL != "" {
- params["TemplateURL"] = options.TemplateURL
- }
- if options.TimeoutInMinutes != 0 {
- params["TimeoutInMinutes"] = strconv.Itoa(options.TimeoutInMinutes)
- }
- if len(options.Capabilities) > 0 {
- addParamsList(params, "Capabilities.member", options.Capabilities)
- }
- if len(options.NotificationARNs) > 0 {
- addParamsList(params, "NotificationARNs.member", options.NotificationARNs)
- }
- // Add any parameters
- for i, t := range options.Parameters {
- key := "Parameters.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "ParameterKey")] = t.ParameterKey
- params[fmt.Sprintf(key, index, "ParameterValue")] = t.ParameterValue
- params[fmt.Sprintf(key, index, "UsePreviousValue")] = strconv.FormatBool(t.UsePreviousValue)
- }
- // Add any tags
- for i, t := range options.Tags {
- key := "Tags.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "Key")] = t.Key
- params[fmt.Sprintf(key, index, "Value")] = t.Value
- }
-
- resp = new(CreateStackResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteStack deletes a specified stack.
-// Once the call completes successfully, stack deletion starts.
-//
-// See http://goo.gl/CVMpxC for more details
-func (c *CloudFormation) DeleteStack(stackName string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteStack")
-
- params["StackName"] = stackName
-
- resp = new(SimpleResp)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StackEvent encapsulates the StackEvent data type
-//
-// See http://goo.gl/EHwiMf for more details
-type StackEvent struct {
- EventId string `xml:"EventId"`
- LogicalResourceId string `xml:"LogicalResourceId"`
- PhysicalResourceId string `xml:"PhysicalResourceId"`
- ResourceProperties string `xml:"ResourceProperties"`
- ResourceStatus string `xml:"ResourceStatus"`
- ResourceStatusReason string `xml:"ResourceStatusReason"`
- ResourceType string `xml:"ResourceType"`
- StackId string `xml:"StackId"`
- StackName string `xml:"StackName"`
- Timestamp time.Time `xml:"Timestamp"`
-}
-
-// DescribeStackEventsResponse wraps a response returned by DescribeStackEvents request
-//
-// See http://goo.gl/zqj4Bz for more details
-type DescribeStackEventsResponse struct {
- NextToken string `xml:"DescribeStackEventsResult>NextToken"`
- StackEvents []StackEvent `xml:"DescribeStackEventsResult>StackEvents>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeStackEvents returns all stack related events for a specified stack.
-//
-// See http://goo.gl/zqj4Bz for more details
-func (c *CloudFormation) DescribeStackEvents(stackName string, nextToken string) (
- resp *DescribeStackEventsResponse, err error) {
- params := makeParams("DescribeStackEvents")
-
- if stackName != "" {
- params["StackName"] = stackName
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- resp = new(DescribeStackEventsResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StackResourceDetail encapsulates the StackResourceDetail data type
-//
-// See http://goo.gl/flce6I for more details
-type StackResourceDetail struct {
- Description string `xml:"Description"`
- LastUpdatedTimestamp time.Time `xml:"LastUpdatedTimestamp"`
- LogicalResourceId string `xml:"LogicalResourceId"`
- Metadata string `xml:"Metadata"`
- PhysicalResourceId string `xml:"PhysicalResourceId"`
- ResourceStatus string `xml:"ResourceStatus"`
- ResourceStatusReason string `xml:"ResourceStatusReason"`
- ResourceType string `xml:"ResourceType"`
- StackId string `xml:"StackId"`
- StackName string `xml:"StackName"`
-}
-
-// DescribeStackResourceResponse wraps a response returned by DescribeStackResource request
-//
-// See http://goo.gl/6pfPFs for more details
-type DescribeStackResourceResponse struct {
- StackResourceDetail StackResourceDetail `xml:"DescribeStackResourceResult>StackResourceDetail"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeStackResource returns a description of the specified resource in the specified stack.
-// For deleted stacks, DescribeStackResource returns resource information
-// for up to 90 days after the stack has been deleted.
-//
-// Required params: stackName, logicalResourceId
-//
-// See http://goo.gl/6pfPFs for more details
-func (c *CloudFormation) DescribeStackResource(stackName string, logicalResourceId string) (
- resp *DescribeStackResourceResponse, err error) {
- params := makeParams("DescribeStackResource")
-
- params["StackName"] = stackName
- params["LogicalResourceId"] = logicalResourceId
-
- resp = new(DescribeStackResourceResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StackResource encapsulates the StackResource data type
-//
-// See http://goo.gl/j4eli5 for more details
-type StackResource struct {
- Description string `xml:"Description"`
- LogicalResourceId string `xml:"LogicalResourceId"`
- PhysicalResourceId string `xml:"PhysicalResourceId"`
- ResourceStatus string `xml:"ResourceStatus"`
- ResourceStatusReason string `xml:"ResourceStatusReason"`
- ResourceType string `xml:"ResourceType"`
- StackId string `xml:"StackId"`
- StackName string `xml:"StackName"`
- Timestamp time.Time `xml:"Timestamp"`
-}
-
-// DescribeStackResourcesResponse wraps a response returned by DescribeStackResources request
-//
-// See http://goo.gl/YnY5rs for more details
-type DescribeStackResourcesResponse struct {
- StackResources []StackResource `xml:"DescribeStackResourcesResult>StackResources>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeStackResources returns AWS resource descriptions for running and deleted stacks.
-// If stackName is specified, all the associated resources that are part of the stack are returned.
-// If physicalResourceId is specified, the associated resources of the stack that the resource
-// belongs to are returned.
-//
-// Only the first 100 resources will be returned. If your stack has more resources than this,
-// you should use ListStackResources instead.
-//
-// See http://goo.gl/YnY5rs for more details
-func (c *CloudFormation) DescribeStackResources(stackName, physicalResourceId, logicalResourceId string) (
- resp *DescribeStackResourcesResponse, err error) {
- params := makeParams("DescribeStackResources")
-
- if stackName != "" {
- params["StackName"] = stackName
- }
- if physicalResourceId != "" {
- params["PhysicalResourceId"] = physicalResourceId
- }
- if logicalResourceId != "" {
- params["LogicalResourceId"] = logicalResourceId
- }
-
- resp = new(DescribeStackResourcesResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Output encapsulates the Output AWS data type
-//
-// See http://goo.gl/UOn7q6 for more information
-type Output struct {
- Description string `xml:"Description"`
- OutputKey string `xml:"OutputKey"`
- OutputValue string `xml:"OutputValue"`
-}
-
-// Stack encapsulates the Stack AWS data type
-//
-// See http://goo.gl/yDZYuV for more information
-type Stack struct {
- Capabilities []string `xml:"Capabilities>member"`
- CreationTime time.Time `xml:"CreationTime"`
- Description string `xml:"Description"`
- DisableRollback bool `xml:"DisableRollback"`
- LastUpdatedTime time.Time `xml:"LastUpdatedTime"`
- NotificationARNs []string `xml:"NotificationARNs>member"`
- Outputs []Output `xml:"Outputs>member"`
- Parameters []Parameter `xml:"Parameters>member"`
- StackId string `xml:"StackId"`
- StackName string `xml:"StackName"`
- StackStatus string `xml:"StackStatus"`
- StackStatusReason string `xml:"StackStatusReason"`
- Tags []Tag `xml:"Tags>member"`
- TimeoutInMinutes int `xml:"TimeoutInMinutes"`
-}
-
-// DescribeStacksResponse wraps a response returned by DescribeStacks request
-//
-// See http://goo.gl/UOLsXD for more information
-type DescribeStacksResponse struct {
- NextToken string `xml:"DescribeStacksResult>NextToken"`
- Stacks []Stack `xml:"DescribeStacksResult>Stacks>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeStacks returns the description for the specified stack;
-// If no stack name was specified, then it returns the description for all the stacks created.
-//
-// See http://goo.gl/UOLsXD for more information
-func (c *CloudFormation) DescribeStacks(stackName string, nextToken string) (
- resp *DescribeStacksResponse, err error) {
- params := makeParams("DescribeStacks")
-
- if stackName != "" {
- params["StackName"] = stackName
- }
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- resp = new(DescribeStacksResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// EstimateTemplateCostResponse wraps a response returned by EstimateTemplateCost request
-//
-// See http://goo.gl/PD9hle for more information
-type EstimateTemplateCostResponse struct {
- Url string `xml:"EstimateTemplateCostResult>Url"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// EstimateTemplateCost returns the estimated monthly cost of a template.
-// The return value is an AWS Simple Monthly Calculator URL with a query string that describes
-// the resources required to run the template.
-//
-// See http://goo.gl/PD9hle for more information
-func (c *CloudFormation) EstimateTemplateCost(parameters []Parameter, templateBody, templateUrl string) (
- resp *EstimateTemplateCostResponse, err error) {
- params := makeParams("EstimateTemplateCost")
-
- if templateBody != "" {
- params["TemplateBody"] = templateBody
- }
- if templateUrl != "" {
- params["TemplateURL"] = templateUrl
- }
- // Add any parameters
- for i, t := range parameters {
- key := "Parameters.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "ParameterKey")] = t.ParameterKey
- params[fmt.Sprintf(key, index, "ParameterValue")] = t.ParameterValue
- params[fmt.Sprintf(key, index, "UsePreviousValue")] = strconv.FormatBool(t.UsePreviousValue)
- }
-
- resp = new(EstimateTemplateCostResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// GetStackPolicyResponse wraps a response returned by GetStackPolicy request
-//
-// See http://goo.gl/iZFSgy for more information
-type GetStackPolicyResponse struct {
- StackPolicyBody string `xml:"GetStackPolicyResult>StackPolicyBody"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// GetStackPolicy returns the stack policy for a specified stack. If a stack doesn't have a policy,
-// a null value is returned.
-//
-// See http://goo.gl/iZFSgy for more information
-func (c *CloudFormation) GetStackPolicy(stackName string) (
- resp *GetStackPolicyResponse, err error) {
- params := makeParams("GetStackPolicy")
-
- params["StackName"] = stackName
-
- resp = new(GetStackPolicyResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// GetTemplateResponse wraps a response returned by GetTemplate request
-//
-// See http://goo.gl/GU59CB for more information
-type GetTemplateResponse struct {
- TemplateBody string `xml:"GetTemplateResult>TemplateBody"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// GetTemplate returns the template body for a specified stack.
-// You can get the template for running or deleted stacks
-//
-// Required Params: StackName - The name or the unique identifier associated with the stack,
-// which are not always interchangeable:
-// Running stacks: You can specify either the stack's name or its unique stack ID.
-// Deleted stacks: You must specify the unique stack ID.
-//
-// See http://goo.gl/GU59CB for more information
-func (c *CloudFormation) GetTemplate(stackName string) (
- resp *GetTemplateResponse, err error) {
- params := makeParams("GetTemplate")
-
- params["StackName"] = stackName
-
- resp = new(GetTemplateResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StackResourceSummary encapsulates the StackResourceSummary data type
-//
-// See http://goo.gl/Af0vcm for more details
-type StackResourceSummary struct {
- LastUpdatedTimestamp time.Time `xml:"LastUpdatedTimestamp"`
- LogicalResourceId string `xml:"LogicalResourceId"`
- PhysicalResourceId string `xml:"PhysicalResourceId"`
- ResourceStatus string `xml:"ResourceStatus"`
- ResourceStatusReason string `xml:"ResourceStatusReason"`
- ResourceType string `xml:"ResourceType"`
-}
-
-// ListStackResourcesResponse wraps a response returned by ListStackResources request
-//
-// See http://goo.gl/JUCgLf for more details
-type ListStackResourcesResponse struct {
- NextToken string `xml:"ListStackResourcesResult>NextToken"`
- StackResourceSummaries []StackResourceSummary `xml:"ListStackResourcesResult>StackResourceSummaries>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListStackResources returns descriptions of all resources of the specified stack.
-// For deleted stacks, ListStackResources returns resource information for up to 90 days
-// after the stack has been deleted.
-//
-// Required Params: stackName - the name or the unique identifier associated with the stack,
-// which are not always interchangeable:
-// Running stacks: You can specify either the stack's name or its unique stack ID.
-// Deleted stacks: You must specify the unique stack ID.
-//
-// See http://goo.gl/JUCgLf for more details
-func (c *CloudFormation) ListStackResources(stackName, nextToken string) (
- resp *ListStackResourcesResponse, err error) {
- params := makeParams("ListStackResources")
-
- params["StackName"] = stackName
-
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- resp = new(ListStackResourcesResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StackSummary encapsulates the StackSummary data type
-//
-// See http://goo.gl/35j3wf for more details
-type StackSummary struct {
- CreationTime time.Time `xml:"CreationTime"`
- DeletionTime time.Time `xml:"DeletionTime"`
- LastUpdatedTime time.Time `xml:"LastUpdatedTime"`
- StackId string `xml:"StackId"`
- StackName string `xml:"StackName"`
- StackStatus string `xml:"StackStatus"`
- StackStatusReason string `xml:"StackStatusReason"`
- TemplateDescription string `xml:"TemplateDescription"`
-}
-
-// ListStacksResponse wraps a response returned by ListStacks request
-//
-// See http://goo.gl/UWi6nm for more details
-type ListStacksResponse struct {
- NextToken string `xml:"ListStacksResult>NextToken"`
- StackSummaries []StackSummary `xml:"ListStacksResult>StackSummaries>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListStacks Returns the summary information for stacks whose status matches the specified StackStatusFilter.
-// Summary information for stacks that have been deleted is kept for 90 days after the stack is deleted.
-// If no StackStatusFilter is specified, summary information for all stacks is returned
-// (including existing stacks and stacks that have been deleted).
-//
-// See http://goo.gl/UWi6nm for more details
-func (c *CloudFormation) ListStacks(stackStatusFilters []string, nextToken string) (
- resp *ListStacksResponse, err error) {
- params := makeParams("ListStacks")
-
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- if len(stackStatusFilters) > 0 {
- addParamsList(params, "StackStatusFilter.member", stackStatusFilters)
- }
-
- resp = new(ListStacksResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SetStackPolicy sets a stack policy for a specified stack.
-//
-// Required Params: stackName
-//
-// See http://goo.gl/iY9ohu for more information
-func (c *CloudFormation) SetStackPolicy(stackName, stackPolicyBody, stackPolicyUrl string) (
- resp *SimpleResp, err error) {
- params := makeParams("SetStackPolicy")
-
- params["StackName"] = stackName
-
- if stackPolicyBody != "" {
- params["StackPolicyBody"] = stackPolicyBody
- }
- if stackPolicyUrl != "" {
- params["StackPolicyURL"] = stackPolicyUrl
- }
-
- resp = new(SimpleResp)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// UpdateStackParams wraps UpdateStack request options
-//
-// See http://goo.gl/LvkhZq for more information
-type UpdateStackParams struct {
- Capabilities []string
- NotificationARNs []string
- Parameters []Parameter
- StackName string
- StackPolicyBody string
- StackPolicyDuringUpdateBody string
- StackPolicyDuringUpdateURL string
- StackPolicyURL string
- TemplateBody string
- TemplateURL string
- UsePreviousTemplate bool
-}
-
-// UpdateStackResponse wraps the UpdateStack call response
-//
-// See http://goo.gl/LvkhZq for more information
-type UpdateStackResponse struct {
- StackId string `xml:"UpdateStackResult>StackId"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// UpdateStack updates a stack as specified in the template.
-// After the call completes successfully, the stack update starts.
-// You can check the status of the stack via the DescribeStacks action.
-//
-// Required Params: options.StackName
-//
-// See http://goo.gl/LvkhZq for more information
-func (c *CloudFormation) UpdateStack(options *UpdateStackParams) (
- resp *UpdateStackResponse, err error) {
- params := makeParams("UpdateStack")
-
- params["StackName"] = options.StackName
-
- if options.StackPolicyBody != "" {
- params["StackPolicyBody"] = options.StackPolicyBody
- }
- if options.StackPolicyDuringUpdateBody != "" {
- params["StackPolicyDuringUpdateBody"] = options.StackPolicyDuringUpdateBody
- }
- if options.StackPolicyDuringUpdateURL != "" {
- params["StackPolicyDuringUpdateURL"] = options.StackPolicyDuringUpdateURL
- }
- if options.StackPolicyURL != "" {
- params["StackPolicyURL"] = options.StackPolicyURL
- }
- if options.TemplateBody != "" {
- params["TemplateBody"] = options.TemplateBody
- }
- if options.TemplateURL != "" {
- params["TemplateURL"] = options.TemplateURL
- }
- if options.UsePreviousTemplate {
- params["UsePreviousTemplate"] = strconv.FormatBool(options.UsePreviousTemplate)
- }
-
- if len(options.Capabilities) > 0 {
- addParamsList(params, "Capabilities.member", options.Capabilities)
- }
- if len(options.NotificationARNs) > 0 {
- addParamsList(params, "NotificationARNs.member", options.NotificationARNs)
- }
- // Add any parameters
- for i, t := range options.Parameters {
- key := "Parameters.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "ParameterKey")] = t.ParameterKey
- params[fmt.Sprintf(key, index, "ParameterValue")] = t.ParameterValue
- params[fmt.Sprintf(key, index, "UsePreviousValue")] = strconv.FormatBool(t.UsePreviousValue)
- }
-
- resp = new(UpdateStackResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// TemplateParameter encapsulates the AWS TemplateParameter data type
-//
-// See http://goo.gl/OBhNzk for more information
-type TemplateParameter struct {
- DefaultValue string `xml:"DefaultValue"`
- Description string `xml:Description"`
- NoEcho bool `xml:NoEcho"`
- ParameterKey string `xml:ParameterKey"`
-}
-
-// ValidateTemplateResponse wraps the ValidateTemplate call response
-//
-// See http://goo.gl/OBhNzk for more information
-type ValidateTemplateResponse struct {
- Capabilities []string `xml:"ValidateTemplateResult>Capabilities>member"`
- CapabilitiesReason string `xml:"ValidateTemplateResult>CapabilitiesReason"`
- Description string `xml:"ValidateTemplateResult>Description"`
- Parameters []TemplateParameter `xml:"ValidateTemplateResult>Parameters>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ValidateTemplate validates a specified template.
-//
-// See http://goo.gl/OBhNzk for more information
-func (c *CloudFormation) ValidateTemplate(templateBody, templateUrl string) (
- resp *ValidateTemplateResponse, err error) {
- params := makeParams("ValidateTemplate")
-
- if templateBody != "" {
- params["TemplateBody"] = templateBody
- }
- if templateUrl != "" {
- params["TemplateURL"] = templateUrl
- }
-
- resp = new(ValidateTemplateResponse)
- if err := c.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
diff --git a/vendor/github.com/goamz/goamz/cloudformation/cloudformation_test.go b/vendor/github.com/goamz/goamz/cloudformation/cloudformation_test.go
deleted file mode 100644
index 1937e8042..000000000
--- a/vendor/github.com/goamz/goamz/cloudformation/cloudformation_test.go
+++ /dev/null
@@ -1,653 +0,0 @@
-package cloudformation_test
-
-import (
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "github.com/goamz/goamz/aws"
- cf "github.com/goamz/goamz/cloudformation"
- "github.com/goamz/goamz/testutil"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- cf *cf.CloudFormation
-}
-
-var testServer = testutil.NewHTTPServer()
-
-var mockTest bool
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.cf = cf.New(auth, aws.Region{CloudFormationEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestCancelUpdateStack(c *C) {
- testServer.Response(200, nil, CancelUpdateStackResponse)
-
- resp, err := s.cf.CancelUpdateStack("foo")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "CancelUpdateStack")
- c.Assert(values.Get("StackName"), Equals, "foo")
- // Response test
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestCreateStack(c *C) {
- testServer.Response(200, nil, CreateStackResponse)
-
- stackParams := &cf.CreateStackParams{
- NotificationARNs: []string{"arn:aws:sns:us-east-1:1234567890:my-topic"},
- Parameters: []cf.Parameter{
- {
- ParameterKey: "AvailabilityZone",
- ParameterValue: "us-east-1a",
- },
- },
- StackName: "MyStack",
- TemplateBody: "[Template Document]",
- }
- resp, err := s.cf.CreateStack(stackParams)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "CreateStack")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NotificationARNs.member.1"), Equals, "arn:aws:sns:us-east-1:1234567890:my-topic")
- c.Assert(values.Get("TemplateBody"), Equals, "[Template Document]")
- c.Assert(values.Get("Parameters.member.1.ParameterKey"), Equals, "AvailabilityZone")
- c.Assert(values.Get("Parameters.member.1.ParameterValue"), Equals, "us-east-1a")
- // Response test
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
- c.Assert(resp.StackId, Equals, "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83")
-}
-
-func (s *S) TestCreateStackWithInvalidParams(c *C) {
- testServer.Response(400, nil, CreateStackWithInvalidParamsResponse)
- //testServer.Response(200, nil, DeleteAutoScalingGroupResponse)
-
- cfTemplate := `
-{
- "AWSTemplateFormatVersion" : "2010-09-09",
- "Description" : "Sample template",
- "Parameters" : {
- "KeyName" : {
- "Description" : "key pair",
- "Type" : "String"
- }
- },
- "Resources" : {
- "Ec2Instance" : {
- "Type" : "AWS::EC2::Instance",
- "Properties" : {
- "KeyName" : { "Ref" : "KeyName" },
- "ImageId" : "ami-7f418316",
- "UserData" : { "Fn::Base64" : "80" }
- }
- }
- },
- "Outputs" : {
- "InstanceId" : {
- "Description" : "InstanceId of the newly created EC2 instance",
- "Value" : { "Ref" : "Ec2Instance" }
- }
-}`
-
- stackParams := &cf.CreateStackParams{
- Capabilities: []string{"CAPABILITY_IAM"},
- DisableRollback: true,
- NotificationARNs: []string{
- "arn:aws:sns:us-east-1:1234567890:my-topic",
- "arn:aws:sns:us-east-1:1234567890:my-topic2",
- },
- OnFailure: "ROLLBACK",
- Parameters: []cf.Parameter{
- {
- ParameterKey: "AvailabilityZone",
- ParameterValue: "us-east-1a",
- },
- },
- StackName: "MyStack",
- StackPolicyBody: "{PolicyBody}",
- StackPolicyURL: "http://stack-policy-url",
- Tags: []cf.Tag{
- {
- Key: "TagKey",
- Value: "TagValue",
- },
- },
- TemplateBody: cfTemplate,
- TemplateURL: "http://url",
- TimeoutInMinutes: 20,
- }
- resp, err := s.cf.CreateStack(stackParams)
- c.Assert(err, NotNil)
- c.Assert(resp, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "CreateStack")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NotificationARNs.member.1"), Equals, "arn:aws:sns:us-east-1:1234567890:my-topic")
- c.Assert(values.Get("NotificationARNs.member.2"), Equals, "arn:aws:sns:us-east-1:1234567890:my-topic2")
- c.Assert(values.Get("Capabilities.member.1"), Equals, "CAPABILITY_IAM")
- c.Assert(values.Get("TemplateBody"), Equals, cfTemplate)
- c.Assert(values.Get("TemplateURL"), Equals, "http://url")
- c.Assert(values.Get("StackPolicyBody"), Equals, "{PolicyBody}")
- c.Assert(values.Get("StackPolicyURL"), Equals, "http://stack-policy-url")
- c.Assert(values.Get("OnFailure"), Equals, "ROLLBACK")
- c.Assert(values.Get("DisableRollback"), Equals, "true")
- c.Assert(values.Get("Tags.member.1.Key"), Equals, "TagKey")
- c.Assert(values.Get("Tags.member.1.Value"), Equals, "TagValue")
- c.Assert(values.Get("Parameters.member.1.ParameterKey"), Equals, "AvailabilityZone")
- c.Assert(values.Get("Parameters.member.1.ParameterValue"), Equals, "us-east-1a")
- c.Assert(values.Get("TimeoutInMinutes"), Equals, "20")
-
- // Response test
- c.Assert(err.(*cf.Error).RequestId, Equals, "70a76d42-9665-11e2-9fdf-211deEXAMPLE")
- c.Assert(err.(*cf.Error).Message, Equals, "Either Template URL or Template Body must be specified.")
- c.Assert(err.(*cf.Error).Type, Equals, "Sender")
- c.Assert(err.(*cf.Error).Code, Equals, "ValidationError")
- c.Assert(err.(*cf.Error).StatusCode, Equals, 400)
-
-}
-
-func (s *S) TestDeleteStack(c *C) {
- testServer.Response(200, nil, DeleteStackResponse)
-
- resp, err := s.cf.DeleteStack("foo")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "DeleteStack")
- c.Assert(values.Get("StackName"), Equals, "foo")
- // Response test
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestDescribeStackEvents(c *C) {
- testServer.Response(200, nil, DescribeStackEventsResponse)
-
- resp, err := s.cf.DescribeStackEvents("MyStack", "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- t1, _ := time.Parse(time.RFC3339, "2010-07-27T22:26:28Z")
- t2, _ := time.Parse(time.RFC3339, "2010-07-27T22:27:28Z")
- t3, _ := time.Parse(time.RFC3339, "2010-07-27T22:28:28Z")
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "DescribeStackEvents")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NextToken"), Equals, "")
-
- // Response test
- expected := &cf.DescribeStackEventsResponse{
- StackEvents: []cf.StackEvent{
- {
- EventId: "Event-1-Id",
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MyStack",
- PhysicalResourceId: "MyStack_One",
- ResourceType: "AWS::CloudFormation::Stack",
- Timestamp: t1,
- ResourceStatus: "CREATE_IN_PROGRESS",
- ResourceStatusReason: "User initiated",
- },
- {
- EventId: "Event-2-Id",
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MyDBInstance",
- PhysicalResourceId: "MyStack_DB1",
- ResourceType: "AWS::SecurityGroup",
- Timestamp: t2,
- ResourceStatus: "CREATE_IN_PROGRESS",
- ResourceProperties: "{\"GroupDescription\":...}",
- },
- {
- EventId: "Event-3-Id",
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MySG1",
- PhysicalResourceId: "MyStack_SG1",
- ResourceType: "AWS::SecurityGroup",
- Timestamp: t3,
- ResourceStatus: "CREATE_COMPLETE",
- },
- },
- NextToken: "",
- RequestId: "4af14eec-350e-11e4-b260-EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeStackResource(c *C) {
- testServer.Response(200, nil, DescribeStackResourceResponse)
-
- resp, err := s.cf.DescribeStackResource("MyStack", "MyDBInstance")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "DescribeStackResource")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("LogicalResourceId"), Equals, "MyDBInstance")
- t, _ := time.Parse(time.RFC3339, "2011-07-07T22:27:28Z")
- // Response test
- expected := &cf.DescribeStackResourceResponse{
- StackResourceDetail: cf.StackResourceDetail{
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MyDBInstance",
- PhysicalResourceId: "MyStack_DB1",
- ResourceType: "AWS::RDS::DBInstance",
- LastUpdatedTimestamp: t,
- ResourceStatus: "CREATE_COMPLETE",
- },
- RequestId: "4af14eec-350e-11e4-b260-EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeStackResources(c *C) {
- testServer.Response(200, nil, DescribeStackResourcesResponse)
-
- resp, err := s.cf.DescribeStackResources("MyStack", "", "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- t1, _ := time.Parse(time.RFC3339, "2010-07-27T22:27:28Z")
- t2, _ := time.Parse(time.RFC3339, "2010-07-27T22:28:28Z")
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "DescribeStackResources")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("PhysicalResourceId"), Equals, "")
- c.Assert(values.Get("LogicalResourceId"), Equals, "")
-
- // Response test
- expected := &cf.DescribeStackResourcesResponse{
- StackResources: []cf.StackResource{
- {
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MyDBInstance",
- PhysicalResourceId: "MyStack_DB1",
- ResourceType: "AWS::DBInstance",
- Timestamp: t1,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- LogicalResourceId: "MyAutoScalingGroup",
- PhysicalResourceId: "MyStack_ASG1",
- ResourceType: "AWS::AutoScalingGroup",
- Timestamp: t2,
- ResourceStatus: "CREATE_IN_PROGRESS",
- },
- },
- RequestId: "4af14eec-350e-11e4-b260-EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeStacks(c *C) {
- testServer.Response(200, nil, DescribeStacksResponse)
-
- resp, err := s.cf.DescribeStacks("MyStack", "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- t, _ := time.Parse(time.RFC3339, "2010-07-27T22:28:28Z")
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "DescribeStacks")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NextToken"), Equals, "")
-
- // Response test
- expected := &cf.DescribeStacksResponse{
- Stacks: []cf.Stack{
- {
- StackId: "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83",
- StackName: "MyStack",
- Description: "My Description",
- Capabilities: []string{"CAPABILITY_IAM"},
- NotificationARNs: []string{"arn:aws:sns:region-name:account-name:topic-name"},
- Parameters: []cf.Parameter{
- {
- ParameterKey: "MyKey",
- ParameterValue: "MyValue",
- },
- },
- Tags: []cf.Tag{
- {
- Key: "MyTagKey",
- Value: "MyTagValue",
- },
- },
- CreationTime: t,
- StackStatus: "CREATE_COMPLETE",
- DisableRollback: false,
- Outputs: []cf.Output{
- {
- Description: "ServerUrl",
- OutputKey: "StartPage",
- OutputValue: "http://my-load-balancer.amazonaws.com:80/index.html",
- },
- },
- },
- },
- NextToken: "",
- RequestId: "4af14eec-350e-11e4-b260-EXAMPLE",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestEstimateTemplateCost(c *C) {
- testServer.Response(200, nil, EstimateTemplateCostResponse)
-
- resp, err := s.cf.EstimateTemplateCost(nil, "", "https://s3.amazonaws.com/cloudformation-samples-us-east-1/Drupal_Simple.template")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "EstimateTemplateCost")
- c.Assert(values.Get("TemplateBody"), Equals, "")
- c.Assert(values.Get("TemplateURL"), Equals, "https://s3.amazonaws.com/cloudformation-samples-us-east-1/Drupal_Simple.template")
- // Response test
- c.Assert(resp.Url, Equals, "http://calculator.s3.amazonaws.com/calc5.html?key=cf-2e351785-e821-450c-9d58-625e1e1ebfb6")
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestGetStackPolicy(c *C) {
- testServer.Response(200, nil, GetStackPolicyResponse)
-
- resp, err := s.cf.GetStackPolicy("MyStack")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "GetStackPolicy")
-
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- // Response test
- policy := `{
- "Statement" : [
- {
- "Effect" : "Deny",
- "Action" : "Update:*",
- "Principal" : "*",
- "Resource" : "LogicalResourceId/ProductionDatabase"
- },
- {
- "Effect" : "Allow",
- "Action" : "Update:*",
- "Principal" : "*",
- "Resource" : "*"
- }
- ]
- }`
- c.Assert(resp.StackPolicyBody, Equals, policy)
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestGetTemplate(c *C) {
- testServer.Response(200, nil, GetTemplateResponse)
-
- resp, err := s.cf.GetTemplate("MyStack")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "GetTemplate")
-
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- // Response test
- templateBody := `{
- "AWSTemplateFormatVersion" : "2010-09-09",
- "Description" : "Simple example",
- "Resources" : {
- "MySQS" : {
- "Type" : "AWS::SQS::Queue",
- "Properties" : {
- }
- }
- }
- }`
- c.Assert(resp.TemplateBody, Equals, templateBody)
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestListStackResources(c *C) {
- testServer.Response(200, nil, ListStackResourcesResponse)
-
- resp, err := s.cf.ListStackResources("MyStack", "4dad1-32131da-d-31")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "ListStackResources")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NextToken"), Equals, "4dad1-32131da-d-31")
-
- // Response test
- t1, _ := time.Parse(time.RFC3339, "2011-06-21T20:15:58Z")
- t2, _ := time.Parse(time.RFC3339, "2011-06-21T20:25:57Z")
- t3, _ := time.Parse(time.RFC3339, "2011-06-21T20:26:12Z")
- t4, _ := time.Parse(time.RFC3339, "2011-06-21T20:28:48Z")
- t5, _ := time.Parse(time.RFC3339, "2011-06-21T20:29:06Z")
- t6, _ := time.Parse(time.RFC3339, "2011-06-21T20:29:23Z")
-
- expected := &cf.ListStackResourcesResponse{
- StackResourceSummaries: []cf.StackResourceSummary{
- {
- LogicalResourceId: "DBSecurityGroup",
- PhysicalResourceId: "gmarcteststack-dbsecuritygroup-1s5m0ez5lkk6w",
- ResourceType: "AWS::RDS::DBSecurityGroup",
- LastUpdatedTimestamp: t1,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- LogicalResourceId: "SampleDB",
- PhysicalResourceId: "MyStack-sampledb-ycwhk1v830lx",
- ResourceType: "AWS::RDS::DBInstance",
- LastUpdatedTimestamp: t2,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- LogicalResourceId: "SampleApplication",
- PhysicalResourceId: "MyStack-SampleApplication-1MKNASYR3RBQL",
- ResourceType: "AWS::ElasticBeanstalk::Application",
- LastUpdatedTimestamp: t3,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- LogicalResourceId: "SampleEnvironment",
- PhysicalResourceId: "myst-Samp-1AGU6ERZX6M3Q",
- ResourceType: "AWS::ElasticBeanstalk::Environment",
- LastUpdatedTimestamp: t4,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- LogicalResourceId: "AlarmTopic",
- PhysicalResourceId: "arn:aws:sns:us-east-1:803981987763:MyStack-AlarmTopic-SW4IQELG7RPJ",
- ResourceType: "AWS::SNS::Topic",
- LastUpdatedTimestamp: t5,
- ResourceStatus: "CREATE_COMPLETE",
- },
- {
- LogicalResourceId: "CPUAlarmHigh",
- PhysicalResourceId: "MyStack-CPUAlarmHigh-POBWQPDJA81F",
- ResourceType: "AWS::CloudWatch::Alarm",
- LastUpdatedTimestamp: t6,
- ResourceStatus: "CREATE_COMPLETE",
- },
- },
- NextToken: "",
- RequestId: "2d06e36c-ac1d-11e0-a958-f9382b6eb86b",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestListStacks(c *C) {
- testServer.Response(200, nil, ListStacksResponse)
-
- resp, err := s.cf.ListStacks([]string{"CREATE_IN_PROGRESS", "DELETE_COMPLETE"}, "4dad1-32131da-d-31")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "ListStacks")
- c.Assert(values.Get("StackStatusFilter.member.1"), Equals, "CREATE_IN_PROGRESS")
- c.Assert(values.Get("StackStatusFilter.member.2"), Equals, "DELETE_COMPLETE")
- c.Assert(values.Get("NextToken"), Equals, "4dad1-32131da-d-31")
-
- // Response test
- c1, _ := time.Parse(time.RFC3339, "2011-05-23T15:47:44Z")
- c2, _ := time.Parse(time.RFC3339, "2011-03-05T19:57:58Z")
- d2, _ := time.Parse(time.RFC3339, "2011-03-10T16:20:51Z")
-
- expected := &cf.ListStacksResponse{
- StackSummaries: []cf.StackSummary{
- {
- StackId: "arn:aws:cloudformation:us-east-1:1234567:stack/TestCreate1/aaaaa",
- StackName: "vpc1",
- StackStatus: "CREATE_IN_PROGRESS",
- CreationTime: c1,
- TemplateDescription: "Creates one EC2 instance and a load balancer.",
- },
- {
- StackId: "arn:aws:cloudformation:us-east-1:1234567:stack/TestDelete2/bbbbb",
- StackName: "WP1",
- StackStatus: "DELETE_COMPLETE",
- CreationTime: c2,
- DeletionTime: d2,
- TemplateDescription: "A simple basic Cloudformation Template.",
- },
- },
- NextToken: "",
- RequestId: "2d06e36c-ac1d-11e0-a958-f9382b6eb86b",
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestSetStackPolicy(c *C) {
- testServer.Response(200, nil, SetStackPolicyResponse)
-
- resp, err := s.cf.SetStackPolicy("MyStack", "[Stack Policy Document]", "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "SetStackPolicy")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("StackPolicyBody"), Equals, "[Stack Policy Document]")
- c.Assert(values.Get("StackPolicyUrl"), Equals, "")
- // Response test
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
-}
-
-func (s *S) TestUpdateStack(c *C) {
- testServer.Response(200, nil, UpdateStackResponse)
-
- stackParams := &cf.UpdateStackParams{
- Capabilities: []string{"CAPABILITY_IAM"},
- NotificationARNs: []string{"arn:aws:sns:us-east-1:1234567890:my-topic"},
- StackPolicyBody: "{PolicyBody}",
- StackPolicyDuringUpdateBody: "{PolicyDuringUpdateBody}",
- Parameters: []cf.Parameter{
- {
- ParameterKey: "AvailabilityZone",
- ParameterValue: "us-east-1a",
- },
- },
- UsePreviousTemplate: true,
- StackName: "MyStack",
- TemplateBody: "[Template Document]",
- }
- resp, err := s.cf.UpdateStack(stackParams)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "UpdateStack")
- c.Assert(values.Get("StackName"), Equals, "MyStack")
- c.Assert(values.Get("NotificationARNs.member.1"), Equals, "arn:aws:sns:us-east-1:1234567890:my-topic")
- c.Assert(values.Get("TemplateBody"), Equals, "[Template Document]")
- c.Assert(values.Get("Parameters.member.1.ParameterKey"), Equals, "AvailabilityZone")
- c.Assert(values.Get("Parameters.member.1.ParameterValue"), Equals, "us-east-1a")
- c.Assert(values.Get("Capabilities.member.1"), Equals, "CAPABILITY_IAM")
- c.Assert(values.Get("StackPolicyBody"), Equals, "{PolicyBody}")
- c.Assert(values.Get("StackPolicyDuringUpdateBody"), Equals, "{PolicyDuringUpdateBody}")
- c.Assert(values.Get("UsePreviousTemplate"), Equals, "true")
-
- // Response test
- c.Assert(resp.RequestId, Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
- c.Assert(resp.StackId, Equals, "arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83")
-}
-
-func (s *S) TestValidateTemplate(c *C) {
- testServer.Response(200, nil, ValidateTemplateResponse)
-
- resp, err := s.cf.ValidateTemplate("", "http://myTemplateRepository/TemplateOne.template")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
-
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2010-05-15")
- c.Assert(values.Get("Action"), Equals, "ValidateTemplate")
- c.Assert(values.Get("TemplateURL"), Equals, "http://myTemplateRepository/TemplateOne.template")
- c.Assert(values.Get("TemplateBody"), Equals, "")
-
- // Response test
- expected := &cf.ValidateTemplateResponse{
- Description: "Test",
- Capabilities: []string{"CAPABILITY_IAM"},
- Parameters: []cf.TemplateParameter{
- {
- NoEcho: false,
- ParameterKey: "InstanceType",
- Description: "Type of instance to launch",
- DefaultValue: "m1.small",
- },
- {
- NoEcho: false,
- ParameterKey: "WebServerPort",
- Description: "The TCP port for the Web Server",
- DefaultValue: "8888",
- },
- {
- NoEcho: false,
- ParameterKey: "KeyName",
- Description: "Name of an existing EC2 KeyPair to enable SSH access into the server",
- },
- },
- RequestId: "0be7b6e8-e4a0-11e0-a5bd-9f8d5a7dbc91",
- }
- c.Assert(resp, DeepEquals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/cloudformation/responses_test.go b/vendor/github.com/goamz/goamz/cloudformation/responses_test.go
deleted file mode 100644
index 705b1d976..000000000
--- a/vendor/github.com/goamz/goamz/cloudformation/responses_test.go
+++ /dev/null
@@ -1,371 +0,0 @@
-package cloudformation_test
-
-var CancelUpdateStackResponse = `
-<CancelUpdateStackResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <CancelUpdateStackResult/>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</CancelUpdateStackResponse>
-`
-
-var CreateStackResponse = `
-<CreateStackResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
-<CreateStackResult>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
-</CreateStackResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateStackResponse>
-`
-
-var CreateStackWithInvalidParamsResponse = `
-<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <Error>
- <Type>Sender</Type>
- <Code>ValidationError</Code>
- <Message>Either Template URL or Template Body must be specified.</Message>
- </Error>
- <RequestId>70a76d42-9665-11e2-9fdf-211deEXAMPLE</RequestId>
-</ErrorResponse>
-`
-
-var DeleteStackResponse = `
-<DeleteStackResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <DeleteStackResult/>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</DeleteStackResponse>
-`
-var DescribeStackEventsResponse = `
-<DescribeStackEventsResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <DescribeStackEventsResult>
- <StackEvents>
- <member>
- <EventId>Event-1-Id</EventId>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MyStack</LogicalResourceId>
- <PhysicalResourceId>MyStack_One</PhysicalResourceId>
- <ResourceType>AWS::CloudFormation::Stack</ResourceType>
- <Timestamp>2010-07-27T22:26:28Z</Timestamp>
- <ResourceStatus>CREATE_IN_PROGRESS</ResourceStatus>
- <ResourceStatusReason>User initiated</ResourceStatusReason>
- </member>
- <member>
- <EventId>Event-2-Id</EventId>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MyDBInstance</LogicalResourceId>
- <PhysicalResourceId>MyStack_DB1</PhysicalResourceId>
- <ResourceType>AWS::SecurityGroup</ResourceType>
- <Timestamp>2010-07-27T22:27:28Z</Timestamp>
- <ResourceStatus>CREATE_IN_PROGRESS</ResourceStatus>
- <ResourceProperties>{"GroupDescription":...}</ResourceProperties>
- </member>
- <member>
- <EventId>Event-3-Id</EventId>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MySG1</LogicalResourceId>
- <PhysicalResourceId>MyStack_SG1</PhysicalResourceId>
- <ResourceType>AWS::SecurityGroup</ResourceType>
- <Timestamp>2010-07-27T22:28:28Z</Timestamp>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- </member>
- </StackEvents>
- <NextToken/>
- </DescribeStackEventsResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeStackEventsResponse>
-`
-
-var DescribeStackResourceResponse = `
-<DescribeStackResourceResponse>
- <DescribeStackResourceResult>
- <StackResourceDetail>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MyDBInstance</LogicalResourceId>
- <PhysicalResourceId>MyStack_DB1</PhysicalResourceId>
- <ResourceType>AWS::RDS::DBInstance</ResourceType>
- <LastUpdatedTimestamp>2011-07-07T22:27:28Z</LastUpdatedTimestamp>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- </StackResourceDetail>
- </DescribeStackResourceResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeStackResourceResponse>
-`
-var DescribeStackResourcesResponse = `
-<DescribeStackResourcesResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <DescribeStackResourcesResult>
- <StackResources>
- <member>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MyDBInstance</LogicalResourceId>
- <PhysicalResourceId>MyStack_DB1</PhysicalResourceId>
- <ResourceType>AWS::DBInstance</ResourceType>
- <Timestamp>2010-07-27T22:27:28Z</Timestamp>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- </member>
- <member>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackName>MyStack</StackName>
- <LogicalResourceId>MyAutoScalingGroup</LogicalResourceId>
- <PhysicalResourceId>MyStack_ASG1</PhysicalResourceId>
- <ResourceType>AWS::AutoScalingGroup</ResourceType>
- <Timestamp>2010-07-27T22:28:28Z</Timestamp>
- <ResourceStatus>CREATE_IN_PROGRESS</ResourceStatus>
- </member>
- </StackResources>
- </DescribeStackResourcesResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeStackResourcesResponse>
-`
-
-var DescribeStacksResponse = `
-<DescribeStacksResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <DescribeStacksResult>
- <Stacks>
- <member>
- <StackName>MyStack</StackName>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- <StackStatusReason/>
- <Description>My Description</Description>
- <Capabilities>
- <member>CAPABILITY_IAM</member>
- </Capabilities>
- <NotificationARNs>
- <member>arn:aws:sns:region-name:account-name:topic-name</member>
- </NotificationARNs>
- <Parameters>
- <member>
- <ParameterValue>MyValue</ParameterValue>
- <ParameterKey>MyKey</ParameterKey>
- </member>
- </Parameters>
- <Tags>
- <member>
- <Key>MyTagKey</Key>
- <Value>MyTagValue</Value>
- </member>
- </Tags>
- <CreationTime>2010-07-27T22:28:28Z</CreationTime>
- <StackStatus>CREATE_COMPLETE</StackStatus>
- <DisableRollback>false</DisableRollback>
- <Outputs>
- <member>
- <Description>ServerUrl</Description>
- <OutputKey>StartPage</OutputKey>
- <OutputValue>http://my-load-balancer.amazonaws.com:80/index.html</OutputValue>
- </member>
- </Outputs>
- </member>
- </Stacks>
- <NextToken/>
- </DescribeStacksResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeStacksResponse>
-`
-
-var EstimateTemplateCostResponse = `
-<EstimateTemplateCostResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <EstimateTemplateCostResult>
- <Url>http://calculator.s3.amazonaws.com/calc5.html?key=cf-2e351785-e821-450c-9d58-625e1e1ebfb6</Url>
- </EstimateTemplateCostResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</EstimateTemplateCostResponse>
-`
-
-var GetStackPolicyResponse = `
-<GetStackPolicyResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <GetStackPolicyResult>
- <StackPolicyBody>{
- "Statement" : [
- {
- "Effect" : "Deny",
- "Action" : "Update:*",
- "Principal" : "*",
- "Resource" : "LogicalResourceId/ProductionDatabase"
- },
- {
- "Effect" : "Allow",
- "Action" : "Update:*",
- "Principal" : "*",
- "Resource" : "*"
- }
- ]
- }</StackPolicyBody>
- </GetStackPolicyResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</GetStackPolicyResponse>
-`
-
-var GetTemplateResponse = `
-<GetTemplateResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <GetTemplateResult>
- <TemplateBody>{
- "AWSTemplateFormatVersion" : "2010-09-09",
- "Description" : "Simple example",
- "Resources" : {
- "MySQS" : {
- "Type" : "AWS::SQS::Queue",
- "Properties" : {
- }
- }
- }
- }</TemplateBody>
- </GetTemplateResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</GetTemplateResponse>
-`
-
-var ListStackResourcesResponse = `
-<ListStackResourcesResponse>
- <ListStackResourcesResult>
- <StackResourceSummaries>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>DBSecurityGroup</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:15:58Z</LastUpdatedTimestamp>
- <PhysicalResourceId>gmarcteststack-dbsecuritygroup-1s5m0ez5lkk6w</PhysicalResourceId>
- <ResourceType>AWS::RDS::DBSecurityGroup</ResourceType>
- </member>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>SampleDB</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:25:57Z</LastUpdatedTimestamp>
- <PhysicalResourceId>MyStack-sampledb-ycwhk1v830lx</PhysicalResourceId>
- <ResourceType>AWS::RDS::DBInstance</ResourceType>
- </member>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>SampleApplication</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:26:12Z</LastUpdatedTimestamp>
- <PhysicalResourceId>MyStack-SampleApplication-1MKNASYR3RBQL</PhysicalResourceId>
- <ResourceType>AWS::ElasticBeanstalk::Application</ResourceType>
- </member>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>SampleEnvironment</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:28:48Z</LastUpdatedTimestamp>
- <PhysicalResourceId>myst-Samp-1AGU6ERZX6M3Q</PhysicalResourceId>
- <ResourceType>AWS::ElasticBeanstalk::Environment</ResourceType>
- </member>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>AlarmTopic</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:29:06Z</LastUpdatedTimestamp>
- <PhysicalResourceId>arn:aws:sns:us-east-1:803981987763:MyStack-AlarmTopic-SW4IQELG7RPJ</PhysicalResourceId>
- <ResourceType>AWS::SNS::Topic</ResourceType>
- </member>
- <member>
- <ResourceStatus>CREATE_COMPLETE</ResourceStatus>
- <LogicalResourceId>CPUAlarmHigh</LogicalResourceId>
- <LastUpdatedTimestamp>2011-06-21T20:29:23Z</LastUpdatedTimestamp>
- <PhysicalResourceId>MyStack-CPUAlarmHigh-POBWQPDJA81F</PhysicalResourceId>
- <ResourceType>AWS::CloudWatch::Alarm</ResourceType>
- </member>
- </StackResourceSummaries>
- </ListStackResourcesResult>
- <ResponseMetadata>
- <RequestId>2d06e36c-ac1d-11e0-a958-f9382b6eb86b</RequestId>
- </ResponseMetadata>
-</ListStackResourcesResponse>
-`
-
-var ListStacksResponse = `
-<ListStacksResponse>
- <ListStacksResult>
- <StackSummaries>
- <member>
- <StackId>arn:aws:cloudformation:us-east-1:1234567:stack/TestCreate1/aaaaa</StackId>
- <StackStatus>CREATE_IN_PROGRESS</StackStatus>
- <StackName>vpc1</StackName>
- <CreationTime>2011-05-23T15:47:44Z</CreationTime>
- <TemplateDescription>Creates one EC2 instance and a load balancer.</TemplateDescription>
- </member>
- <member>
- <StackId>arn:aws:cloudformation:us-east-1:1234567:stack/TestDelete2/bbbbb</StackId>
- <StackStatus>DELETE_COMPLETE</StackStatus>
- <DeletionTime>2011-03-10T16:20:51Z</DeletionTime>
- <StackName>WP1</StackName>
- <CreationTime>2011-03-05T19:57:58Z</CreationTime>
- <TemplateDescription>A simple basic Cloudformation Template.</TemplateDescription>
- </member>
- </StackSummaries>
- </ListStacksResult>
- <ResponseMetadata>
- <RequestId>2d06e36c-ac1d-11e0-a958-f9382b6eb86b</RequestId>
- </ResponseMetadata>
-</ListStacksResponse>
-`
-
-var SetStackPolicyResponse = `
-<SetStackPolicyResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <SetStackPolicyResponse/>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</SetStackPolicyResponse>
-`
-
-var UpdateStackResponse = `
-<UpdateStackResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <UpdateStackResult>
- <StackId>arn:aws:cloudformation:us-east-1:123456789:stack/MyStack/aaf549a0-a413-11df-adb3-5081b3858e83</StackId>
- </UpdateStackResult>
- <ResponseMetadata>
- <RequestId>4af14eec-350e-11e4-b260-EXAMPLE</RequestId>
- </ResponseMetadata>
-</UpdateStackResponse>
-`
-var ValidateTemplateResponse = `
-<ValidateTemplateResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
- <ValidateTemplateResult>
- <Description>Test</Description>
- <Capabilities>
- <member>CAPABILITY_IAM</member>
- </Capabilities>
- <Parameters>
- <member>
- <NoEcho>false</NoEcho>
- <ParameterKey>InstanceType</ParameterKey>
- <Description>Type of instance to launch</Description>
- <DefaultValue>m1.small</DefaultValue>
- </member>
- <member>
- <NoEcho>false</NoEcho>
- <ParameterKey>WebServerPort</ParameterKey>
- <Description>The TCP port for the Web Server</Description>
- <DefaultValue>8888</DefaultValue>
- </member>
- <member>
- <NoEcho>false</NoEcho>
- <ParameterKey>KeyName</ParameterKey>
- <Description>Name of an existing EC2 KeyPair to enable SSH access into the server</Description>
- </member>
- </Parameters>
- </ValidateTemplateResult>
- <ResponseMetadata>
- <RequestId>0be7b6e8-e4a0-11e0-a5bd-9f8d5a7dbc91</RequestId>
- </ResponseMetadata>
-</ValidateTemplateResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/cloudfront/cloudfront.go b/vendor/github.com/goamz/goamz/cloudfront/cloudfront.go
deleted file mode 100644
index 745060f1c..000000000
--- a/vendor/github.com/goamz/goamz/cloudfront/cloudfront.go
+++ /dev/null
@@ -1,135 +0,0 @@
-package cloudfront
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
- "crypto/sha1"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-type CloudFront struct {
- BaseURL string
- keyPairId string
- key *rsa.PrivateKey
-}
-
-var base64Replacer = strings.NewReplacer("=", "_", "+", "-", "/", "~")
-
-func New(baseurl string, key *rsa.PrivateKey, keyPairId string) *CloudFront {
- return &CloudFront{
- BaseURL: baseurl,
- keyPairId: keyPairId,
- key: key,
- }
-}
-
-type epochTime struct {
- EpochTime int64 `json:"AWS:EpochTime"`
-}
-
-type condition struct {
- DateLessThan epochTime
-}
-
-type statement struct {
- Resource string
- Condition condition
-}
-
-type policy struct {
- Statement []statement
-}
-
-func buildPolicy(resource string, expireTime time.Time) ([]byte, error) {
- p := &policy{
- Statement: []statement{
- statement{
- Resource: resource,
- Condition: condition{
- DateLessThan: epochTime{
- EpochTime: expireTime.Truncate(time.Millisecond).Unix(),
- },
- },
- },
- },
- }
-
- return json.Marshal(p)
-}
-
-func (cf *CloudFront) generateSignature(policy []byte) (string, error) {
- hash := sha1.New()
- if _, err := hash.Write(policy); err != nil {
- return "", err
- }
-
- hashed := hash.Sum(nil)
-
- signed, err := rsa.SignPKCS1v15(rand.Reader, cf.key, crypto.SHA1, hashed)
- if err != nil {
- return "", err
- }
-
- encoded := base64Replacer.Replace(base64.StdEncoding.EncodeToString(signed))
-
- return encoded, nil
-}
-
-// Creates a signed url using RSAwithSHA1 as specified by
-// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html#private-content-canned-policy-creating-signature
-func (cf *CloudFront) CannedSignedURL(path, queryString string, expires time.Time) (string, error) {
- resource := cf.BaseURL + path
- if queryString != "" {
- resource = path + "?" + queryString
- }
-
- policy, err := buildPolicy(resource, expires)
- if err != nil {
- return "", err
- }
-
- signature, err := cf.generateSignature(policy)
- if err != nil {
- return "", err
- }
-
- // TOOD: Do this once
- uri, err := url.Parse(cf.BaseURL)
- if err != nil {
- return "", err
- }
-
- uri.RawQuery = queryString
- if queryString != "" {
- uri.RawQuery += "&"
- }
-
- expireTime := expires.Truncate(time.Millisecond).Unix()
-
- uri.Path = path
- uri.RawQuery += fmt.Sprintf("Expires=%d&Signature=%s&Key-Pair-Id=%s", expireTime, signature, cf.keyPairId)
-
- return uri.String(), nil
-}
-
-func (cloudfront *CloudFront) SignedURL(path, querystrings string, expires time.Time) string {
- policy := `{"Statement":[{"Resource":"` + path + "?" + querystrings + `,"Condition":{"DateLessThan":{"AWS:EpochTime":` + strconv.FormatInt(expires.Truncate(time.Millisecond).Unix(), 10) + `}}}]}`
-
- hash := sha1.New()
- hash.Write([]byte(policy))
- b := hash.Sum(nil)
- he := base64.StdEncoding.EncodeToString(b)
-
- policySha1 := he
-
- url := cloudfront.BaseURL + path + "?" + querystrings + "&Expires=" + strconv.FormatInt(expires.Unix(), 10) + "&Signature=" + policySha1 + "&Key-Pair-Id=" + cloudfront.keyPairId
-
- return url
-}
diff --git a/vendor/github.com/goamz/goamz/cloudfront/cloudfront_test.go b/vendor/github.com/goamz/goamz/cloudfront/cloudfront_test.go
deleted file mode 100644
index 63744d1cb..000000000
--- a/vendor/github.com/goamz/goamz/cloudfront/cloudfront_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package cloudfront
-
-import (
- "crypto/x509"
- "encoding/pem"
- "io/ioutil"
- "net/url"
- "testing"
- "time"
-)
-
-func TestSignedCannedURL(t *testing.T) {
- rawKey, err := ioutil.ReadFile("testdata/key.pem")
- if err != nil {
- t.Fatal(err)
- }
-
- pemKey, _ := pem.Decode(rawKey)
- privateKey, err := x509.ParsePKCS1PrivateKey(pemKey.Bytes)
- if err != nil {
- t.Fatal(err)
- }
-
- cf := &CloudFront{
- key: privateKey,
- keyPairId: "test-key-pair-1231245",
- BaseURL: "https://cloudfront.com",
- }
-
- expireTime, err := time.Parse(time.RFC3339, "2014-03-28T14:00:21Z")
- if err != nil {
- t.Fatal(err)
- }
-
- query := make(url.Values)
- query.Add("test", "value")
-
- uri, err := cf.CannedSignedURL("test", "test=value", expireTime)
- if err != nil {
- t.Fatal(err)
- }
-
- parsed, err := url.Parse(uri)
- if err != nil {
- t.Fatal(err)
- }
-
- signature := parsed.Query().Get("Signature")
- if signature == "" {
- t.Fatal("Encoded signature is empty")
- }
-}
diff --git a/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pem b/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pem
deleted file mode 100644
index 96e820a2c..000000000
--- a/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQC0yMzp9DkPAE99DhsEaGkqougLvtmDKri4bZj0fFjmGmjyyjz9
-hlrsr87LHVWzH/7igK7040HG1UqypX3ijtJa9+6BKHwBBctboU3y4GfwFwVAOumY
-9UytFpyPlgUFrffZLQAywKkT24OgcfEj0G5kiQn760wFnmSUtOuITo708QIDAQAB
-AoGAJUA6+PoZx72Io3wElSPuh5qJteHdb+mdpmLu4XG936wRc/W4G4VTtvGC6tdg
-kUhGfOWHJ26sXwwUGDuBdO146m0DkBTuIooy97afpL6hXgL5v4ELHbbuFJcf4Geg
-/UAuexvRT1HenYFQ/iXM0LlqI33i8cFRc1A+j0Gseo07gAECQQDYFCn7OUokX+Q8
-M2Cwhu7JT1obmP2HwsBtXl0CDDxtOQkuYJP/UqvtdYPz/kRn3yQjoynaCTHYrFz/
-H8oN1nNhAkEA1i9TEpo7RbanIyT4vbc1/5xfjE7Pj0lnGku0QXFp/S+8YxbqhjrQ
-4Qp7TTXIPPqvQhhEpAGGspM460K3F6h7kQJBANJCbMeFa9wRY2ohJIkiA+HoUWph
-aPNeUxkZpa+EcJhn08NJPzpIG/ypSYl3duEMhYIYF3WPVO3ea2/mYxsr/oECQFj5
-td/fdEoEk7AU1sQxDNyPwF2QC8dxbcRNuKcLD0Wfg/oB9hEm88jYytoLQpCabx3c
-6P7cp3EdmaKZx2erlRECQDYTSK2tS0+VoXSV9JbU08Pbu53j3Zhmp4l0csP+l7EU
-U+rRQzKho4X9vpR/VpRGXbw8tTIhojNpHh5ofryVfgk=
------END RSA PRIVATE KEY-----
diff --git a/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pub b/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pub
deleted file mode 100644
index 7d0b5b4d6..000000000
--- a/vendor/github.com/goamz/goamz/cloudfront/testdata/key.pub
+++ /dev/null
@@ -1,6 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0yMzp9DkPAE99DhsEaGkqougL
-vtmDKri4bZj0fFjmGmjyyjz9hlrsr87LHVWzH/7igK7040HG1UqypX3ijtJa9+6B
-KHwBBctboU3y4GfwFwVAOumY9UytFpyPlgUFrffZLQAywKkT24OgcfEj0G5kiQn7
-60wFnmSUtOuITo708QIDAQAB
------END PUBLIC KEY-----
diff --git a/vendor/github.com/goamz/goamz/cloudwatch/ChangeLog b/vendor/github.com/goamz/goamz/cloudwatch/ChangeLog
deleted file mode 100644
index 46fea639e..000000000
--- a/vendor/github.com/goamz/goamz/cloudwatch/ChangeLog
+++ /dev/null
@@ -1,7 +0,0 @@
-2013-10-21 Carlos Salguero <cfsalguero@gmail.com>
-
-* Removed Namespace from the constructor as not all AWS API method needs it
- and methods like ListMetrics you could need to call the method without a
- Namespace to list all available metrics
-
-* Added ListMetrics method
diff --git a/vendor/github.com/goamz/goamz/cloudwatch/README.md b/vendor/github.com/goamz/goamz/cloudwatch/README.md
deleted file mode 100644
index dc837b4c7..000000000
--- a/vendor/github.com/goamz/goamz/cloudwatch/README.md
+++ /dev/null
@@ -1,109 +0,0 @@
-#GoLang AWS Cloudwatch
-
-## Installation
-Please refer to the project's main page at [https://github.com/goamz/goamz](https://github.com/goamz/goamz) for instructions about how to install.
-
-## Available methods
-
-<table>
- <tr>
- <td>GetMetricStatistics</td>
- <td>Gets statistics for the specified metric.</td>
- </tr>
- <tr>
- <td>ListMetrics</td>
- <td>Returns a list of valid metrics stored for the AWS account.</td>
- </tr>
- <tr>
- <td>PutMetricData</td>
- <td>Publishes metric data points to Amazon CloudWatch.</td>
- </tr>
- <tr>
- <td>PutMetricAlarm</td>
- <td>Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric.</td>
- </tr>
- </table>
-
-[Please refer to AWS Cloudwatch's documentation for more info](http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Operations.html)
-
-##Examples
-####Get Metric Statistics
-
-```
-import (
- "fmt"
- "time"
- "os"
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/cloudwatch"
-)
-
-func test_get_metric_statistics() {
- region := aws.Regions["a_region"]
- namespace:= "AWS/ELB"
- dimension := &cloudwatch.Dimension{
- Name: "LoadBalancerName",
- Value: "your_value",
- }
- metricName := "RequestCount"
- now := time.Now()
- prev := now.Add(time.Duration(600)*time.Second*-1) // 600 secs = 10 minutes
-
- auth, err := aws.GetAuth("your_AccessKeyId", "your_SecretAccessKey", "", now)
- if err != nil {
- fmt.Printf("Error: %+v\n", err)
- os.Exit(1)
- }
-
- cw, err := cloudwatch.NewCloudWatch(auth, region.CloudWatchServicepoint)
- request := &cloudwatch.GetMetricStatisticsRequest {
- Dimensions: []cloudwatch.Dimension{*dimension},
- EndTime: now,
- StartTime: prev,
- MetricName: metricName,
- Unit: "Count", // Not mandatory
- Period: 60,
- Statistics: []string{"Sum"},
- Namespace: namespace,
- }
-
- response, err := cw.GetMetricStatistics(request)
- if err == nil {
- fmt.Printf("%+v\n", response)
- } else {
- fmt.Printf("Error: %+v\n", err)
- }
-}
-
-```
-####List Metrics
-
-```
-import (
- "fmt"
- "time"
- "os"
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/cloudwatch"
-)
-
-func test_list_metrics() {
- region := aws.Regions["us-east-1"] // Any region here
- now := time.Now()
-
- auth, err := aws.GetAuth("an AccessKeyId", "a SecretAccessKey", "", now)
- if err != nil {
- fmt.Printf("Error: %+v\n", err)
- os.Exit(1)
- }
- cw, err := cloudwatch.NewCloudWatch(auth, region.CloudWatchServicepoint)
- request := &cloudwatch.ListMetricsRequest{Namespace: "AWS/EC2"}
-
- response, err := cw.ListMetrics(request)
- if err == nil {
- fmt.Printf("%+v\n", response)
- } else {
- fmt.Printf("Error: %+v\n", err)
- }
-}
-```
diff --git a/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch.go b/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch.go
deleted file mode 100644
index 461d6a102..000000000
--- a/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch.go
+++ /dev/null
@@ -1,404 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# The Initial Developer of the Original Code is the Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2012
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Ben Bangert (bbangert@mozilla.com)
-# Logan Owen (lsowen@s1network.com)
-#
-# ***** END LICENSE BLOCK *****/
-
-package cloudwatch
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "github.com/feyeleanor/sets"
- "github.com/goamz/goamz/aws"
- "strconv"
- "time"
-)
-
-// The CloudWatch type encapsulates all the CloudWatch operations in a region.
-type CloudWatch struct {
- Service aws.AWSService
-}
-
-type Dimension struct {
- Name string
- Value string
-}
-
-type StatisticSet struct {
- Maximum float64
- Minimum float64
- SampleCount float64
- Sum float64
-}
-
-type MetricDatum struct {
- Dimensions []Dimension
- MetricName string
- StatisticValues *StatisticSet
- Timestamp time.Time
- Unit string
- Value float64
-}
-
-type Datapoint struct {
- Average float64
- Maximum float64
- Minimum float64
- SampleCount float64
- Sum float64
- Timestamp time.Time
- Unit string
-}
-
-type GetMetricStatisticsRequest struct {
- Dimensions []Dimension
- EndTime time.Time
- StartTime time.Time
- MetricName string
- Unit string
- Period int
- Statistics []string
- Namespace string
-}
-
-type GetMetricStatisticsResult struct {
- Datapoints []Datapoint `xml:"Datapoints>member"`
- NextToken string `xml:"NextToken"`
-}
-
-type GetMetricStatisticsResponse struct {
- GetMetricStatisticsResult GetMetricStatisticsResult
- ResponseMetadata aws.ResponseMetadata
-}
-
-type Metric struct {
- Dimensions []Dimension `xml:"Dimensions>member"`
- MetricName string
- Namespace string
-}
-
-type ListMetricsResult struct {
- Metrics []Metric `xml:"Metrics>member"`
- NextToken string
-}
-
-type ListMetricsResponse struct {
- ListMetricsResult ListMetricsResult
- ResponseMetadata aws.ResponseMetadata
-}
-
-type ListMetricsRequest struct {
- Dimensions []Dimension
- MetricName string
- Namespace string
- NextToken string
-}
-
-type AlarmAction struct {
- ARN string
-}
-
-type MetricAlarm struct {
- AlarmActions []AlarmAction
- AlarmDescription string
- AlarmName string
- ComparisonOperator string
- Dimensions []Dimension
- EvaluationPeriods int
- InsufficientDataActions []AlarmAction
- MetricName string
- Namespace string
- OkActions []AlarmAction
- Period int
- Statistic string
- Threshold float64
- Unit string
-}
-
-var attempts = aws.AttemptStrategy{
- Min: 5,
- Total: 5 * time.Second,
- Delay: 200 * time.Millisecond,
-}
-
-var validUnits = sets.SSet(
- "Seconds",
- "Microseconds",
- "Milliseconds",
- "Bytes",
- "Kilobytes",
- "Megabytes",
- "Gigabytes",
- "Terabytes",
- "Bits",
- "Kilobits",
- "Megabits",
- "Gigabits",
- "Terabits",
- "Percent",
- "Count",
- "Bytes/Second",
- "Kilobytes/Second",
- "Megabytes/Second",
- "Gigabytes/Second",
- "Terabytes/Second",
- "Bits/Second",
- "Kilobits/Second",
- "Megabits/Second",
- "Gigabits/Second",
- "Terabits/Second",
- "Count/Second",
-)
-
-var validMetricStatistics = sets.SSet(
- "Average",
- "Sum",
- "SampleCount",
- "Maximum",
- "Minimum",
-)
-
-var validComparisonOperators = sets.SSet(
- "LessThanThreshold",
- "LessThanOrEqualToThreshold",
- "GreaterThanThreshold",
- "GreaterThanOrEqualToThreshold",
-)
-
-// Create a new CloudWatch object for a given namespace
-func NewCloudWatch(auth aws.Auth, region aws.ServiceInfo) (*CloudWatch, error) {
- service, err := aws.NewService(auth, region)
- if err != nil {
- return nil, err
- }
- return &CloudWatch{
- Service: service,
- }, nil
-}
-
-func (c *CloudWatch) query(method, path string, params map[string]string, resp interface{}) error {
- // Add basic Cloudwatch param
- params["Version"] = "2010-08-01"
-
- r, err := c.Service.Query(method, path, params)
- if err != nil {
- return err
- }
- defer r.Body.Close()
-
- if r.StatusCode != 200 {
- return c.Service.BuildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-// Get statistics for specified metric
-//
-// If the arguments are invalid or the server returns an error, the error will
-// be set and the other values undefined.
-func (c *CloudWatch) GetMetricStatistics(req *GetMetricStatisticsRequest) (result *GetMetricStatisticsResponse, err error) {
- statisticsSet := sets.SSet(req.Statistics...)
- // Kick out argument errors
- switch {
- case req.EndTime.IsZero():
- err = errors.New("No endTime specified")
- case req.StartTime.IsZero():
- err = errors.New("No startTime specified")
- case req.MetricName == "":
- err = errors.New("No metricName specified")
- case req.Namespace == "":
- err = errors.New("No Namespace specified")
- case req.Period < 60 || req.Period%60 != 0:
- err = errors.New("Period not 60 seconds or a multiple of 60 seconds")
- case len(req.Statistics) < 1:
- err = errors.New("No statistics supplied")
- case validMetricStatistics.Union(statisticsSet).Len() != validMetricStatistics.Len():
- err = errors.New("Invalid statistic values supplied")
- case req.Unit != "" && !validUnits.Member(req.Unit):
- err = errors.New("Unit is not a valid value")
- }
- if err != nil {
- return
- }
-
- // Serialize all the params
- params := aws.MakeParams("GetMetricStatistics")
- params["EndTime"] = req.EndTime.UTC().Format(time.RFC3339)
- params["StartTime"] = req.StartTime.UTC().Format(time.RFC3339)
- params["MetricName"] = req.MetricName
- params["Namespace"] = req.Namespace
- params["Period"] = strconv.Itoa(req.Period)
- if req.Unit != "" {
- params["Unit"] = req.Unit
- }
-
- // Serialize the lists of data
- for i, d := range req.Dimensions {
- prefix := "Dimensions.member." + strconv.Itoa(i+1)
- params[prefix+".Name"] = d.Name
- params[prefix+".Value"] = d.Value
- }
- for i, d := range req.Statistics {
- prefix := "Statistics.member." + strconv.Itoa(i+1)
- params[prefix] = d
- }
- result = new(GetMetricStatisticsResponse)
- err = c.query("GET", "/", params, result)
- return
-}
-
-// Returns a list of valid metrics stored for the AWS account owner.
-// Returned metrics can be used with GetMetricStatistics to obtain statistical data for a given metric.
-
-func (c *CloudWatch) ListMetrics(req *ListMetricsRequest) (result *ListMetricsResponse, err error) {
-
- // Serialize all the params
- params := aws.MakeParams("ListMetrics")
- if req.Namespace != "" {
- params["Namespace"] = req.Namespace
- }
- if len(req.Dimensions) > 0 {
- for i, d := range req.Dimensions {
- prefix := "Dimensions.member." + strconv.Itoa(i+1)
- params[prefix+".Name"] = d.Name
- params[prefix+".Value"] = d.Value
- }
- }
-
- result = new(ListMetricsResponse)
- err = c.query("GET", "/", params, &result)
- metrics := result.ListMetricsResult.Metrics
- if result.ListMetricsResult.NextToken != "" {
- params = aws.MakeParams("ListMetrics")
- params["NextToken"] = result.ListMetricsResult.NextToken
- for result.ListMetricsResult.NextToken != "" && err == nil {
- result = new(ListMetricsResponse)
- err = c.query("GET", "/", params, &result)
- if err == nil {
- newslice := make([]Metric, len(metrics)+len(result.ListMetricsResult.Metrics))
- copy(newslice, metrics)
- copy(newslice[len(metrics):], result.ListMetricsResult.Metrics)
- metrics = newslice
- }
- }
- result.ListMetricsResult.Metrics = metrics
- }
- return
-}
-
-func (c *CloudWatch) PutMetricData(metrics []MetricDatum) (result *aws.BaseResponse, err error) {
- return c.PutMetricDataNamespace(metrics, "")
-}
-
-func (c *CloudWatch) PutMetricDataNamespace(metrics []MetricDatum, namespace string) (result *aws.BaseResponse, err error) {
- // Serialize the params
- params := aws.MakeParams("PutMetricData")
- if namespace != "" {
- params["Namespace"] = namespace
- }
- for i, metric := range metrics {
- prefix := "MetricData.member." + strconv.Itoa(i+1)
- if metric.MetricName == "" {
- err = fmt.Errorf("No metric name supplied for metric: %d", i)
- return
- }
- params[prefix+".MetricName"] = metric.MetricName
- if metric.Unit != "" {
- params[prefix+".Unit"] = metric.Unit
- }
- params[prefix+".Value"] = strconv.FormatFloat(metric.Value, 'E', 10, 64)
- if !metric.Timestamp.IsZero() {
- params[prefix+".Timestamp"] = metric.Timestamp.UTC().Format(time.RFC3339)
- }
- for j, dim := range metric.Dimensions {
- dimprefix := prefix + ".Dimensions.member." + strconv.Itoa(j+1)
- params[dimprefix+".Name"] = dim.Name
- params[dimprefix+".Value"] = dim.Value
- }
- if metric.StatisticValues != nil {
- statprefix := prefix + ".StatisticValues"
- params[statprefix+".Maximum"] = strconv.FormatFloat(metric.StatisticValues.Maximum, 'E', 10, 64)
- params[statprefix+".Minimum"] = strconv.FormatFloat(metric.StatisticValues.Minimum, 'E', 10, 64)
- params[statprefix+".SampleCount"] = strconv.FormatFloat(metric.StatisticValues.SampleCount, 'E', 10, 64)
- params[statprefix+".Sum"] = strconv.FormatFloat(metric.StatisticValues.Sum, 'E', 10, 64)
- }
- }
- result = new(aws.BaseResponse)
- err = c.query("POST", "/", params, result)
- return
-}
-
-func (c *CloudWatch) PutMetricAlarm(alarm *MetricAlarm) (result *aws.BaseResponse, err error) {
- // Serialize the params
- params := aws.MakeParams("PutMetricAlarm")
-
- switch {
- case alarm.AlarmName == "":
- err = errors.New("No AlarmName supplied")
- case !validComparisonOperators.Member(alarm.ComparisonOperator):
- err = errors.New("ComparisonOperator is not valid")
- case alarm.EvaluationPeriods == 0:
- err = errors.New("No number of EvaluationPeriods specified")
- case alarm.MetricName == "":
- err = errors.New("No MetricName specified")
- case alarm.Namespace == "":
- err = errors.New("No Namespace specified")
- case alarm.Period == 0:
- err = errors.New("No Period over which statistic should apply was specified")
- case !validMetricStatistics.Member(alarm.Statistic):
- err = errors.New("Invalid statistic value supplied")
- case alarm.Threshold == 0:
- err = errors.New("No Threshold value specified")
- case alarm.Unit != "" && !validUnits.Member(alarm.Unit):
- err = errors.New("Unit is not a valid value")
- }
- if err != nil {
- return
- }
-
- for i, action := range alarm.AlarmActions {
- params["AlarmActions.member."+strconv.Itoa(i+1)] = action.ARN
- }
- for i, action := range alarm.InsufficientDataActions {
- params["InsufficientDataActions.member."+strconv.Itoa(i+1)] = action.ARN
- }
- for i, action := range alarm.OkActions {
- params["OKActions.member."+strconv.Itoa(i+1)] = action.ARN
- }
- if alarm.AlarmDescription != "" {
- params["AlarmDescription"] = alarm.AlarmDescription
- }
- params["AlarmDescription"] = alarm.AlarmDescription
- params["AlarmName"] = alarm.AlarmName
- params["ComparisonOperator"] = alarm.ComparisonOperator
- for i, dim := range alarm.Dimensions {
- dimprefix := "Dimensions.member." + strconv.Itoa(i+1)
- params[dimprefix+".Name"] = dim.Name
- params[dimprefix+".Value"] = dim.Value
- }
- params["EvaluationPeriods"] = strconv.Itoa(alarm.EvaluationPeriods)
- params["MetricName"] = alarm.MetricName
- params["Namespace"] = alarm.Namespace
- params["Period"] = strconv.Itoa(alarm.Period)
- params["Statistic"] = alarm.Statistic
- params["Threshold"] = strconv.FormatFloat(alarm.Threshold, 'E', 10, 64)
- if alarm.Unit != "" {
- params["Unit"] = alarm.Unit
- }
-
- result = new(aws.BaseResponse)
- err = c.query("POST", "/", params, result)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch_test.go b/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch_test.go
deleted file mode 100644
index a4271f1ea..000000000
--- a/vendor/github.com/goamz/goamz/cloudwatch/cloudwatch_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-package cloudwatch_test
-
-import (
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/cloudwatch"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- cw *cloudwatch.CloudWatch
-}
-
-var _ = Suite(&S{})
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.cw, _ = cloudwatch.NewCloudWatch(auth, aws.ServiceInfo{testServer.URL, aws.V2Signature})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func getTestAlarm() *cloudwatch.MetricAlarm {
- alarm := new(cloudwatch.MetricAlarm)
-
- alarm.AlarmName = "TestAlarm"
- alarm.MetricName = "TestMetric"
- alarm.Namespace = "TestNamespace"
- alarm.ComparisonOperator = "LessThanThreshold"
- alarm.Threshold = 1
- alarm.EvaluationPeriods = 5
- alarm.Period = 60
- alarm.Statistic = "Sum"
-
- return alarm
-}
-
-func (s *S) TestPutAlarm(c *C) {
- testServer.Response(200, nil, "<RequestId>123</RequestId>")
-
- alarm := getTestAlarm()
-
- _, err := s.cw.PutMetricAlarm(alarm)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Form["Action"], DeepEquals, []string{"PutMetricAlarm"})
- c.Assert(req.Form["AlarmName"], DeepEquals, []string{"TestAlarm"})
- c.Assert(req.Form["ComparisonOperator"], DeepEquals, []string{"LessThanThreshold"})
- c.Assert(req.Form["EvaluationPeriods"], DeepEquals, []string{"5"})
- c.Assert(req.Form["Threshold"], DeepEquals, []string{"1.0000000000E+00"})
- c.Assert(req.Form["Period"], DeepEquals, []string{"60"})
- c.Assert(req.Form["Statistic"], DeepEquals, []string{"Sum"})
-}
-
-func (s *S) TestPutAlarmWithAction(c *C) {
- testServer.Response(200, nil, "<RequestId>123</RequestId>")
-
- alarm := getTestAlarm()
-
- alarm.AlarmActions = []cloudwatch.AlarmAction{
- cloudwatch.AlarmAction{
- ARN: "123",
- },
- }
-
- alarm.OkActions = []cloudwatch.AlarmAction{
- cloudwatch.AlarmAction{
- ARN: "456",
- },
- }
-
- alarm.InsufficientDataActions = []cloudwatch.AlarmAction{
- cloudwatch.AlarmAction{
- ARN: "789",
- },
- }
-
- _, err := s.cw.PutMetricAlarm(alarm)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Form["Action"], DeepEquals, []string{"PutMetricAlarm"})
- c.Assert(req.Form["AlarmActions.member.1"], DeepEquals, []string{"123"})
- c.Assert(req.Form["OKActions.member.1"], DeepEquals, []string{"456"})
- c.Assert(req.Form["InsufficientDataActions.member.1"], DeepEquals, []string{"789"})
- c.Assert(req.Form["AlarmName"], DeepEquals, []string{"TestAlarm"})
- c.Assert(req.Form["ComparisonOperator"], DeepEquals, []string{"LessThanThreshold"})
- c.Assert(req.Form["EvaluationPeriods"], DeepEquals, []string{"5"})
- c.Assert(req.Form["Threshold"], DeepEquals, []string{"1.0000000000E+00"})
- c.Assert(req.Form["Period"], DeepEquals, []string{"60"})
- c.Assert(req.Form["Statistic"], DeepEquals, []string{"Sum"})
-}
-
-func (s *S) TestPutAlarmInvalidComapirsonOperator(c *C) {
- testServer.Response(200, nil, "<RequestId>123</RequestId>")
-
- alarm := getTestAlarm()
-
- alarm.ComparisonOperator = "LessThan"
-
- _, err := s.cw.PutMetricAlarm(alarm)
- c.Assert(err, NotNil)
- c.Assert(err.Error(), Equals, "ComparisonOperator is not valid")
-}
-
-func (s *S) TestPutAlarmInvalidStatistic(c *C) {
- testServer.Response(200, nil, "<RequestId>123</RequestId>")
-
- alarm := getTestAlarm()
-
- alarm.Statistic = "Count"
-
- _, err := s.cw.PutMetricAlarm(alarm)
- c.Assert(err, NotNil)
- c.Assert(err.Error(), Equals, "Invalid statistic value supplied")
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/.gitignore b/vendor/github.com/goamz/goamz/dynamodb/.gitignore
deleted file mode 100644
index 2385ddf57..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dynamodb_local*
diff --git a/vendor/github.com/goamz/goamz/dynamodb/Makefile b/vendor/github.com/goamz/goamz/dynamodb/Makefile
deleted file mode 100644
index 4c02cd4b7..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-DYNAMODB_LOCAL_VERSION = 2013-12-12
-
-launch: DynamoDBLocal.jar
- cd dynamodb_local_$(DYNAMODB_LOCAL_VERSION) && java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar
-
-DynamoDBLocal.jar: dynamodb_local_$(DYNAMODB_LOCAL_VERSION).tar.gz
- [ -d dynamodb_local_$(DYNAMODB_LOCAL_VERSION) ] || tar -zxf dynamodb_local_$(DYNAMODB_LOCAL_VERSION).tar.gz
-
-dynamodb_local_$(DYNAMODB_LOCAL_VERSION).tar.gz:
- curl -O https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_$(DYNAMODB_LOCAL_VERSION).tar.gz
-
-clean:
- rm -rf dynamodb_local_$(DYNAMODB_LOCAL_VERSION)*
diff --git a/vendor/github.com/goamz/goamz/dynamodb/README.md b/vendor/github.com/goamz/goamz/dynamodb/README.md
deleted file mode 100644
index 5896d67b6..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Running integration tests
-
-## against DynamoDB local
-
-To download and launch DynamoDB local:
-
-```sh
-$ make
-```
-
-To test:
-
-```sh
-$ go test -v -amazon
-```
-
-## against real DynamoDB server on us-east
-
-_WARNING_: Some dangerous operations such as `DeleteTable` will be performed during the tests. Please be careful.
-
-To test:
-
-```sh
-$ go test -v -amazon -local=false
-```
-
-_Note_: Running tests against real DynamoDB will take several minutes.
diff --git a/vendor/github.com/goamz/goamz/dynamodb/attribute.go b/vendor/github.com/goamz/goamz/dynamodb/attribute.go
deleted file mode 100755
index 38389ada2..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/attribute.go
+++ /dev/null
@@ -1,185 +0,0 @@
-package dynamodb
-
-import (
- "strconv"
-)
-
-const (
- TYPE_STRING = "S"
- TYPE_NUMBER = "N"
- TYPE_BINARY = "B"
-
- TYPE_STRING_SET = "SS"
- TYPE_NUMBER_SET = "NS"
- TYPE_BINARY_SET = "BS"
-
- COMPARISON_EQUAL = "EQ"
- COMPARISON_NOT_EQUAL = "NE"
- COMPARISON_LESS_THAN_OR_EQUAL = "LE"
- COMPARISON_LESS_THAN = "LT"
- COMPARISON_GREATER_THAN_OR_EQUAL = "GE"
- COMPARISON_GREATER_THAN = "GT"
- COMPARISON_ATTRIBUTE_EXISTS = "NOT_NULL"
- COMPARISON_ATTRIBUTE_DOES_NOT_EXIST = "NULL"
- COMPARISON_CONTAINS = "CONTAINS"
- COMPARISON_DOES_NOT_CONTAIN = "NOT_CONTAINS"
- COMPARISON_BEGINS_WITH = "BEGINS_WITH"
- COMPARISON_IN = "IN"
- COMPARISON_BETWEEN = "BETWEEN"
-)
-
-type Key struct {
- HashKey string
- RangeKey string
-}
-
-type PrimaryKey struct {
- KeyAttribute *Attribute
- RangeAttribute *Attribute
-}
-
-type Attribute struct {
- Type string
- Name string
- Value string
- SetValues []string
- Exists string // exists on dynamodb? Values: "true", "false", or ""
-}
-
-type AttributeComparison struct {
- AttributeName string
- ComparisonOperator string
- AttributeValueList []Attribute // contains attributes with only types and names (value ignored)
-}
-
-func NewEqualInt64AttributeComparison(attributeName string, equalToValue int64) *AttributeComparison {
- numeric := NewNumericAttribute(attributeName, strconv.FormatInt(equalToValue, 10))
- return &AttributeComparison{attributeName,
- COMPARISON_EQUAL,
- []Attribute{*numeric},
- }
-}
-
-func NewEqualStringAttributeComparison(attributeName string, equalToValue string) *AttributeComparison {
- str := NewStringAttribute(attributeName, equalToValue)
- return &AttributeComparison{attributeName,
- COMPARISON_EQUAL,
- []Attribute{*str},
- }
-}
-
-func NewStringAttributeComparison(attributeName string, comparisonOperator string, value string) *AttributeComparison {
- valueToCompare := NewStringAttribute(attributeName, value)
- return &AttributeComparison{attributeName,
- comparisonOperator,
- []Attribute{*valueToCompare},
- }
-}
-
-func NewNumericAttributeComparison(attributeName string, comparisonOperator string, value int64) *AttributeComparison {
- valueToCompare := NewNumericAttribute(attributeName, strconv.FormatInt(value, 10))
- return &AttributeComparison{attributeName,
- comparisonOperator,
- []Attribute{*valueToCompare},
- }
-}
-
-func NewBinaryAttributeComparison(attributeName string, comparisonOperator string, value bool) *AttributeComparison {
- valueToCompare := NewBinaryAttribute(attributeName, strconv.FormatBool(value))
- return &AttributeComparison{attributeName,
- comparisonOperator,
- []Attribute{*valueToCompare},
- }
-}
-
-func NewStringAttribute(name string, value string) *Attribute {
- return &Attribute{
- Type: TYPE_STRING,
- Name: name,
- Value: value,
- }
-}
-
-func NewNumericAttribute(name string, value string) *Attribute {
- return &Attribute{
- Type: TYPE_NUMBER,
- Name: name,
- Value: value,
- }
-}
-
-func NewBinaryAttribute(name string, value string) *Attribute {
- return &Attribute{
- Type: TYPE_BINARY,
- Name: name,
- Value: value,
- }
-}
-
-func NewStringSetAttribute(name string, values []string) *Attribute {
- return &Attribute{
- Type: TYPE_STRING_SET,
- Name: name,
- SetValues: values,
- }
-}
-
-func NewNumericSetAttribute(name string, values []string) *Attribute {
- return &Attribute{
- Type: TYPE_NUMBER_SET,
- Name: name,
- SetValues: values,
- }
-}
-
-func NewBinarySetAttribute(name string, values []string) *Attribute {
- return &Attribute{
- Type: TYPE_BINARY_SET,
- Name: name,
- SetValues: values,
- }
-}
-
-func (a *Attribute) SetType() bool {
- switch a.Type {
- case TYPE_BINARY_SET, TYPE_NUMBER_SET, TYPE_STRING_SET:
- return true
- }
- return false
-}
-
-func (a *Attribute) SetExists(exists bool) *Attribute {
- if exists {
- a.Exists = "true"
- } else {
- a.Exists = "false"
- }
- return a
-}
-
-func (k *PrimaryKey) HasRange() bool {
- return k.RangeAttribute != nil
-}
-
-// Useful when you may have many goroutines using a primary key, so they don't fuxor up your values.
-func (k *PrimaryKey) Clone(h string, r string) []Attribute {
- pk := &Attribute{
- Type: k.KeyAttribute.Type,
- Name: k.KeyAttribute.Name,
- Value: h,
- }
-
- result := []Attribute{*pk}
-
- if k.HasRange() {
- rk := &Attribute{
- Type: k.RangeAttribute.Type,
- Name: k.RangeAttribute.Name,
- Value: r,
- }
-
- result = append(result, *rk)
- }
-
- return result
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/const.go b/vendor/github.com/goamz/goamz/dynamodb/const.go
deleted file mode 100644
index b070d44cb..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/const.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package dynamodb
-
-type ReturnValues string
-
-const (
- NONE ReturnValues = "NONE"
- ALL_OLD ReturnValues = "ALL_HOLD"
- UPDATED_OLD ReturnValues = "UPDATED_OLD"
- ALL_NEW ReturnValues = "ALL_NEW"
- UPDATED_NEW ReturnValues = "UPDATED_NEW"
-)
diff --git a/vendor/github.com/goamz/goamz/dynamodb/dynamodb.go b/vendor/github.com/goamz/goamz/dynamodb/dynamodb.go
deleted file mode 100755
index 7881e8dc1..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/dynamodb.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package dynamodb
-
-import simplejson "github.com/bitly/go-simplejson"
-import (
- "errors"
- "github.com/goamz/goamz/aws"
- "io/ioutil"
- "log"
- "net/http"
- "strings"
- "time"
-)
-
-type Server struct {
- Auth aws.Auth
- Region aws.Region
-}
-
-/*
-type Query struct {
- Query string
-}
-*/
-
-/*
-func NewQuery(queryParts []string) *Query {
- return &Query{
- "{" + strings.Join(queryParts, ",") + "}",
- }
-}
-*/
-
-const (
- // DynamoDBAPIPrefix is the versioned prefix for DynamoDB API commands.
- DynamoDBAPIPrefix = "DynamoDB_20120810."
- // DynamoDBStreamsAPIPrefix is the versioned prefix for DynamoDB Streams API commands.
- DynamoDBStreamsAPIPrefix = "DynamoDBStreams_20120810."
-)
-
-// Specific error constants
-var ErrNotFound = errors.New("Item not found")
-
-// Error represents an error in an operation with Dynamodb (following goamz/s3)
-type Error struct {
- StatusCode int // HTTP status code (200, 403, ...)
- Status string
- Code string // Dynamodb error code ("MalformedQueryString", ...)
- Message string // The human-oriented error message
-}
-
-func (e *Error) Error() string {
- return e.Code + ": " + e.Message
-}
-
-func buildError(r *http.Response, jsonBody []byte) error {
-
- ddbError := Error{
- StatusCode: r.StatusCode,
- Status: r.Status,
- }
- // TODO return error if Unmarshal fails?
-
- json, err := simplejson.NewJson(jsonBody)
- if err != nil {
- log.Printf("Failed to parse body as JSON")
- return err
- }
- ddbError.Message = json.Get("message").MustString()
-
- // Of the form: com.amazon.coral.validate#ValidationException
- // We only want the last part
- codeStr := json.Get("__type").MustString()
- hashIndex := strings.Index(codeStr, "#")
- if hashIndex > 0 {
- codeStr = codeStr[hashIndex+1:]
- }
- ddbError.Code = codeStr
-
- return &ddbError
-}
-
-func (s *Server) queryServer(target string, query *Query) ([]byte, error) {
- data := strings.NewReader(query.String())
- var endpoint string
- if isStreamsTarget(target) {
- endpoint = s.Region.DynamoDBStreamsEndpoint
- } else {
- endpoint = s.Region.DynamoDBEndpoint
- }
- hreq, err := http.NewRequest("POST", endpoint+"/", data)
- if err != nil {
- return nil, err
- }
-
- hreq.Header.Set("Content-Type", "application/x-amz-json-1.0")
- hreq.Header.Set("X-Amz-Date", time.Now().UTC().Format(aws.ISO8601BasicFormat))
- hreq.Header.Set("X-Amz-Target", target)
-
- token := s.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(s.Auth, "dynamodb", s.Region)
- signer.Sign(hreq)
-
- resp, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- log.Printf("Error calling Amazon")
- return nil, err
- }
-
- defer resp.Body.Close()
-
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- log.Printf("Could not read response body")
- return nil, err
- }
-
- // http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html
- // "A response code of 200 indicates the operation was successful."
- if resp.StatusCode != 200 {
- ddbErr := buildError(resp, body)
- return nil, ddbErr
- }
-
- return body, nil
-}
-
-func target(name string) string {
- return DynamoDBAPIPrefix + name
-}
-
-func streamsTarget(name string) string {
- return DynamoDBStreamsAPIPrefix + name
-}
-
-func isStreamsTarget(target string) bool {
- return strings.HasPrefix(target, DynamoDBStreamsAPIPrefix)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/dynamodb_test.go b/vendor/github.com/goamz/goamz/dynamodb/dynamodb_test.go
deleted file mode 100755
index 63dd03da3..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/dynamodb_test.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package dynamodb_test
-
-import (
- "flag"
- "testing"
- "time"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-const TIMEOUT = 3 * time.Minute
-
-var amazon = flag.Bool("amazon", false, "Enable tests against dynamodb")
-var local = flag.Bool("local", true, "Use DynamoDB local on 8080 instead of real server on us-east.")
-
-var dynamodb_region aws.Region
-var dynamodb_auth aws.Auth
-
-type DynamoDBTest struct {
- server *dynamodb.Server
- aws.Region // Exports Region
- TableDescriptionT dynamodb.TableDescriptionT
- table *dynamodb.Table
-}
-
-// Delete all items in the table
-func (s *DynamoDBTest) TearDownTest(c *C) {
- pk, err := s.TableDescriptionT.BuildPrimaryKey()
- if err != nil {
- c.Fatal(err)
- }
-
- attrs, err := s.table.Scan(nil)
- if err != nil {
- c.Fatal(err)
- }
- for _, a := range attrs {
- key := &dynamodb.Key{
- HashKey: a[pk.KeyAttribute.Name].Value,
- }
- if pk.HasRange() {
- key.RangeKey = a[pk.RangeAttribute.Name].Value
- }
- if ok, err := s.table.DeleteItem(key); !ok {
- c.Fatal(err)
- }
- }
-}
-
-func (s *DynamoDBTest) TearDownSuite(c *C) {
- // return immediately in the case of calling c.Skip() in SetUpSuite()
- if s.server == nil {
- return
- }
-
- // check whether the table exists
- if tables, err := s.server.ListTables(); err != nil {
- c.Fatal(err)
- } else {
- if !findTableByName(tables, s.TableDescriptionT.TableName) {
- return
- }
- }
-
- // Delete the table and wait
- if _, err := s.server.DeleteTable(s.TableDescriptionT); err != nil {
- c.Fatal(err)
- }
-
- done := make(chan bool)
- timeout := time.After(TIMEOUT)
- go func() {
- for {
- select {
- case <-done:
- return
- default:
- tables, err := s.server.ListTables()
- if err != nil {
- c.Fatal(err)
- }
- if findTableByName(tables, s.TableDescriptionT.TableName) {
- time.Sleep(5 * time.Second)
- } else {
- done <- true
- return
- }
- }
- }
- }()
- select {
- case <-done:
- break
- case <-timeout:
- c.Error("Expect the table to be deleted but timed out")
- close(done)
- }
-}
-
-func (s *DynamoDBTest) WaitUntilStatus(c *C, status string) {
- // We should wait until the table is in specified status because a real DynamoDB has some delay for ready
- done := make(chan bool)
- timeout := time.After(TIMEOUT)
- go func() {
- for {
- select {
- case <-done:
- return
- default:
- desc, err := s.table.DescribeTable()
- if err != nil {
- c.Fatal(err)
- }
- if desc.TableStatus == status {
- done <- true
- return
- }
- time.Sleep(5 * time.Second)
- }
- }
- }()
- select {
- case <-done:
- break
- case <-timeout:
- c.Errorf("Expect a status to be %s, but timed out", status)
- close(done)
- }
-}
-
-func setUpAuth(c *C) {
- if !*amazon {
- c.Skip("Test against amazon not enabled.")
- }
- if *local {
- c.Log("Using local server")
- dynamodb_region = aws.Region{
- DynamoDBEndpoint: "http://127.0.0.1:8000",
- DynamoDBStreamsEndpoint: "http://127.0.0.1:8000",
- }
- dynamodb_auth = aws.Auth{AccessKey: "DUMMY_KEY", SecretKey: "DUMMY_SECRET"}
- } else {
- c.Log("Using REAL AMAZON SERVER")
- dynamodb_region = aws.USEast
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err)
- }
- dynamodb_auth = auth
- }
-}
-
-func findTableByName(tables []string, name string) bool {
- for _, t := range tables {
- if t == name {
- return true
- }
- }
- return false
-}
-
-func Test(t *testing.T) {
- TestingT(t)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/item.go b/vendor/github.com/goamz/goamz/dynamodb/item.go
deleted file mode 100755
index a3814d9ad..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/item.go
+++ /dev/null
@@ -1,351 +0,0 @@
-package dynamodb
-
-import simplejson "github.com/bitly/go-simplejson"
-import (
- "errors"
- "fmt"
- "log"
-)
-
-type BatchGetItem struct {
- Server *Server
- Keys map[*Table][]Key
-}
-
-type BatchWriteItem struct {
- Server *Server
- ItemActions map[*Table]map[string][][]Attribute
-}
-
-func (t *Table) BatchGetItems(keys []Key) *BatchGetItem {
- batchGetItem := &BatchGetItem{t.Server, make(map[*Table][]Key)}
-
- batchGetItem.Keys[t] = keys
- return batchGetItem
-}
-
-func (t *Table) BatchWriteItems(itemActions map[string][][]Attribute) *BatchWriteItem {
- batchWriteItem := &BatchWriteItem{t.Server, make(map[*Table]map[string][][]Attribute)}
-
- batchWriteItem.ItemActions[t] = itemActions
- return batchWriteItem
-}
-
-func (batchGetItem *BatchGetItem) AddTable(t *Table, keys *[]Key) *BatchGetItem {
- batchGetItem.Keys[t] = *keys
- return batchGetItem
-}
-
-func (batchWriteItem *BatchWriteItem) AddTable(t *Table, itemActions *map[string][][]Attribute) *BatchWriteItem {
- batchWriteItem.ItemActions[t] = *itemActions
- return batchWriteItem
-}
-
-func (batchGetItem *BatchGetItem) Execute() (map[string][]map[string]*Attribute, error) {
- q := NewEmptyQuery()
- q.AddGetRequestItems(batchGetItem.Keys)
-
- jsonResponse, err := batchGetItem.Server.queryServer("DynamoDB_20120810.BatchGetItem", q)
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return nil, err
- }
-
- results := make(map[string][]map[string]*Attribute)
-
- tables, err := json.Get("Responses").Map()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- for table, entries := range tables {
- var tableResult []map[string]*Attribute
-
- jsonEntriesArray, ok := entries.([]interface{})
- if !ok {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- for _, entry := range jsonEntriesArray {
- item, ok := entry.(map[string]interface{})
- if !ok {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- unmarshalledItem := parseAttributes(item)
- tableResult = append(tableResult, unmarshalledItem)
- }
-
- results[table] = tableResult
- }
-
- return results, nil
-}
-
-func (batchWriteItem *BatchWriteItem) Execute() (map[string]interface{}, error) {
- q := NewEmptyQuery()
- q.AddWriteRequestItems(batchWriteItem.ItemActions)
-
- jsonResponse, err := batchWriteItem.Server.queryServer("DynamoDB_20120810.BatchWriteItem", q)
-
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return nil, err
- }
-
- unprocessed, err := json.Get("UnprocessedItems").Map()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- if len(unprocessed) == 0 {
- return nil, nil
- } else {
- return unprocessed, errors.New("One or more unprocessed items.")
- }
-
-}
-
-func (t *Table) GetItem(key *Key) (map[string]*Attribute, error) {
- return t.getItem(key, false)
-}
-
-func (t *Table) GetItemConsistent(key *Key, consistentRead bool) (map[string]*Attribute, error) {
- return t.getItem(key, consistentRead)
-}
-
-func (t *Table) getItem(key *Key, consistentRead bool) (map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKey(t, key)
-
- if consistentRead {
- q.ConsistentRead(consistentRead)
- }
-
- jsonResponse, err := t.Server.queryServer(target("GetItem"), q)
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return nil, err
- }
-
- itemJson, ok := json.CheckGet("Item")
- if !ok {
- // We got an empty from amz. The item doesn't exist.
- return nil, ErrNotFound
- }
-
- item, err := itemJson.Map()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- return parseAttributes(item), nil
-
-}
-
-func (t *Table) PutItem(hashKey string, rangeKey string, attributes []Attribute) (bool, error) {
- return t.putItem(hashKey, rangeKey, attributes, nil)
-}
-
-func (t *Table) ConditionalPutItem(hashKey, rangeKey string, attributes, expected []Attribute) (bool, error) {
- return t.putItem(hashKey, rangeKey, attributes, expected)
-}
-
-func (t *Table) putItem(hashKey, rangeKey string, attributes, expected []Attribute) (bool, error) {
- if len(attributes) == 0 {
- return false, errors.New("At least one attribute is required.")
- }
-
- q := NewQuery(t)
-
- keys := t.Key.Clone(hashKey, rangeKey)
- attributes = append(attributes, keys...)
-
- q.AddItem(attributes)
- if expected != nil {
- q.AddExpected(expected)
- }
-
- jsonResponse, err := t.Server.queryServer(target("PutItem"), q)
-
- if err != nil {
- return false, err
- }
-
- _, err = simplejson.NewJson(jsonResponse)
- if err != nil {
- return false, err
- }
-
- return true, nil
-}
-
-func (t *Table) deleteItem(key *Key, expected []Attribute) (bool, error) {
- q := NewQuery(t)
- q.AddKey(t, key)
-
- if expected != nil {
- q.AddExpected(expected)
- }
-
- jsonResponse, err := t.Server.queryServer(target("DeleteItem"), q)
-
- if err != nil {
- return false, err
- }
-
- _, err = simplejson.NewJson(jsonResponse)
- if err != nil {
- return false, err
- }
-
- return true, nil
-}
-
-func (t *Table) DeleteItem(key *Key) (bool, error) {
- return t.deleteItem(key, nil)
-}
-
-func (t *Table) ConditionalDeleteItem(key *Key, expected []Attribute) (bool, error) {
- return t.deleteItem(key, expected)
-}
-
-func (t *Table) AddAttributes(key *Key, attributes []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, nil, "ADD")
-}
-
-func (t *Table) UpdateAttributes(key *Key, attributes []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, nil, "PUT")
-}
-
-func (t *Table) DeleteAttributes(key *Key, attributes []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, nil, "DELETE")
-}
-
-func (t *Table) ConditionalAddAttributes(key *Key, attributes, expected []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, expected, "ADD")
-}
-
-func (t *Table) ConditionalUpdateAttributes(key *Key, attributes, expected []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, expected, "PUT")
-}
-
-func (t *Table) ConditionalDeleteAttributes(key *Key, attributes, expected []Attribute) (bool, error) {
- return t.modifyAttributes(key, attributes, expected, "DELETE")
-}
-
-func (t *Table) modifyAttributes(key *Key, attributes, expected []Attribute, action string) (bool, error) {
-
- if len(attributes) == 0 {
- return false, errors.New("At least one attribute is required.")
- }
-
- q := NewQuery(t)
- q.AddKey(t, key)
- q.AddUpdates(attributes, action)
-
- if expected != nil {
- q.AddExpected(expected)
- }
-
- jsonResponse, err := t.Server.queryServer(target("UpdateItem"), q)
-
- if err != nil {
- return false, err
- }
-
- _, err = simplejson.NewJson(jsonResponse)
- if err != nil {
- return false, err
- }
-
- return true, nil
-}
-
-func parseAttributes(s map[string]interface{}) map[string]*Attribute {
- results := map[string]*Attribute{}
-
- for key, value := range s {
- if v, ok := value.(map[string]interface{}); ok {
- if val, ok := v[TYPE_STRING].(string); ok {
- results[key] = &Attribute{
- Type: TYPE_STRING,
- Name: key,
- Value: val,
- }
- } else if val, ok := v[TYPE_NUMBER].(string); ok {
- results[key] = &Attribute{
- Type: TYPE_NUMBER,
- Name: key,
- Value: val,
- }
- } else if val, ok := v[TYPE_BINARY].(string); ok {
- results[key] = &Attribute{
- Type: TYPE_BINARY,
- Name: key,
- Value: val,
- }
- } else if vals, ok := v[TYPE_STRING_SET].([]interface{}); ok {
- arry := make([]string, len(vals))
- for i, ivalue := range vals {
- if val, ok := ivalue.(string); ok {
- arry[i] = val
- }
- }
- results[key] = &Attribute{
- Type: TYPE_STRING_SET,
- Name: key,
- SetValues: arry,
- }
- } else if vals, ok := v[TYPE_NUMBER_SET].([]interface{}); ok {
- arry := make([]string, len(vals))
- for i, ivalue := range vals {
- if val, ok := ivalue.(string); ok {
- arry[i] = val
- }
- }
- results[key] = &Attribute{
- Type: TYPE_NUMBER_SET,
- Name: key,
- SetValues: arry,
- }
- } else if vals, ok := v[TYPE_BINARY_SET].([]interface{}); ok {
- arry := make([]string, len(vals))
- for i, ivalue := range vals {
- if val, ok := ivalue.(string); ok {
- arry[i] = val
- }
- }
- results[key] = &Attribute{
- Type: TYPE_BINARY_SET,
- Name: key,
- SetValues: arry,
- }
- }
- } else {
- log.Printf("type assertion to map[string] interface{} failed for : %s\n ", value)
- }
-
- }
-
- return results
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/item_test.go b/vendor/github.com/goamz/goamz/dynamodb/item_test.go
deleted file mode 100644
index 37b4b8838..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/item_test.go
+++ /dev/null
@@ -1,446 +0,0 @@
-package dynamodb_test
-
-import (
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-type ItemSuite struct {
- TableDescriptionT dynamodb.TableDescriptionT
- DynamoDBTest
- WithRange bool
-}
-
-func (s *ItemSuite) SetUpSuite(c *C) {
- setUpAuth(c)
- s.DynamoDBTest.TableDescriptionT = s.TableDescriptionT
- s.server = &dynamodb.Server{dynamodb_auth, dynamodb_region}
- pk, err := s.TableDescriptionT.BuildPrimaryKey()
- if err != nil {
- c.Skip(err.Error())
- }
- s.table = s.server.NewTable(s.TableDescriptionT.TableName, pk)
-
- // Cleanup
- s.TearDownSuite(c)
- _, err = s.server.CreateTable(s.TableDescriptionT)
- if err != nil {
- c.Fatal(err)
- }
- s.WaitUntilStatus(c, "ACTIVE")
-}
-
-var item_suite = &ItemSuite{
- TableDescriptionT: dynamodb.TableDescriptionT{
- TableName: "DynamoDBTestMyTable",
- AttributeDefinitions: []dynamodb.AttributeDefinitionT{
- dynamodb.AttributeDefinitionT{"TestHashKey", "S"},
- dynamodb.AttributeDefinitionT{"TestRangeKey", "N"},
- },
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- dynamodb.KeySchemaT{"TestRangeKey", "RANGE"},
- },
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- },
- WithRange: true,
-}
-
-var item_without_range_suite = &ItemSuite{
- TableDescriptionT: dynamodb.TableDescriptionT{
- TableName: "DynamoDBTestMyTable",
- AttributeDefinitions: []dynamodb.AttributeDefinitionT{
- dynamodb.AttributeDefinitionT{"TestHashKey", "S"},
- },
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- },
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- },
- WithRange: false,
-}
-
-var _ = Suite(item_suite)
-var _ = Suite(item_without_range_suite)
-
-func (s *ItemSuite) TestConditionalPutUpdateDeleteItem(c *C) {
- if s.WithRange {
- // No rangekey test required
- return
- }
-
- attrs := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr1Val"),
- }
- pk := &dynamodb.Key{HashKey: "NewHashKeyVal"}
-
- // Put
- if ok, err := s.table.PutItem("NewHashKeyVal", "", attrs); !ok {
- c.Fatal(err)
- }
-
- {
- // Put with condition failed
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "expectedAttr1Val").SetExists(true),
- *dynamodb.NewStringAttribute("AttrNotExists", "").SetExists(false),
- }
- if ok, err := s.table.ConditionalPutItem("NewHashKeyVal", "", attrs, expected); ok {
- c.Errorf("Expect condition does not meet.")
- } else {
- c.Check(err.Error(), Matches, "ConditionalCheckFailedException.*")
- }
-
- // Add attributes with condition failed
- if ok, err := s.table.ConditionalAddAttributes(pk, attrs, expected); ok {
- c.Errorf("Expect condition does not meet.")
- } else {
- c.Check(err.Error(), Matches, "ConditionalCheckFailedException.*")
- }
-
- // Update attributes with condition failed
- if ok, err := s.table.ConditionalUpdateAttributes(pk, attrs, expected); ok {
- c.Errorf("Expect condition does not meet.")
- } else {
- c.Check(err.Error(), Matches, "ConditionalCheckFailedException.*")
- }
-
- // Delete attributes with condition failed
- if ok, err := s.table.ConditionalDeleteAttributes(pk, attrs, expected); ok {
- c.Errorf("Expect condition does not meet.")
- } else {
- c.Check(err.Error(), Matches, "ConditionalCheckFailedException.*")
- }
- }
-
- {
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr1Val").SetExists(true),
- }
-
- // Add attributes with condition met
- addNewAttrs := []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("AddNewAttr1", "10"),
- *dynamodb.NewNumericAttribute("AddNewAttr2", "20"),
- }
- if ok, err := s.table.ConditionalAddAttributes(pk, addNewAttrs, nil); !ok {
- c.Errorf("Expect condition met. %s", err)
- }
-
- // Update attributes with condition met
- updateAttrs := []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("AddNewAttr1", "100"),
- }
- if ok, err := s.table.ConditionalUpdateAttributes(pk, updateAttrs, expected); !ok {
- c.Errorf("Expect condition met. %s", err)
- }
-
- // Delete attributes with condition met
- deleteAttrs := []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("AddNewAttr2", ""),
- }
- if ok, err := s.table.ConditionalDeleteAttributes(pk, deleteAttrs, expected); !ok {
- c.Errorf("Expect condition met. %s", err)
- }
-
- // Get to verify operations that condition are met
- item, err := s.table.GetItem(pk)
- if err != nil {
- c.Fatal(err)
- }
-
- if val, ok := item["AddNewAttr1"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewNumericAttribute("AddNewAttr1", "100"))
- } else {
- c.Error("Expect AddNewAttr1 attribute to be added and updated")
- }
-
- if _, ok := item["AddNewAttr2"]; ok {
- c.Error("Expect AddNewAttr2 attribute to be deleted")
- }
- }
-
- {
- // Put with condition met
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr1Val").SetExists(true),
- }
- newattrs := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr2Val"),
- }
- if ok, err := s.table.ConditionalPutItem("NewHashKeyVal", "", newattrs, expected); !ok {
- c.Errorf("Expect condition met. %s", err)
- }
-
- // Get to verify Put operation that condition are met
- item, err := s.table.GetItem(pk)
- if err != nil {
- c.Fatal(err)
- }
-
- if val, ok := item["Attr1"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewStringAttribute("Attr1", "Attr2Val"))
- } else {
- c.Error("Expect Attr1 attribute to be updated")
- }
- }
-
- {
- // Delete with condition failed
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "expectedAttr1Val").SetExists(true),
- }
- if ok, err := s.table.ConditionalDeleteItem(pk, expected); ok {
- c.Errorf("Expect condition does not meet.")
- } else {
- c.Check(err.Error(), Matches, "ConditionalCheckFailedException.*")
- }
- }
-
- {
- // Delete with condition met
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr2Val").SetExists(true),
- }
- if ok, _ := s.table.ConditionalDeleteItem(pk, expected); !ok {
- c.Errorf("Expect condition met.")
- }
-
- // Get to verify Delete operation
- _, err := s.table.GetItem(pk)
- c.Check(err.Error(), Matches, "Item not found")
- }
-}
-
-func (s *ItemSuite) TestPutGetDeleteItem(c *C) {
- attrs := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("Attr1", "Attr1Val"),
- }
-
- var rk string
- if s.WithRange {
- rk = "1"
- }
-
- // Put
- if ok, err := s.table.PutItem("NewHashKeyVal", rk, attrs); !ok {
- c.Fatal(err)
- }
-
- // Get to verify Put operation
- pk := &dynamodb.Key{HashKey: "NewHashKeyVal", RangeKey: rk}
- item, err := s.table.GetItem(pk)
- if err != nil {
- c.Fatal(err)
- }
-
- if val, ok := item["TestHashKey"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewStringAttribute("TestHashKey", "NewHashKeyVal"))
- } else {
- c.Error("Expect TestHashKey to be found")
- }
-
- if s.WithRange {
- if val, ok := item["TestRangeKey"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewNumericAttribute("TestRangeKey", "1"))
- } else {
- c.Error("Expect TestRangeKey to be found")
- }
- }
-
- // Delete
- if ok, _ := s.table.DeleteItem(pk); !ok {
- c.Fatal(err)
- }
-
- // Get to verify Delete operation
- _, err = s.table.GetItem(pk)
- c.Check(err.Error(), Matches, "Item not found")
-}
-
-func (s *ItemSuite) TestUpdateItem(c *C) {
- attrs := []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("count", "0"),
- }
-
- var rk string
- if s.WithRange {
- rk = "1"
- }
-
- if ok, err := s.table.PutItem("NewHashKeyVal", rk, attrs); !ok {
- c.Fatal(err)
- }
-
- // UpdateItem with Add
- attrs = []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("count", "10"),
- }
- pk := &dynamodb.Key{HashKey: "NewHashKeyVal", RangeKey: rk}
- if ok, err := s.table.AddAttributes(pk, attrs); !ok {
- c.Error(err)
- }
-
- // Get to verify Add operation
- if item, err := s.table.GetItemConsistent(pk, true); err != nil {
- c.Error(err)
- } else {
- if val, ok := item["count"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewNumericAttribute("count", "10"))
- } else {
- c.Error("Expect count to be found")
- }
- }
-
- // UpdateItem with Put
- attrs = []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("count", "100"),
- }
- if ok, err := s.table.UpdateAttributes(pk, attrs); !ok {
- c.Error(err)
- }
-
- // Get to verify Put operation
- if item, err := s.table.GetItem(pk); err != nil {
- c.Fatal(err)
- } else {
- if val, ok := item["count"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewNumericAttribute("count", "100"))
- } else {
- c.Error("Expect count to be found")
- }
- }
-
- // UpdateItem with Delete
- attrs = []dynamodb.Attribute{
- *dynamodb.NewNumericAttribute("count", ""),
- }
- if ok, err := s.table.DeleteAttributes(pk, attrs); !ok {
- c.Error(err)
- }
-
- // Get to verify Delete operation
- if item, err := s.table.GetItem(pk); err != nil {
- c.Error(err)
- } else {
- if _, ok := item["count"]; ok {
- c.Error("Expect count not to be found")
- }
- }
-}
-
-func (s *ItemSuite) TestUpdateItemWithSet(c *C) {
- attrs := []dynamodb.Attribute{
- *dynamodb.NewStringSetAttribute("list", []string{"A", "B"}),
- }
-
- var rk string
- if s.WithRange {
- rk = "1"
- }
-
- if ok, err := s.table.PutItem("NewHashKeyVal", rk, attrs); !ok {
- c.Error(err)
- }
-
- // UpdateItem with Add
- attrs = []dynamodb.Attribute{
- *dynamodb.NewStringSetAttribute("list", []string{"C"}),
- }
- pk := &dynamodb.Key{HashKey: "NewHashKeyVal", RangeKey: rk}
- if ok, err := s.table.AddAttributes(pk, attrs); !ok {
- c.Error(err)
- }
-
- // Get to verify Add operation
- if item, err := s.table.GetItem(pk); err != nil {
- c.Error(err)
- } else {
- if val, ok := item["list"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewStringSetAttribute("list", []string{"A", "B", "C"}))
- } else {
- c.Error("Expect count to be found")
- }
- }
-
- // UpdateItem with Delete
- attrs = []dynamodb.Attribute{
- *dynamodb.NewStringSetAttribute("list", []string{"A"}),
- }
- if ok, err := s.table.DeleteAttributes(pk, attrs); !ok {
- c.Error(err)
- }
-
- // Get to verify Delete operation
- if item, err := s.table.GetItem(pk); err != nil {
- c.Error(err)
- } else {
- if val, ok := item["list"]; ok {
- c.Check(val, DeepEquals, dynamodb.NewStringSetAttribute("list", []string{"B", "C"}))
- } else {
- c.Error("Expect list to be remained")
- }
- }
-}
-
-func (s *ItemSuite) TestUpdateItem_new(c *C) {
- attrs := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("intval", "1"),
- }
- var rk string
- if s.WithRange {
- rk = "1"
- }
- pk := &dynamodb.Key{HashKey: "UpdateKeyVal", RangeKey: rk}
-
- num := func(a, b string) dynamodb.Attribute {
- return *dynamodb.NewNumericAttribute(a, b)
- }
-
- checkVal := func(i string) {
- if item, err := s.table.GetItem(pk); err != nil {
- c.Error(err)
- } else {
- c.Check(item["intval"], DeepEquals, dynamodb.NewNumericAttribute("intval", i))
- }
- }
-
- if ok, err := s.table.PutItem("UpdateKeyVal", rk, attrs); !ok {
- c.Error(err)
- }
- checkVal("1")
-
- // Simple Increment
- s.table.UpdateItem(pk).UpdateExpression("SET intval = intval + :incr", num(":incr", "5")).Execute()
- checkVal("6")
-
- conditionalUpdate := func(check string) {
- s.table.UpdateItem(pk).
- ConditionExpression("intval = :check").
- UpdateExpression("SET intval = intval + :incr").
- ExpressionAttributes(num(":check", check), num(":incr", "4")).
- Execute()
- }
- // Conditional increment should be a no-op.
- conditionalUpdate("42")
- checkVal("6")
-
- // conditional increment should succeed this time
- conditionalUpdate("6")
- checkVal("10")
-
- // Update with new values getting values
- result, err := s.table.UpdateItem(pk).
- ReturnValues(dynamodb.UPDATED_NEW).
- UpdateExpression("SET intval = intval + :incr", num(":incr", "2")).
- Execute()
- c.Check(err, IsNil)
- c.Check(result.Attributes["intval"], DeepEquals, num("intval", "12"))
- checkVal("12")
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/marshaller.go b/vendor/github.com/goamz/goamz/dynamodb/marshaller.go
deleted file mode 100644
index 2898fbda9..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/marshaller.go
+++ /dev/null
@@ -1,626 +0,0 @@
-package dynamodb
-
-import (
- "encoding/base64"
- "encoding/json"
- "fmt"
- "math"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
- "unicode"
-)
-
-func MarshalAttributes(m interface{}) ([]Attribute, error) {
- v := reflect.ValueOf(m).Elem()
-
- builder := &attributeBuilder{}
- builder.buffer = []Attribute{}
- for _, f := range cachedTypeFields(v.Type()) { // loop on each field
- fv := fieldByIndex(v, f.index)
- if !fv.IsValid() || isEmptyValueToOmit(fv) {
- continue
- }
-
- err := builder.reflectToDynamoDBAttribute(f.name, fv)
- if err != nil {
- return builder.buffer, err
- }
- }
-
- return builder.buffer, nil
-}
-
-func UnmarshalAttributes(attributesRef *map[string]*Attribute, m interface{}) error {
- rv := reflect.ValueOf(m)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return fmt.Errorf("InvalidUnmarshalError reflect.ValueOf(v): %#v, m interface{}: %#v", rv, reflect.TypeOf(m))
- }
-
- v := reflect.ValueOf(m).Elem()
-
- attributes := *attributesRef
- for _, f := range cachedTypeFields(v.Type()) { // loop on each field
- fv := fieldByIndex(v, f.index)
- correlatedAttribute := attributes[f.name]
- if correlatedAttribute == nil {
- continue
- }
- err := unmarshallAttribute(correlatedAttribute, fv)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-type attributeBuilder struct {
- buffer []Attribute
-}
-
-func (builder *attributeBuilder) Push(attribute *Attribute) {
- builder.buffer = append(builder.buffer, *attribute)
-}
-
-func unmarshallAttribute(a *Attribute, v reflect.Value) error {
- switch v.Kind() {
- case reflect.Bool:
- n, err := strconv.ParseInt(a.Value, 10, 64)
- if err != nil {
- return fmt.Errorf("UnmarshalTypeError (bool) %#v: %#v", a.Value, err)
- }
- v.SetBool(n != 0)
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- n, err := strconv.ParseInt(a.Value, 10, 64)
- if err != nil || v.OverflowInt(n) {
- return fmt.Errorf("UnmarshalTypeError (number) %#v: %#v", a.Value, err)
- }
- v.SetInt(n)
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- n, err := strconv.ParseUint(a.Value, 10, 64)
- if err != nil || v.OverflowUint(n) {
- return fmt.Errorf("UnmarshalTypeError (number) %#v: %#v", a.Value, err)
- }
- v.SetUint(n)
-
- case reflect.Float32, reflect.Float64:
- n, err := strconv.ParseFloat(a.Value, v.Type().Bits())
- if err != nil || v.OverflowFloat(n) {
- return fmt.Errorf("UnmarshalTypeError (number) %#v: %#v", a.Value, err)
- }
- v.SetFloat(n)
-
- case reflect.String:
- v.SetString(a.Value)
-
- case reflect.Slice:
- if v.Type().Elem().Kind() == reflect.Uint8 { // byte arrays are a special case
- b := make([]byte, base64.StdEncoding.DecodedLen(len(a.Value)))
- n, err := base64.StdEncoding.Decode(b, []byte(a.Value))
- if err != nil {
- return fmt.Errorf("UnmarshalTypeError (byte) %#v: %#v", a.Value, err)
- }
- v.Set(reflect.ValueOf(b[0:n]))
- break
- }
-
- if a.SetType() { // Special NS and SS types should be correctly handled
- nativeSetCreated := false
- switch v.Type().Elem().Kind() {
- case reflect.Bool:
- nativeSetCreated = true
- arry := reflect.MakeSlice(v.Type(), len(a.SetValues), len(a.SetValues))
- for i, aval := range a.SetValues {
- n, err := strconv.ParseInt(aval, 10, 64)
- if err != nil {
- return fmt.Errorf("UnmarshalSetTypeError (bool) %#v: %#v", aval, err)
- }
- arry.Index(i).SetBool(n != 0)
- }
- v.Set(arry)
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- nativeSetCreated = true
- arry := reflect.MakeSlice(v.Type(), len(a.SetValues), len(a.SetValues))
- for i, aval := range a.SetValues {
- n, err := strconv.ParseInt(aval, 10, 64)
- if err != nil || arry.Index(i).OverflowInt(n) {
- return fmt.Errorf("UnmarshalSetTypeError (number) %#v: %#v", aval, err)
- }
- arry.Index(i).SetInt(n)
- }
- v.Set(arry)
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- nativeSetCreated = true
- arry := reflect.MakeSlice(v.Type(), len(a.SetValues), len(a.SetValues))
- for i, aval := range a.SetValues {
- n, err := strconv.ParseUint(aval, 10, 64)
- if err != nil || arry.Index(i).OverflowUint(n) {
- return fmt.Errorf("UnmarshalSetTypeError (number) %#v: %#v", aval, err)
- }
- arry.Index(i).SetUint(n)
- }
- v.Set(arry)
-
- case reflect.Float32, reflect.Float64:
- nativeSetCreated = true
- arry := reflect.MakeSlice(v.Type(), len(a.SetValues), len(a.SetValues))
- for i, aval := range a.SetValues {
- n, err := strconv.ParseFloat(aval, arry.Index(i).Type().Bits())
- if err != nil || arry.Index(i).OverflowFloat(n) {
- return fmt.Errorf("UnmarshalSetTypeError (number) %#v: %#v", aval, err)
- }
- arry.Index(i).SetFloat(n)
- }
- v.Set(arry)
-
- case reflect.String:
- nativeSetCreated = true
- arry := reflect.MakeSlice(v.Type(), len(a.SetValues), len(a.SetValues))
- for i, aval := range a.SetValues {
- arry.Index(i).SetString(aval)
- }
- v.Set(arry)
- }
-
- if nativeSetCreated {
- break
- }
- }
-
- // Slices can be marshalled as nil, but otherwise are handled
- // as arrays.
- fallthrough
- case reflect.Array, reflect.Struct, reflect.Map, reflect.Interface, reflect.Ptr:
- unmarshalled := reflect.New(v.Type())
- err := json.Unmarshal([]byte(a.Value), unmarshalled.Interface())
- if err != nil {
- return err
- }
- v.Set(unmarshalled.Elem())
-
- default:
- return fmt.Errorf("UnsupportedTypeError %#v", v.Type())
- }
-
- return nil
-}
-
-// reflectValueQuoted writes the value in v to the output.
-// If quoted is true, the serialization is wrapped in a JSON string.
-func (e *attributeBuilder) reflectToDynamoDBAttribute(name string, v reflect.Value) error {
- if !v.IsValid() {
- return nil
- } // don't build
-
- switch v.Kind() {
- case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
- rv, err := numericReflectedValueString(v)
- if err != nil {
- return err
- }
- e.Push(NewNumericAttribute(name, rv))
-
- case reflect.String:
- e.Push(NewStringAttribute(name, v.String()))
-
- case reflect.Slice:
- if v.IsNil() {
- break
- }
- if v.Type().Elem().Kind() == reflect.Uint8 {
- // Byte slices are treated as errors
- s := v.Bytes()
- dst := make([]byte, base64.StdEncoding.EncodedLen(len(s)))
- base64.StdEncoding.Encode(dst, s)
- e.Push(NewStringAttribute(name, string(dst)))
- break
- }
-
- // Special NS and SS types should be correctly handled
- nativeSetCreated := false
- switch v.Type().Elem().Kind() {
- case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
- nativeSetCreated = true
- arrystrings := make([]string, v.Len())
- for i, _ := range arrystrings {
- var err error
- arrystrings[i], err = numericReflectedValueString(v.Index(i))
- if err != nil {
- return err
- }
- }
- e.Push(NewNumericSetAttribute(name, arrystrings))
- case reflect.String: // simple copy will suffice
- nativeSetCreated = true
- arrystrings := make([]string, v.Len())
- for i, _ := range arrystrings {
- arrystrings[i] = v.Index(i).String()
- }
- e.Push(NewStringSetAttribute(name, arrystrings))
- }
-
- if nativeSetCreated {
- break
- }
-
- // Slices can be marshalled as nil, but otherwise are handled
- // as arrays.
- fallthrough
- case reflect.Array, reflect.Struct, reflect.Map, reflect.Interface, reflect.Ptr:
- jsonVersion, err := json.Marshal(v.Interface())
- if err != nil {
- return err
- }
- escapedJson := `"` + string(jsonVersion) + `"` // strconv.Quote not required because the entire string is escaped from json Marshall
- e.Push(NewStringAttribute(name, escapedJson[1:len(escapedJson)-1]))
-
- default:
- return fmt.Errorf("UnsupportedTypeError %#v", v.Type())
- }
- return nil
-}
-
-func numericReflectedValueString(v reflect.Value) (string, error) {
- switch v.Kind() {
- case reflect.Bool:
- x := v.Bool()
- if x {
- return "1", nil
- } else {
- return "0", nil
- }
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return strconv.FormatInt(v.Int(), 10), nil
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return strconv.FormatUint(v.Uint(), 10), nil
-
- case reflect.Float32, reflect.Float64:
- f := v.Float()
- if math.IsInf(f, 0) || math.IsNaN(f) {
- return "", fmt.Errorf("UnsupportedValueError %#v (formatted float: %s)", v, strconv.FormatFloat(f, 'g', -1, v.Type().Bits()))
- }
- return strconv.FormatFloat(f, 'g', -1, v.Type().Bits()), nil
- }
- return "", fmt.Errorf("UnsupportedNumericValueError %#v", v.Type())
-}
-
-// In DynamoDB we should omit empty value in some type
-// See http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html
-func isEmptyValueToOmit(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String, reflect.Interface, reflect.Ptr:
- // should omit if empty value
- return isEmptyValue(v)
- }
- // otherwise should not omit
- return false
-}
-
-// ---------------- Below are copied handy functions from http://golang.org/src/pkg/encoding/json/encode.go --------------------------------
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- }
- return false
-}
-
-func fieldByIndex(v reflect.Value, index []int) reflect.Value {
- for _, i := range index {
- if v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return reflect.Value{}
- }
- v = v.Elem()
- }
- v = v.Field(i)
- }
- return v
-}
-
-// A field represents a single field found in a struct.
-type field struct {
- name string
- tag bool
- index []int
- typ reflect.Type
- omitEmpty bool
- quoted bool
-}
-
-// byName sorts field by name, breaking ties with depth,
-// then breaking ties with "name came from json tag", then
-// breaking ties with index sequence.
-type byName []field
-
-func (x byName) Len() int { return len(x) }
-
-func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byName) Less(i, j int) bool {
- if x[i].name != x[j].name {
- return x[i].name < x[j].name
- }
- if len(x[i].index) != len(x[j].index) {
- return len(x[i].index) < len(x[j].index)
- }
- if x[i].tag != x[j].tag {
- return x[i].tag
- }
- return byIndex(x).Less(i, j)
-}
-
-// byIndex sorts field by index sequence.
-type byIndex []field
-
-func (x byIndex) Len() int { return len(x) }
-
-func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byIndex) Less(i, j int) bool {
- for k, xik := range x[i].index {
- if k >= len(x[j].index) {
- return false
- }
- if xik != x[j].index[k] {
- return xik < x[j].index[k]
- }
- }
- return len(x[i].index) < len(x[j].index)
-}
-
-func isValidTag(s string) bool {
- if s == "" {
- return false
- }
- for _, c := range s {
- switch {
- case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
- // Backslash and quote chars are reserved, but
- // otherwise any punctuation chars are allowed
- // in a tag name.
- default:
- if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
- return false
- }
- }
- }
- return true
-}
-
-// tagOptions is the string following a comma in a struct field's "json"
-// tag, or the empty string. It does not include the leading comma.
-type tagOptions string
-
-// Contains returns whether checks that a comma-separated list of options
-// contains a particular substr flag. substr must be surrounded by a
-// string boundary or commas.
-func (o tagOptions) Contains(optionName string) bool {
- if len(o) == 0 {
- return false
- }
- s := string(o)
- for s != "" {
- var next string
- i := strings.Index(s, ",")
- if i >= 0 {
- s, next = s[:i], s[i+1:]
- }
- if s == optionName {
- return true
- }
- s = next
- }
- return false
-}
-
-// parseTag splits a struct field's json tag into its name and
-// comma-separated options.
-func parseTag(tag string) (string, tagOptions) {
- if idx := strings.Index(tag, ","); idx != -1 {
- return tag[:idx], tagOptions(tag[idx+1:])
- }
- return tag, tagOptions("")
-}
-
-// typeFields returns a list of fields that JSON should recognize for the given type.
-// The algorithm is breadth-first search over the set of structs to include - the top struct
-// and then any reachable anonymous structs.
-func typeFields(t reflect.Type) []field {
- // Anonymous fields to explore at the current level and the next.
- current := []field{}
- next := []field{{typ: t}}
-
- // Count of queued names for current level and the next.
- count := map[reflect.Type]int{}
- nextCount := map[reflect.Type]int{}
-
- // Types already visited at an earlier level.
- visited := map[reflect.Type]bool{}
-
- // Fields found.
- var fields []field
-
- for len(next) > 0 {
- current, next = next, current[:0]
- count, nextCount = nextCount, map[reflect.Type]int{}
-
- for _, f := range current {
- if visited[f.typ] {
- continue
- }
- visited[f.typ] = true
-
- // Scan f.typ for fields to include.
- for i := 0; i < f.typ.NumField(); i++ {
- sf := f.typ.Field(i)
- if sf.PkgPath != "" { // unexported
- continue
- }
- tag := sf.Tag.Get("json")
- if tag == "-" {
- continue
- }
- name, opts := parseTag(tag)
- if !isValidTag(name) {
- name = ""
- }
- index := make([]int, len(f.index)+1)
- copy(index, f.index)
- index[len(f.index)] = i
-
- ft := sf.Type
- if ft.Name() == "" && ft.Kind() == reflect.Ptr {
- // Follow pointer.
- ft = ft.Elem()
- }
-
- // Record found field and index sequence.
- if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
- tagged := name != ""
- if name == "" {
- name = sf.Name
- }
- fields = append(fields, field{name, tagged, index, ft,
- opts.Contains("omitempty"), opts.Contains("string")})
- if count[f.typ] > 1 {
- // If there were multiple instances, add a second,
- // so that the annihilation code will see a duplicate.
- // It only cares about the distinction between 1 or 2,
- // so don't bother generating any more copies.
- fields = append(fields, fields[len(fields)-1])
- }
- continue
- }
-
- // Record new anonymous struct to explore in next round.
- nextCount[ft]++
- if nextCount[ft] == 1 {
- next = append(next, field{name: ft.Name(), index: index, typ: ft})
- }
- }
- }
- }
-
- sort.Sort(byName(fields))
-
- // Delete all fields that are hidden by the Go rules for embedded fields,
- // except that fields with JSON tags are promoted.
-
- // The fields are sorted in primary order of name, secondary order
- // of field index length. Loop over names; for each name, delete
- // hidden fields by choosing the one dominant field that survives.
- out := fields[:0]
- for advance, i := 0, 0; i < len(fields); i += advance {
- // One iteration per name.
- // Find the sequence of fields with the name of this first field.
- fi := fields[i]
- name := fi.name
- for advance = 1; i+advance < len(fields); advance++ {
- fj := fields[i+advance]
- if fj.name != name {
- break
- }
- }
- if advance == 1 { // Only one field with this name
- out = append(out, fi)
- continue
- }
- dominant, ok := dominantField(fields[i : i+advance])
- if ok {
- out = append(out, dominant)
- }
- }
-
- fields = out
- sort.Sort(byIndex(fields))
-
- return fields
-}
-
-// dominantField looks through the fields, all of which are known to
-// have the same name, to find the single field that dominates the
-// others using Go's embedding rules, modified by the presence of
-// JSON tags. If there are multiple top-level fields, the boolean
-// will be false: This condition is an error in Go and we skip all
-// the fields.
-func dominantField(fields []field) (field, bool) {
- // The fields are sorted in increasing index-length order. The winner
- // must therefore be one with the shortest index length. Drop all
- // longer entries, which is easy: just truncate the slice.
- length := len(fields[0].index)
- tagged := -1 // Index of first tagged field.
- for i, f := range fields {
- if len(f.index) > length {
- fields = fields[:i]
- break
- }
- if f.tag {
- if tagged >= 0 {
- // Multiple tagged fields at the same level: conflict.
- // Return no field.
- return field{}, false
- }
- tagged = i
- }
- }
- if tagged >= 0 {
- return fields[tagged], true
- }
- // All remaining fields have the same length. If there's more than one,
- // we have a conflict (two fields named "X" at the same level) and we
- // return no field.
- if len(fields) > 1 {
- return field{}, false
- }
- return fields[0], true
-}
-
-var fieldCache struct {
- sync.RWMutex
- m map[reflect.Type][]field
-}
-
-// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
-func cachedTypeFields(t reflect.Type) []field {
- fieldCache.RLock()
- f := fieldCache.m[t]
- fieldCache.RUnlock()
- if f != nil {
- return f
- }
-
- // Compute fields without lock.
- // Might duplicate effort but won't hold other computations back.
- f = typeFields(t)
- if f == nil {
- f = []field{}
- }
-
- fieldCache.Lock()
- if fieldCache.m == nil {
- fieldCache.m = map[reflect.Type][]field{}
- }
- fieldCache.m[t] = f
- fieldCache.Unlock()
- return f
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/marshaller_test.go b/vendor/github.com/goamz/goamz/dynamodb/marshaller_test.go
deleted file mode 100644
index 8b9d2fc08..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/marshaller_test.go
+++ /dev/null
@@ -1,283 +0,0 @@
-package dynamodb_test
-
-import (
- "time"
-
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-type TestSubStruct struct {
- SubBool bool
- SubInt int
- SubString string
- SubStringArray []string
-}
-
-type TestStruct struct {
- TestBool bool
- TestInt int
- TestInt32 int32
- TestInt64 int64
- TestUint uint
- TestFloat32 float32
- TestFloat64 float64
- TestString string
- TestByteArray []byte
- TestStringArray []string
- TestIntArray []int
- TestInt8Array []int8
- TestFloatArray []float64
- TestSub TestSubStruct
-}
-
-type TestStructTime struct {
- TestTime time.Time
-}
-
-func testObject() *TestStruct {
- return &TestStruct{
- TestBool: true,
- TestInt: -99,
- TestInt32: 999,
- TestInt64: 9999,
- TestUint: 99,
- TestFloat32: 9.9999,
- TestFloat64: 99.999999,
- TestString: "test",
- TestByteArray: []byte("bytes"),
- TestStringArray: []string{"test1", "test2", "test3", "test4"},
- TestIntArray: []int{0, 1, 12, 123, 1234, 12345},
- TestInt8Array: []int8{0, 1, 12, 123},
- TestFloatArray: []float64{0.1, 1.1, 1.2, 1.23, 1.234, 1.2345},
- TestSub: TestSubStruct{
- SubBool: true,
- SubInt: 2,
- SubString: "subtest",
- SubStringArray: []string{"sub1", "sub2", "sub3"},
- },
- }
-}
-
-func testObjectTime() *TestStructTime {
- t, _ := time.Parse("Jan 2, 2006 at 3:04pm", "Mar 3, 2003 at 5:03pm")
- return &TestStructTime{
- TestTime: t,
- }
-}
-
-func testObjectWithZeroValues() *TestStruct {
- return &TestStruct{}
-}
-
-func testObjectWithNilSets() *TestStruct {
- return &TestStruct{
- TestBool: true,
- TestInt: -99,
- TestInt32: 999,
- TestInt64: 9999,
- TestUint: 99,
- TestFloat32: 9.9999,
- TestFloat64: 99.999999,
- TestString: "test",
- TestByteArray: []byte("bytes"),
- TestStringArray: []string(nil),
- TestIntArray: []int(nil),
- TestFloatArray: []float64(nil),
- TestSub: TestSubStruct{
- SubBool: true,
- SubInt: 2,
- SubString: "subtest",
- SubStringArray: []string{"sub1", "sub2", "sub3"},
- },
- }
-}
-func testObjectWithEmptySets() *TestStruct {
- return &TestStruct{
- TestBool: true,
- TestInt: -99,
- TestInt32: 999,
- TestInt64: 9999,
- TestUint: 99,
- TestFloat32: 9.9999,
- TestFloat64: 99.999999,
- TestString: "test",
- TestByteArray: []byte("bytes"),
- TestStringArray: []string{},
- TestIntArray: []int{},
- TestFloatArray: []float64{},
- TestSub: TestSubStruct{
- SubBool: true,
- SubInt: 2,
- SubString: "subtest",
- SubStringArray: []string{"sub1", "sub2", "sub3"},
- },
- }
-}
-
-func testAttrs() []dynamodb.Attribute {
- return []dynamodb.Attribute{
- dynamodb.Attribute{Type: "N", Name: "TestBool", Value: "1", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt", Value: "-99", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt32", Value: "999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt64", Value: "9999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestUint", Value: "99", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat32", Value: "9.9999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat64", Value: "99.999999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestString", Value: "test", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestByteArray", Value: "Ynl0ZXM=", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "SS", Name: "TestStringArray", Value: "", SetValues: []string{"test1", "test2", "test3", "test4"}},
- dynamodb.Attribute{Type: "NS", Name: "TestIntArray", Value: "", SetValues: []string{"0", "1", "12", "123", "1234", "12345"}},
- dynamodb.Attribute{Type: "NS", Name: "TestInt8Array", Value: "", SetValues: []string{"0", "1", "12", "123"}},
- dynamodb.Attribute{Type: "NS", Name: "TestFloatArray", Value: "", SetValues: []string{"0.1", "1.1", "1.2", "1.23", "1.234", "1.2345"}},
- dynamodb.Attribute{Type: "S", Name: "TestSub", Value: `{"SubBool":true,"SubInt":2,"SubString":"subtest","SubStringArray":["sub1","sub2","sub3"]}`, SetValues: []string(nil)},
- }
-}
-
-func testAttrsTime() []dynamodb.Attribute {
- return []dynamodb.Attribute{
- dynamodb.Attribute{Type: "S", Name: "TestTime", Value: "\"2003-03-03T17:03:00Z\"", SetValues: []string(nil)},
- }
-}
-
-func testAttrsWithZeroValues() []dynamodb.Attribute {
- return []dynamodb.Attribute{
- dynamodb.Attribute{Type: "N", Name: "TestBool", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt32", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt64", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestUint", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat32", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat64", Value: "0", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestSub", Value: `{"SubBool":false,"SubInt":0,"SubString":"","SubStringArray":null}`, SetValues: []string(nil)},
- }
-}
-
-func testAttrsWithNilSets() []dynamodb.Attribute {
- return []dynamodb.Attribute{
- dynamodb.Attribute{Type: "N", Name: "TestBool", Value: "1", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt", Value: "-99", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt32", Value: "999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestInt64", Value: "9999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestUint", Value: "99", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat32", Value: "9.9999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "N", Name: "TestFloat64", Value: "99.999999", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestString", Value: "test", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestByteArray", Value: "Ynl0ZXM=", SetValues: []string(nil)},
- dynamodb.Attribute{Type: "S", Name: "TestSub", Value: `{"SubBool":true,"SubInt":2,"SubString":"subtest","SubStringArray":["sub1","sub2","sub3"]}`, SetValues: []string(nil)},
- }
-}
-
-type MarshallerSuite struct {
-}
-
-var _ = Suite(&MarshallerSuite{})
-
-func (s *MarshallerSuite) TestMarshal(c *C) {
- testObj := testObject()
- attrs, err := dynamodb.MarshalAttributes(testObj)
- if err != nil {
- c.Errorf("Error from dynamodb.MarshalAttributes: %#v", err)
- }
-
- expected := testAttrs()
- c.Check(attrs, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestUnmarshal(c *C) {
- testObj := &TestStruct{}
-
- attrMap := map[string]*dynamodb.Attribute{}
- attrs := testAttrs()
- for i, _ := range attrs {
- attrMap[attrs[i].Name] = &attrs[i]
- }
-
- err := dynamodb.UnmarshalAttributes(&attrMap, testObj)
- if err != nil {
- c.Fatalf("Error from dynamodb.UnmarshalAttributes: %#v (Built: %#v)", err, testObj)
- }
-
- expected := testObject()
- c.Check(testObj, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestMarshalTime(c *C) {
- testObj := testObjectTime()
- attrs, err := dynamodb.MarshalAttributes(testObj)
- if err != nil {
- c.Errorf("Error from dynamodb.MarshalAttributes: %#v", err)
- }
-
- expected := testAttrsTime()
- c.Check(attrs, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestUnmarshalTime(c *C) {
- testObj := &TestStructTime{}
-
- attrMap := map[string]*dynamodb.Attribute{}
- attrs := testAttrsTime()
- for i, _ := range attrs {
- attrMap[attrs[i].Name] = &attrs[i]
- }
-
- err := dynamodb.UnmarshalAttributes(&attrMap, testObj)
- if err != nil {
- c.Fatalf("Error from dynamodb.UnmarshalAttributes: %#v (Built: %#v)", err, testObj)
- }
-
- expected := testObjectTime()
- c.Check(testObj, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestMarshalNilSets(c *C) {
- testObj := testObjectWithNilSets()
- attrs, err := dynamodb.MarshalAttributes(testObj)
- if err != nil {
- c.Errorf("Error from dynamodb.MarshalAttributes: %#v", err)
- }
-
- expected := testAttrsWithNilSets()
- c.Check(attrs, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestMarshalZeroValues(c *C) {
- testObj := testObjectWithZeroValues()
- attrs, err := dynamodb.MarshalAttributes(testObj)
- if err != nil {
- c.Errorf("Error from dynamodb.MarshalAttributes: %#v", err)
- }
-
- expected := testAttrsWithZeroValues()
- c.Check(attrs, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestMarshalEmptySets(c *C) {
- testObj := testObjectWithEmptySets()
- attrs, err := dynamodb.MarshalAttributes(testObj)
- if err != nil {
- c.Errorf("Error from dynamodb.MarshalAttributes: %#v", err)
- }
-
- expected := testAttrsWithNilSets()
- c.Check(attrs, DeepEquals, expected)
-}
-
-func (s *MarshallerSuite) TestUnmarshalEmptySets(c *C) {
- testObj := &TestStruct{}
-
- attrMap := map[string]*dynamodb.Attribute{}
- attrs := testAttrsWithNilSets()
- for i, _ := range attrs {
- attrMap[attrs[i].Name] = &attrs[i]
- }
-
- err := dynamodb.UnmarshalAttributes(&attrMap, testObj)
- if err != nil {
- c.Fatalf("Error from dynamodb.UnmarshalAttributes: %#v (Built: %#v)", err, testObj)
- }
-
- expected := testObjectWithNilSets()
- c.Check(testObj, DeepEquals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/query.go b/vendor/github.com/goamz/goamz/dynamodb/query.go
deleted file mode 100644
index 453e38733..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/query.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package dynamodb
-
-import (
- "errors"
- "fmt"
- simplejson "github.com/bitly/go-simplejson"
-)
-
-func (t *Table) Query(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- return runQuery(q, t)
-}
-
-func (t *Table) QueryOnIndex(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddIndex(indexName)
- return runQuery(q, t)
-}
-
-func (t *Table) QueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddIndex(indexName)
- q.ScanIndexDescending()
- return runQuery(q, t)
-}
-
-func (t *Table) LimitedQuery(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddLimit(limit)
- return runQuery(q, t)
-}
-
-func (t *Table) LimitedQueryOnIndex(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddIndex(indexName)
- q.AddLimit(limit)
- return runQuery(q, t)
-}
-
-func (t *Table) LimitedQueryDescending(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddLimit(limit)
- q.ScanIndexDescending()
- return runQuery(q, t)
-}
-
-func (t *Table) LimitedQueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddIndex(indexName)
- q.AddLimit(limit)
- q.ScanIndexDescending()
- return runQuery(q, t)
-}
-
-func (t *Table) CountQuery(attributeComparisons []AttributeComparison) (int64, error) {
- q := NewQuery(t)
- q.AddKeyConditions(attributeComparisons)
- q.AddSelect("COUNT")
- jsonResponse, err := t.Server.queryServer("DynamoDB_20120810.Query", q)
- if err != nil {
- return 0, err
- }
- json, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return 0, err
- }
-
- itemCount, err := json.Get("Count").Int64()
- if err != nil {
- return 0, err
- }
-
- return itemCount, nil
-}
-
-func runQuery(q *Query, t *Table) ([]map[string]*Attribute, error) {
- jsonResponse, err := t.Server.queryServer("DynamoDB_20120810.Query", q)
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return nil, err
- }
-
- itemCount, err := json.Get("Count").Int()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- results := make([]map[string]*Attribute, itemCount)
-
- for i, _ := range results {
- item, err := json.Get("Items").GetIndex(i).Map()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
- results[i] = parseAttributes(item)
- }
- return results, nil
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/query_builder.go b/vendor/github.com/goamz/goamz/dynamodb/query_builder.go
deleted file mode 100644
index 47a90bb1c..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/query_builder.go
+++ /dev/null
@@ -1,362 +0,0 @@
-package dynamodb
-
-import (
- "encoding/json"
- "sort"
-)
-
-type msi map[string]interface{}
-type Query struct {
- buffer msi
-}
-
-func NewEmptyQuery() *Query {
- return &Query{msi{}}
-}
-
-func NewQuery(t *Table) *Query {
- q := &Query{msi{}}
- q.addTable(t)
- return q
-}
-
-// This way of specifing the key is used when doing a Get.
-// If rangeKey is "", it is assumed to not want to be used
-func (q *Query) AddKey(t *Table, key *Key) {
- k := t.Key
- keymap := msi{
- k.KeyAttribute.Name: msi{
- k.KeyAttribute.Type: key.HashKey},
- }
- if k.HasRange() {
- keymap[k.RangeAttribute.Name] = msi{k.RangeAttribute.Type: key.RangeKey}
- }
-
- q.buffer["Key"] = keymap
-}
-
-func keyAttributes(t *Table, key *Key) msi {
- k := t.Key
-
- out := msi{}
- out[k.KeyAttribute.Name] = msi{k.KeyAttribute.Type: key.HashKey}
- if k.HasRange() {
- out[k.RangeAttribute.Name] = msi{k.RangeAttribute.Type: key.RangeKey}
- }
- return out
-}
-
-func (q *Query) AddAttributesToGet(attributes []string) {
- if len(attributes) == 0 {
- return
- }
-
- q.buffer["AttributesToGet"] = attributes
-}
-
-func (q *Query) ConsistentRead(c bool) {
- if c == true {
- q.buffer["ConsistentRead"] = "true" //String "true", not bool true
- }
-}
-
-func (q *Query) AddGetRequestItems(tableKeys map[*Table][]Key) {
- requestitems := msi{}
- for table, keys := range tableKeys {
- keyslist := []msi{}
- for _, key := range keys {
- keyslist = append(keyslist, keyAttributes(table, &key))
- }
- requestitems[table.Name] = msi{"Keys": keyslist}
- }
- q.buffer["RequestItems"] = requestitems
-}
-
-func (q *Query) AddWriteRequestItems(tableItems map[*Table]map[string][][]Attribute) {
- b := q.buffer
-
- b["RequestItems"] = func() msi {
- out := msi{}
- for table, itemActions := range tableItems {
- out[table.Name] = func() interface{} {
- out2 := []interface{}{}
-
- // here breaks an order of array....
- // For now, we iterate over sorted key by action for stable testing
- keys := []string{}
- for k := range itemActions {
- keys = append(keys, k)
- }
- sort.Strings(keys)
-
- for ki := range keys {
- action := keys[ki]
- items := itemActions[action]
- for _, attributes := range items {
- Item_or_Key := map[bool]string{true: "Item", false: "Key"}[action == "Put"]
- out2 = append(out2, msi{action + "Request": msi{Item_or_Key: attributeList(attributes)}})
- }
- }
- return out2
- }()
- }
- return out
- }()
-}
-
-func (q *Query) AddCreateRequestTable(description TableDescriptionT) {
- b := q.buffer
-
- attDefs := []interface{}{}
- for _, attr := range description.AttributeDefinitions {
- attDefs = append(attDefs, msi{
- "AttributeName": attr.Name,
- "AttributeType": attr.Type,
- })
- }
- b["AttributeDefinitions"] = attDefs
- b["KeySchema"] = description.KeySchema
- b["TableName"] = description.TableName
- b["ProvisionedThroughput"] = msi{
- "ReadCapacityUnits": int(description.ProvisionedThroughput.ReadCapacityUnits),
- "WriteCapacityUnits": int(description.ProvisionedThroughput.WriteCapacityUnits),
- }
-
- if description.StreamSpecification.StreamEnabled {
- b["StreamSpecification"] = msi{
- "StreamEnabled": "true",
- "StreamViewType": description.StreamSpecification.StreamViewType,
- }
- }
-
- localSecondaryIndexes := []interface{}{}
-
- for _, ind := range description.LocalSecondaryIndexes {
- localSecondaryIndexes = append(localSecondaryIndexes, msi{
- "IndexName": ind.IndexName,
- "KeySchema": ind.KeySchema,
- "Projection": ind.Projection,
- })
- }
-
- globalSecondaryIndexes := []interface{}{}
- intmax := func(x, y int64) int64 {
- if x > y {
- return x
- }
- return y
- }
- for _, ind := range description.GlobalSecondaryIndexes {
- rec := msi{
- "IndexName": ind.IndexName,
- "KeySchema": ind.KeySchema,
- "Projection": ind.Projection,
- }
- // need at least one unit, and since go's max() is float based.
- rec["ProvisionedThroughput"] = msi{
- "ReadCapacityUnits": intmax(1, ind.ProvisionedThroughput.ReadCapacityUnits),
- "WriteCapacityUnits": intmax(1, ind.ProvisionedThroughput.WriteCapacityUnits),
- }
- globalSecondaryIndexes = append(globalSecondaryIndexes, rec)
- }
-
- if len(localSecondaryIndexes) > 0 {
- b["LocalSecondaryIndexes"] = localSecondaryIndexes
- }
-
- if len(globalSecondaryIndexes) > 0 {
- b["GlobalSecondaryIndexes"] = globalSecondaryIndexes
- }
-}
-
-func (q *Query) AddDeleteRequestTable(description TableDescriptionT) {
- b := q.buffer
- b["TableName"] = description.TableName
-}
-
-func (q *Query) AddUpdateRequestTable(description TableDescriptionT) {
- b := q.buffer
-
- attDefs := []interface{}{}
- for _, attr := range description.AttributeDefinitions {
- attDefs = append(attDefs, msi{
- "AttributeName": attr.Name,
- "AttributeType": attr.Type,
- })
- }
- if len(attDefs) > 0 {
- b["AttributeDefinitions"] = attDefs
- }
- b["TableName"] = description.TableName
- b["ProvisionedThroughput"] = msi{
- "ReadCapacityUnits": int(description.ProvisionedThroughput.ReadCapacityUnits),
- "WriteCapacityUnits": int(description.ProvisionedThroughput.WriteCapacityUnits),
- }
-
-}
-
-func (q *Query) AddKeyConditions(comparisons []AttributeComparison) {
- q.buffer["KeyConditions"] = buildComparisons(comparisons)
-}
-
-func (q *Query) AddLimit(limit int64) {
- q.buffer["Limit"] = limit
-}
-func (q *Query) AddSelect(value string) {
- q.buffer["Select"] = value
-}
-
-func (q *Query) AddIndex(value string) {
- q.buffer["IndexName"] = value
-}
-
-func (q *Query) ScanIndexDescending() {
- q.buffer["ScanIndexForward"] = "false"
-}
-
-/*
- "ScanFilter":{
- "AttributeName1":{"AttributeValueList":[{"S":"AttributeValue"}],"ComparisonOperator":"EQ"}
- },
-*/
-func (q *Query) AddScanFilter(comparisons []AttributeComparison) {
- q.buffer["ScanFilter"] = buildComparisons(comparisons)
-}
-
-func (q *Query) AddParallelScanConfiguration(segment int, totalSegments int) {
- q.buffer["Segment"] = segment
- q.buffer["TotalSegments"] = totalSegments
-}
-
-func buildComparisons(comparisons []AttributeComparison) msi {
- out := msi{}
-
- for _, c := range comparisons {
- avlist := []interface{}{}
- for _, attributeValue := range c.AttributeValueList {
- avlist = append(avlist, msi{attributeValue.Type: attributeValue.Value})
- }
- out[c.AttributeName] = msi{
- "AttributeValueList": avlist,
- "ComparisonOperator": c.ComparisonOperator,
- }
- }
-
- return out
-}
-
-// The primary key must be included in attributes.
-func (q *Query) AddItem(attributes []Attribute) {
- q.buffer["Item"] = attributeList(attributes)
-}
-
-func (q *Query) AddUpdates(attributes []Attribute, action string) {
- updates := msi{}
- for _, a := range attributes {
- au := msi{
- "Value": msi{
- a.Type: map[bool]interface{}{true: a.SetValues, false: a.Value}[a.SetType()],
- },
- "Action": action,
- }
- // Delete 'Value' from AttributeUpdates if Type is not Set
- if action == "DELETE" && !a.SetType() {
- delete(au, "Value")
- }
- updates[a.Name] = au
- }
-
- q.buffer["AttributeUpdates"] = updates
-}
-
-func (q *Query) AddExpected(attributes []Attribute) {
- expected := msi{}
- for _, a := range attributes {
- value := msi{}
- if a.Exists != "" {
- value["Exists"] = a.Exists
- }
- // If set Exists to false, we must remove Value
- if value["Exists"] != "false" {
- value["Value"] = msi{a.Type: map[bool]interface{}{true: a.SetValues, false: a.Value}[a.SetType()]}
- }
- expected[a.Name] = value
- }
- q.buffer["Expected"] = expected
-}
-
-// Add the ReturnValues parameter, used in UpdateItem queries.
-func (q *Query) AddReturnValues(returnValues ReturnValues) {
- q.buffer["ReturnValues"] = string(returnValues)
-}
-
-// Add the UpdateExpression parameter, used in UpdateItem queries.
-func (q *Query) AddUpdateExpression(expression string) {
- q.buffer["UpdateExpression"] = expression
-}
-
-// Add the ConditionExpression parameter, used in UpdateItem queries.
-func (q *Query) AddConditionExpression(expression string) {
- q.buffer["ConditionExpression"] = expression
-}
-
-func (q *Query) AddExpressionAttributes(attributes []Attribute) {
- existing, ok := q.buffer["ExpressionAttributes"].(msi)
- if !ok {
- existing = msi{}
- q.buffer["ExpressionAttributes"] = existing
- }
- for key, val := range attributeList(attributes) {
- existing[key] = val
- }
-}
-
-func (q *Query) AddExclusiveStartStreamArn(arn string) {
- q.buffer["ExclusiveStartStreamArn"] = arn
-}
-
-func (q *Query) AddStreamArn(arn string) {
- q.buffer["StreamArn"] = arn
-}
-
-func (q *Query) AddExclusiveStartShardId(shardId string) {
- q.buffer["ExclusiveStartShardId"] = shardId
-}
-
-func (q *Query) AddShardId(shardId string) {
- q.buffer["ShardId"] = shardId
-}
-
-func (q *Query) AddShardIteratorType(shardIteratorType string) {
- q.buffer["ShardIteratorType"] = shardIteratorType
-}
-
-func (q *Query) AddSequenceNumber(sequenceNumber string) {
- q.buffer["SequenceNumber"] = sequenceNumber
-}
-
-func (q *Query) AddShardIterator(shardIterator string) {
- q.buffer["ShardIterator"] = shardIterator
-}
-
-func attributeList(attributes []Attribute) msi {
- b := msi{}
- for _, a := range attributes {
- //UGH!! (I miss the query operator)
- b[a.Name] = msi{a.Type: map[bool]interface{}{true: a.SetValues, false: a.Value}[a.SetType()]}
- }
- return b
-}
-
-func (q *Query) addTable(t *Table) {
- q.addTableByName(t.Name)
-}
-
-func (q *Query) addTableByName(tableName string) {
- q.buffer["TableName"] = tableName
-}
-
-func (q *Query) String() string {
- bytes, _ := json.Marshal(q.buffer)
- return string(bytes)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/query_builder_test.go b/vendor/github.com/goamz/goamz/dynamodb/query_builder_test.go
deleted file mode 100755
index 9a1f6f2c5..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/query_builder_test.go
+++ /dev/null
@@ -1,380 +0,0 @@
-package dynamodb_test
-
-import (
- simplejson "github.com/bitly/go-simplejson"
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-type QueryBuilderSuite struct {
- server *dynamodb.Server
-}
-
-var _ = Suite(&QueryBuilderSuite{})
-
-func (s *QueryBuilderSuite) SetUpSuite(c *C) {
- auth := &aws.Auth{AccessKey: "", SecretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"}
- s.server = &dynamodb.Server{*auth, aws.USEast}
-}
-
-func (s *QueryBuilderSuite) TestEmptyQuery(c *C) {
- q := dynamodb.NewEmptyQuery()
- queryString := q.String()
- expectedString := "{}"
- c.Check(queryString, Equals, expectedString)
-
- if expectedString != queryString {
- c.Fatalf("Unexpected Query String : %s\n", queryString)
- }
-}
-
-func (s *QueryBuilderSuite) TestAddWriteRequestItems(c *C) {
- primary := dynamodb.NewStringAttribute("WidgetFoo", "")
- secondary := dynamodb.NewNumericAttribute("Created", "")
- key := dynamodb.PrimaryKey{primary, secondary}
- table := s.server.NewTable("FooData", key)
-
- primary2 := dynamodb.NewStringAttribute("TestHashKey", "")
- secondary2 := dynamodb.NewNumericAttribute("TestRangeKey", "")
- key2 := dynamodb.PrimaryKey{primary2, secondary2}
- table2 := s.server.NewTable("TestTable", key2)
-
- q := dynamodb.NewEmptyQuery()
-
- attribute1 := dynamodb.NewNumericAttribute("testing", "4")
- attribute2 := dynamodb.NewNumericAttribute("testingbatch", "2111")
- attribute3 := dynamodb.NewStringAttribute("testingstrbatch", "mystr")
- item1 := []dynamodb.Attribute{*attribute1, *attribute2, *attribute3}
-
- attribute4 := dynamodb.NewNumericAttribute("testing", "444")
- attribute5 := dynamodb.NewNumericAttribute("testingbatch", "93748249272")
- attribute6 := dynamodb.NewStringAttribute("testingstrbatch", "myotherstr")
- item2 := []dynamodb.Attribute{*attribute4, *attribute5, *attribute6}
-
- attributeDel1 := dynamodb.NewStringAttribute("TestHashKeyDel", "DelKey")
- attributeDel2 := dynamodb.NewNumericAttribute("TestRangeKeyDel", "7777777")
- itemDel := []dynamodb.Attribute{*attributeDel1, *attributeDel2}
-
- attributeTest1 := dynamodb.NewStringAttribute("TestHashKey", "MyKey")
- attributeTest2 := dynamodb.NewNumericAttribute("TestRangeKey", "0193820384293")
- itemTest := []dynamodb.Attribute{*attributeTest1, *attributeTest2}
-
- tableItems := map[*dynamodb.Table]map[string][][]dynamodb.Attribute{}
- actionItems := make(map[string][][]dynamodb.Attribute)
- actionItems["Put"] = [][]dynamodb.Attribute{item1, item2}
- actionItems["Delete"] = [][]dynamodb.Attribute{itemDel}
- tableItems[table] = actionItems
-
- actionItems2 := make(map[string][][]dynamodb.Attribute)
- actionItems2["Put"] = [][]dynamodb.Attribute{itemTest}
- tableItems[table2] = actionItems2
-
- q.AddWriteRequestItems(tableItems)
-
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
-
- expectedJson, err := simplejson.NewJson([]byte(`
-{
- "RequestItems": {
- "TestTable": [
- {
- "PutRequest": {
- "Item": {
- "TestRangeKey": {
- "N": "0193820384293"
- },
- "TestHashKey": {
- "S": "MyKey"
- }
- }
- }
- }
- ],
- "FooData": [
- {
- "DeleteRequest": {
- "Key": {
- "TestRangeKeyDel": {
- "N": "7777777"
- },
- "TestHashKeyDel": {
- "S": "DelKey"
- }
- }
- }
- },
- {
- "PutRequest": {
- "Item": {
- "testingstrbatch": {
- "S": "mystr"
- },
- "testingbatch": {
- "N": "2111"
- },
- "testing": {
- "N": "4"
- }
- }
- }
- },
- {
- "PutRequest": {
- "Item": {
- "testingstrbatch": {
- "S": "myotherstr"
- },
- "testingbatch": {
- "N": "93748249272"
- },
- "testing": {
- "N": "444"
- }
- }
- }
- }
- ]
- }
-}
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
-}
-
-func (s *QueryBuilderSuite) TestAddExpectedQuery(c *C) {
- primary := dynamodb.NewStringAttribute("domain", "")
- key := dynamodb.PrimaryKey{primary, nil}
- table := s.server.NewTable("sites", key)
-
- q := dynamodb.NewQuery(table)
- q.AddKey(table, &dynamodb.Key{HashKey: "test"})
-
- expected := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("domain", "expectedTest").SetExists(true),
- *dynamodb.NewStringAttribute("testKey", "").SetExists(false),
- }
- q.AddExpected(expected)
-
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
-
- expectedJson, err := simplejson.NewJson([]byte(`
- {
- "Expected": {
- "domain": {
- "Exists": "true",
- "Value": {
- "S": "expectedTest"
- }
- },
- "testKey": {
- "Exists": "false"
- }
- },
- "Key": {
- "domain": {
- "S": "test"
- }
- },
- "TableName": "sites"
- }
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
-}
-
-func (s *QueryBuilderSuite) TestGetItemQuery(c *C) {
- primary := dynamodb.NewStringAttribute("domain", "")
- key := dynamodb.PrimaryKey{primary, nil}
- table := s.server.NewTable("sites", key)
-
- q := dynamodb.NewQuery(table)
- q.AddKey(table, &dynamodb.Key{HashKey: "test"})
-
- {
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
-
- expectedJson, err := simplejson.NewJson([]byte(`
- {
- "Key": {
- "domain": {
- "S": "test"
- }
- },
- "TableName": "sites"
- }
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
- }
-
- // Use ConsistentRead
- {
- q.ConsistentRead(true)
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
-
- expectedJson, err := simplejson.NewJson([]byte(`
- {
- "ConsistentRead": "true",
- "Key": {
- "domain": {
- "S": "test"
- }
- },
- "TableName": "sites"
- }
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
- }
-}
-
-func (s *QueryBuilderSuite) TestUpdateQuery(c *C) {
- primary := dynamodb.NewStringAttribute("domain", "")
- rangek := dynamodb.NewNumericAttribute("time", "")
- key := dynamodb.PrimaryKey{primary, rangek}
- table := s.server.NewTable("sites", key)
-
- countAttribute := dynamodb.NewNumericAttribute("count", "4")
- attributes := []dynamodb.Attribute{*countAttribute}
-
- q := dynamodb.NewQuery(table)
- q.AddKey(table, &dynamodb.Key{HashKey: "test", RangeKey: "1234"})
- q.AddUpdates(attributes, "ADD")
-
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
- expectedJson, err := simplejson.NewJson([]byte(`
-{
- "AttributeUpdates": {
- "count": {
- "Action": "ADD",
- "Value": {
- "N": "4"
- }
- }
- },
- "Key": {
- "domain": {
- "S": "test"
- },
- "time": {
- "N": "1234"
- }
- },
- "TableName": "sites"
-}
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
-}
-
-func (s *QueryBuilderSuite) TestAddUpdates(c *C) {
- primary := dynamodb.NewStringAttribute("domain", "")
- key := dynamodb.PrimaryKey{primary, nil}
- table := s.server.NewTable("sites", key)
-
- q := dynamodb.NewQuery(table)
- q.AddKey(table, &dynamodb.Key{HashKey: "test"})
-
- attr := dynamodb.NewStringSetAttribute("StringSet", []string{"str", "str2"})
-
- q.AddUpdates([]dynamodb.Attribute{*attr}, "ADD")
-
- queryJson, err := simplejson.NewJson([]byte(q.String()))
- if err != nil {
- c.Fatal(err)
- }
- expectedJson, err := simplejson.NewJson([]byte(`
-{
- "AttributeUpdates": {
- "StringSet": {
- "Action": "ADD",
- "Value": {
- "SS": ["str", "str2"]
- }
- }
- },
- "Key": {
- "domain": {
- "S": "test"
- }
- },
- "TableName": "sites"
-}
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
-}
-
-func (s *QueryBuilderSuite) TestAddKeyConditions(c *C) {
- primary := dynamodb.NewStringAttribute("domain", "")
- key := dynamodb.PrimaryKey{primary, nil}
- table := s.server.NewTable("sites", key)
-
- q := dynamodb.NewQuery(table)
- acs := []dynamodb.AttributeComparison{
- *dynamodb.NewStringAttributeComparison("domain", "EQ", "example.com"),
- *dynamodb.NewStringAttributeComparison("path", "EQ", "/"),
- }
- q.AddKeyConditions(acs)
- queryJson, err := simplejson.NewJson([]byte(q.String()))
-
- if err != nil {
- c.Fatal(err)
- }
-
- expectedJson, err := simplejson.NewJson([]byte(`
-{
- "KeyConditions": {
- "domain": {
- "AttributeValueList": [
- {
- "S": "example.com"
- }
- ],
- "ComparisonOperator": "EQ"
- },
- "path": {
- "AttributeValueList": [
- {
- "S": "/"
- }
- ],
- "ComparisonOperator": "EQ"
- }
- },
- "TableName": "sites"
-}
- `))
- if err != nil {
- c.Fatal(err)
- }
- c.Check(queryJson, DeepEquals, expectedJson)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/scan.go b/vendor/github.com/goamz/goamz/dynamodb/scan.go
deleted file mode 100644
index e8ed62363..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/scan.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package dynamodb
-
-import (
- "errors"
- "fmt"
- simplejson "github.com/bitly/go-simplejson"
-)
-
-func (t *Table) FetchResults(query *Query) ([]map[string]*Attribute, error) {
- jsonResponse, err := t.Server.queryServer(target("Scan"), query)
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return nil, err
- }
-
- itemCount, err := json.Get("Count").Int()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- results := make([]map[string]*Attribute, itemCount)
-
- for i, _ := range results {
- item, err := json.Get("Items").GetIndex(i).Map()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
- results[i] = parseAttributes(item)
- }
- return results, nil
-
-}
-
-func (t *Table) Scan(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddScanFilter(attributeComparisons)
- return t.FetchResults(q)
-}
-
-func (t *Table) ParallelScan(attributeComparisons []AttributeComparison, segment int, totalSegments int) ([]map[string]*Attribute, error) {
- q := NewQuery(t)
- q.AddScanFilter(attributeComparisons)
- q.AddParallelScanConfiguration(segment, totalSegments)
- return t.FetchResults(q)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/stream.go b/vendor/github.com/goamz/goamz/dynamodb/stream.go
deleted file mode 100644
index 57f3a145f..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/stream.go
+++ /dev/null
@@ -1,307 +0,0 @@
-package dynamodb
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
-
- simplejson "github.com/bitly/go-simplejson"
-)
-
-type Stream struct {
- Server *Server
- Arn string
-}
-
-type StreamListItemT struct {
- StreamArn string
- StreamLabel string
- TableName string
-}
-
-type SequenceNumberRangeT struct {
- EndingSequenceNumber string
- StartingSequenceNumber string
-}
-
-type ShardT struct {
- ParentShardId string
- SequenceNumberRange SequenceNumberRangeT
- ShardId string
-}
-
-type StreamDescriptionT struct {
- CreationDateTime float64
- KeySchema []KeySchemaT
- LastEvaluatedShardId string
- Shards []ShardT
- StreamArn string
- StreamLabel string
- StreamStatus string
- StreamViewType string
- TableName string
-}
-
-type RecordT struct {
- AwsRegion string
- EventID string
- EventName string
- EventSource string
- EventVersion string
- StreamRecord *StreamRecordT
-}
-
-type StreamRecordT struct {
- Keys map[string]*Attribute
- NewImage map[string]*Attribute
- OldImage map[string]*Attribute
- SequenceNumber string
- StreamViewType string
- SizeBytes int64
-}
-
-type listStreamsResponse struct {
- Streams []StreamListItemT
-}
-
-type describeStreamResponse struct {
- StreamDescription StreamDescriptionT
-}
-
-var ErrNoRecords = errors.New("No records")
-
-func (s *Server) ListStreams(startArn string) ([]StreamListItemT, error) {
- return s.LimitedListTableStreams("", startArn, 0)
-}
-
-func (s *Server) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error) {
- return s.LimitedListTableStreams("", startArn, limit)
-}
-
-func (s *Server) ListTableStreams(table, startArn string) ([]StreamListItemT, error) {
- return s.LimitedListTableStreams(table, startArn, 0)
-}
-
-func (s *Server) LimitedListTableStreams(table, startArn string, limit int64) ([]StreamListItemT, error) {
- query := NewEmptyQuery()
-
- if len(table) != 0 {
- query.addTableByName(table)
- }
-
- if len(startArn) != 0 {
- query.AddExclusiveStartStreamArn(startArn)
- }
-
- if limit > 0 {
- query.AddLimit(limit)
- }
-
- jsonResponse, err := s.queryServer(streamsTarget("ListStreams"), query)
- if err != nil {
- return nil, err
- }
-
- var r listStreamsResponse
- err = json.Unmarshal(jsonResponse, &r)
- if err != nil {
- return nil, err
- }
-
- return r.Streams, nil
-}
-
-func (s *Server) DescribeStream(arn, startShardId string) (*StreamDescriptionT, error) {
- return s.LimitedDescribeStream(arn, startShardId, 0)
-}
-
-func (s *Server) LimitedDescribeStream(arn, startShardId string, limit int64) (*StreamDescriptionT, error) {
- query := NewEmptyQuery()
- query.AddStreamArn(arn)
-
- if len(startShardId) != 0 {
- query.AddExclusiveStartShardId(startShardId)
- }
-
- if limit > 0 {
- query.AddLimit(limit)
- }
-
- jsonResponse, err := s.queryServer(streamsTarget("DescribeStream"), query)
- if err != nil {
- return nil, err
- }
-
- var r describeStreamResponse
- err = json.Unmarshal(jsonResponse, &r)
- if err != nil {
- return nil, err
- }
-
- return &r.StreamDescription, nil
-}
-
-func (s *Server) NewStream(streamArn string) *Stream {
- return &Stream{s, streamArn}
-}
-
-func (s *Stream) DescribeStream(startShardId string) (*StreamDescriptionT, error) {
- return s.Server.DescribeStream(s.Arn, startShardId)
-}
-
-func (s *Stream) LimitedDescribeStream(startShardId string, limit int64) (*StreamDescriptionT, error) {
- return s.Server.LimitedDescribeStream(s.Arn, startShardId, limit)
-}
-
-func (s *Server) GetShardIterator(streamArn, shardId, shardIteratorType, sequenceNumber string) (string, error) {
- query := NewEmptyQuery()
- query.AddStreamArn(streamArn)
- query.AddShardId(shardId)
- query.AddShardIteratorType(shardIteratorType)
-
- if len(sequenceNumber) != 0 {
- query.AddSequenceNumber(sequenceNumber)
- }
-
- jsonResponse, err := s.queryServer(streamsTarget("GetShardIterator"), query)
-
- if err != nil {
- return "unknown", err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return "unknown", err
- }
-
- return json.Get("ShardIterator").MustString(), nil
-}
-
-func (s *Stream) GetShardIterator(shardId, shardIteratorType, sequenceNumber string) (string, error) {
- return s.Server.GetShardIterator(s.Arn, shardId, shardIteratorType, sequenceNumber)
-}
-
-func (s *Server) GetRecords(shardIterator string) (string, []*RecordT, error) {
- return s.LimitedGetRecords(shardIterator, 0)
-}
-
-func (s *Server) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error) {
- query := NewEmptyQuery()
- query.AddShardIterator(shardIterator)
-
- if limit > 0 {
- query.AddLimit(limit)
- }
-
- jsonResponse, err := s.queryServer(streamsTarget("GetRecords"), query)
- if err != nil {
- return "", nil, err
- }
-
- jsonParsed, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return "", nil, err
- }
-
- nextShardIt := ""
- nextShardItJson, ok := jsonParsed.CheckGet("NextShardIterator")
- if ok {
- nextShardIt, err = nextShardItJson.String()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return "", nil, errors.New(message)
- }
- }
-
- recordsJson, ok := jsonParsed.CheckGet("Records")
- if !ok {
- return nextShardIt, nil, ErrNoRecords
- }
-
- recordsArray, err := recordsJson.Array()
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nextShardIt, nil, errors.New(message)
- }
-
- var records []*RecordT
- for _, record := range recordsArray {
- if recordMap, ok := record.(map[string]interface{}); ok {
- r := parseRecord(recordMap)
- records = append(records, r)
- }
- }
-
- return nextShardIt, records, nil
-}
-
-func (s *Stream) GetRecords(shardIterator string) (string, []*RecordT, error) {
- return s.Server.GetRecords(shardIterator)
-}
-
-func (s *Stream) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error) {
- return s.Server.LimitedGetRecords(shardIterator, limit)
-}
-
-func parseRecord(r map[string]interface{}) *RecordT {
- record := RecordT{}
- rValue := reflect.ValueOf(&record)
-
- keys := []string{"awsRegion", "eventID", "eventName", "eventSource", "eventVersion"}
- for i, key := range keys {
- if value, ok := r[key]; ok {
- if valueStr, ok := value.(string); ok {
- rValue.Elem().Field(i).SetString(valueStr)
- }
- }
- }
-
- if streamRecord, ok := r["dynamodb"]; ok {
- if streamRecordMap, ok := streamRecord.(map[string]interface{}); ok {
- record.StreamRecord = parseStreamRecord(streamRecordMap)
- }
- }
-
- return &record
-}
-
-func parseStreamRecord(s map[string]interface{}) *StreamRecordT {
- sr := StreamRecordT{}
- rValue := reflect.ValueOf(&sr)
-
- attrKeys := []string{"Keys", "NewImage", "OldImage"}
- numAttrKeys := len(attrKeys)
- for i, key := range attrKeys {
- if value, ok := s[key]; ok {
- if valueMap, ok := value.(map[string]interface{}); ok {
- attrs := parseAttributes(valueMap)
- rValue.Elem().Field(i).Set(reflect.ValueOf(attrs))
- }
- }
- }
-
- strKeys := []string{"SequenceNumber", "StreamViewType"}
- numStrKeys := len(strKeys)
- for i, key := range strKeys {
- if value, ok := s[key]; ok {
- if valueStr, ok := value.(string); ok {
- rValue.Elem().Field(i + numAttrKeys).SetString(valueStr)
- }
- }
- }
-
- intKeys := []string{"SizeBytes"}
- for i, key := range intKeys {
- if value, ok := s[key]; ok {
- if valueNumber, ok := value.(json.Number); ok {
- if valueInt, err := valueNumber.Int64(); err == nil {
- rValue.Elem().Field(i + numAttrKeys + numStrKeys).SetInt(valueInt)
- }
- }
- }
- }
-
- return &sr
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/stream_test.go b/vendor/github.com/goamz/goamz/dynamodb/stream_test.go
deleted file mode 100755
index a982ffa65..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/stream_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package dynamodb_test
-
-import (
- "strconv"
-
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-type StreamSuite struct {
- TableDescriptionT dynamodb.TableDescriptionT
- DynamoDBTest
-}
-
-func (s *StreamSuite) SetUpSuite(c *C) {
- setUpAuth(c)
- s.DynamoDBTest.TableDescriptionT = s.TableDescriptionT
- s.server = &dynamodb.Server{dynamodb_auth, dynamodb_region}
- pk, err := s.TableDescriptionT.BuildPrimaryKey()
- if err != nil {
- c.Skip(err.Error())
- }
- s.table = s.server.NewTable(s.TableDescriptionT.TableName, pk)
-
- // Cleanup
- s.TearDownSuite(c)
- _, err = s.server.CreateTable(s.TableDescriptionT)
- if err != nil {
- c.Fatal(err)
- }
- s.WaitUntilStatus(c, "ACTIVE")
-}
-
-var stream_suite_keys_only = &StreamSuite{
- TableDescriptionT: dynamodb.TableDescriptionT{
- TableName: "StreamTable",
- AttributeDefinitions: []dynamodb.AttributeDefinitionT{
- dynamodb.AttributeDefinitionT{"TestHashKey", "S"},
- dynamodb.AttributeDefinitionT{"TestRangeKey", "N"},
- },
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- dynamodb.KeySchemaT{"TestRangeKey", "RANGE"},
- },
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- StreamSpecification: dynamodb.StreamSpecificationT{
- StreamEnabled: true,
- StreamViewType: "KEYS_ONLY",
- },
- },
-}
-
-var stream_suite_new_image = &StreamSuite{
- TableDescriptionT: dynamodb.TableDescriptionT{
- TableName: "StreamTable",
- AttributeDefinitions: []dynamodb.AttributeDefinitionT{
- dynamodb.AttributeDefinitionT{"TestHashKey", "S"},
- dynamodb.AttributeDefinitionT{"TestRangeKey", "N"},
- },
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- dynamodb.KeySchemaT{"TestRangeKey", "RANGE"},
- },
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- StreamSpecification: dynamodb.StreamSpecificationT{
- StreamEnabled: true,
- StreamViewType: "NEW_IMAGE",
- },
- },
-}
-
-var _ = Suite(stream_suite_keys_only)
-var _ = Suite(stream_suite_new_image)
-
-func (s *StreamSuite) TestStream(c *C) {
- checkStream(s.table, c)
-}
-
-func checkStream(table *dynamodb.Table, c *C) {
- // list the table's streams
- streams, err := table.ListStreams("")
- if err != nil {
- c.Fatal(err)
- }
- c.Check(len(streams), Not(Equals), 0)
- c.Check(streams[0].TableName, Equals, table.Name)
-
- // stick a couple of items in the table
- attrs := []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("TestAttr", "0"),
- }
- if ok, err := table.PutItem("0", "0", attrs); !ok {
- c.Fatal(err)
- }
- attrs = []dynamodb.Attribute{
- *dynamodb.NewStringAttribute("TestAttr", "1"),
- }
- if ok, err := table.PutItem("1", "1", attrs); !ok {
- c.Fatal(err)
- }
-
- // create a stream object
- stream := table.Server.NewStream(streams[0].StreamArn)
-
- // describe the steam
- desc, err := stream.DescribeStream("")
- if err != nil {
- c.Fatal(err)
- }
-
- tableDesc, err := table.DescribeTable()
- if err != nil {
- c.Fatal(err)
- }
-
- c.Check(desc.KeySchema[0], Equals, tableDesc.KeySchema[0])
- c.Check(desc.StreamArn, Equals, streams[0].StreamArn)
- c.Check(desc.StreamStatus, Equals, "ENABLED")
- c.Check(desc.StreamViewType, Equals, tableDesc.StreamSpecification.StreamViewType)
- c.Check(desc.TableName, Equals, table.Name)
- c.Check(len(desc.Shards), Equals, 1)
-
- // get a shard iterator
- shardIt, err := stream.GetShardIterator(desc.Shards[0].ShardId, "TRIM_HORIZON", "")
- if err != nil {
- c.Fatal(err)
- }
- c.Check(len(shardIt), Not(Equals), 0)
-
- // poll for records
- nextIt, records, err := stream.GetRecords(shardIt)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(len(nextIt), Not(Equals), 0)
- c.Check(len(records), Equals, 2)
-
- for index, record := range records {
- c.Check(record.EventSource, Equals, "aws:dynamodb")
- c.Check(record.EventName, Equals, "INSERT")
- c.Check(len(record.EventID), Not(Equals), 0)
-
- // look at the actual record
- streamRec := record.StreamRecord
- c.Check(streamRec.StreamViewType, Equals, desc.StreamViewType)
- c.Check(len(streamRec.SequenceNumber), Not(Equals), 0)
- if streamRec.SizeBytes <= 0 {
- c.Errorf("Expected greater-than-zero size, got: %d", streamRec.SizeBytes)
- }
- // check the keys
- if streamRec.StreamViewType == "KEYS_ONLY" {
- checkKeys(streamRec.Keys, index, c)
- }
- // check the image
- if streamRec.StreamViewType == "NEW_IMAGE" {
- checkNewImage(streamRec.NewImage, index, c)
- }
- }
-}
-
-func checkKeys(keys map[string]*dynamodb.Attribute, expect int, c *C) {
- c.Check(len(keys), Equals, 2)
- value, err := strconv.Atoi(keys["TestHashKey"].Value)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(value, Equals, expect)
- value, err = strconv.Atoi(keys["TestRangeKey"].Value)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(value, Equals, expect)
-}
-
-func checkNewImage(image map[string]*dynamodb.Attribute, expect int, c *C) {
- c.Check(len(image), Equals, 3)
- value, err := strconv.Atoi(image["TestHashKey"].Value)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(value, Equals, expect)
- value, err = strconv.Atoi(image["TestRangeKey"].Value)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(value, Equals, expect)
- value, err = strconv.Atoi(image["TestAttr"].Value)
- if err != nil {
- c.Fatal(err)
- }
- c.Check(value, Equals, expect)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/table.go b/vendor/github.com/goamz/goamz/dynamodb/table.go
deleted file mode 100755
index 541433c13..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/table.go
+++ /dev/null
@@ -1,259 +0,0 @@
-package dynamodb
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- simplejson "github.com/bitly/go-simplejson"
-)
-
-type Table struct {
- Server *Server
- Name string
- Key PrimaryKey
-}
-
-type AttributeDefinitionT struct {
- Name string `json:"AttributeName"`
- Type string `json:"AttributeType"`
-}
-
-type KeySchemaT struct {
- AttributeName string
- KeyType string
-}
-
-type ProjectionT struct {
- ProjectionType string
-}
-
-type GlobalSecondaryIndexT struct {
- IndexName string
- IndexSizeBytes int64
- ItemCount int64
- KeySchema []KeySchemaT
- Projection ProjectionT
- ProvisionedThroughput ProvisionedThroughputT
-}
-
-type LocalSecondaryIndexT struct {
- IndexName string
- IndexSizeBytes int64
- ItemCount int64
- KeySchema []KeySchemaT
- Projection ProjectionT
-}
-
-type ProvisionedThroughputT struct {
- NumberOfDecreasesToday int64
- ReadCapacityUnits int64
- WriteCapacityUnits int64
-}
-
-type StreamSpecificationT struct {
- StreamEnabled bool
- StreamViewType string
-}
-
-type TableDescriptionT struct {
- AttributeDefinitions []AttributeDefinitionT
- CreationDateTime float64
- ItemCount int64
- KeySchema []KeySchemaT
- GlobalSecondaryIndexes []GlobalSecondaryIndexT
- LocalSecondaryIndexes []LocalSecondaryIndexT
- ProvisionedThroughput ProvisionedThroughputT
- StreamSpecification StreamSpecificationT
- TableName string
- TableSizeBytes int64
- TableStatus string
- LatestStreamArn string
- LatestStreamLabel string
-}
-
-type describeTableResponse struct {
- Table TableDescriptionT
-}
-
-func findAttributeDefinitionByName(ads []AttributeDefinitionT, name string) *AttributeDefinitionT {
- for _, a := range ads {
- if a.Name == name {
- return &a
- }
- }
- return nil
-}
-
-func (a *AttributeDefinitionT) GetEmptyAttribute() *Attribute {
- switch a.Type {
- case "S":
- return NewStringAttribute(a.Name, "")
- case "N":
- return NewNumericAttribute(a.Name, "")
- case "B":
- return NewBinaryAttribute(a.Name, "")
- default:
- return nil
- }
-}
-
-func (t *TableDescriptionT) BuildPrimaryKey() (pk PrimaryKey, err error) {
- for _, k := range t.KeySchema {
- var attr *Attribute
- ad := findAttributeDefinitionByName(t.AttributeDefinitions, k.AttributeName)
- if ad == nil {
- return pk, errors.New("An inconsistency found in TableDescriptionT")
- }
- attr = ad.GetEmptyAttribute()
- if attr == nil {
- return pk, errors.New("An inconsistency found in TableDescriptionT")
- }
-
- switch k.KeyType {
- case "HASH":
- pk.KeyAttribute = attr
- case "RANGE":
- pk.RangeAttribute = attr
- }
- }
- return
-}
-
-func (s *Server) NewTable(name string, key PrimaryKey) *Table {
- return &Table{s, name, key}
-}
-
-func (s *Server) ListTables() ([]string, error) {
- var tables []string
-
- query := NewEmptyQuery()
-
- jsonResponse, err := s.queryServer(target("ListTables"), query)
-
- if err != nil {
- return nil, err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return nil, err
- }
-
- response, err := json.Get("TableNames").Array()
-
- if err != nil {
- message := fmt.Sprintf("Unexpected response %s", jsonResponse)
- return nil, errors.New(message)
- }
-
- for _, value := range response {
- if t, ok := (value).(string); ok {
- tables = append(tables, t)
- }
- }
-
- return tables, nil
-}
-
-func (s *Server) CreateTable(tableDescription TableDescriptionT) (string, error) {
- query := NewEmptyQuery()
- query.AddCreateRequestTable(tableDescription)
-
- jsonResponse, err := s.queryServer(target("CreateTable"), query)
-
- if err != nil {
- return "unknown", err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return "unknown", err
- }
-
- return json.Get("TableDescription").Get("TableStatus").MustString(), nil
-}
-
-func (s *Server) DeleteTable(tableDescription TableDescriptionT) (string, error) {
- query := NewEmptyQuery()
- query.AddDeleteRequestTable(tableDescription)
-
- jsonResponse, err := s.queryServer(target("DeleteTable"), query)
-
- if err != nil {
- return "unknown", err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return "unknown", err
- }
-
- return json.Get("TableDescription").Get("TableStatus").MustString(), nil
-}
-
-func (t *Table) DescribeTable() (*TableDescriptionT, error) {
- return t.Server.DescribeTable(t.Name)
-}
-
-func (s *Server) DescribeTable(name string) (*TableDescriptionT, error) {
- q := NewEmptyQuery()
- q.addTableByName(name)
-
- jsonResponse, err := s.queryServer(target("DescribeTable"), q)
- if err != nil {
- return nil, err
- }
-
- var r describeTableResponse
- err = json.Unmarshal(jsonResponse, &r)
- if err != nil {
- return nil, err
- }
-
- return &r.Table, nil
-}
-
-func (s *Server) UpdateTable(tableDescription TableDescriptionT) (string, error) {
- query := NewEmptyQuery()
- query.AddUpdateRequestTable(tableDescription)
-
- jsonResponse, err := s.queryServer(target("UpdateTable"), query)
-
- if err != nil {
- return "unknown", err
- }
-
- json, err := simplejson.NewJson(jsonResponse)
-
- if err != nil {
- return "unknown", err
- }
-
- return json.Get("TableDescription").Get("TableStatus").MustString(), nil
-}
-
-func (t *Table) ListStreams(startArn string) ([]StreamListItemT, error) {
- return t.Server.ListTableStreams(t.Name, startArn)
-}
-
-func (t *Table) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error) {
- return t.Server.LimitedListTableStreams(t.Name, startArn, limit)
-}
-
-func keyParam(k *PrimaryKey, hashKey string, rangeKey string) string {
- value := fmt.Sprintf("{\"HashKeyElement\":{%s}", keyValue(k.KeyAttribute.Type, hashKey))
-
- if k.RangeAttribute != nil {
- value = fmt.Sprintf("%s,\"RangeKeyElement\":{%s}", value,
- keyValue(k.RangeAttribute.Type, rangeKey))
- }
-
- return fmt.Sprintf("\"Key\":%s}", value)
-}
-
-func keyValue(key string, value string) string {
- return fmt.Sprintf("\"%s\":\"%s\"", key, value)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/table_test.go b/vendor/github.com/goamz/goamz/dynamodb/table_test.go
deleted file mode 100755
index 8925bdc1b..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/table_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package dynamodb_test
-
-import (
- "github.com/goamz/goamz/dynamodb"
- . "gopkg.in/check.v1"
-)
-
-type TableSuite struct {
- TableDescriptionT dynamodb.TableDescriptionT
- DynamoDBTest
-}
-
-func (s *TableSuite) SetUpSuite(c *C) {
- setUpAuth(c)
- s.DynamoDBTest.TableDescriptionT = s.TableDescriptionT
- s.server = &dynamodb.Server{dynamodb_auth, dynamodb_region}
- pk, err := s.TableDescriptionT.BuildPrimaryKey()
- if err != nil {
- c.Skip(err.Error())
- }
- s.table = s.server.NewTable(s.TableDescriptionT.TableName, pk)
-
- // Cleanup
- s.TearDownSuite(c)
-}
-
-var table_suite = &TableSuite{
- TableDescriptionT: dynamodb.TableDescriptionT{
- TableName: "DynamoDBTestMyTable",
- AttributeDefinitions: []dynamodb.AttributeDefinitionT{
- dynamodb.AttributeDefinitionT{"TestHashKey", "S"},
- dynamodb.AttributeDefinitionT{"TestRangeKey", "N"},
- dynamodb.AttributeDefinitionT{"TestSecKey", "N"},
- },
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- dynamodb.KeySchemaT{"TestRangeKey", "RANGE"},
- },
- GlobalSecondaryIndexes: []dynamodb.GlobalSecondaryIndexT{
- dynamodb.GlobalSecondaryIndexT{
- IndexName: "gsiTest",
- KeySchema: []dynamodb.KeySchemaT{
- dynamodb.KeySchemaT{"TestHashKey", "HASH"},
- dynamodb.KeySchemaT{"TestSecKey", "RANGE"},
- },
- Projection: dynamodb.ProjectionT{"ALL"},
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- },
- },
- ProvisionedThroughput: dynamodb.ProvisionedThroughputT{
- ReadCapacityUnits: 1,
- WriteCapacityUnits: 1,
- },
- },
-}
-
-var _ = Suite(table_suite)
-
-func (s *TableSuite) TestCreateListTable(c *C) {
- status, err := s.server.CreateTable(s.TableDescriptionT)
- if err != nil {
- c.Fatal(err)
- }
- if status != "ACTIVE" && status != "CREATING" {
- c.Error("Expect status to be ACTIVE or CREATING")
- }
-
- s.WaitUntilStatus(c, "ACTIVE")
-
- tables, err := s.server.ListTables()
- if err != nil {
- c.Fatal(err)
- }
- c.Check(len(tables), Not(Equals), 0)
- c.Check(findTableByName(tables, s.TableDescriptionT.TableName), Equals, true)
-}
diff --git a/vendor/github.com/goamz/goamz/dynamodb/update_item.go b/vendor/github.com/goamz/goamz/dynamodb/update_item.go
deleted file mode 100644
index 280eb4bed..000000000
--- a/vendor/github.com/goamz/goamz/dynamodb/update_item.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package dynamodb
-
-import simplejson "github.com/bitly/go-simplejson"
-
-/*
-Construct an update item query.
-
-The query can be composed via chaining and then executed via Execute()
-
-Usage:
- update := table.UpdateItem(key)
- .ReturnValues(dynamodb.UPDATED_NEW)
- .UpdateExpression("SET Counter = Counter + :incr")
- .UpdateCondition("Counter < :checkVal")
- .ExpressionAttributes(NewNumberAttribute(":incr", "1"), NewNumberAttribute(":checkVal", 42))
- result, err := update.Execute()
- if err == nil {
- log.Printf("Counter is now %v", result.Attributes["Counter"].Value)
- }
-
-*/
-func (t *Table) UpdateItem(key *Key) *UpdateItem {
- q := NewQuery(t)
- q.AddKey(t, key)
- return &UpdateItem{table: t, query: q}
-}
-
-type UpdateItem struct {
- table *Table
- query *Query
- hasReturnValues bool
-}
-
-// Specify how return values are to be provided.
-func (u *UpdateItem) ReturnValues(returnValues ReturnValues) *UpdateItem {
- u.hasReturnValues = (returnValues != NONE)
- u.query.AddReturnValues(returnValues)
- return u
-}
-
-/*
-Specify an update expression and optional attribute settings at the same time.
-
- update.UpdateExpression("SET Foo = Foo + :incr", dynamodb.NewNumberAttribute(":incr", "7"))
-
-is equivalent to
-
- update.UpdateExpression("SET Foo = Foo + :incr")
- .ExpressionAttributes(NewNumberAttribute(":incr", "7"))
-
-*/
-func (u *UpdateItem) UpdateExpression(expression string, attributes ...Attribute) *UpdateItem {
- u.query.AddUpdateExpression(expression)
- u.ExpressionAttributes(attributes...)
- return u
-}
-
-// Specify attribute substitutions to be used in expressions.
-func (u *UpdateItem) ExpressionAttributes(attributes ...Attribute) *UpdateItem {
- u.query.AddExpressionAttributes(attributes)
- return u
-}
-
-// Specify a check condition for conditional updates.
-func (u *UpdateItem) ConditionExpression(expression string) *UpdateItem {
- u.query.AddConditionExpression(expression)
- return u
-}
-
-// Execute this query.
-func (u *UpdateItem) Execute() (*UpdateResult, error) {
- jsonResponse, err := u.table.Server.queryServer(target("UpdateItem"), u.query)
-
- if err != nil {
- return nil, err
- }
-
- if u.hasReturnValues {
- resp, err := simplejson.NewJson(jsonResponse)
- if err != nil {
- return nil, err
- }
- attrib, err := resp.Get("Attributes").Map()
- if err != nil {
- return nil, err
- }
- return &UpdateResult{parseAttributes(attrib)}, nil
- }
- return nil, nil
-}
-
-type UpdateResult struct {
- Attributes map[string]*Attribute
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2.go b/vendor/github.com/goamz/goamz/ec2/ec2.go
deleted file mode 100644
index e6ec612cf..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2.go
+++ /dev/null
@@ -1,2267 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 Canonical Ltd.
-//
-// Written by Gustavo Niemeyer <gustavo.niemeyer@canonical.com>
-//
-
-package ec2
-
-import (
- "crypto/rand"
- "encoding/hex"
- "encoding/xml"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-const debug = false
-
-// The EC2 type encapsulates operations with a specific EC2 region.
-type EC2 struct {
- aws.Auth
- aws.Region
- httpClient *http.Client
- private byte // Reserve the right of using private data.
-}
-
-// NewWithClient creates a new EC2 with a custom http client
-func NewWithClient(auth aws.Auth, region aws.Region, client *http.Client) *EC2 {
- return &EC2{auth, region, client, 0}
-}
-
-// New creates a new EC2.
-func New(auth aws.Auth, region aws.Region) *EC2 {
- return NewWithClient(auth, region, aws.RetryingClient)
-}
-
-// ----------------------------------------------------------------------------
-// Filtering helper.
-
-// Filter builds filtering parameters to be used in an EC2 query which supports
-// filtering. For example:
-//
-// filter := NewFilter()
-// filter.Add("architecture", "i386")
-// filter.Add("launch-index", "0")
-// resp, err := ec2.Instances(nil, filter)
-//
-type Filter struct {
- m map[string][]string
-}
-
-// NewFilter creates a new Filter.
-func NewFilter() *Filter {
- return &Filter{make(map[string][]string)}
-}
-
-// Add appends a filtering parameter with the given name and value(s).
-func (f *Filter) Add(name string, value ...string) {
- f.m[name] = append(f.m[name], value...)
-}
-
-func (f *Filter) addParams(params map[string]string) {
- if f != nil {
- a := make([]string, len(f.m))
- i := 0
- for k := range f.m {
- a[i] = k
- i++
- }
- sort.StringSlice(a).Sort()
- for i, k := range a {
- prefix := "Filter." + strconv.Itoa(i+1)
- params[prefix+".Name"] = k
- for j, v := range f.m[k] {
- params[prefix+".Value."+strconv.Itoa(j+1)] = v
- }
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by EC2.
-//
-// See http://goo.gl/VZGuC for more details.
-type Error struct {
- // HTTP status code (200, 403, ...)
- StatusCode int
- // EC2 error code ("UnsupportedOperation", ...)
- Code string
- // The human-oriented error message
- Message string
- RequestId string `xml:"RequestID"`
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-// For now a single error inst is being exposed. In the future it may be useful
-// to provide access to all of them, but rather than doing it as an array/slice,
-// use a *next pointer, so that it's backward compatible and it continues to be
-// easy to handle the first error, which is what most people will want.
-type xmlErrors struct {
- RequestId string `xml:"RequestID"`
- Errors []Error `xml:"Errors>Error"`
-}
-
-var timeNow = time.Now
-
-func (ec2 *EC2) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2014-02-01"
- params["Timestamp"] = timeNow().In(time.UTC).Format(time.RFC3339)
- endpoint, err := url.Parse(ec2.Region.EC2Endpoint)
- if err != nil {
- return err
- }
- if endpoint.Path == "" {
- endpoint.Path = "/"
- }
- sign(ec2.Auth, "GET", endpoint.Path, params, endpoint.Host)
- endpoint.RawQuery = multimap(params).Encode()
- if debug {
- log.Printf("get { %v } -> {\n", endpoint.String())
- }
- r, err := ec2.httpClient.Get(endpoint.String())
- if err != nil {
- return err
- }
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-func buildError(r *http.Response) error {
- errors := xmlErrors{}
- xml.NewDecoder(r.Body).Decode(&errors)
- var err Error
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func addParamsList(params map[string]string, label string, ids []string) {
- for i, id := range ids {
- params[label+"."+strconv.Itoa(i+1)] = id
- }
-}
-
-func addBlockDeviceParams(prename string, params map[string]string, blockdevices []BlockDeviceMapping) {
- for i, k := range blockdevices {
- // Fixup index since Amazon counts these from 1
- prefix := prename + "BlockDeviceMapping." + strconv.Itoa(i+1) + "."
-
- if k.DeviceName != "" {
- params[prefix+"DeviceName"] = k.DeviceName
- }
- if k.VirtualName != "" {
- params[prefix+"VirtualName"] = k.VirtualName
- }
- if k.SnapshotId != "" {
- params[prefix+"Ebs.SnapshotId"] = k.SnapshotId
- }
- if k.VolumeType != "" {
- params[prefix+"Ebs.VolumeType"] = k.VolumeType
- }
- if k.IOPS != 0 {
- params[prefix+"Ebs.Iops"] = strconv.FormatInt(k.IOPS, 10)
- }
- if k.VolumeSize != 0 {
- params[prefix+"Ebs.VolumeSize"] = strconv.FormatInt(k.VolumeSize, 10)
- }
- if k.DeleteOnTermination {
- params[prefix+"Ebs.DeleteOnTermination"] = "true"
- }
- if k.NoDevice {
- params[prefix+"NoDevice"] = "true"
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// Instance management functions and types.
-
-// RunInstancesOptions encapsulates options for the respective request in EC2.
-//
-// See http://goo.gl/Mcm3b for more details.
-type RunInstancesOptions struct {
- ImageId string
- MinCount int
- MaxCount int
- KeyName string
- InstanceType string
- SecurityGroups []SecurityGroup
- KernelId string
- RamdiskId string
- UserData []byte
- AvailabilityZone string
- PlacementGroupName string
- Tenancy string
- Monitoring bool
- SubnetId string
- DisableAPITermination bool
- ShutdownBehavior string
- PrivateIPAddress string
- IamInstanceProfile IamInstanceProfile
- BlockDevices []BlockDeviceMapping
- EbsOptimized bool
- AssociatePublicIpAddress bool
-}
-
-// Response to a RunInstances request.
-//
-// See http://goo.gl/Mcm3b for more details.
-type RunInstancesResp struct {
- RequestId string `xml:"requestId"`
- ReservationId string `xml:"reservationId"`
- OwnerId string `xml:"ownerId"`
- SecurityGroups []SecurityGroup `xml:"groupSet>item"`
- Instances []Instance `xml:"instancesSet>item"`
-}
-
-// Instance encapsulates a running instance in EC2.
-//
-// See http://goo.gl/OCH8a for more details.
-type Instance struct {
-
- // General instance information
- InstanceId string `xml:"instanceId"` // The ID of the instance launched
- InstanceType string `xml:"instanceType"` // The instance type eg. m1.small | m1.medium | m1.large etc
- AvailabilityZone string `xml:"placement>availabilityZone"` // The Availability Zone the instance is located in
- Tags []Tag `xml:"tagSet>item"` // Any tags assigned to the resource
- State InstanceState `xml:"instanceState"` // The current state of the instance
- Reason string `xml:"reason"` // The reason for the most recent state transition. This might be an empty string
- StateReason InstanceStateReason `xml:"stateReason"` // The reason for the most recent state transition
- ImageId string `xml:"imageId"` // The ID of the AMI used to launch the instance
- KeyName string `xml:"keyName"` // The key pair name, if this instance was launched with an associated key pair
- Monitoring string `xml:"monitoring>state"` // Valid values: disabled | enabled | pending
- IamInstanceProfile IamInstanceProfile `xml:"iamInstanceProfile"` // The IAM instance profile associated with the instance
- LaunchTime string `xml:"launchTime"` // The time the instance was launched
- OwnerId string // This isn't currently returned in the response, and is taken from the parent reservation
-
- // More specific information
- Architecture string `xml:"architecture"` // Valid values: i386 | x86_64
- Hypervisor string `xml:"hypervisor"` // Valid values: ovm | xen
- KernelId string `xml:"kernelId"` // The kernel associated with this instance
- RamDiskId string `xml:"ramdiskId"` // The RAM disk associated with this instance
- Platform string `xml:"platform"` // The value is Windows for Windows AMIs; otherwise blank
- VirtualizationType string `xml:"virtualizationType"` // Valid values: paravirtual | hvm
- AMILaunchIndex int `xml:"amiLaunchIndex"` // The AMI launch index, which can be used to find this instance in the launch group
- PlacementGroupName string `xml:"placement>groupName"` // The name of the placement group the instance is in (for cluster compute instances)
- Tenancy string `xml:"placement>tenancy"` // (VPC only) Valid values: default | dedicated
- InstanceLifecycle string `xml:"instanceLifecycle"` // Spot instance? Valid values: "spot" or blank
- SpotInstanceRequestId string `xml:"spotInstanceRequestId"` // The ID of the Spot Instance request
- ClientToken string `xml:"clientToken"` // The idempotency token you provided when you launched the instance
- ProductCodes []ProductCode `xml:"productCodes>item"` // The product codes attached to this instance
-
- // Storage
- RootDeviceType string `xml:"rootDeviceType"` // Valid values: ebs | instance-store
- RootDeviceName string `xml:"rootDeviceName"` // The root device name (for example, /dev/sda1)
- BlockDevices []BlockDevice `xml:"blockDeviceMapping>item"` // Any block device mapping entries for the instance
- EbsOptimized bool `xml:"ebsOptimized"` // Indicates whether the instance is optimized for Amazon EBS I/O
-
- // Network
- DNSName string `xml:"dnsName"` // The public DNS name assigned to the instance. This element remains empty until the instance enters the running state
- PrivateDNSName string `xml:"privateDnsName"` // The private DNS name assigned to the instance. This DNS name can only be used inside the Amazon EC2 network. This element remains empty until the instance enters the running state
- IPAddress string `xml:"ipAddress"` // The public IP address assigned to the instance
- PrivateIPAddress string `xml:"privateIpAddress"` // The private IP address assigned to the instance
- SubnetId string `xml:"subnetId"` // The ID of the subnet in which the instance is running
- VpcId string `xml:"vpcId"` // The ID of the VPC in which the instance is running
- SecurityGroups []SecurityGroup `xml:"groupSet>item"` // A list of the security groups for the instance
-
- // Advanced Networking
- NetworkInterfaces []InstanceNetworkInterface `xml:"networkInterfaceSet>item"` // (VPC) One or more network interfaces for the instance
- SourceDestCheck bool `xml:"sourceDestCheck"` // Controls whether source/destination checking is enabled on the instance
- SriovNetSupport string `xml:"sriovNetSupport"` // Specifies whether enhanced networking is enabled. Valid values: simple
-}
-
-// isSpotInstance returns if the instance is a spot instance
-func (i Instance) IsSpotInstance() bool {
- if i.InstanceLifecycle == "spot" {
- return true
- }
- return false
-}
-
-type BlockDevice struct {
- DeviceName string `xml:"deviceName"`
- EBS EBS `xml:"ebs"`
-}
-
-type EBS struct {
- VolumeId string `xml:"volumeId"`
- Status string `xml:"status"`
- AttachTime string `xml:"attachTime"`
- DeleteOnTermination bool `xml:"deleteOnTermination"`
-}
-
-// ProductCode represents a product code
-// See http://goo.gl/hswmQm for more details.
-type ProductCode struct {
- ProductCode string `xml:"productCode"` // The product code
- Type string `xml:"type"` // Valid values: devpay | marketplace
-}
-
-// InstanceNetworkInterface represents a network interface attached to an instance
-// See http://goo.gl/9eW02N for more details.
-type InstanceNetworkInterface struct {
- Id string `xml:"networkInterfaceId"`
- Description string `xml:"description"`
- SubnetId string `xml:"subnetId"`
- VpcId string `xml:"vpcId"`
- OwnerId string `xml:"ownerId"` // The ID of the AWS account that created the network interface.
- Status string `xml:"status"` // Valid values: available | attaching | in-use | detaching
- MacAddress string `xml:"macAddress"`
- PrivateIPAddress string `xml:"privateIpAddress"`
- PrivateDNSName string `xml:"privateDnsName"`
- SourceDestCheck bool `xml:"sourceDestCheck"`
- SecurityGroups []SecurityGroup `xml:"groupSet>item"`
- Attachment InstanceNetworkInterfaceAttachment `xml:"attachment"`
- Association InstanceNetworkInterfaceAssociation `xml:"association"`
- PrivateIPAddresses []InstancePrivateIpAddress `xml:"privateIpAddressesSet>item"`
-}
-
-// InstanceNetworkInterfaceAttachment describes a network interface attachment to an instance
-// See http://goo.gl/0ql0Cg for more details
-type InstanceNetworkInterfaceAttachment struct {
- AttachmentID string `xml:"attachmentID"` // The ID of the network interface attachment.
- DeviceIndex int32 `xml:"deviceIndex"` // The index of the device on the instance for the network interface attachment.
- Status string `xml:"status"` // Valid values: attaching | attached | detaching | detached
- AttachTime string `xml:"attachTime"` // Time attached, as a Datetime
- DeleteOnTermination bool `xml:"deleteOnTermination"` // Indicates whether the network interface is deleted when the instance is terminated.
-}
-
-// Describes association information for an Elastic IP address.
-// See http://goo.gl/YCDdMe for more details
-type InstanceNetworkInterfaceAssociation struct {
- PublicIP string `xml:"publicIp"` // The address of the Elastic IP address bound to the network interface
- PublicDNSName string `xml:"publicDnsName"` // The public DNS name
- IPOwnerId string `xml:"ipOwnerId"` // The ID of the owner of the Elastic IP address
-}
-
-// InstancePrivateIpAddress describes a private IP address
-// See http://goo.gl/irN646 for more details
-type InstancePrivateIpAddress struct {
- PrivateIPAddress string `xml:"privateIpAddress"` // The private IP address of the network interface
- PrivateDNSName string `xml:"privateDnsName"` // The private DNS name
- Primary bool `xml:"primary"` // Indicates whether this IP address is the primary private IP address of the network interface
- Association InstanceNetworkInterfaceAssociation `xml:"association"` // The association information for an Elastic IP address for the network interface
-}
-
-// IamInstanceProfile
-// See http://goo.gl/PjyijL for more details
-type IamInstanceProfile struct {
- ARN string `xml:"arn"`
- Id string `xml:"id"`
- Name string `xml:"name"`
-}
-
-// RunInstances starts new instances in EC2.
-// If options.MinCount and options.MaxCount are both zero, a single instance
-// will be started; otherwise if options.MaxCount is zero, options.MinCount
-// will be used instead.
-//
-// See http://goo.gl/Mcm3b for more details.
-func (ec2 *EC2) RunInstances(options *RunInstancesOptions) (resp *RunInstancesResp, err error) {
- params := makeParams("RunInstances")
- params["ImageId"] = options.ImageId
- params["InstanceType"] = options.InstanceType
- var min, max int
- if options.MinCount == 0 && options.MaxCount == 0 {
- min = 1
- max = 1
- } else if options.MaxCount == 0 {
- min = options.MinCount
- max = min
- } else {
- min = options.MinCount
- max = options.MaxCount
- }
- params["MinCount"] = strconv.Itoa(min)
- params["MaxCount"] = strconv.Itoa(max)
- token, err := clientToken()
- if err != nil {
- return nil, err
- }
- params["ClientToken"] = token
-
- if options.KeyName != "" {
- params["KeyName"] = options.KeyName
- }
- if options.KernelId != "" {
- params["KernelId"] = options.KernelId
- }
- if options.RamdiskId != "" {
- params["RamdiskId"] = options.RamdiskId
- }
- if options.UserData != nil {
- userData := make([]byte, b64.EncodedLen(len(options.UserData)))
- b64.Encode(userData, options.UserData)
- params["UserData"] = string(userData)
- }
- if options.AvailabilityZone != "" {
- params["Placement.AvailabilityZone"] = options.AvailabilityZone
- }
- if options.PlacementGroupName != "" {
- params["Placement.GroupName"] = options.PlacementGroupName
- }
- if options.Tenancy != "" {
- params["Placement.Tenancy"] = options.Tenancy
- }
- if options.Monitoring {
- params["Monitoring.Enabled"] = "true"
- }
- if options.SubnetId != "" && options.AssociatePublicIpAddress {
- // If we have a non-default VPC / Subnet specified, we can flag
- // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided.
- // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise
- // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request
- // You also need to attach Security Groups to the NetworkInterface instead of the instance,
- // to avoid: Network interfaces and an instance-level security groups may not be specified on
- // the same request
- params["NetworkInterface.0.DeviceIndex"] = "0"
- params["NetworkInterface.0.AssociatePublicIpAddress"] = "true"
- params["NetworkInterface.0.SubnetId"] = options.SubnetId
-
- i := 1
- for _, g := range options.SecurityGroups {
- // We only have SecurityGroupId's on NetworkInterface's, no SecurityGroup params.
- if g.Id != "" {
- params["NetworkInterface.0.SecurityGroupId."+strconv.Itoa(i)] = g.Id
- i++
- }
- }
- } else {
- if options.SubnetId != "" {
- params["SubnetId"] = options.SubnetId
- }
-
- i, j := 1, 1
- for _, g := range options.SecurityGroups {
- if g.Id != "" {
- params["SecurityGroupId."+strconv.Itoa(i)] = g.Id
- i++
- } else {
- params["SecurityGroup."+strconv.Itoa(j)] = g.Name
- j++
- }
- }
- }
- if options.IamInstanceProfile.ARN != "" {
- params["IamInstanceProfile.Arn"] = options.IamInstanceProfile.ARN
- }
- if options.IamInstanceProfile.Name != "" {
- params["IamInstanceProfile.Name"] = options.IamInstanceProfile.Name
- }
- if options.DisableAPITermination {
- params["DisableApiTermination"] = "true"
- }
- if options.ShutdownBehavior != "" {
- params["InstanceInitiatedShutdownBehavior"] = options.ShutdownBehavior
- }
- if options.PrivateIPAddress != "" {
- params["PrivateIpAddress"] = options.PrivateIPAddress
- }
- if options.EbsOptimized {
- params["EbsOptimized"] = "true"
- }
-
- addBlockDeviceParams("", params, options.BlockDevices)
-
- resp = &RunInstancesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-func clientToken() (string, error) {
- // Maximum EC2 client token size is 64 bytes.
- // Each byte expands to two when hex encoded.
- buf := make([]byte, 32)
- _, err := rand.Read(buf)
- if err != nil {
- return "", err
- }
- return hex.EncodeToString(buf), nil
-}
-
-// ----------------------------------------------------------------------------
-// Spot Instance management functions and types.
-
-// The RequestSpotInstances type encapsulates options for the respective request in EC2.
-//
-// See http://goo.gl/GRZgCD for more details.
-type RequestSpotInstances struct {
- SpotPrice string
- InstanceCount int
- Type string
- ImageId string
- KeyName string
- InstanceType string
- SecurityGroups []SecurityGroup
- IamInstanceProfile string
- KernelId string
- RamdiskId string
- UserData []byte
- AvailZone string
- PlacementGroupName string
- Monitoring bool
- SubnetId string
- AssociatePublicIpAddress bool
- PrivateIPAddress string
- BlockDevices []BlockDeviceMapping
-}
-
-type SpotInstanceSpec struct {
- ImageId string
- KeyName string
- InstanceType string
- SecurityGroups []SecurityGroup
- IamInstanceProfile string
- KernelId string
- RamdiskId string
- UserData []byte
- AvailZone string
- PlacementGroupName string
- Monitoring bool
- SubnetId string
- AssociatePublicIpAddress bool
- PrivateIPAddress string
- BlockDevices []BlockDeviceMapping
-}
-
-type SpotLaunchSpec struct {
- ImageId string `xml:"imageId"`
- KeyName string `xml:"keyName"`
- InstanceType string `xml:"instanceType"`
- SecurityGroups []SecurityGroup `xml:"groupSet>item"`
- IamInstanceProfile string `xml:"iamInstanceProfile"`
- KernelId string `xml:"kernelId"`
- RamdiskId string `xml:"ramdiskId"`
- PlacementGroupName string `xml:"placement>groupName"`
- Monitoring bool `xml:"monitoring>enabled"`
- SubnetId string `xml:"subnetId"`
- BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"`
-}
-
-type SpotRequestResult struct {
- SpotRequestId string `xml:"spotInstanceRequestId"`
- SpotPrice string `xml:"spotPrice"`
- Type string `xml:"type"`
- AvailZone string `xml:"launchedAvailabilityZone"`
- InstanceId string `xml:"instanceId"`
- State string `xml:"state"`
- SpotLaunchSpec SpotLaunchSpec `xml:"launchSpecification"`
- CreateTime string `xml:"createTime"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-// Response to a RequestSpotInstances request.
-//
-// See http://goo.gl/GRZgCD for more details.
-type RequestSpotInstancesResp struct {
- RequestId string `xml:"requestId"`
- SpotRequestResults []SpotRequestResult `xml:"spotInstanceRequestSet>item"`
-}
-
-// RequestSpotInstances requests a new spot instances in EC2.
-func (ec2 *EC2) RequestSpotInstances(options *RequestSpotInstances) (resp *RequestSpotInstancesResp, err error) {
- params := makeParams("RequestSpotInstances")
- prefix := "LaunchSpecification" + "."
-
- params["SpotPrice"] = options.SpotPrice
- params[prefix+"ImageId"] = options.ImageId
- params[prefix+"InstanceType"] = options.InstanceType
-
- if options.InstanceCount != 0 {
- params["InstanceCount"] = strconv.Itoa(options.InstanceCount)
- }
- if options.KeyName != "" {
- params[prefix+"KeyName"] = options.KeyName
- }
- if options.KernelId != "" {
- params[prefix+"KernelId"] = options.KernelId
- }
- if options.RamdiskId != "" {
- params[prefix+"RamdiskId"] = options.RamdiskId
- }
- if options.UserData != nil {
- userData := make([]byte, b64.EncodedLen(len(options.UserData)))
- b64.Encode(userData, options.UserData)
- params[prefix+"UserData"] = string(userData)
- }
- if options.AvailZone != "" {
- params[prefix+"Placement.AvailabilityZone"] = options.AvailZone
- }
- if options.PlacementGroupName != "" {
- params[prefix+"Placement.GroupName"] = options.PlacementGroupName
- }
- if options.Monitoring {
- params[prefix+"Monitoring.Enabled"] = "true"
- }
- if options.SubnetId != "" && options.AssociatePublicIpAddress {
- // If we have a non-default VPC / Subnet specified, we can flag
- // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided.
- // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise
- // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request
- // You also need to attach Security Groups to the NetworkInterface instead of the instance,
- // to avoid: Network interfaces and an instance-level security groups may not be specified on
- // the same request
- params[prefix+"NetworkInterface.0.DeviceIndex"] = "0"
- params[prefix+"NetworkInterface.0.AssociatePublicIpAddress"] = "true"
- params[prefix+"NetworkInterface.0.SubnetId"] = options.SubnetId
-
- i := 1
- for _, g := range options.SecurityGroups {
- // We only have SecurityGroupId's on NetworkInterface's, no SecurityGroup params.
- if g.Id != "" {
- params[prefix+"NetworkInterface.0.SecurityGroupId."+strconv.Itoa(i)] = g.Id
- i++
- }
- }
- } else {
- if options.SubnetId != "" {
- params[prefix+"SubnetId"] = options.SubnetId
- }
-
- i, j := 1, 1
- for _, g := range options.SecurityGroups {
- if g.Id != "" {
- params[prefix+"SecurityGroupId."+strconv.Itoa(i)] = g.Id
- i++
- } else {
- params[prefix+"SecurityGroup."+strconv.Itoa(j)] = g.Name
- j++
- }
- }
- }
- if options.IamInstanceProfile != "" {
- params[prefix+"IamInstanceProfile.Name"] = options.IamInstanceProfile
- }
- if options.PrivateIPAddress != "" {
- params[prefix+"PrivateIpAddress"] = options.PrivateIPAddress
- }
- addBlockDeviceParams(prefix, params, options.BlockDevices)
-
- resp = &RequestSpotInstancesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Response to a DescribeSpotInstanceRequests request.
-//
-// See http://goo.gl/KsKJJk for more details.
-type SpotRequestsResp struct {
- RequestId string `xml:"requestId"`
- SpotRequestResults []SpotRequestResult `xml:"spotInstanceRequestSet>item"`
-}
-
-// DescribeSpotInstanceRequests returns details about spot requests in EC2. Both parameters
-// are optional, and if provided will limit the spot requests returned to those
-// matching the given spot request ids or filtering rules.
-//
-// See http://goo.gl/KsKJJk for more details.
-func (ec2 *EC2) DescribeSpotRequests(spotrequestIds []string, filter *Filter) (resp *SpotRequestsResp, err error) {
- params := makeParams("DescribeSpotInstanceRequests")
- addParamsList(params, "SpotInstanceRequestId", spotrequestIds)
- filter.addParams(params)
- resp = &SpotRequestsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Response to a CancelSpotInstanceRequests request.
-//
-// See http://goo.gl/3BKHj for more details.
-type CancelSpotRequestResult struct {
- SpotRequestId string `xml:"spotInstanceRequestId"`
- State string `xml:"state"`
-}
-type CancelSpotRequestsResp struct {
- RequestId string `xml:"requestId"`
- CancelSpotRequestResults []CancelSpotRequestResult `xml:"spotInstanceRequestSet>item"`
-}
-
-// CancelSpotRequests requests the cancellation of spot requests when the given ids.
-//
-// See http://goo.gl/3BKHj for more details.
-func (ec2 *EC2) CancelSpotRequests(spotrequestIds []string) (resp *CancelSpotRequestsResp, err error) {
- params := makeParams("CancelSpotInstanceRequests")
- addParamsList(params, "SpotInstanceRequestId", spotrequestIds)
- resp = &CancelSpotRequestsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Response to a TerminateInstances request.
-//
-// See http://goo.gl/3BKHj for more details.
-type TerminateInstancesResp struct {
- RequestId string `xml:"requestId"`
- StateChanges []InstanceStateChange `xml:"instancesSet>item"`
-}
-
-// InstanceState encapsulates the state of an instance in EC2.
-//
-// See http://goo.gl/y3ZBq for more details.
-type InstanceState struct {
- Code int `xml:"code"` // Watch out, bits 15-8 have unpublished meaning.
- Name string `xml:"name"`
-}
-
-// InstanceStateChange informs of the previous and current states
-// for an instance when a state change is requested.
-type InstanceStateChange struct {
- InstanceId string `xml:"instanceId"`
- CurrentState InstanceState `xml:"currentState"`
- PreviousState InstanceState `xml:"previousState"`
-}
-
-// InstanceStateReason describes a state change for an instance in EC2
-//
-// See http://goo.gl/KZkbXi for more details
-type InstanceStateReason struct {
- Code string `xml:"code"`
- Message string `xml:"message"`
-}
-
-// TerminateInstances requests the termination of instances when the given ids.
-//
-// See http://goo.gl/3BKHj for more details.
-func (ec2 *EC2) TerminateInstances(instIds []string) (resp *TerminateInstancesResp, err error) {
- params := makeParams("TerminateInstances")
- addParamsList(params, "InstanceId", instIds)
- resp = &TerminateInstancesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Response to a DescribeInstances request.
-//
-// See http://goo.gl/mLbmw for more details.
-type DescribeInstancesResp struct {
- RequestId string `xml:"requestId"`
- Reservations []Reservation `xml:"reservationSet>item"`
-}
-
-// Reservation represents details about a reservation in EC2.
-//
-// See http://goo.gl/0ItPT for more details.
-type Reservation struct {
- ReservationId string `xml:"reservationId"`
- OwnerId string `xml:"ownerId"`
- RequesterId string `xml:"requesterId"`
- SecurityGroups []SecurityGroup `xml:"groupSet>item"`
- Instances []Instance `xml:"instancesSet>item"`
-}
-
-// Instances returns details about instances in EC2. Both parameters
-// are optional, and if provided will limit the instances returned to those
-// matching the given instance ids or filtering rules.
-//
-// See http://goo.gl/4No7c for more details.
-func (ec2 *EC2) DescribeInstances(instIds []string, filter *Filter) (resp *DescribeInstancesResp, err error) {
- params := makeParams("DescribeInstances")
- addParamsList(params, "InstanceId", instIds)
- filter.addParams(params)
- resp = &DescribeInstancesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- // Add additional parameters to instances which aren't available in the response
- for i, rsv := range resp.Reservations {
- ownerId := rsv.OwnerId
- for j, inst := range rsv.Instances {
- inst.OwnerId = ownerId
- resp.Reservations[i].Instances[j] = inst
- }
- }
-
- return
-}
-
-// DescribeInstanceStatusOptions encapsulates the query parameters for the corresponding action.
-//
-// See http:////goo.gl/2FBTdS for more details.
-type DescribeInstanceStatusOptions struct {
- InstanceIds []string // If non-empty, limit the query to this subset of instances. Maximum length of 100.
- IncludeAllInstances bool // If true, describe all instances, instead of just running instances (the default).
- MaxResults int // Maximum number of results to return. Minimum of 5. Maximum of 1000.
- NextToken string // The token for the next set of items to return. (You received this token from a prior call.)
-}
-
-// Response to a DescribeInstanceStatus request.
-//
-// See http://goo.gl/2FBTdS for more details.
-type DescribeInstanceStatusResp struct {
- RequestId string `xml:"requestId"`
- InstanceStatusSet []InstanceStatusItem `xml:"instanceStatusSet>item"`
- NextToken string `xml:"nextToken"`
-}
-
-// InstanceStatusItem describes the instance status, cause, details, and potential actions to take in response.
-//
-// See http://goo.gl/oImFZZ for more details.
-type InstanceStatusItem struct {
- InstanceId string `xml:"instanceId"`
- AvailabilityZone string `xml:"availabilityZone"`
- Events []InstanceStatusEvent `xml:"eventsSet>item"` // Extra information regarding events associated with the instance.
- InstanceState InstanceState `xml:"instanceState"` // The intended state of the instance. Calls to DescribeInstanceStatus require that an instance be in the running state.
- SystemStatus InstanceStatus `xml:"systemStatus"`
- InstanceStatus InstanceStatus `xml:"instanceStatus"`
-}
-
-// InstanceStatusEvent describes an instance event.
-//
-// See http://goo.gl/PXsDTn for more details.
-type InstanceStatusEvent struct {
- Code string `xml:"code"` // The associated code of the event.
- Description string `xml:"description"` // A description of the event.
- NotBefore string `xml:"notBefore"` // The earliest scheduled start time for the event.
- NotAfter string `xml:"notAfter"` // The latest scheduled end time for the event.
-}
-
-// InstanceStatus describes the status of an instance with details.
-//
-// See http://goo.gl/eFch4S for more details.
-type InstanceStatus struct {
- Status string `xml:"status"` // The instance status.
- Details InstanceStatusDetails `xml:"details"` // The system instance health or application instance health.
-}
-
-// InstanceStatusDetails describes the instance status with the cause and more detail.
-//
-// See http://goo.gl/3qoMC4 for more details.
-type InstanceStatusDetails struct {
- Name string `xml:"name"` // The type of instance status.
- Status string `xml:"status"` // The status.
- ImpairedSince string `xml:"impairedSince"` // The time when a status check failed. For an instance that was launched and impaired, this is the time when the instance was launched.
-}
-
-// DescribeInstanceStatus returns instance status information about instances in EC2.
-// instIds and filter are optional, and if provided will limit the instances returned to those
-// matching the given instance ids or filtering rules.
-// all determines whether to report all matching instances or only those in the running state
-//
-// See http://goo.gl/2FBTdS for more details.
-func (ec2 *EC2) DescribeInstanceStatus(options *DescribeInstanceStatusOptions, filter *Filter) (resp *DescribeInstanceStatusResp, err error) {
- params := makeParams("DescribeInstanceStatus")
- if len(options.InstanceIds) > 0 {
- addParamsList(params, "InstanceId", options.InstanceIds)
- }
- if options.IncludeAllInstances {
- params["IncludeAllInstances"] = "true"
- }
- if options.MaxResults != 0 {
- params["MaxResults"] = strconv.Itoa(options.MaxResults)
- }
- if options.NextToken != "" {
- params["NextToken"] = options.NextToken
- }
- filter.addParams(params)
- resp = &DescribeInstanceStatusResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ----------------------------------------------------------------------------
-// KeyPair management functions and types.
-
-type CreateKeyPairResp struct {
- RequestId string `xml:"requestId"`
- KeyName string `xml:"keyName"`
- KeyFingerprint string `xml:"keyFingerprint"`
- KeyMaterial string `xml:"keyMaterial"`
-}
-
-// CreateKeyPair creates a new key pair and returns the private key contents.
-//
-// See http://goo.gl/0S6hV
-func (ec2 *EC2) CreateKeyPair(keyName string) (resp *CreateKeyPairResp, err error) {
- params := makeParams("CreateKeyPair")
- params["KeyName"] = keyName
-
- resp = &CreateKeyPairResp{}
- err = ec2.query(params, resp)
- if err == nil {
- resp.KeyFingerprint = strings.TrimSpace(resp.KeyFingerprint)
- }
- return
-}
-
-// DeleteKeyPair deletes a key pair.
-//
-// See http://goo.gl/0bqok
-func (ec2 *EC2) DeleteKeyPair(name string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteKeyPair")
- params["KeyName"] = name
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- return
-}
-
-type ImportKeyPairOptions struct {
- KeyName string
- PublicKeyMaterial string
-}
-
-type ImportKeyPairResp struct {
- RequestId string `xml:"requestId"`
- KeyName string `xml:"keyName"`
- KeyFingerprint string `xml:"keyFingerprint"`
-}
-
-// ImportKeyPair import a key pair.
-//
-// See http://goo.gl/xpTccS
-func (ec2 *EC2) ImportKeyPair(options *ImportKeyPairOptions) (resp *ImportKeyPairResp, err error) {
- params := makeParams("ImportKeyPair")
- params["KeyName"] = options.KeyName
- params["PublicKeyMaterial"] = options.PublicKeyMaterial
-
- resp = &ImportKeyPairResp{}
- err = ec2.query(params, resp)
- return
-}
-
-// ResourceTag represents key-value metadata used to classify and organize
-// EC2 instances.
-//
-// See http://goo.gl/bncl3 for more details
-type Tag struct {
- Key string `xml:"key"`
- Value string `xml:"value"`
-}
-
-// CreateTags adds or overwrites one or more tags for the specified taggable resources.
-// For a list of tagable resources, see: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html
-//
-// See http://goo.gl/Vmkqc for more details
-func (ec2 *EC2) CreateTags(resourceIds []string, tags []Tag) (resp *SimpleResp, err error) {
- params := makeParams("CreateTags")
- addParamsList(params, "ResourceId", resourceIds)
-
- for j, tag := range tags {
- params["Tag."+strconv.Itoa(j+1)+".Key"] = tag.Key
- params["Tag."+strconv.Itoa(j+1)+".Value"] = tag.Value
- }
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a StartInstances request.
-//
-// See http://goo.gl/awKeF for more details.
-type StartInstanceResp struct {
- RequestId string `xml:"requestId"`
- StateChanges []InstanceStateChange `xml:"instancesSet>item"`
-}
-
-// Response to a StopInstances request.
-//
-// See http://goo.gl/436dJ for more details.
-type StopInstanceResp struct {
- RequestId string `xml:"requestId"`
- StateChanges []InstanceStateChange `xml:"instancesSet>item"`
-}
-
-// StartInstances starts an Amazon EBS-backed AMI that you've previously stopped.
-//
-// See http://goo.gl/awKeF for more details.
-func (ec2 *EC2) StartInstances(ids ...string) (resp *StartInstanceResp, err error) {
- params := makeParams("StartInstances")
- addParamsList(params, "InstanceId", ids)
- resp = &StartInstanceResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StopInstances requests stopping one or more Amazon EBS-backed instances.
-//
-// See http://goo.gl/436dJ for more details.
-func (ec2 *EC2) StopInstances(ids ...string) (resp *StopInstanceResp, err error) {
- params := makeParams("StopInstances")
- addParamsList(params, "InstanceId", ids)
- resp = &StopInstanceResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// RebootInstance requests a reboot of one or more instances. This operation is asynchronous;
-// it only queues a request to reboot the specified instance(s). The operation will succeed
-// if the instances are valid and belong to you.
-//
-// Requests to reboot terminated instances are ignored.
-//
-// See http://goo.gl/baoUf for more details.
-func (ec2 *EC2) RebootInstances(ids ...string) (resp *SimpleResp, err error) {
- params := makeParams("RebootInstances")
- addParamsList(params, "InstanceId", ids)
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// The ModifyInstanceAttribute request parameters.
-type ModifyInstance struct {
- InstanceType string
- BlockDevices []BlockDeviceMapping
- DisableAPITermination bool
- EbsOptimized bool
- SecurityGroups []SecurityGroup
- ShutdownBehavior string
- KernelId string
- RamdiskId string
- SourceDestCheck bool
- SriovNetSupport bool
- UserData []byte
-}
-
-// Response to a ModifyInstanceAttribute request.
-//
-// http://goo.gl/icuXh5 for more details.
-type ModifyInstanceResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
-}
-
-// ModifyImageAttribute modifies the specified attribute of the specified instance.
-// You can specify only one attribute at a time. To modify some attributes, the
-// instance must be stopped.
-//
-// See http://goo.gl/icuXh5 for more details.
-func (ec2 *EC2) ModifyInstance(instId string, options *ModifyInstance) (resp *ModifyInstanceResp, err error) {
- params := makeParams("ModifyInstanceAttribute")
- params["InstanceId"] = instId
- addBlockDeviceParams("", params, options.BlockDevices)
-
- if options.InstanceType != "" {
- params["InstanceType.Value"] = options.InstanceType
- }
-
- if options.DisableAPITermination {
- params["DisableApiTermination.Value"] = "true"
- }
-
- if options.EbsOptimized {
- params["EbsOptimized"] = "true"
- }
-
- if options.ShutdownBehavior != "" {
- params["InstanceInitiatedShutdownBehavior.Value"] = options.ShutdownBehavior
- }
-
- if options.KernelId != "" {
- params["Kernel.Value"] = options.KernelId
- }
-
- if options.RamdiskId != "" {
- params["Ramdisk.Value"] = options.RamdiskId
- }
-
- if options.SourceDestCheck {
- params["SourceDestCheck.Value"] = "true"
- }
-
- if options.SriovNetSupport {
- params["SriovNetSupport.Value"] = "simple"
- }
-
- if options.UserData != nil {
- userData := make([]byte, b64.EncodedLen(len(options.UserData)))
- b64.Encode(userData, options.UserData)
- params["UserData"] = string(userData)
- }
-
- i := 1
- for _, g := range options.SecurityGroups {
- if g.Id != "" {
- params["GroupId."+strconv.Itoa(i)] = g.Id
- i++
- }
- }
-
- resp = &ModifyInstanceResp{}
- err = ec2.query(params, resp)
- if err != nil {
- resp = nil
- }
- return
-}
-
-// Reserved Instances
-
-// Structures
-
-// DescribeReservedInstancesResponse structure returned from a DescribeReservedInstances request.
-//
-// See
-type DescribeReservedInstancesResponse struct {
- RequestId string `xml:"requestId"`
- ReservedInstances []ReservedInstancesResponseItem `xml:"reservedInstancesSet>item"`
-}
-
-//
-//
-// See
-type ReservedInstancesResponseItem struct {
- ReservedInstanceId string `xml:"reservedInstancesId"`
- InstanceType string `xml:"instanceType"`
- AvailabilityZone string `xml:"availabilityZone"`
- Start string `xml:"start"`
- Duration uint64 `xml:"duration"`
- End string `xml:"end"`
- FixedPrice float32 `xml:"fixedPrice"`
- UsagePrice float32 `xml:"usagePrice"`
- InstanceCount int `xml:"instanceCount"`
- ProductDescription string `xml:"productDescription"`
- State string `xml:"state"`
- Tags []Tag `xml:"tagSet->item"`
- InstanceTenancy string `xml:"instanceTenancy"`
- CurrencyCode string `xml:"currencyCode"`
- OfferingType string `xml:"offeringType"`
- RecurringCharges []RecurringCharge `xml:"recurringCharges>item"`
-}
-
-//
-//
-// See
-type RecurringCharge struct {
- Frequency string `xml:"frequency"`
- Amount float32 `xml:"amount"`
-}
-
-// functions
-// DescribeReservedInstances
-//
-// See
-func (ec2 *EC2) DescribeReservedInstances(instIds []string, filter *Filter) (resp *DescribeReservedInstancesResponse, err error) {
- params := makeParams("DescribeReservedInstances")
-
- for i, id := range instIds {
- params["ReservedInstancesId."+strconv.Itoa(i+1)] = id
- }
- filter.addParams(params)
-
- resp = &DescribeReservedInstancesResponse{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ----------------------------------------------------------------------------
-// Image and snapshot management functions and types.
-
-// The CreateImage request parameters.
-//
-// See http://goo.gl/cxU41 for more details.
-type CreateImage struct {
- InstanceId string
- Name string
- Description string
- NoReboot bool
- BlockDevices []BlockDeviceMapping
-}
-
-// Response to a CreateImage request.
-//
-// See http://goo.gl/cxU41 for more details.
-type CreateImageResp struct {
- RequestId string `xml:"requestId"`
- ImageId string `xml:"imageId"`
-}
-
-// Response to a DescribeImages request.
-//
-// See http://goo.gl/hLnyg for more details.
-type ImagesResp struct {
- RequestId string `xml:"requestId"`
- Images []Image `xml:"imagesSet>item"`
-}
-
-// Response to a DescribeImageAttribute request.
-//
-// See http://goo.gl/bHO3zT for more details.
-type ImageAttributeResp struct {
- RequestId string `xml:"requestId"`
- ImageId string `xml:"imageId"`
- Kernel string `xml:"kernel>value"`
- RamDisk string `xml:"ramdisk>value"`
- Description string `xml:"description>value"`
- Group string `xml:"launchPermission>item>group"`
- UserIds []string `xml:"launchPermission>item>userId"`
- ProductCodes []string `xml:"productCodes>item>productCode"`
- BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"`
-}
-
-// The RegisterImage request parameters.
-type RegisterImage struct {
- ImageLocation string
- Name string
- Description string
- Architecture string
- KernelId string
- RamdiskId string
- RootDeviceName string
- VirtType string
- BlockDevices []BlockDeviceMapping
-}
-
-// Response to a RegisterImage request.
-type RegisterImageResp struct {
- RequestId string `xml:"requestId"`
- ImageId string `xml:"imageId"`
-}
-
-// Response to a DegisterImage request.
-//
-// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html
-type DeregisterImageResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
-}
-
-// BlockDeviceMapping represents the association of a block device with an image.
-//
-// See http://goo.gl/wnDBf for more details.
-type BlockDeviceMapping struct {
- DeviceName string `xml:"deviceName"`
- VirtualName string `xml:"virtualName"`
- SnapshotId string `xml:"ebs>snapshotId"`
- VolumeType string `xml:"ebs>volumeType"`
- VolumeSize int64 `xml:"ebs>volumeSize"`
- DeleteOnTermination bool `xml:"ebs>deleteOnTermination"`
- NoDevice bool `xml:"noDevice"`
-
- // The number of I/O operations per second (IOPS) that the volume supports.
- IOPS int64 `xml:"ebs>iops"`
-}
-
-// Image represents details about an image.
-//
-// See http://goo.gl/iSqJG for more details.
-type Image struct {
- Id string `xml:"imageId"`
- Name string `xml:"name"`
- Description string `xml:"description"`
- Type string `xml:"imageType"`
- State string `xml:"imageState"`
- Location string `xml:"imageLocation"`
- Public bool `xml:"isPublic"`
- Architecture string `xml:"architecture"`
- Platform string `xml:"platform"`
- ProductCodes []string `xml:"productCode>item>productCode"`
- KernelId string `xml:"kernelId"`
- RamdiskId string `xml:"ramdiskId"`
- StateReason string `xml:"stateReason"`
- OwnerId string `xml:"imageOwnerId"`
- OwnerAlias string `xml:"imageOwnerAlias"`
- RootDeviceType string `xml:"rootDeviceType"`
- RootDeviceName string `xml:"rootDeviceName"`
- VirtualizationType string `xml:"virtualizationType"`
- Hypervisor string `xml:"hypervisor"`
- BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-// The ModifyImageAttribute request parameters.
-type ModifyImageAttribute struct {
- AddUsers []string
- RemoveUsers []string
- AddGroups []string
- RemoveGroups []string
- ProductCodes []string
- Description string
-}
-
-// The CopyImage request parameters.
-//
-// See http://goo.gl/hQwPCK for more details.
-type CopyImage struct {
- SourceRegion string
- SourceImageId string
- Name string
- Description string
- ClientToken string
-}
-
-// Response to a CopyImage request.
-//
-// See http://goo.gl/hQwPCK for more details.
-type CopyImageResp struct {
- RequestId string `xml:"requestId"`
- ImageId string `xml:"imageId"`
-}
-
-// Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance
-// that is either running or stopped.
-//
-// See http://goo.gl/cxU41 for more details.
-func (ec2 *EC2) CreateImage(options *CreateImage) (resp *CreateImageResp, err error) {
- params := makeParams("CreateImage")
- params["InstanceId"] = options.InstanceId
- params["Name"] = options.Name
- if options.Description != "" {
- params["Description"] = options.Description
- }
- if options.NoReboot {
- params["NoReboot"] = "true"
- }
- addBlockDeviceParams("", params, options.BlockDevices)
-
- resp = &CreateImageResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// Images returns details about available images.
-// The ids and filter parameters, if provided, will limit the images returned.
-// For example, to get all the private images associated with this account set
-// the boolean filter "is-public" to 0.
-// For list of filters: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html
-//
-// Note: calling this function with nil ids and filter parameters will result in
-// a very large number of images being returned.
-//
-// See http://goo.gl/SRBhW for more details.
-func (ec2 *EC2) Images(ids []string, filter *Filter) (resp *ImagesResp, err error) {
- params := makeParams("DescribeImages")
- for i, id := range ids {
- params["ImageId."+strconv.Itoa(i+1)] = id
- }
- filter.addParams(params)
-
- resp = &ImagesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ImagesByOwners returns details about available images.
-// The ids, owners, and filter parameters, if provided, will limit the images returned.
-// For example, to get all the private images associated with this account set
-// the boolean filter "is-public" to 0.
-// For list of filters: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html
-//
-// Note: calling this function with nil ids and filter parameters will result in
-// a very large number of images being returned.
-//
-// See http://goo.gl/SRBhW for more details.
-func (ec2 *EC2) ImagesByOwners(ids []string, owners []string, filter *Filter) (resp *ImagesResp, err error) {
- params := makeParams("DescribeImages")
- for i, id := range ids {
- params["ImageId."+strconv.Itoa(i+1)] = id
- }
- for i, owner := range owners {
- params[fmt.Sprintf("Owner.%d", i+1)] = owner
- }
-
- filter.addParams(params)
-
- resp = &ImagesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ImageAttribute describes an attribute of an AMI.
-// You can specify only one attribute at a time.
-// Valid attributes are:
-// description | kernel | ramdisk | launchPermission | productCodes | blockDeviceMapping
-//
-// See http://goo.gl/bHO3zT for more details.
-func (ec2 *EC2) ImageAttribute(imageId, attribute string) (resp *ImageAttributeResp, err error) {
- params := makeParams("DescribeImageAttribute")
- params["ImageId"] = imageId
- params["Attribute"] = attribute
-
- resp = &ImageAttributeResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ModifyImageAttribute sets attributes for an image.
-//
-// See http://goo.gl/YUjO4G for more details.
-func (ec2 *EC2) ModifyImageAttribute(imageId string, options *ModifyImageAttribute) (resp *SimpleResp, err error) {
- params := makeParams("ModifyImageAttribute")
- params["ImageId"] = imageId
- if options.Description != "" {
- params["Description.Value"] = options.Description
- }
-
- if options.AddUsers != nil {
- for i, user := range options.AddUsers {
- p := fmt.Sprintf("LaunchPermission.Add.%d.UserId", i+1)
- params[p] = user
- }
- }
-
- if options.RemoveUsers != nil {
- for i, user := range options.RemoveUsers {
- p := fmt.Sprintf("LaunchPermission.Remove.%d.UserId", i+1)
- params[p] = user
- }
- }
-
- if options.AddGroups != nil {
- for i, group := range options.AddGroups {
- p := fmt.Sprintf("LaunchPermission.Add.%d.Group", i+1)
- params[p] = group
- }
- }
-
- if options.RemoveGroups != nil {
- for i, group := range options.RemoveGroups {
- p := fmt.Sprintf("LaunchPermission.Remove.%d.Group", i+1)
- params[p] = group
- }
- }
-
- if options.ProductCodes != nil {
- addParamsList(params, "ProductCode", options.ProductCodes)
- }
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- resp = nil
- }
-
- return
-}
-
-// Registers a new AMI with EC2.
-//
-// See: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html
-func (ec2 *EC2) RegisterImage(options *RegisterImage) (resp *RegisterImageResp, err error) {
- params := makeParams("RegisterImage")
- params["Name"] = options.Name
- if options.ImageLocation != "" {
- params["ImageLocation"] = options.ImageLocation
- }
-
- if options.Description != "" {
- params["Description"] = options.Description
- }
-
- if options.Architecture != "" {
- params["Architecture"] = options.Architecture
- }
-
- if options.KernelId != "" {
- params["KernelId"] = options.KernelId
- }
-
- if options.RamdiskId != "" {
- params["RamdiskId"] = options.RamdiskId
- }
-
- if options.RootDeviceName != "" {
- params["RootDeviceName"] = options.RootDeviceName
- }
-
- if options.VirtType != "" {
- params["VirtualizationType"] = options.VirtType
- }
-
- addBlockDeviceParams("", params, options.BlockDevices)
-
- resp = &RegisterImageResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// Degisters an image. Note that this does not delete the backing stores of the AMI.
-//
-// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html
-func (ec2 *EC2) DeregisterImage(imageId string) (resp *DeregisterImageResp, err error) {
- params := makeParams("DeregisterImage")
- params["ImageId"] = imageId
-
- resp = &DeregisterImageResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// Copy and Image from one region to another.
-//
-// See http://goo.gl/hQwPCK for more details.
-func (ec2 *EC2) CopyImage(options *CopyImage) (resp *CopyImageResp, err error) {
- params := makeParams("CopyImage")
-
- if options.SourceRegion != "" {
- params["SourceRegion"] = options.SourceRegion
- }
-
- if options.SourceImageId != "" {
- params["SourceImageId"] = options.SourceImageId
- }
-
- if options.Name != "" {
- params["Name"] = options.Name
- }
-
- if options.Description != "" {
- params["Description"] = options.Description
- }
-
- if options.ClientToken != "" {
- params["ClientToken"] = options.ClientToken
- }
-
- resp = &CopyImageResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// Response to a CreateSnapshot request.
-//
-// See http://goo.gl/ttcda for more details.
-type CreateSnapshotResp struct {
- RequestId string `xml:"requestId"`
- Snapshot
-}
-
-// CreateSnapshot creates a volume snapshot and stores it in S3.
-//
-// See http://goo.gl/ttcda for more details.
-func (ec2 *EC2) CreateSnapshot(volumeId, description string) (resp *CreateSnapshotResp, err error) {
- params := makeParams("CreateSnapshot")
- params["VolumeId"] = volumeId
- params["Description"] = description
-
- resp = &CreateSnapshotResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// DeleteSnapshots deletes the volume snapshots with the given ids.
-//
-// Note: If you make periodic snapshots of a volume, the snapshots are
-// incremental so that only the blocks on the device that have changed
-// since your last snapshot are incrementally saved in the new snapshot.
-// Even though snapshots are saved incrementally, the snapshot deletion
-// process is designed so that you need to retain only the most recent
-// snapshot in order to restore the volume.
-//
-// See http://goo.gl/vwU1y for more details.
-func (ec2 *EC2) DeleteSnapshots(ids []string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteSnapshot")
- for i, id := range ids {
- params["SnapshotId."+strconv.Itoa(i+1)] = id
- }
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// Response to a DescribeSnapshots request.
-//
-// See http://goo.gl/nClDT for more details.
-type SnapshotsResp struct {
- RequestId string `xml:"requestId"`
- Snapshots []Snapshot `xml:"snapshotSet>item"`
-}
-
-// Snapshot represents details about a volume snapshot.
-//
-// See http://goo.gl/nkovs for more details.
-type Snapshot struct {
- Id string `xml:"snapshotId"`
- VolumeId string `xml:"volumeId"`
- VolumeSize string `xml:"volumeSize"`
- Status string `xml:"status"`
- StartTime string `xml:"startTime"`
- Description string `xml:"description"`
- Progress string `xml:"progress"`
- OwnerId string `xml:"ownerId"`
- OwnerAlias string `xml:"ownerAlias"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-// Snapshots returns details about volume snapshots available to the user.
-// The ids and filter parameters, if provided, limit the snapshots returned.
-//
-// See http://goo.gl/ogJL4 for more details.
-func (ec2 *EC2) Snapshots(ids []string, filter *Filter) (resp *SnapshotsResp, err error) {
- params := makeParams("DescribeSnapshots")
- for i, id := range ids {
- params["SnapshotId."+strconv.Itoa(i+1)] = id
- }
- filter.addParams(params)
-
- resp = &SnapshotsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ----------------------------------------------------------------------------
-// Volume management
-
-// The CreateVolume request parameters
-//
-// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html
-type CreateVolume struct {
- AvailZone string
- Size int64
- SnapshotId string
- VolumeType string
- IOPS int64
-}
-
-// Response to an AttachVolume request
-type AttachVolumeResp struct {
- RequestId string `xml:"requestId"`
- VolumeId string `xml:"volumeId"`
- InstanceId string `xml:"instanceId"`
- Device string `xml:"device"`
- Status string `xml:"status"`
- AttachTime string `xml:"attachTime"`
-}
-
-// Response to a CreateVolume request
-type CreateVolumeResp struct {
- RequestId string `xml:"requestId"`
- VolumeId string `xml:"volumeId"`
- Size int64 `xml:"size"`
- SnapshotId string `xml:"snapshotId"`
- AvailZone string `xml:"availabilityZone"`
- Status string `xml:"status"`
- CreateTime string `xml:"createTime"`
- VolumeType string `xml:"volumeType"`
- IOPS int64 `xml:"iops"`
-}
-
-// Volume is a single volume.
-type Volume struct {
- VolumeId string `xml:"volumeId"`
- Size string `xml:"size"`
- SnapshotId string `xml:"snapshotId"`
- AvailZone string `xml:"availabilityZone"`
- Status string `xml:"status"`
- Attachments []VolumeAttachment `xml:"attachmentSet>item"`
- VolumeType string `xml:"volumeType"`
- IOPS int64 `xml:"iops"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-type VolumeAttachment struct {
- VolumeId string `xml:"volumeId"`
- InstanceId string `xml:"instanceId"`
- Device string `xml:"device"`
- Status string `xml:"status"`
-}
-
-// Response to a DescribeVolumes request
-type VolumesResp struct {
- RequestId string `xml:"requestId"`
- Volumes []Volume `xml:"volumeSet>item"`
-}
-
-// Attach a volume.
-func (ec2 *EC2) AttachVolume(volumeId string, instanceId string, device string) (resp *AttachVolumeResp, err error) {
- params := makeParams("AttachVolume")
- params["VolumeId"] = volumeId
- params["InstanceId"] = instanceId
- params["Device"] = device
-
- resp = &AttachVolumeResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return resp, nil
-}
-
-// Create a new volume.
-func (ec2 *EC2) CreateVolume(options *CreateVolume) (resp *CreateVolumeResp, err error) {
- params := makeParams("CreateVolume")
- params["AvailabilityZone"] = options.AvailZone
- if options.Size > 0 {
- params["Size"] = strconv.FormatInt(options.Size, 10)
- }
-
- if options.SnapshotId != "" {
- params["SnapshotId"] = options.SnapshotId
- }
-
- if options.VolumeType != "" {
- params["VolumeType"] = options.VolumeType
- }
-
- if options.IOPS > 0 {
- params["Iops"] = strconv.FormatInt(options.IOPS, 10)
- }
-
- resp = &CreateVolumeResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Delete an EBS volume.
-func (ec2 *EC2) DeleteVolume(id string) (resp *SimpleResp, err error) {
- params := makeParams("DeleteVolume")
- params["VolumeId"] = id
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Detaches an EBS volume.
-func (ec2 *EC2) DetachVolume(id string) (resp *SimpleResp, err error) {
- params := makeParams("DetachVolume")
- params["VolumeId"] = id
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Finds or lists all volumes.
-func (ec2 *EC2) Volumes(volIds []string, filter *Filter) (resp *VolumesResp, err error) {
- params := makeParams("DescribeVolumes")
- addParamsList(params, "VolumeId", volIds)
- filter.addParams(params)
- resp = &VolumesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ----------------------------------------------------------------------------
-// Security group management functions and types.
-
-// SimpleResp represents a response to an EC2 request which on success will
-// return no other information besides a request id.
-type SimpleResp struct {
- XMLName xml.Name
- RequestId string `xml:"requestId"`
-}
-
-// CreateSecurityGroupResp represents a response to a CreateSecurityGroup request.
-type CreateSecurityGroupResp struct {
- SecurityGroup
- RequestId string `xml:"requestId"`
-}
-
-// CreateSecurityGroup run a CreateSecurityGroup request in EC2, with the provided
-// name and description.
-//
-// See http://goo.gl/Eo7Yl for more details.
-func (ec2 *EC2) CreateSecurityGroup(group SecurityGroup) (resp *CreateSecurityGroupResp, err error) {
- params := makeParams("CreateSecurityGroup")
- params["GroupName"] = group.Name
- params["GroupDescription"] = group.Description
- if group.VpcId != "" {
- params["VpcId"] = group.VpcId
- }
-
- resp = &CreateSecurityGroupResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- resp.Name = group.Name
- return resp, nil
-}
-
-// SecurityGroupsResp represents a response to a DescribeSecurityGroups
-// request in EC2.
-//
-// See http://goo.gl/k12Uy for more details.
-type SecurityGroupsResp struct {
- RequestId string `xml:"requestId"`
- Groups []SecurityGroupInfo `xml:"securityGroupInfo>item"`
-}
-
-// SecurityGroup encapsulates details for a security group in EC2.
-//
-// See http://goo.gl/CIdyP for more details.
-type SecurityGroupInfo struct {
- SecurityGroup
- OwnerId string `xml:"ownerId"`
- Description string `xml:"groupDescription"`
- IPPerms []IPPerm `xml:"ipPermissions>item"`
- IPPermsEgress []IPPerm `xml:"ipPermissionsEgress>item"`
-}
-
-// IPPerm represents an allowance within an EC2 security group.
-//
-// See http://goo.gl/4oTxv for more details.
-type IPPerm struct {
- Protocol string `xml:"ipProtocol"`
- FromPort int `xml:"fromPort"`
- ToPort int `xml:"toPort"`
- SourceIPs []string `xml:"ipRanges>item>cidrIp"`
- SourceGroups []UserSecurityGroup `xml:"groups>item"`
-}
-
-// UserSecurityGroup holds a security group and the owner
-// of that group.
-type UserSecurityGroup struct {
- Id string `xml:"groupId"`
- Name string `xml:"groupName"`
- OwnerId string `xml:"userId"`
-}
-
-// SecurityGroup represents an EC2 security group.
-// If SecurityGroup is used as a parameter, then one of Id or Name
-// may be empty. If both are set, then Id is used.
-type SecurityGroup struct {
- Id string `xml:"groupId"`
- Name string `xml:"groupName"`
- Description string `xml:"groupDescription"`
- VpcId string `xml:"vpcId"`
-}
-
-// SecurityGroupNames is a convenience function that
-// returns a slice of security groups with the given names.
-func SecurityGroupNames(names ...string) []SecurityGroup {
- g := make([]SecurityGroup, len(names))
- for i, name := range names {
- g[i] = SecurityGroup{Name: name}
- }
- return g
-}
-
-// SecurityGroupNames is a convenience function that
-// returns a slice of security groups with the given ids.
-func SecurityGroupIds(ids ...string) []SecurityGroup {
- g := make([]SecurityGroup, len(ids))
- for i, id := range ids {
- g[i] = SecurityGroup{Id: id}
- }
- return g
-}
-
-// SecurityGroups returns details about security groups in EC2. Both parameters
-// are optional, and if provided will limit the security groups returned to those
-// matching the given groups or filtering rules.
-//
-// See http://goo.gl/k12Uy for more details.
-func (ec2 *EC2) SecurityGroups(groups []SecurityGroup, filter *Filter) (resp *SecurityGroupsResp, err error) {
- params := makeParams("DescribeSecurityGroups")
- i, j := 1, 1
- for _, g := range groups {
- if g.Id != "" {
- params["GroupId."+strconv.Itoa(i)] = g.Id
- i++
- } else {
- params["GroupName."+strconv.Itoa(j)] = g.Name
- j++
- }
- }
- filter.addParams(params)
-
- resp = &SecurityGroupsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteSecurityGroup removes the given security group in EC2.
-//
-// See http://goo.gl/QJJDO for more details.
-func (ec2 *EC2) DeleteSecurityGroup(group SecurityGroup) (resp *SimpleResp, err error) {
- params := makeParams("DeleteSecurityGroup")
- if group.Id != "" {
- params["GroupId"] = group.Id
- } else {
- params["GroupName"] = group.Name
- }
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// AuthorizeSecurityGroup creates an allowance for clients matching the provided
-// rules to access instances within the given security group.
-//
-// See http://goo.gl/u2sDJ for more details.
-func (ec2 *EC2) AuthorizeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) {
- return ec2.authOrRevoke("AuthorizeSecurityGroupIngress", group, perms)
-}
-
-// RevokeSecurityGroup revokes permissions from a group.
-//
-// See http://goo.gl/ZgdxA for more details.
-func (ec2 *EC2) RevokeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) {
- return ec2.authOrRevoke("RevokeSecurityGroupIngress", group, perms)
-}
-
-// AuthorizeSecurityGroupEgress creates an allowance for instances within the
-// given security group to access servers matching the provided rules.
-//
-// See http://goo.gl/R91LXY for more details.
-func (ec2 *EC2) AuthorizeSecurityGroupEgress(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) {
- return ec2.authOrRevoke("AuthorizeSecurityGroupEgress", group, perms)
-}
-
-// RevokeSecurityGroupEgress revokes egress permissions from a group
-//
-// see http://goo.gl/Zv4wh8
-func (ec2 *EC2) RevokeSecurityGroupEgress(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) {
- return ec2.authOrRevoke("RevokeSecurityGroupEgress", group, perms)
-}
-
-func (ec2 *EC2) authOrRevoke(op string, group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) {
- params := makeParams(op)
- if group.Id != "" {
- params["GroupId"] = group.Id
- } else {
- params["GroupName"] = group.Name
- }
-
- for i, perm := range perms {
- prefix := "IpPermissions." + strconv.Itoa(i+1)
- params[prefix+".IpProtocol"] = perm.Protocol
- params[prefix+".FromPort"] = strconv.Itoa(perm.FromPort)
- params[prefix+".ToPort"] = strconv.Itoa(perm.ToPort)
- for j, ip := range perm.SourceIPs {
- params[prefix+".IpRanges."+strconv.Itoa(j+1)+".CidrIp"] = ip
- }
- for j, g := range perm.SourceGroups {
- subprefix := prefix + ".Groups." + strconv.Itoa(j+1)
- if g.OwnerId != "" {
- params[subprefix+".UserId"] = g.OwnerId
- }
- if g.Id != "" {
- params[subprefix+".GroupId"] = g.Id
- } else {
- params[subprefix+".GroupName"] = g.Name
- }
- }
- }
-
- resp = &SimpleResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ----------------------------------------------------------------------------
-// Elastic IP management functions and types.
-
-// Response to a DescribeAddresses request.
-//
-// See http://goo.gl/zW7J4p for more details.
-type DescribeAddressesResp struct {
- RequestId string `xml:"requestId"`
- Addresses []Address `xml:"addressesSet>item"`
-}
-
-// Address represents an Elastic IP Address
-// See http://goo.gl/uxCjp7 for more details
-type Address struct {
- PublicIp string `xml:"publicIp"`
- AllocationId string `xml:"allocationId"`
- Domain string `xml:"domain"`
- InstanceId string `xml:"instanceId"`
- AssociationId string `xml:"associationId"`
- NetworkInterfaceId string `xml:"networkInterfaceId"`
- NetworkInterfaceOwnerId string `xml:"networkInterfaceOwnerId"`
- PrivateIpAddress string `xml:"privateIpAddress"`
-}
-
-// DescribeAddresses returns details about one or more
-// Elastic IP Addresses. Returned addresses can be
-// filtered by Public IP, Allocation ID or multiple filters
-//
-// See http://goo.gl/zW7J4p for more details.
-func (ec2 *EC2) DescribeAddresses(publicIps []string, allocationIds []string, filter *Filter) (resp *DescribeAddressesResp, err error) {
- params := makeParams("DescribeAddresses")
- addParamsList(params, "PublicIp", publicIps)
- addParamsList(params, "AllocationId", allocationIds)
- filter.addParams(params)
- resp = &DescribeAddressesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// AllocateAddressOptions are request parameters for allocating an Elastic IP Address
-//
-// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html
-type AllocateAddressOptions struct {
- Domain string
-}
-
-// Response to an AllocateAddress request
-//
-// See http://goo.gl/aLPmbm for more details
-type AllocateAddressResp struct {
- RequestId string `xml:"requestId"`
- PublicIp string `xml:"publicIp"`
- Domain string `xml:"domain"`
- AllocationId string `xml:"allocationId"`
-}
-
-// Allocates a new Elastic IP address.
-// The domain parameter is optional and is used for provisioning an ip address
-// in EC2 or in VPC respectively
-//
-// See http://goo.gl/aLPmbm for more details
-func (ec2 *EC2) AllocateAddress(options *AllocateAddressOptions) (resp *AllocateAddressResp, err error) {
- params := makeParams("AllocateAddress")
- params["Domain"] = options.Domain
- resp = &AllocateAddressResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a ReleaseAddress request
-//
-// See http://goo.gl/Ciw2Z8 for more details
-type ReleaseAddressResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
-}
-
-// Release existing elastic ip address from the account
-// PublicIp = Required for EC2
-// AllocationId = Required for VPC
-//
-// See http://goo.gl/Ciw2Z8 for more details
-func (ec2 *EC2) ReleaseAddress(publicIp, allocationId string) (resp *ReleaseAddressResp, err error) {
- params := makeParams("ReleaseAddress")
-
- if publicIp != "" {
- params["PublicIp"] = publicIp
-
- }
- if allocationId != "" {
- params["AllocationId"] = allocationId
- }
-
- resp = &ReleaseAddressResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Options set for AssociateAddress
-//
-// See http://goo.gl/hhj4z7 for more details
-type AssociateAddressOptions struct {
- PublicIp string
- InstanceId string
- AllocationId string
- NetworkInterfaceId string
- PrivateIpAddress string
- AllowReassociation bool
-}
-
-// Response to an AssociateAddress request
-//
-// See http://goo.gl/hhj4z7 for more details
-type AssociateAddressResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
- AssociationId string `xml:"associationId"`
-}
-
-// Associate an Elastic ip address to an instance id or a network interface
-//
-// See http://goo.gl/hhj4z7 for more details
-func (ec2 *EC2) AssociateAddress(options *AssociateAddressOptions) (resp *AssociateAddressResp, err error) {
- params := makeParams("AssociateAddress")
- params["InstanceId"] = options.InstanceId
- if options.PublicIp != "" {
- params["PublicIp"] = options.PublicIp
- }
- if options.AllocationId != "" {
- params["AllocationId"] = options.AllocationId
- }
- if options.NetworkInterfaceId != "" {
- params["NetworkInterfaceId"] = options.NetworkInterfaceId
- }
- if options.PrivateIpAddress != "" {
- params["PrivateIpAddress"] = options.PrivateIpAddress
- }
- if options.AllowReassociation {
- params["AllowReassociation"] = "true"
- }
-
- resp = &AssociateAddressResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a Disassociate Address request
-//
-// See http://goo.gl/Dapkuzfor more details
-type DisassociateAddressResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
-}
-
-// Disassociate an elastic ip address from an instance
-// PublicIp - Required for EC2
-// AssociationId - Required for VPC
-// See http://goo.gl/Dapkuz for more details
-func (ec2 *EC2) DisassociateAddress(publicIp, associationId string) (resp *DisassociateAddressResp, err error) {
- params := makeParams("DisassociateAddress")
- if publicIp != "" {
- params["PublicIp"] = publicIp
- }
- if associationId != "" {
- params["AssociationId"] = associationId
- }
-
- resp = &DisassociateAddressResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2_test.go b/vendor/github.com/goamz/goamz/ec2/ec2_test.go
deleted file mode 100644
index 3ca3a220d..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2_test.go
+++ /dev/null
@@ -1,1280 +0,0 @@
-package ec2_test
-
-import (
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/ec2"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- ec2 *ec2.EC2
-}
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.ec2 = ec2.NewWithClient(
- auth,
- aws.Region{EC2Endpoint: testServer.URL},
- testutil.DefaultClient,
- )
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestRunInstancesErrorDump(c *C) {
- testServer.Response(400, nil, ErrorDump)
-
- options := ec2.RunInstancesOptions{
- ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store
- InstanceType: "t1.micro", // Doesn't work with micro, results in 400.
- }
-
- msg := `AMIs with an instance-store root device are not supported for the instance type 't1\.micro'\.`
-
- resp, err := s.ec2.RunInstances(&options)
-
- testServer.WaitRequest()
-
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, msg+` \(UnsupportedOperation\)`)
-
- ec2err, ok := err.(*ec2.Error)
- c.Assert(ok, Equals, true)
- c.Assert(ec2err.StatusCode, Equals, 400)
- c.Assert(ec2err.Code, Equals, "UnsupportedOperation")
- c.Assert(ec2err.Message, Matches, msg)
- c.Assert(ec2err.RequestId, Equals, "0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4")
-}
-
-func (s *S) TestRequestSpotInstancesErrorDump(c *C) {
- testServer.Response(400, nil, ErrorDump)
-
- options := ec2.RequestSpotInstances{
- SpotPrice: "0.01",
- ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store
- InstanceType: "t1.micro", // Doesn't work with micro, results in 400.
- }
-
- msg := `AMIs with an instance-store root device are not supported for the instance type 't1\.micro'\.`
-
- resp, err := s.ec2.RequestSpotInstances(&options)
-
- testServer.WaitRequest()
-
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, msg+` \(UnsupportedOperation\)`)
-
- ec2err, ok := err.(*ec2.Error)
- c.Assert(ok, Equals, true)
- c.Assert(ec2err.StatusCode, Equals, 400)
- c.Assert(ec2err.Code, Equals, "UnsupportedOperation")
- c.Assert(ec2err.Message, Matches, msg)
- c.Assert(ec2err.RequestId, Equals, "0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4")
-}
-
-func (s *S) TestRunInstancesErrorWithoutXML(c *C) {
- testServer.Responses(5, 500, nil, "")
- options := ec2.RunInstancesOptions{ImageId: "image-id"}
-
- resp, err := s.ec2.RunInstances(&options)
-
- testServer.WaitRequest()
-
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, "500 Internal Server Error")
-
- ec2err, ok := err.(*ec2.Error)
- c.Assert(ok, Equals, true)
- c.Assert(ec2err.StatusCode, Equals, 500)
- c.Assert(ec2err.Code, Equals, "")
- c.Assert(ec2err.Message, Equals, "500 Internal Server Error")
- c.Assert(ec2err.RequestId, Equals, "")
-}
-
-func (s *S) TestRequestSpotInstancesErrorWithoutXML(c *C) {
- testServer.Responses(5, 500, nil, "")
- options := ec2.RequestSpotInstances{SpotPrice: "spot-price", ImageId: "image-id"}
-
- resp, err := s.ec2.RequestSpotInstances(&options)
-
- testServer.WaitRequest()
-
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, "500 Internal Server Error")
-
- ec2err, ok := err.(*ec2.Error)
- c.Assert(ok, Equals, true)
- c.Assert(ec2err.StatusCode, Equals, 500)
- c.Assert(ec2err.Code, Equals, "")
- c.Assert(ec2err.Message, Equals, "500 Internal Server Error")
- c.Assert(ec2err.RequestId, Equals, "")
-}
-
-func (s *S) TestRunInstancesExample(c *C) {
- testServer.Response(200, nil, RunInstancesExample)
-
- options := ec2.RunInstancesOptions{
- KeyName: "my-keys",
- ImageId: "image-id",
- InstanceType: "inst-type",
- SecurityGroups: []ec2.SecurityGroup{{Name: "g1"}, {Id: "g2"}, {Name: "g3"}, {Id: "g4"}},
- UserData: []byte("1234"),
- KernelId: "kernel-id",
- RamdiskId: "ramdisk-id",
- AvailabilityZone: "zone",
- PlacementGroupName: "group",
- Monitoring: true,
- SubnetId: "subnet-id",
- DisableAPITermination: true,
- ShutdownBehavior: "terminate",
- PrivateIPAddress: "10.0.0.25",
- BlockDevices: []ec2.BlockDeviceMapping{
- {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"},
- {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true},
- },
- }
- resp, err := s.ec2.RunInstances(&options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"RunInstances"})
- c.Assert(req.Form["ImageId"], DeepEquals, []string{"image-id"})
- c.Assert(req.Form["MinCount"], DeepEquals, []string{"1"})
- c.Assert(req.Form["MaxCount"], DeepEquals, []string{"1"})
- c.Assert(req.Form["KeyName"], DeepEquals, []string{"my-keys"})
- c.Assert(req.Form["InstanceType"], DeepEquals, []string{"inst-type"})
- c.Assert(req.Form["SecurityGroup.1"], DeepEquals, []string{"g1"})
- c.Assert(req.Form["SecurityGroup.2"], DeepEquals, []string{"g3"})
- c.Assert(req.Form["SecurityGroupId.1"], DeepEquals, []string{"g2"})
- c.Assert(req.Form["SecurityGroupId.2"], DeepEquals, []string{"g4"})
- c.Assert(req.Form["UserData"], DeepEquals, []string{"MTIzNA=="})
- c.Assert(req.Form["KernelId"], DeepEquals, []string{"kernel-id"})
- c.Assert(req.Form["RamdiskId"], DeepEquals, []string{"ramdisk-id"})
- c.Assert(req.Form["Placement.AvailabilityZone"], DeepEquals, []string{"zone"})
- c.Assert(req.Form["Placement.GroupName"], DeepEquals, []string{"group"})
- c.Assert(req.Form["Monitoring.Enabled"], DeepEquals, []string{"true"})
- c.Assert(req.Form["SubnetId"], DeepEquals, []string{"subnet-id"})
- c.Assert(req.Form["DisableApiTermination"], DeepEquals, []string{"true"})
- c.Assert(req.Form["InstanceInitiatedShutdownBehavior"], DeepEquals, []string{"terminate"})
- c.Assert(req.Form["PrivateIpAddress"], DeepEquals, []string{"10.0.0.25"})
- c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"})
- c.Assert(req.Form["BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"})
- c.Assert(req.Form["BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"})
- c.Assert(req.Form["BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.ReservationId, Equals, "r-47a5402e")
- c.Assert(resp.OwnerId, Equals, "999988887777")
- c.Assert(resp.SecurityGroups, DeepEquals, []ec2.SecurityGroup{{Name: "default", Id: "sg-67ad940e"}})
- c.Assert(resp.Instances, HasLen, 3)
-
- i0 := resp.Instances[0]
- c.Assert(i0.InstanceId, Equals, "i-2ba64342")
- c.Assert(i0.InstanceType, Equals, "m1.small")
- c.Assert(i0.ImageId, Equals, "ami-60a54009")
- c.Assert(i0.Monitoring, Equals, "enabled")
- c.Assert(i0.KeyName, Equals, "example-key-name")
- c.Assert(i0.AMILaunchIndex, Equals, 0)
- c.Assert(i0.VirtualizationType, Equals, "paravirtual")
- c.Assert(i0.Hypervisor, Equals, "xen")
-
- i1 := resp.Instances[1]
- c.Assert(i1.InstanceId, Equals, "i-2bc64242")
- c.Assert(i1.InstanceType, Equals, "m1.small")
- c.Assert(i1.ImageId, Equals, "ami-60a54009")
- c.Assert(i1.Monitoring, Equals, "enabled")
- c.Assert(i1.KeyName, Equals, "example-key-name")
- c.Assert(i1.AMILaunchIndex, Equals, 1)
- c.Assert(i1.VirtualizationType, Equals, "paravirtual")
- c.Assert(i1.Hypervisor, Equals, "xen")
-
- i2 := resp.Instances[2]
- c.Assert(i2.InstanceId, Equals, "i-2be64332")
- c.Assert(i2.InstanceType, Equals, "m1.small")
- c.Assert(i2.ImageId, Equals, "ami-60a54009")
- c.Assert(i2.Monitoring, Equals, "enabled")
- c.Assert(i2.KeyName, Equals, "example-key-name")
- c.Assert(i2.AMILaunchIndex, Equals, 2)
- c.Assert(i2.VirtualizationType, Equals, "paravirtual")
- c.Assert(i2.Hypervisor, Equals, "xen")
-}
-
-func (s *S) TestRequestSpotInstancesExample(c *C) {
- testServer.Response(200, nil, RequestSpotInstancesExample)
-
- options := ec2.RequestSpotInstances{
- SpotPrice: "0.5",
- KeyName: "my-keys",
- ImageId: "image-id",
- InstanceType: "inst-type",
- SecurityGroups: []ec2.SecurityGroup{{Name: "g1"}, {Id: "g2"}, {Name: "g3"}, {Id: "g4"}},
- UserData: []byte("1234"),
- KernelId: "kernel-id",
- RamdiskId: "ramdisk-id",
- AvailZone: "zone",
- PlacementGroupName: "group",
- Monitoring: true,
- SubnetId: "subnet-id",
- PrivateIPAddress: "10.0.0.25",
- BlockDevices: []ec2.BlockDeviceMapping{
- {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"},
- {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true},
- },
- }
- resp, err := s.ec2.RequestSpotInstances(&options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"RequestSpotInstances"})
- c.Assert(req.Form["SpotPrice"], DeepEquals, []string{"0.5"})
- c.Assert(req.Form["LaunchSpecification.ImageId"], DeepEquals, []string{"image-id"})
- c.Assert(req.Form["LaunchSpecification.KeyName"], DeepEquals, []string{"my-keys"})
- c.Assert(req.Form["LaunchSpecification.InstanceType"], DeepEquals, []string{"inst-type"})
- c.Assert(req.Form["LaunchSpecification.SecurityGroup.1"], DeepEquals, []string{"g1"})
- c.Assert(req.Form["LaunchSpecification.SecurityGroup.2"], DeepEquals, []string{"g3"})
- c.Assert(req.Form["LaunchSpecification.SecurityGroupId.1"], DeepEquals, []string{"g2"})
- c.Assert(req.Form["LaunchSpecification.SecurityGroupId.2"], DeepEquals, []string{"g4"})
- c.Assert(req.Form["LaunchSpecification.UserData"], DeepEquals, []string{"MTIzNA=="})
- c.Assert(req.Form["LaunchSpecification.KernelId"], DeepEquals, []string{"kernel-id"})
- c.Assert(req.Form["LaunchSpecification.RamdiskId"], DeepEquals, []string{"ramdisk-id"})
- c.Assert(req.Form["LaunchSpecification.Placement.AvailabilityZone"], DeepEquals, []string{"zone"})
- c.Assert(req.Form["LaunchSpecification.Placement.GroupName"], DeepEquals, []string{"group"})
- c.Assert(req.Form["LaunchSpecification.Monitoring.Enabled"], DeepEquals, []string{"true"})
- c.Assert(req.Form["LaunchSpecification.SubnetId"], DeepEquals, []string{"subnet-id"})
- c.Assert(req.Form["LaunchSpecification.PrivateIpAddress"], DeepEquals, []string{"10.0.0.25"})
- c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"})
- c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"})
- c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"})
- c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.SpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d")
- c.Assert(resp.SpotRequestResults[0].SpotPrice, Equals, "0.5")
- c.Assert(resp.SpotRequestResults[0].State, Equals, "open")
- c.Assert(resp.SpotRequestResults[0].SpotLaunchSpec.ImageId, Equals, "ami-1a2b3c4d")
-}
-
-func (s *S) TestCancelSpotRequestsExample(c *C) {
- testServer.Response(200, nil, CancelSpotRequestsExample)
-
- resp, err := s.ec2.CancelSpotRequests([]string{"s-1", "s-2"})
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CancelSpotInstanceRequests"})
- c.Assert(req.Form["SpotInstanceRequestId.1"], DeepEquals, []string{"s-1"})
- c.Assert(req.Form["SpotInstanceRequestId.2"], DeepEquals, []string{"s-2"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.CancelSpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d")
- c.Assert(resp.CancelSpotRequestResults[0].State, Equals, "cancelled")
-}
-
-func (s *S) TestTerminateInstancesExample(c *C) {
- testServer.Response(200, nil, TerminateInstancesExample)
-
- resp, err := s.ec2.TerminateInstances([]string{"i-1", "i-2"})
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"TerminateInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"})
- c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"})
- c.Assert(req.Form["UserData"], IsNil)
- c.Assert(req.Form["KernelId"], IsNil)
- c.Assert(req.Form["RamdiskId"], IsNil)
- c.Assert(req.Form["Placement.AvailabilityZone"], IsNil)
- c.Assert(req.Form["Placement.GroupName"], IsNil)
- c.Assert(req.Form["Monitoring.Enabled"], IsNil)
- c.Assert(req.Form["SubnetId"], IsNil)
- c.Assert(req.Form["DisableApiTermination"], IsNil)
- c.Assert(req.Form["InstanceInitiatedShutdownBehavior"], IsNil)
- c.Assert(req.Form["PrivateIpAddress"], IsNil)
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.StateChanges, HasLen, 1)
- c.Assert(resp.StateChanges[0].InstanceId, Equals, "i-3ea74257")
- c.Assert(resp.StateChanges[0].CurrentState.Code, Equals, 32)
- c.Assert(resp.StateChanges[0].CurrentState.Name, Equals, "shutting-down")
- c.Assert(resp.StateChanges[0].PreviousState.Code, Equals, 16)
- c.Assert(resp.StateChanges[0].PreviousState.Name, Equals, "running")
-}
-
-func (s *S) TestDescribeSpotRequestsExample(c *C) {
- testServer.Response(200, nil, DescribeSpotRequestsExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeSpotRequests([]string{"s-1", "s-2"}, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSpotInstanceRequests"})
- c.Assert(req.Form["SpotInstanceRequestId.1"], DeepEquals, []string{"s-1"})
- c.Assert(req.Form["SpotInstanceRequestId.2"], DeepEquals, []string{"s-2"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "b1719f2a-5334-4479-b2f1-26926EXAMPLE")
- c.Assert(resp.SpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d")
- c.Assert(resp.SpotRequestResults[0].State, Equals, "active")
- c.Assert(resp.SpotRequestResults[0].SpotPrice, Equals, "0.5")
- c.Assert(resp.SpotRequestResults[0].SpotLaunchSpec.ImageId, Equals, "ami-1a2b3c4d")
-}
-
-func (s *S) TestDescribeInstancesExample1(c *C) {
- testServer.Response(200, nil, DescribeInstancesExample1)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeInstances([]string{"i-1", "i-2"}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"})
- c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE")
- c.Assert(resp.Reservations, HasLen, 2)
-
- r0 := resp.Reservations[0]
- c.Assert(r0.ReservationId, Equals, "r-b27e30d9")
- c.Assert(r0.OwnerId, Equals, "999988887777")
- c.Assert(r0.RequesterId, Equals, "854251627541")
- c.Assert(r0.SecurityGroups, DeepEquals, []ec2.SecurityGroup{{Name: "default", Id: "sg-67ad940e"}})
- c.Assert(r0.Instances, HasLen, 1)
-
- r0i := r0.Instances[0]
- c.Assert(r0i.InstanceId, Equals, "i-c5cd56af")
- c.Assert(r0i.PrivateDNSName, Equals, "domU-12-31-39-10-56-34.compute-1.internal")
- c.Assert(r0i.DNSName, Equals, "ec2-174-129-165-232.compute-1.amazonaws.com")
- c.Assert(r0i.AvailabilityZone, Equals, "us-east-1b")
- c.Assert(r0i.IPAddress, Equals, "174.129.165.232")
- c.Assert(r0i.PrivateIPAddress, Equals, "10.198.85.190")
-}
-
-func (s *S) TestDescribeInstancesExample2(c *C) {
- testServer.Response(200, nil, DescribeInstancesExample2)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeInstances([]string{"i-1", "i-2"}, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"})
- c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"})
- c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"})
- c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"})
- c.Assert(req.Form["Filter.1.Value.2"], IsNil)
- c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"})
- c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"})
- c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Reservations, HasLen, 1)
-
- r0 := resp.Reservations[0]
- r0i := r0.Instances[0]
- c.Assert(r0i.State.Code, Equals, 16)
- c.Assert(r0i.State.Name, Equals, "running")
-
- r0t0 := r0i.Tags[0]
- r0t1 := r0i.Tags[1]
- c.Assert(r0t0.Key, Equals, "webserver")
- c.Assert(r0t0.Value, Equals, "")
- c.Assert(r0t1.Key, Equals, "stack")
- c.Assert(r0t1.Value, Equals, "Production")
-}
-
-func (s *S) TestDescribeInstanceStatusExample(c *C) {
- testServer.Response(200, nil, DescribeInstanceStatusExample)
-
- resp, err := s.ec2.DescribeInstanceStatus(&ec2.DescribeInstanceStatusOptions{}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstanceStatus"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.InstanceStatusSet, HasLen, 1)
- c.Assert(resp.NextToken, Equals, "exampleToken")
-
- i0 := resp.InstanceStatusSet[0]
- c.Assert(i0.InstanceId, Equals, "i-c7cd56ad")
- c.Assert(i0.AvailabilityZone, Equals, "us-east-1b")
- c.Assert(i0.Events, HasLen, 1)
-
- e0 := i0.Events[0]
- c.Assert(e0.Code, Equals, "instance-reboot")
- c.Assert(e0.Description, Equals, "example description")
- c.Assert(e0.NotBefore, Equals, "2010-08-17T01:15:18.000Z")
- c.Assert(e0.NotAfter, Equals, "2010-08-17T01:15:18.000Z")
-
- c.Assert(i0.InstanceState.Code, Equals, 16)
- c.Assert(i0.InstanceState.Name, Equals, "running")
- c.Assert(i0.SystemStatus.Status, Equals, "ok")
- c.Assert(i0.SystemStatus.Details.Name, Equals, "reachability")
- c.Assert(i0.SystemStatus.Details.Status, Equals, "passed")
- c.Assert(i0.SystemStatus.Details.ImpairedSince, Equals, "2010-08-17T01:15:18.000Z")
- c.Assert(i0.InstanceStatus.Status, Equals, "ok")
- c.Assert(i0.InstanceStatus.Details.Name, Equals, "reachability")
- c.Assert(i0.InstanceStatus.Details.Status, Equals, "passed")
- c.Assert(i0.InstanceStatus.Details.ImpairedSince, Equals, "2010-08-17T01:15:18.000Z")
-}
-
-func (s *S) TestDescribeAddressesPublicIPExample(c *C) {
- testServer.Response(200, nil, DescribeAddressesExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeAddresses([]string{"192.0.2.1", "198.51.100.2", "203.0.113.41"}, []string{}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeAddresses"})
- c.Assert(req.Form["PublicIp.1"], DeepEquals, []string{"192.0.2.1"})
- c.Assert(req.Form["PublicIp.2"], DeepEquals, []string{"198.51.100.2"})
- c.Assert(req.Form["PublicIp.3"], DeepEquals, []string{"203.0.113.41"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Addresses, HasLen, 3)
-
- r0 := resp.Addresses[0]
- c.Assert(r0.PublicIp, Equals, "192.0.2.1")
- c.Assert(r0.Domain, Equals, "standard")
- c.Assert(r0.InstanceId, Equals, "i-f15ebb98")
-
- r0i := resp.Addresses[1]
- c.Assert(r0i.PublicIp, Equals, "198.51.100.2")
- c.Assert(r0i.Domain, Equals, "standard")
- c.Assert(r0i.InstanceId, Equals, "")
-
- r0ii := resp.Addresses[2]
- c.Assert(r0ii.PublicIp, Equals, "203.0.113.41")
- c.Assert(r0ii.Domain, Equals, "vpc")
- c.Assert(r0ii.InstanceId, Equals, "i-64600030")
- c.Assert(r0ii.AssociationId, Equals, "eipassoc-f0229899")
- c.Assert(r0ii.AllocationId, Equals, "eipalloc-08229861")
- c.Assert(r0ii.NetworkInterfaceOwnerId, Equals, "053230519467")
- c.Assert(r0ii.NetworkInterfaceId, Equals, "eni-ef229886")
- c.Assert(r0ii.PrivateIpAddress, Equals, "10.0.0.228")
-}
-
-func (s *S) TestDescribeAddressesAllocationIDExample(c *C) {
- testServer.Response(200, nil, DescribeAddressesAllocationIdExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeAddresses([]string{}, []string{"eipalloc-08229861", "eipalloc-08364752"}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeAddresses"})
- c.Assert(req.Form["AllocationId.1"], DeepEquals, []string{"eipalloc-08229861"})
- c.Assert(req.Form["AllocationId.2"], DeepEquals, []string{"eipalloc-08364752"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Addresses, HasLen, 2)
-
- r0 := resp.Addresses[0]
- c.Assert(r0.PublicIp, Equals, "203.0.113.41")
- c.Assert(r0.AllocationId, Equals, "eipalloc-08229861")
- c.Assert(r0.Domain, Equals, "vpc")
- c.Assert(r0.InstanceId, Equals, "i-64600030")
- c.Assert(r0.AssociationId, Equals, "eipassoc-f0229899")
- c.Assert(r0.NetworkInterfaceId, Equals, "eni-ef229886")
- c.Assert(r0.NetworkInterfaceOwnerId, Equals, "053230519467")
- c.Assert(r0.PrivateIpAddress, Equals, "10.0.0.228")
-
- r1 := resp.Addresses[1]
- c.Assert(r1.PublicIp, Equals, "146.54.2.230")
- c.Assert(r1.AllocationId, Equals, "eipalloc-08364752")
- c.Assert(r1.Domain, Equals, "vpc")
- c.Assert(r1.InstanceId, Equals, "i-64693456")
- c.Assert(r1.AssociationId, Equals, "eipassoc-f0348693")
- c.Assert(r1.NetworkInterfaceId, Equals, "eni-da764039")
- c.Assert(r1.NetworkInterfaceOwnerId, Equals, "053230519467")
- c.Assert(r1.PrivateIpAddress, Equals, "10.0.0.102")
-}
-
-func (s *S) TestCreateImageExample(c *C) {
- testServer.Response(200, nil, CreateImageExample)
-
- options := &ec2.CreateImage{
- InstanceId: "i-123456",
- Name: "foo",
- Description: "Test CreateImage",
- NoReboot: true,
- BlockDevices: []ec2.BlockDeviceMapping{
- {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"},
- {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true},
- },
- }
-
- resp, err := s.ec2.CreateImage(options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateImage"})
- c.Assert(req.Form["InstanceId"], DeepEquals, []string{options.InstanceId})
- c.Assert(req.Form["Name"], DeepEquals, []string{options.Name})
- c.Assert(req.Form["Description"], DeepEquals, []string{options.Description})
- c.Assert(req.Form["NoReboot"], DeepEquals, []string{"true"})
- c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"})
- c.Assert(req.Form["BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"})
- c.Assert(req.Form["BlockDeviceMapping.2.DeviceName"], DeepEquals, []string{"/dev/sdc"})
- c.Assert(req.Form["BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"})
- c.Assert(req.Form["BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.ImageId, Equals, "ami-4fa54026")
-}
-
-func (s *S) TestDescribeImagesExample(c *C) {
- testServer.Response(200, nil, DescribeImagesExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.Images([]string{"ami-1", "ami-2"}, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeImages"})
- c.Assert(req.Form["ImageId.1"], DeepEquals, []string{"ami-1"})
- c.Assert(req.Form["ImageId.2"], DeepEquals, []string{"ami-2"})
- c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"})
- c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"})
- c.Assert(req.Form["Filter.1.Value.2"], IsNil)
- c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"})
- c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"})
- c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE")
- c.Assert(resp.Images, HasLen, 1)
-
- i0 := resp.Images[0]
- c.Assert(i0.Id, Equals, "ami-a2469acf")
- c.Assert(i0.Type, Equals, "machine")
- c.Assert(i0.Name, Equals, "example-marketplace-amzn-ami.1")
- c.Assert(i0.Description, Equals, "Amazon Linux AMI i386 EBS")
- c.Assert(i0.Location, Equals, "aws-marketplace/example-marketplace-amzn-ami.1")
- c.Assert(i0.State, Equals, "available")
- c.Assert(i0.Public, Equals, true)
- c.Assert(i0.OwnerId, Equals, "123456789999")
- c.Assert(i0.OwnerAlias, Equals, "aws-marketplace")
- c.Assert(i0.Architecture, Equals, "i386")
- c.Assert(i0.KernelId, Equals, "aki-805ea7e9")
- c.Assert(i0.RootDeviceType, Equals, "ebs")
- c.Assert(i0.RootDeviceName, Equals, "/dev/sda1")
- c.Assert(i0.VirtualizationType, Equals, "paravirtual")
- c.Assert(i0.Hypervisor, Equals, "xen")
-
- c.Assert(i0.Tags, HasLen, 1)
- c.Assert(i0.Tags[0].Key, Equals, "Purpose")
- c.Assert(i0.Tags[0].Value, Equals, "EXAMPLE")
-
- c.Assert(i0.BlockDevices, HasLen, 1)
- c.Assert(i0.BlockDevices[0].DeviceName, Equals, "/dev/sda1")
- c.Assert(i0.BlockDevices[0].SnapshotId, Equals, "snap-787e9403")
- c.Assert(i0.BlockDevices[0].VolumeSize, Equals, int64(8))
- c.Assert(i0.BlockDevices[0].DeleteOnTermination, Equals, true)
-
- testServer.Response(200, nil, DescribeImagesExample)
- resp2, err := s.ec2.ImagesByOwners([]string{"ami-1", "ami-2"}, []string{"123456789999", "id2"}, filter)
-
- req2 := testServer.WaitRequest()
- c.Assert(req2.Form["Action"], DeepEquals, []string{"DescribeImages"})
- c.Assert(req2.Form["ImageId.1"], DeepEquals, []string{"ami-1"})
- c.Assert(req2.Form["ImageId.2"], DeepEquals, []string{"ami-2"})
- c.Assert(req2.Form["Owner.1"], DeepEquals, []string{"123456789999"})
- c.Assert(req2.Form["Owner.2"], DeepEquals, []string{"id2"})
- c.Assert(req2.Form["Filter.1.Name"], DeepEquals, []string{"key1"})
- c.Assert(req2.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"})
- c.Assert(req2.Form["Filter.1.Value.2"], IsNil)
- c.Assert(req2.Form["Filter.2.Name"], DeepEquals, []string{"key2"})
- c.Assert(req2.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"})
- c.Assert(req2.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp2.RequestId, Equals, "4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE")
- c.Assert(resp2.Images, HasLen, 1)
-
- i1 := resp2.Images[0]
- c.Assert(i1.Id, Equals, "ami-a2469acf")
- c.Assert(i1.Type, Equals, "machine")
- c.Assert(i1.Name, Equals, "example-marketplace-amzn-ami.1")
- c.Assert(i1.Description, Equals, "Amazon Linux AMI i386 EBS")
- c.Assert(i1.Location, Equals, "aws-marketplace/example-marketplace-amzn-ami.1")
- c.Assert(i1.State, Equals, "available")
- c.Assert(i1.Public, Equals, true)
- c.Assert(i1.OwnerId, Equals, "123456789999")
- c.Assert(i1.OwnerAlias, Equals, "aws-marketplace")
- c.Assert(i1.Architecture, Equals, "i386")
- c.Assert(i1.KernelId, Equals, "aki-805ea7e9")
- c.Assert(i1.RootDeviceType, Equals, "ebs")
- c.Assert(i1.RootDeviceName, Equals, "/dev/sda1")
- c.Assert(i1.VirtualizationType, Equals, "paravirtual")
- c.Assert(i1.Hypervisor, Equals, "xen")
-
- c.Assert(i1.BlockDevices, HasLen, 1)
- c.Assert(i1.BlockDevices[0].DeviceName, Equals, "/dev/sda1")
- c.Assert(i1.BlockDevices[0].SnapshotId, Equals, "snap-787e9403")
- c.Assert(i1.BlockDevices[0].VolumeSize, Equals, int64(8))
- c.Assert(i1.BlockDevices[0].DeleteOnTermination, Equals, true)
-}
-
-func (s *S) TestImageAttributeExample(c *C) {
- testServer.Response(200, nil, ImageAttributeExample)
-
- resp, err := s.ec2.ImageAttribute("ami-61a54008", "launchPermission")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeImageAttribute"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.ImageId, Equals, "ami-61a54008")
- c.Assert(resp.Group, Equals, "all")
- c.Assert(resp.UserIds[0], Equals, "495219933132")
-}
-
-func (s *S) TestCreateSnapshotExample(c *C) {
- testServer.Response(200, nil, CreateSnapshotExample)
-
- resp, err := s.ec2.CreateSnapshot("vol-4d826724", "Daily Backup")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateSnapshot"})
- c.Assert(req.Form["VolumeId"], DeepEquals, []string{"vol-4d826724"})
- c.Assert(req.Form["Description"], DeepEquals, []string{"Daily Backup"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Snapshot.Id, Equals, "snap-78a54011")
- c.Assert(resp.Snapshot.VolumeId, Equals, "vol-4d826724")
- c.Assert(resp.Snapshot.Status, Equals, "pending")
- c.Assert(resp.Snapshot.StartTime, Equals, "2008-05-07T12:51:50.000Z")
- c.Assert(resp.Snapshot.Progress, Equals, "60%")
- c.Assert(resp.Snapshot.OwnerId, Equals, "111122223333")
- c.Assert(resp.Snapshot.VolumeSize, Equals, "10")
- c.Assert(resp.Snapshot.Description, Equals, "Daily Backup")
-}
-
-func (s *S) TestDeleteSnapshotsExample(c *C) {
- testServer.Response(200, nil, DeleteSnapshotExample)
-
- resp, err := s.ec2.DeleteSnapshots([]string{"snap-78a54011"})
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteSnapshot"})
- c.Assert(req.Form["SnapshotId.1"], DeepEquals, []string{"snap-78a54011"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestDescribeSnapshotsExample(c *C) {
- testServer.Response(200, nil, DescribeSnapshotsExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.Snapshots([]string{"snap-1", "snap-2"}, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSnapshots"})
- c.Assert(req.Form["SnapshotId.1"], DeepEquals, []string{"snap-1"})
- c.Assert(req.Form["SnapshotId.2"], DeepEquals, []string{"snap-2"})
- c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"})
- c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"})
- c.Assert(req.Form["Filter.1.Value.2"], IsNil)
- c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"})
- c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"})
- c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Snapshots, HasLen, 1)
-
- s0 := resp.Snapshots[0]
- c.Assert(s0.Id, Equals, "snap-1a2b3c4d")
- c.Assert(s0.VolumeId, Equals, "vol-8875daef")
- c.Assert(s0.VolumeSize, Equals, "15")
- c.Assert(s0.Status, Equals, "pending")
- c.Assert(s0.StartTime, Equals, "2010-07-29T04:12:01.000Z")
- c.Assert(s0.Progress, Equals, "30%")
- c.Assert(s0.OwnerId, Equals, "111122223333")
- c.Assert(s0.Description, Equals, "Daily Backup")
-
- c.Assert(s0.Tags, HasLen, 1)
- c.Assert(s0.Tags[0].Key, Equals, "Purpose")
- c.Assert(s0.Tags[0].Value, Equals, "demo_db_14_backup")
-}
-
-func (s *S) TestModifyImageAttributeExample(c *C) {
- testServer.Response(200, nil, ModifyImageAttributeExample)
-
- options := ec2.ModifyImageAttribute{
- Description: "Test Description",
- }
-
- resp, err := s.ec2.ModifyImageAttribute("ami-4fa54026", &options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyImageAttribute"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestModifyImageAttributeExample_complex(c *C) {
- testServer.Response(200, nil, ModifyImageAttributeExample)
-
- options := ec2.ModifyImageAttribute{
- AddUsers: []string{"u1", "u2"},
- RemoveUsers: []string{"u3"},
- AddGroups: []string{"g1", "g3"},
- RemoveGroups: []string{"g2"},
- Description: "Test Description",
- }
-
- resp, err := s.ec2.ModifyImageAttribute("ami-4fa54026", &options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyImageAttribute"})
- c.Assert(req.Form["LaunchPermission.Add.1.UserId"], DeepEquals, []string{"u1"})
- c.Assert(req.Form["LaunchPermission.Add.2.UserId"], DeepEquals, []string{"u2"})
- c.Assert(req.Form["LaunchPermission.Remove.1.UserId"], DeepEquals, []string{"u3"})
- c.Assert(req.Form["LaunchPermission.Add.1.Group"], DeepEquals, []string{"g1"})
- c.Assert(req.Form["LaunchPermission.Add.2.Group"], DeepEquals, []string{"g3"})
- c.Assert(req.Form["LaunchPermission.Remove.1.Group"], DeepEquals, []string{"g2"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestCopyImageExample(c *C) {
- testServer.Response(200, nil, CopyImageExample)
-
- options := ec2.CopyImage{
- SourceRegion: "us-west-2",
- SourceImageId: "ami-1a2b3c4d",
- Description: "Test Description",
- }
-
- resp, err := s.ec2.CopyImage(&options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CopyImage"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "60bc441d-fa2c-494d-b155-5d6a3EXAMPLE")
-}
-
-func (s *S) TestCreateKeyPairExample(c *C) {
- testServer.Response(200, nil, CreateKeyPairExample)
-
- resp, err := s.ec2.CreateKeyPair("foo")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateKeyPair"})
- c.Assert(req.Form["KeyName"], DeepEquals, []string{"foo"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.KeyName, Equals, "foo")
- c.Assert(resp.KeyFingerprint, Equals, "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00")
-}
-
-func (s *S) TestDeleteKeyPairExample(c *C) {
- testServer.Response(200, nil, DeleteKeyPairExample)
-
- resp, err := s.ec2.DeleteKeyPair("foo")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteKeyPair"})
- c.Assert(req.Form["KeyName"], DeepEquals, []string{"foo"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestCreateSecurityGroupExample(c *C) {
- testServer.Response(200, nil, CreateSecurityGroupExample)
-
- resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: "websrv", Description: "Web Servers"})
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateSecurityGroup"})
- c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"})
- c.Assert(req.Form["GroupDescription"], DeepEquals, []string{"Web Servers"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Name, Equals, "websrv")
- c.Assert(resp.Id, Equals, "sg-67ad940e")
-}
-
-func (s *S) TestDescribeSecurityGroupsExample(c *C) {
- testServer.Response(200, nil, DescribeSecurityGroupsExample)
-
- resp, err := s.ec2.SecurityGroups([]ec2.SecurityGroup{{Name: "WebServers"}, {Name: "RangedPortsBySource"}}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"})
- c.Assert(req.Form["GroupName.1"], DeepEquals, []string{"WebServers"})
- c.Assert(req.Form["GroupName.2"], DeepEquals, []string{"RangedPortsBySource"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Groups, HasLen, 2)
-
- g0 := resp.Groups[0]
- c.Assert(g0.OwnerId, Equals, "999988887777")
- c.Assert(g0.Name, Equals, "WebServers")
- c.Assert(g0.Id, Equals, "sg-67ad940e")
- c.Assert(g0.Description, Equals, "Web Servers")
- c.Assert(g0.IPPerms, HasLen, 1)
- c.Assert(g0.IPPermsEgress, HasLen, 1)
-
- g0ipp := g0.IPPerms[0]
- c.Assert(g0ipp.Protocol, Equals, "tcp")
- c.Assert(g0ipp.FromPort, Equals, 80)
- c.Assert(g0ipp.ToPort, Equals, 80)
- c.Assert(g0ipp.SourceIPs, DeepEquals, []string{"0.0.0.0/0"})
-
- g0ippe := g0.IPPermsEgress[0]
- c.Assert(g0ippe.Protocol, Equals, "tcp")
- c.Assert(g0ippe.FromPort, Equals, 80)
- c.Assert(g0ippe.ToPort, Equals, 80)
- c.Assert(g0ippe.SourceIPs, DeepEquals, []string{"0.0.0.0/0"})
-
- g1 := resp.Groups[1]
- c.Assert(g1.OwnerId, Equals, "999988887777")
- c.Assert(g1.Name, Equals, "RangedPortsBySource")
- c.Assert(g1.Id, Equals, "sg-76abc467")
- c.Assert(g1.Description, Equals, "Group A")
- c.Assert(g1.IPPerms, HasLen, 1)
-
- g1ipp := g1.IPPerms[0]
- c.Assert(g1ipp.Protocol, Equals, "tcp")
- c.Assert(g1ipp.FromPort, Equals, 6000)
- c.Assert(g1ipp.ToPort, Equals, 7000)
- c.Assert(g1ipp.SourceIPs, IsNil)
-}
-
-func (s *S) TestDescribeSecurityGroupsExampleWithFilter(c *C) {
- testServer.Response(200, nil, DescribeSecurityGroupsExample)
-
- filter := ec2.NewFilter()
- filter.Add("ip-permission.protocol", "tcp")
- filter.Add("ip-permission.from-port", "22")
- filter.Add("ip-permission.to-port", "22")
- filter.Add("ip-permission.group-name", "app_server_group", "database_group")
-
- _, err := s.ec2.SecurityGroups(nil, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"})
- c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"ip-permission.from-port"})
- c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"22"})
- c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"ip-permission.group-name"})
- c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"app_server_group"})
- c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"database_group"})
- c.Assert(req.Form["Filter.3.Name"], DeepEquals, []string{"ip-permission.protocol"})
- c.Assert(req.Form["Filter.3.Value.1"], DeepEquals, []string{"tcp"})
- c.Assert(req.Form["Filter.4.Name"], DeepEquals, []string{"ip-permission.to-port"})
- c.Assert(req.Form["Filter.4.Value.1"], DeepEquals, []string{"22"})
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDescribeSecurityGroupsDumpWithGroup(c *C) {
- testServer.Response(200, nil, DescribeSecurityGroupsDump)
-
- resp, err := s.ec2.SecurityGroups(nil, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"})
- c.Assert(err, IsNil)
- c.Check(resp.Groups, HasLen, 1)
- c.Check(resp.Groups[0].IPPerms, HasLen, 2)
-
- ipp0 := resp.Groups[0].IPPerms[0]
- c.Assert(ipp0.SourceIPs, IsNil)
- c.Check(ipp0.Protocol, Equals, "icmp")
- c.Assert(ipp0.SourceGroups, HasLen, 1)
- c.Check(ipp0.SourceGroups[0].OwnerId, Equals, "12345")
- c.Check(ipp0.SourceGroups[0].Name, Equals, "default")
- c.Check(ipp0.SourceGroups[0].Id, Equals, "sg-67ad940e")
-
- ipp1 := resp.Groups[0].IPPerms[1]
- c.Check(ipp1.Protocol, Equals, "tcp")
- c.Assert(ipp0.SourceIPs, IsNil)
- c.Assert(ipp0.SourceGroups, HasLen, 1)
- c.Check(ipp1.SourceGroups[0].Id, Equals, "sg-76abc467")
- c.Check(ipp1.SourceGroups[0].OwnerId, Equals, "12345")
- c.Check(ipp1.SourceGroups[0].Name, Equals, "other")
-}
-
-func (s *S) TestDeleteSecurityGroupExample(c *C) {
- testServer.Response(200, nil, DeleteSecurityGroupExample)
-
- resp, err := s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: "websrv"})
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteSecurityGroup"})
- c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"})
- c.Assert(req.Form["GroupId"], IsNil)
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestDeleteSecurityGroupExampleWithId(c *C) {
- testServer.Response(200, nil, DeleteSecurityGroupExample)
-
- // ignore return and error - we're only want to check the parameter handling.
- s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Id: "sg-67ad940e", Name: "ignored"})
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["GroupName"], IsNil)
- c.Assert(req.Form["GroupId"], DeepEquals, []string{"sg-67ad940e"})
-}
-
-func (s *S) TestAuthorizeSecurityGroupExample1(c *C) {
- testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample)
-
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 80,
- ToPort: 80,
- SourceIPs: []string{"205.192.0.0/16", "205.159.0.0/16"},
- }}
- resp, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, perms)
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"AuthorizeSecurityGroupIngress"})
- c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"})
- c.Assert(req.Form["IpPermissions.1.IpProtocol"], DeepEquals, []string{"tcp"})
- c.Assert(req.Form["IpPermissions.1.FromPort"], DeepEquals, []string{"80"})
- c.Assert(req.Form["IpPermissions.1.ToPort"], DeepEquals, []string{"80"})
- c.Assert(req.Form["IpPermissions.1.IpRanges.1.CidrIp"], DeepEquals, []string{"205.192.0.0/16"})
- c.Assert(req.Form["IpPermissions.1.IpRanges.2.CidrIp"], DeepEquals, []string{"205.159.0.0/16"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestAuthorizeSecurityGroupExample1WithId(c *C) {
- testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample)
-
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 80,
- ToPort: 80,
- SourceIPs: []string{"205.192.0.0/16", "205.159.0.0/16"},
- }}
- // ignore return and error - we're only want to check the parameter handling.
- s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Id: "sg-67ad940e", Name: "ignored"}, perms)
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["GroupName"], IsNil)
- c.Assert(req.Form["GroupId"], DeepEquals, []string{"sg-67ad940e"})
-}
-
-func (s *S) TestAuthorizeSecurityGroupExample2(c *C) {
- testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample)
-
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 80,
- ToPort: 81,
- SourceGroups: []ec2.UserSecurityGroup{
- {OwnerId: "999988887777", Name: "OtherAccountGroup"},
- {Id: "sg-67ad940e"},
- },
- }}
- resp, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, perms)
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"AuthorizeSecurityGroupIngress"})
- c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"})
- c.Assert(req.Form["IpPermissions.1.IpProtocol"], DeepEquals, []string{"tcp"})
- c.Assert(req.Form["IpPermissions.1.FromPort"], DeepEquals, []string{"80"})
- c.Assert(req.Form["IpPermissions.1.ToPort"], DeepEquals, []string{"81"})
- c.Assert(req.Form["IpPermissions.1.Groups.1.UserId"], DeepEquals, []string{"999988887777"})
- c.Assert(req.Form["IpPermissions.1.Groups.1.GroupName"], DeepEquals, []string{"OtherAccountGroup"})
- c.Assert(req.Form["IpPermissions.1.Groups.2.UserId"], IsNil)
- c.Assert(req.Form["IpPermissions.1.Groups.2.GroupName"], IsNil)
- c.Assert(req.Form["IpPermissions.1.Groups.2.GroupId"], DeepEquals, []string{"sg-67ad940e"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestRevokeSecurityGroupExample(c *C) {
- // RevokeSecurityGroup is implemented by the same code as AuthorizeSecurityGroup
- // so there's no need to duplicate all the tests.
- testServer.Response(200, nil, RevokeSecurityGroupIngressExample)
-
- resp, err := s.ec2.RevokeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, nil)
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"RevokeSecurityGroupIngress"})
- c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"})
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestCreateTags(c *C) {
- testServer.Response(200, nil, CreateTagsExample)
-
- resp, err := s.ec2.CreateTags([]string{"ami-1a2b3c4d", "i-7f4d3a2b"}, []ec2.Tag{{"webserver", ""}, {"stack", "Production"}})
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["ResourceId.1"], DeepEquals, []string{"ami-1a2b3c4d"})
- c.Assert(req.Form["ResourceId.2"], DeepEquals, []string{"i-7f4d3a2b"})
- c.Assert(req.Form["Tag.1.Key"], DeepEquals, []string{"webserver"})
- c.Assert(req.Form["Tag.1.Value"], DeepEquals, []string{""})
- c.Assert(req.Form["Tag.2.Key"], DeepEquals, []string{"stack"})
- c.Assert(req.Form["Tag.2.Value"], DeepEquals, []string{"Production"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestStartInstances(c *C) {
- testServer.Response(200, nil, StartInstancesExample)
-
- resp, err := s.ec2.StartInstances("i-10a64379")
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"StartInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-
- s0 := resp.StateChanges[0]
- c.Assert(s0.InstanceId, Equals, "i-10a64379")
- c.Assert(s0.CurrentState.Code, Equals, 0)
- c.Assert(s0.CurrentState.Name, Equals, "pending")
- c.Assert(s0.PreviousState.Code, Equals, 80)
- c.Assert(s0.PreviousState.Name, Equals, "stopped")
-}
-
-func (s *S) TestStopInstances(c *C) {
- testServer.Response(200, nil, StopInstancesExample)
-
- resp, err := s.ec2.StopInstances("i-10a64379")
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"StopInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-
- s0 := resp.StateChanges[0]
- c.Assert(s0.InstanceId, Equals, "i-10a64379")
- c.Assert(s0.CurrentState.Code, Equals, 64)
- c.Assert(s0.CurrentState.Name, Equals, "stopping")
- c.Assert(s0.PreviousState.Code, Equals, 16)
- c.Assert(s0.PreviousState.Name, Equals, "running")
-}
-
-func (s *S) TestRebootInstances(c *C) {
- testServer.Response(200, nil, RebootInstancesExample)
-
- resp, err := s.ec2.RebootInstances("i-10a64379")
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"RebootInstances"})
- c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestSignatureWithEndpointPath(c *C) {
- ec2.FakeTime(true)
- defer ec2.FakeTime(false)
-
- testServer.Response(200, nil, RebootInstancesExample)
-
- // https://bugs.launchpad.net/goamz/+bug/1022749
- ec2 := ec2.NewWithClient(s.ec2.Auth, aws.Region{EC2Endpoint: testServer.URL + "/services/Cloud"}, testutil.DefaultClient)
-
- _, err := ec2.RebootInstances("i-10a64379")
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Signature"], DeepEquals, []string{"VVoC6Y6xfES+KvZo+789thP8+tye4F6fOKBiKmXk4S4="})
-}
-
-func (s *S) TestAllocateAddressExample(c *C) {
- testServer.Response(200, nil, AllocateAddressExample)
-
- options := &ec2.AllocateAddressOptions{
- Domain: "vpc",
- }
-
- resp, err := s.ec2.AllocateAddress(options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"AllocateAddress"})
- c.Assert(req.Form["Domain"], DeepEquals, []string{"vpc"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.PublicIp, Equals, "198.51.100.1")
- c.Assert(resp.Domain, Equals, "vpc")
- c.Assert(resp.AllocationId, Equals, "eipalloc-5723d13e")
-}
-
-func (s *S) TestReleaseAddressExample(c *C) {
- testServer.Response(200, nil, ReleaseAddressExample)
-
- resp, err := s.ec2.ReleaseAddress("192.0.2.1", "eipalloc-5723d13e")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"ReleaseAddress"})
- c.Assert(req.Form["PublicIp"], DeepEquals, []string{"192.0.2.1"})
- c.Assert(req.Form["AllocationId"], DeepEquals, []string{"eipalloc-5723d13e"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestAssociateAddressExample(c *C) {
- testServer.Response(200, nil, AssociateAddressExample)
-
- options := &ec2.AssociateAddressOptions{
- PublicIp: "192.0.2.1",
- InstanceId: "i-4fd2431a",
- AllocationId: "eipalloc-5723d13e",
- AllowReassociation: true,
- }
-
- resp, err := s.ec2.AssociateAddress(options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"AssociateAddress"})
- c.Assert(req.Form["PublicIp"], DeepEquals, []string{"192.0.2.1"})
- c.Assert(req.Form["InstanceId"], DeepEquals, []string{"i-4fd2431a"})
- c.Assert(req.Form["AllocationId"], DeepEquals, []string{"eipalloc-5723d13e"})
- c.Assert(req.Form["AllowReassociation"], DeepEquals, []string{"true"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.AssociationId, Equals, "eipassoc-fc5ca095")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestDisassociateAddressExample(c *C) {
- testServer.Response(200, nil, DisassociateAddressExample)
-
- resp, err := s.ec2.DisassociateAddress("192.0.2.1", "eipassoc-aa7486c3")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DisassociateAddress"})
- c.Assert(req.Form["PublicIp"], DeepEquals, []string{"192.0.2.1"})
- c.Assert(req.Form["AssociationId"], DeepEquals, []string{"eipassoc-aa7486c3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestModifyInstance(c *C) {
- testServer.Response(200, nil, ModifyInstanceExample)
-
- options := ec2.ModifyInstance{
- InstanceType: "m1.small",
- DisableAPITermination: true,
- EbsOptimized: true,
- SecurityGroups: []ec2.SecurityGroup{{Id: "g1"}, {Id: "g2"}},
- ShutdownBehavior: "terminate",
- KernelId: "kernel-id",
- RamdiskId: "ramdisk-id",
- SourceDestCheck: true,
- SriovNetSupport: true,
- UserData: []byte("1234"),
- BlockDevices: []ec2.BlockDeviceMapping{
- {DeviceName: "/dev/sda1", SnapshotId: "snap-a08912c9", DeleteOnTermination: true},
- },
- }
-
- resp, err := s.ec2.ModifyInstance("i-2ba64342", &options)
- req := testServer.WaitRequest()
-
- c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyInstanceAttribute"})
- c.Assert(req.Form["InstanceId"], DeepEquals, []string{"i-2ba64342"})
- c.Assert(req.Form["InstanceType.Value"], DeepEquals, []string{"m1.small"})
- c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sda1"})
- c.Assert(req.Form["BlockDeviceMapping.1.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"})
- c.Assert(req.Form["BlockDeviceMapping.1.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"})
- c.Assert(req.Form["DisableApiTermination.Value"], DeepEquals, []string{"true"})
- c.Assert(req.Form["EbsOptimized"], DeepEquals, []string{"true"})
- c.Assert(req.Form["GroupId.1"], DeepEquals, []string{"g1"})
- c.Assert(req.Form["GroupId.2"], DeepEquals, []string{"g2"})
- c.Assert(req.Form["InstanceInitiatedShutdownBehavior.Value"], DeepEquals, []string{"terminate"})
- c.Assert(req.Form["Kernel.Value"], DeepEquals, []string{"kernel-id"})
- c.Assert(req.Form["Ramdisk.Value"], DeepEquals, []string{"ramdisk-id"})
- c.Assert(req.Form["SourceDestCheck.Value"], DeepEquals, []string{"true"})
- c.Assert(req.Form["SriovNetSupport.Value"], DeepEquals, []string{"simple"})
- c.Assert(req.Form["UserData"], DeepEquals, []string{"MTIzNA=="})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
-}
-
-func (s *S) TestDescribeReservedInstancesExample(c *C) {
- testServer.Response(200, nil, DescribeReservedInstancesExample)
-
- resp, err := s.ec2.DescribeReservedInstances([]string{"i-1", "i-2"}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeReservedInstances"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.ReservedInstances, HasLen, 1)
-
- r0 := resp.ReservedInstances[0]
- c.Assert(r0.ReservedInstanceId, Equals, "e5a2ff3b-7d14-494f-90af-0b5d0EXAMPLE")
-
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2i_test.go b/vendor/github.com/goamz/goamz/ec2/ec2i_test.go
deleted file mode 100644
index e8656f19f..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2i_test.go
+++ /dev/null
@@ -1,204 +0,0 @@
-package ec2_test
-
-import (
- "crypto/rand"
- "fmt"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/ec2"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-// AmazonServer represents an Amazon EC2 server.
-type AmazonServer struct {
- auth aws.Auth
-}
-
-func (s *AmazonServer) SetUp(c *C) {
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err.Error())
- }
- s.auth = auth
-}
-
-// Suite cost per run: 0.02 USD
-var _ = Suite(&AmazonClientSuite{})
-
-// AmazonClientSuite tests the client against a live EC2 server.
-type AmazonClientSuite struct {
- srv AmazonServer
- ClientTests
-}
-
-func (s *AmazonClientSuite) SetUpSuite(c *C) {
- if !testutil.Amazon {
- c.Skip("AmazonClientSuite tests not enabled")
- }
- s.srv.SetUp(c)
- s.ec2 = ec2.NewWithClient(s.srv.auth, aws.USEast, testutil.DefaultClient)
-}
-
-// ClientTests defines integration tests designed to test the client.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ClientTests struct {
- ec2 *ec2.EC2
-}
-
-var imageId = "ami-ccf405a5" // Ubuntu Maverick, i386, EBS store
-
-// Cost: 0.00 USD
-func (s *ClientTests) TestRunInstancesError(c *C) {
- options := ec2.RunInstancesOptions{
- ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store
- InstanceType: "t1.micro", // Doesn't work with micro, results in 400.
- }
-
- resp, err := s.ec2.RunInstances(&options)
-
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, "AMI.*root device.*not supported.*")
-
- ec2err, ok := err.(*ec2.Error)
- c.Assert(ok, Equals, true)
- c.Assert(ec2err.StatusCode, Equals, 400)
- c.Assert(ec2err.Code, Equals, "UnsupportedOperation")
- c.Assert(ec2err.Message, Matches, "AMI.*root device.*not supported.*")
- c.Assert(ec2err.RequestId, Matches, ".+")
-}
-
-// Cost: 0.02 USD
-func (s *ClientTests) TestRunAndTerminate(c *C) {
- options := ec2.RunInstancesOptions{
- ImageId: imageId,
- InstanceType: "t1.micro",
- }
- resp1, err := s.ec2.RunInstances(&options)
- c.Assert(err, IsNil)
- c.Check(resp1.ReservationId, Matches, "r-[0-9a-f]*")
- c.Check(resp1.OwnerId, Matches, "[0-9]+")
- c.Check(resp1.Instances, HasLen, 1)
- c.Check(resp1.Instances[0].InstanceType, Equals, "t1.micro")
-
- instId := resp1.Instances[0].InstanceId
-
- resp2, err := s.ec2.DescribeInstances([]string{instId}, nil)
- c.Assert(err, IsNil)
- if c.Check(resp2.Reservations, HasLen, 1) && c.Check(len(resp2.Reservations[0].Instances), Equals, 1) {
- inst := resp2.Reservations[0].Instances[0]
- c.Check(inst.InstanceId, Equals, instId)
- }
-
- resp3, err := s.ec2.TerminateInstances([]string{instId})
- c.Assert(err, IsNil)
- c.Check(resp3.StateChanges, HasLen, 1)
- c.Check(resp3.StateChanges[0].InstanceId, Equals, instId)
- c.Check(resp3.StateChanges[0].CurrentState.Name, Equals, "shutting-down")
- c.Check(resp3.StateChanges[0].CurrentState.Code, Equals, 32)
-}
-
-// Cost: 0.00 USD
-func (s *ClientTests) TestSecurityGroups(c *C) {
- name := "goamz-test"
- descr := "goamz security group for tests"
-
- // Clean it up, if a previous test left it around and avoid leaving it around.
- s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
- defer s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
-
- resp1, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr})
- c.Assert(err, IsNil)
- c.Assert(resp1.RequestId, Matches, ".+")
- c.Assert(resp1.Name, Equals, name)
- c.Assert(resp1.Id, Matches, ".+")
-
- resp1, err = s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr})
- ec2err, _ := err.(*ec2.Error)
- c.Assert(resp1, IsNil)
- c.Assert(ec2err, NotNil)
- c.Assert(ec2err.Code, Equals, "InvalidGroup.Duplicate")
-
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 0,
- ToPort: 1024,
- SourceIPs: []string{"127.0.0.1/24"},
- }}
-
- resp2, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms)
- c.Assert(err, IsNil)
- c.Assert(resp2.RequestId, Matches, ".+")
-
- resp3, err := s.ec2.SecurityGroups(ec2.SecurityGroupNames(name), nil)
- c.Assert(err, IsNil)
- c.Assert(resp3.RequestId, Matches, ".+")
- c.Assert(resp3.Groups, HasLen, 1)
-
- g0 := resp3.Groups[0]
- c.Assert(g0.Name, Equals, name)
- c.Assert(g0.Description, Equals, descr)
- c.Assert(g0.IPPerms, HasLen, 1)
- c.Assert(g0.IPPerms[0].Protocol, Equals, "tcp")
- c.Assert(g0.IPPerms[0].FromPort, Equals, 0)
- c.Assert(g0.IPPerms[0].ToPort, Equals, 1024)
- c.Assert(g0.IPPerms[0].SourceIPs, DeepEquals, []string{"127.0.0.1/24"})
-
- resp2, err = s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
- c.Assert(err, IsNil)
- c.Assert(resp2.RequestId, Matches, ".+")
-}
-
-var sessionId = func() string {
- buf := make([]byte, 8)
- // if we have no randomness, we'll just make do, so ignore the error.
- rand.Read(buf)
- return fmt.Sprintf("%x", buf)
-}()
-
-// sessionName reutrns a name that is probably
-// unique to this test session.
-func sessionName(prefix string) string {
- return prefix + "-" + sessionId
-}
-
-var allRegions = []aws.Region{
- aws.USEast,
- aws.USWest,
- aws.EUWest,
- aws.APSoutheast,
- aws.APNortheast,
-}
-
-// Communicate with all EC2 endpoints to see if they are alive.
-func (s *ClientTests) TestRegions(c *C) {
- name := sessionName("goamz-region-test")
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 80,
- ToPort: 80,
- SourceIPs: []string{"127.0.0.1/32"},
- }}
- errs := make(chan error, len(allRegions))
- for _, region := range allRegions {
- go func(r aws.Region) {
- e := ec2.NewWithClient(s.ec2.Auth, r, testutil.DefaultClient)
- _, err := e.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms)
- errs <- err
- }(region)
- }
- for _ = range allRegions {
- err := <-errs
- if err != nil {
- ec2_err, ok := err.(*ec2.Error)
- if ok {
- c.Check(ec2_err.Code, Matches, "InvalidGroup.NotFound")
- } else {
- c.Errorf("Non-EC2 error: %s", err)
- }
- } else {
- c.Errorf("Test should have errored but it seems to have succeeded")
- }
- }
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2t_test.go b/vendor/github.com/goamz/goamz/ec2/ec2t_test.go
deleted file mode 100644
index 37c2e7eb7..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2t_test.go
+++ /dev/null
@@ -1,581 +0,0 @@
-package ec2_test
-
-import (
- "fmt"
- "regexp"
- "sort"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/ec2"
- "github.com/goamz/goamz/ec2/ec2test"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-// LocalServer represents a local ec2test fake server.
-type LocalServer struct {
- auth aws.Auth
- region aws.Region
- srv *ec2test.Server
-}
-
-func (s *LocalServer) SetUp(c *C) {
- srv, err := ec2test.NewServer()
- c.Assert(err, IsNil)
- c.Assert(srv, NotNil)
-
- s.srv = srv
- s.region = aws.Region{EC2Endpoint: srv.URL()}
-}
-
-// LocalServerSuite defines tests that will run
-// against the local ec2test server. It includes
-// selected tests from ClientTests;
-// when the ec2test functionality is sufficient, it should
-// include all of them, and ClientTests can be simply embedded.
-type LocalServerSuite struct {
- srv LocalServer
- ServerTests
- clientTests ClientTests
-}
-
-var _ = Suite(&LocalServerSuite{})
-
-func (s *LocalServerSuite) SetUpSuite(c *C) {
- s.srv.SetUp(c)
- s.ServerTests.ec2 = ec2.NewWithClient(s.srv.auth, s.srv.region, testutil.DefaultClient)
- s.clientTests.ec2 = ec2.NewWithClient(s.srv.auth, s.srv.region, testutil.DefaultClient)
-}
-
-func (s *LocalServerSuite) TestRunAndTerminate(c *C) {
- s.clientTests.TestRunAndTerminate(c)
-}
-
-func (s *LocalServerSuite) TestSecurityGroups(c *C) {
- s.clientTests.TestSecurityGroups(c)
-}
-
-// TestUserData is not defined on ServerTests because it
-// requires the ec2test server to function.
-func (s *LocalServerSuite) TestUserData(c *C) {
- data := make([]byte, 256)
- for i := range data {
- data[i] = byte(i)
- }
- inst, err := s.ec2.RunInstances(&ec2.RunInstancesOptions{
- ImageId: imageId,
- InstanceType: "t1.micro",
- UserData: data,
- })
- c.Assert(err, IsNil)
- c.Assert(inst, NotNil)
- c.Assert(inst.Instances[0].DNSName, Equals, inst.Instances[0].InstanceId+".example.com")
-
- id := inst.Instances[0].InstanceId
-
- defer s.ec2.TerminateInstances([]string{id})
-
- tinst := s.srv.srv.Instance(id)
- c.Assert(tinst, NotNil)
- c.Assert(tinst.UserData, DeepEquals, data)
-}
-
-// AmazonServerSuite runs the ec2test server tests against a live EC2 server.
-// It will only be activated if the -all flag is specified.
-type AmazonServerSuite struct {
- srv AmazonServer
- ServerTests
-}
-
-var _ = Suite(&AmazonServerSuite{})
-
-func (s *AmazonServerSuite) SetUpSuite(c *C) {
- if !testutil.Amazon {
- c.Skip("AmazonServerSuite tests not enabled")
- }
- s.srv.SetUp(c)
- s.ServerTests.ec2 = ec2.NewWithClient(s.srv.auth, aws.USEast, testutil.DefaultClient)
-}
-
-// ServerTests defines a set of tests designed to test
-// the ec2test local fake ec2 server.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ServerTests struct {
- ec2 *ec2.EC2
-}
-
-func terminateInstances(c *C, e *ec2.EC2, insts []*ec2.Instance) {
- var ids []string
- for _, inst := range insts {
- if inst != nil {
- ids = append(ids, inst.InstanceId)
- }
- }
- _, err := e.TerminateInstances(ids)
- c.Check(err, IsNil, Commentf("%d INSTANCES LEFT RUNNING!!!", len(ids)))
-}
-
-func (s *ServerTests) makeTestGroup(c *C, name, descr string) ec2.SecurityGroup {
- // Clean it up if a previous test left it around.
- _, err := s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
- if err != nil && err.(*ec2.Error).Code != "InvalidGroup.NotFound" {
- c.Fatalf("delete security group: %v", err)
- }
-
- resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr})
- c.Assert(err, IsNil)
- c.Assert(resp.Name, Equals, name)
- return resp.SecurityGroup
-}
-
-func (s *ServerTests) TestIPPerms(c *C) {
- g0 := s.makeTestGroup(c, "goamz-test0", "ec2test group 0")
- defer s.ec2.DeleteSecurityGroup(g0)
-
- g1 := s.makeTestGroup(c, "goamz-test1", "ec2test group 1")
- defer s.ec2.DeleteSecurityGroup(g1)
-
- resp, err := s.ec2.SecurityGroups([]ec2.SecurityGroup{g0, g1}, nil)
- c.Assert(err, IsNil)
- c.Assert(resp.Groups, HasLen, 2)
- c.Assert(resp.Groups[0].IPPerms, HasLen, 0)
- c.Assert(resp.Groups[1].IPPerms, HasLen, 0)
-
- ownerId := resp.Groups[0].OwnerId
-
- // test some invalid parameters
- // TODO more
- _, err = s.ec2.AuthorizeSecurityGroup(g0, []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 0,
- ToPort: 1024,
- SourceIPs: []string{"z127.0.0.1/24"},
- }})
- c.Assert(err, NotNil)
- c.Check(err.(*ec2.Error).Code, Equals, "InvalidPermission.Malformed")
-
- // Check that AuthorizeSecurityGroup adds the correct authorizations.
- _, err = s.ec2.AuthorizeSecurityGroup(g0, []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 2000,
- ToPort: 2001,
- SourceIPs: []string{"127.0.0.0/24"},
- SourceGroups: []ec2.UserSecurityGroup{{
- Name: g1.Name,
- }, {
- Id: g0.Id,
- }},
- }, {
- Protocol: "tcp",
- FromPort: 2000,
- ToPort: 2001,
- SourceIPs: []string{"200.1.1.34/32"},
- }})
- c.Assert(err, IsNil)
-
- resp, err = s.ec2.SecurityGroups([]ec2.SecurityGroup{g0}, nil)
- c.Assert(err, IsNil)
- c.Assert(resp.Groups, HasLen, 1)
- c.Assert(resp.Groups[0].IPPerms, HasLen, 1)
-
- perm := resp.Groups[0].IPPerms[0]
- srcg := perm.SourceGroups
- c.Assert(srcg, HasLen, 2)
-
- // Normalize so we don't care about returned order.
- if srcg[0].Name == g1.Name {
- srcg[0], srcg[1] = srcg[1], srcg[0]
- }
- c.Check(srcg[0].Name, Equals, g0.Name)
- c.Check(srcg[0].Id, Equals, g0.Id)
- c.Check(srcg[0].OwnerId, Equals, ownerId)
- c.Check(srcg[1].Name, Equals, g1.Name)
- c.Check(srcg[1].Id, Equals, g1.Id)
- c.Check(srcg[1].OwnerId, Equals, ownerId)
-
- sort.Strings(perm.SourceIPs)
- c.Check(perm.SourceIPs, DeepEquals, []string{"127.0.0.0/24", "200.1.1.34/32"})
-
- // Check that we can't delete g1 (because g0 is using it)
- _, err = s.ec2.DeleteSecurityGroup(g1)
- c.Assert(err, NotNil)
- c.Check(err.(*ec2.Error).Code, Equals, "InvalidGroup.InUse")
-
- _, err = s.ec2.RevokeSecurityGroup(g0, []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 2000,
- ToPort: 2001,
- SourceGroups: []ec2.UserSecurityGroup{{Id: g1.Id}},
- }, {
- Protocol: "tcp",
- FromPort: 2000,
- ToPort: 2001,
- SourceIPs: []string{"200.1.1.34/32"},
- }})
- c.Assert(err, IsNil)
-
- resp, err = s.ec2.SecurityGroups([]ec2.SecurityGroup{g0}, nil)
- c.Assert(err, IsNil)
- c.Assert(resp.Groups, HasLen, 1)
- c.Assert(resp.Groups[0].IPPerms, HasLen, 1)
-
- perm = resp.Groups[0].IPPerms[0]
- srcg = perm.SourceGroups
- c.Assert(srcg, HasLen, 1)
- c.Check(srcg[0].Name, Equals, g0.Name)
- c.Check(srcg[0].Id, Equals, g0.Id)
- c.Check(srcg[0].OwnerId, Equals, ownerId)
-
- c.Check(perm.SourceIPs, DeepEquals, []string{"127.0.0.0/24"})
-
- // We should be able to delete g1 now because we've removed its only use.
- _, err = s.ec2.DeleteSecurityGroup(g1)
- c.Assert(err, IsNil)
-
- _, err = s.ec2.DeleteSecurityGroup(g0)
- c.Assert(err, IsNil)
-
- f := ec2.NewFilter()
- f.Add("group-id", g0.Id, g1.Id)
- resp, err = s.ec2.SecurityGroups(nil, f)
- c.Assert(err, IsNil)
- c.Assert(resp.Groups, HasLen, 0)
-}
-
-func (s *ServerTests) TestDuplicateIPPerm(c *C) {
- name := "goamz-test"
- descr := "goamz security group for tests"
-
- // Clean it up, if a previous test left it around and avoid leaving it around.
- s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
- defer s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name})
-
- resp1, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr})
- c.Assert(err, IsNil)
- c.Assert(resp1.Name, Equals, name)
-
- perms := []ec2.IPPerm{{
- Protocol: "tcp",
- FromPort: 200,
- ToPort: 1024,
- SourceIPs: []string{"127.0.0.1/24"},
- }, {
- Protocol: "tcp",
- FromPort: 0,
- ToPort: 100,
- SourceIPs: []string{"127.0.0.1/24"},
- }}
-
- _, err = s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms[0:1])
- c.Assert(err, IsNil)
-
- _, err = s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms[0:2])
- c.Assert(err, ErrorMatches, `.*\(InvalidPermission.Duplicate\)`)
-}
-
-type filterSpec struct {
- name string
- values []string
-}
-
-func (s *ServerTests) TestInstanceFiltering(c *C) {
- groupResp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName("testgroup1"), Description: "testgroup one description"})
- c.Assert(err, IsNil)
- group1 := groupResp.SecurityGroup
- defer s.ec2.DeleteSecurityGroup(group1)
-
- groupResp, err = s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName("testgroup2"), Description: "testgroup two description"})
- c.Assert(err, IsNil)
- group2 := groupResp.SecurityGroup
- defer s.ec2.DeleteSecurityGroup(group2)
-
- insts := make([]*ec2.Instance, 3)
- inst, err := s.ec2.RunInstances(&ec2.RunInstancesOptions{
- MinCount: 2,
- ImageId: imageId,
- InstanceType: "t1.micro",
- SecurityGroups: []ec2.SecurityGroup{group1},
- })
- c.Assert(err, IsNil)
- insts[0] = &inst.Instances[0]
- insts[1] = &inst.Instances[1]
- defer terminateInstances(c, s.ec2, insts)
-
- imageId2 := "ami-e358958a" // Natty server, i386, EBS store
- inst, err = s.ec2.RunInstances(&ec2.RunInstancesOptions{
- ImageId: imageId2,
- InstanceType: "t1.micro",
- SecurityGroups: []ec2.SecurityGroup{group2},
- })
- c.Assert(err, IsNil)
- insts[2] = &inst.Instances[0]
-
- ids := func(indices ...int) (instIds []string) {
- for _, index := range indices {
- instIds = append(instIds, insts[index].InstanceId)
- }
- return
- }
-
- tests := []struct {
- about string
- instanceIds []string // instanceIds argument to Instances method.
- filters []filterSpec // filters argument to Instances method.
- resultIds []string // set of instance ids of expected results.
- allowExtra bool // resultIds may be incomplete.
- err string // expected error.
- }{
- {
- about: "check that Instances returns all instances",
- resultIds: ids(0, 1, 2),
- allowExtra: true,
- }, {
- about: "check that specifying two instance ids returns them",
- instanceIds: ids(0, 2),
- resultIds: ids(0, 2),
- }, {
- about: "check that specifying a non-existent instance id gives an error",
- instanceIds: append(ids(0), "i-deadbeef"),
- err: `.*\(InvalidInstanceID\.NotFound\)`,
- }, {
- about: "check that a filter allowed both instances returns both of them",
- filters: []filterSpec{
- {"instance-id", ids(0, 2)},
- },
- resultIds: ids(0, 2),
- }, {
- about: "check that a filter allowing only one instance returns it",
- filters: []filterSpec{
- {"instance-id", ids(1)},
- },
- resultIds: ids(1),
- }, {
- about: "check that a filter allowing no instances returns none",
- filters: []filterSpec{
- {"instance-id", []string{"i-deadbeef12345"}},
- },
- }, {
- about: "check that filtering on group id works",
- filters: []filterSpec{
- {"group-id", []string{group1.Id}},
- },
- resultIds: ids(0, 1),
- }, {
- about: "check that filtering on group name works",
- filters: []filterSpec{
- {"group-name", []string{group1.Name}},
- },
- resultIds: ids(0, 1),
- }, {
- about: "check that filtering on image id works",
- filters: []filterSpec{
- {"image-id", []string{imageId}},
- },
- resultIds: ids(0, 1),
- allowExtra: true,
- }, {
- about: "combination filters 1",
- filters: []filterSpec{
- {"image-id", []string{imageId, imageId2}},
- {"group-name", []string{group1.Name}},
- },
- resultIds: ids(0, 1),
- }, {
- about: "combination filters 2",
- filters: []filterSpec{
- {"image-id", []string{imageId2}},
- {"group-name", []string{group1.Name}},
- },
- },
- }
- for i, t := range tests {
- c.Logf("%d. %s", i, t.about)
- var f *ec2.Filter
- if t.filters != nil {
- f = ec2.NewFilter()
- for _, spec := range t.filters {
- f.Add(spec.name, spec.values...)
- }
- }
- resp, err := s.ec2.DescribeInstances(t.instanceIds, f)
- if t.err != "" {
- c.Check(err, ErrorMatches, t.err)
- continue
- }
- c.Assert(err, IsNil)
- insts := make(map[string]*ec2.Instance)
- for _, r := range resp.Reservations {
- for j := range r.Instances {
- inst := &r.Instances[j]
- c.Check(insts[inst.InstanceId], IsNil, Commentf("duplicate instance id: %q", inst.InstanceId))
- insts[inst.InstanceId] = inst
- }
- }
- if !t.allowExtra {
- c.Check(insts, HasLen, len(t.resultIds), Commentf("expected %d instances got %#v", len(t.resultIds), insts))
- }
- for j, id := range t.resultIds {
- c.Check(insts[id], NotNil, Commentf("instance id %d (%q) not found; got %#v", j, id, insts))
- }
- }
-}
-
-func idsOnly(gs []ec2.SecurityGroup) []ec2.SecurityGroup {
- for i := range gs {
- gs[i].Name = ""
- }
- return gs
-}
-
-func namesOnly(gs []ec2.SecurityGroup) []ec2.SecurityGroup {
- for i := range gs {
- gs[i].Id = ""
- }
- return gs
-}
-
-func (s *ServerTests) TestGroupFiltering(c *C) {
- g := make([]ec2.SecurityGroup, 4)
- for i := range g {
- resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName(fmt.Sprintf("testgroup%d", i)), Description: fmt.Sprintf("testdescription%d", i)})
- c.Assert(err, IsNil)
- g[i] = resp.SecurityGroup
- c.Logf("group %d: %v", i, g[i])
- defer s.ec2.DeleteSecurityGroup(g[i])
- }
-
- perms := [][]ec2.IPPerm{
- {{
- Protocol: "tcp",
- FromPort: 100,
- ToPort: 200,
- SourceIPs: []string{"1.2.3.4/32"},
- }},
- {{
- Protocol: "tcp",
- FromPort: 200,
- ToPort: 300,
- SourceGroups: []ec2.UserSecurityGroup{{Id: g[1].Id}},
- }},
- {{
- Protocol: "udp",
- FromPort: 200,
- ToPort: 400,
- SourceGroups: []ec2.UserSecurityGroup{{Id: g[1].Id}},
- }},
- }
- for i, ps := range perms {
- _, err := s.ec2.AuthorizeSecurityGroup(g[i], ps)
- c.Assert(err, IsNil)
- }
-
- groups := func(indices ...int) (gs []ec2.SecurityGroup) {
- for _, index := range indices {
- gs = append(gs, g[index])
- }
- return
- }
-
- type groupTest struct {
- about string
- groups []ec2.SecurityGroup // groupIds argument to SecurityGroups method.
- filters []filterSpec // filters argument to SecurityGroups method.
- results []ec2.SecurityGroup // set of expected result groups.
- allowExtra bool // specified results may be incomplete.
- err string // expected error.
- }
- filterCheck := func(name, val string, gs []ec2.SecurityGroup) groupTest {
- return groupTest{
- about: "filter check " + name,
- filters: []filterSpec{{name, []string{val}}},
- results: gs,
- allowExtra: true,
- }
- }
- tests := []groupTest{
- {
- about: "check that SecurityGroups returns all groups",
- results: groups(0, 1, 2, 3),
- allowExtra: true,
- }, {
- about: "check that specifying two group ids returns them",
- groups: idsOnly(groups(0, 2)),
- results: groups(0, 2),
- }, {
- about: "check that specifying names only works",
- groups: namesOnly(groups(0, 2)),
- results: groups(0, 2),
- }, {
- about: "check that specifying a non-existent group id gives an error",
- groups: append(groups(0), ec2.SecurityGroup{Id: "sg-eeeeeeeee"}),
- err: `.*\(InvalidGroup\.NotFound\)`,
- }, {
- about: "check that a filter allowed two groups returns both of them",
- filters: []filterSpec{
- {"group-id", []string{g[0].Id, g[2].Id}},
- },
- results: groups(0, 2),
- },
- {
- about: "check that the previous filter works when specifying a list of ids",
- groups: groups(1, 2),
- filters: []filterSpec{
- {"group-id", []string{g[0].Id, g[2].Id}},
- },
- results: groups(2),
- }, {
- about: "check that a filter allowing no groups returns none",
- filters: []filterSpec{
- {"group-id", []string{"sg-eeeeeeeee"}},
- },
- },
- filterCheck("description", "testdescription1", groups(1)),
- filterCheck("group-name", g[2].Name, groups(2)),
- filterCheck("ip-permission.cidr", "1.2.3.4/32", groups(0)),
- filterCheck("ip-permission.group-name", g[1].Name, groups(1, 2)),
- filterCheck("ip-permission.protocol", "udp", groups(2)),
- filterCheck("ip-permission.from-port", "200", groups(1, 2)),
- filterCheck("ip-permission.to-port", "200", groups(0)),
- // TODO owner-id
- }
- for i, t := range tests {
- c.Logf("%d. %s", i, t.about)
- var f *ec2.Filter
- if t.filters != nil {
- f = ec2.NewFilter()
- for _, spec := range t.filters {
- f.Add(spec.name, spec.values...)
- }
- }
- resp, err := s.ec2.SecurityGroups(t.groups, f)
- if t.err != "" {
- c.Check(err, ErrorMatches, t.err)
- continue
- }
- c.Assert(err, IsNil)
- groups := make(map[string]*ec2.SecurityGroup)
- for j := range resp.Groups {
- group := &resp.Groups[j].SecurityGroup
- c.Check(groups[group.Id], IsNil, Commentf("duplicate group id: %q", group.Id))
-
- groups[group.Id] = group
- }
- // If extra groups may be returned, eliminate all groups that
- // we did not create in this session apart from the default group.
- if t.allowExtra {
- namePat := regexp.MustCompile(sessionName("testgroup[0-9]"))
- for id, g := range groups {
- if !namePat.MatchString(g.Name) {
- delete(groups, id)
- }
- }
- }
- c.Check(groups, HasLen, len(t.results))
- for j, g := range t.results {
- rg := groups[g.Id]
- c.Assert(rg, NotNil, Commentf("group %d (%v) not found; got %#v", j, g, groups))
- c.Check(rg.Name, Equals, g.Name, Commentf("group %d (%v)", j, g))
- }
- }
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2test/filter.go b/vendor/github.com/goamz/goamz/ec2/ec2test/filter.go
deleted file mode 100644
index 1a0c04619..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2test/filter.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package ec2test
-
-import (
- "fmt"
- "net/url"
- "strings"
-)
-
-// filter holds an ec2 filter. A filter maps an attribute to a set of
-// possible values for that attribute. For an item to pass through the
-// filter, every attribute of the item mentioned in the filter must match
-// at least one of its given values.
-type filter map[string][]string
-
-// newFilter creates a new filter from the Filter fields in the url form.
-//
-// The filtering is specified through a map of name=>values, where the
-// name is a well-defined key identifying the data to be matched,
-// and the list of values holds the possible values the filtered
-// item can take for the key to be included in the
-// result set. For example:
-//
-// Filter.1.Name=instance-type
-// Filter.1.Value.1=m1.small
-// Filter.1.Value.2=m1.large
-//
-func newFilter(form url.Values) filter {
- // TODO return an error if the fields are not well formed?
- names := make(map[int]string)
- values := make(map[int][]string)
- maxId := 0
- for name, fvalues := range form {
- var rest string
- var id int
- if x, _ := fmt.Sscanf(name, "Filter.%d.%s", &id, &rest); x != 2 {
- continue
- }
- if id > maxId {
- maxId = id
- }
- if rest == "Name" {
- names[id] = fvalues[0]
- continue
- }
- if !strings.HasPrefix(rest, "Value.") {
- continue
- }
- values[id] = append(values[id], fvalues[0])
- }
-
- f := make(filter)
- for id, name := range names {
- f[name] = values[id]
- }
- return f
-}
-
-func notDigit(r rune) bool {
- return r < '0' || r > '9'
-}
-
-// filterable represents an object that can be passed through a filter.
-type filterable interface {
- // matchAttr returns true if given attribute of the
- // object matches value. It returns an error if the
- // attribute is not recognised or the value is malformed.
- matchAttr(attr, value string) (bool, error)
-}
-
-// ok returns true if x passes through the filter.
-func (f filter) ok(x filterable) (bool, error) {
-next:
- for a, vs := range f {
- for _, v := range vs {
- if ok, err := x.matchAttr(a, v); ok {
- continue next
- } else if err != nil {
- return false, fmt.Errorf("bad attribute or value %q=%q for type %T: %v", a, v, x, err)
- }
- }
- return false, nil
- }
- return true, nil
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/ec2test/server.go b/vendor/github.com/goamz/goamz/ec2/ec2test/server.go
deleted file mode 100644
index e25d4ea20..000000000
--- a/vendor/github.com/goamz/goamz/ec2/ec2test/server.go
+++ /dev/null
@@ -1,993 +0,0 @@
-// The ec2test package implements a fake EC2 provider with
-// the capability of inducing errors on any given operation,
-// and retrospectively determining what operations have been
-// carried out.
-package ec2test
-
-import (
- "encoding/base64"
- "encoding/xml"
- "fmt"
- "github.com/goamz/goamz/ec2"
- "io"
- "net"
- "net/http"
- "net/url"
- "regexp"
- "strconv"
- "strings"
- "sync"
-)
-
-var b64 = base64.StdEncoding
-
-// Action represents a request that changes the ec2 state.
-type Action struct {
- RequestId string
-
- // Request holds the requested action as a url.Values instance
- Request url.Values
-
- // If the action succeeded, Response holds the value that
- // was marshalled to build the XML response for the request.
- Response interface{}
-
- // If the action failed, Err holds an error giving details of the failure.
- Err *ec2.Error
-}
-
-// TODO possible other things:
-// - some virtual time stamp interface, so a client
-// can ask for all actions after a certain virtual time.
-
-// Server implements an EC2 simulator for use in testing.
-type Server struct {
- url string
- listener net.Listener
- mu sync.Mutex
- reqs []*Action
-
- instances map[string]*Instance // id -> instance
- reservations map[string]*reservation // id -> reservation
- groups map[string]*securityGroup // id -> group
- maxId counter
- reqId counter
- reservationId counter
- groupId counter
- initialInstanceState ec2.InstanceState
-}
-
-// reservation holds a simulated ec2 reservation.
-type reservation struct {
- id string
- instances map[string]*Instance
- groups []*securityGroup
-}
-
-// instance holds a simulated ec2 instance
-type Instance struct {
- // UserData holds the data that was passed to the RunInstances request
- // when the instance was started.
- UserData []byte
- id string
- imageId string
- reservation *reservation
- instType string
- state ec2.InstanceState
-}
-
-// permKey represents permission for a given security
-// group or IP address (but not both) to access a given range of
-// ports. Equality of permKeys is used in the implementation of
-// permission sets, relying on the uniqueness of securityGroup
-// instances.
-type permKey struct {
- protocol string
- fromPort int
- toPort int
- group *securityGroup
- ipAddr string
-}
-
-// securityGroup holds a simulated ec2 security group.
-// Instances of securityGroup should only be created through
-// Server.createSecurityGroup to ensure that groups can be
-// compared by pointer value.
-type securityGroup struct {
- id string
- name string
- description string
-
- perms map[permKey]bool
-}
-
-func (g *securityGroup) ec2SecurityGroup() ec2.SecurityGroup {
- return ec2.SecurityGroup{
- Name: g.name,
- Id: g.id,
- }
-}
-
-func (g *securityGroup) matchAttr(attr, value string) (ok bool, err error) {
- switch attr {
- case "description":
- return g.description == value, nil
- case "group-id":
- return g.id == value, nil
- case "group-name":
- return g.name == value, nil
- case "ip-permission.cidr":
- return g.hasPerm(func(k permKey) bool { return k.ipAddr == value }), nil
- case "ip-permission.group-name":
- return g.hasPerm(func(k permKey) bool {
- return k.group != nil && k.group.name == value
- }), nil
- case "ip-permission.from-port":
- port, err := strconv.Atoi(value)
- if err != nil {
- return false, err
- }
- return g.hasPerm(func(k permKey) bool { return k.fromPort == port }), nil
- case "ip-permission.to-port":
- port, err := strconv.Atoi(value)
- if err != nil {
- return false, err
- }
- return g.hasPerm(func(k permKey) bool { return k.toPort == port }), nil
- case "ip-permission.protocol":
- return g.hasPerm(func(k permKey) bool { return k.protocol == value }), nil
- case "owner-id":
- return value == ownerId, nil
- }
- return false, fmt.Errorf("unknown attribute %q", attr)
-}
-
-func (g *securityGroup) hasPerm(test func(k permKey) bool) bool {
- for k := range g.perms {
- if test(k) {
- return true
- }
- }
- return false
-}
-
-// ec2Perms returns the list of EC2 permissions granted
-// to g. It groups permissions by port range and protocol.
-func (g *securityGroup) ec2Perms() (perms []ec2.IPPerm) {
- // The grouping is held in result. We use permKey for convenience,
- // (ensuring that the group and ipAddr of each key is zero). For
- // each protocol/port range combination, we build up the permission
- // set in the associated value.
- result := make(map[permKey]*ec2.IPPerm)
- for k := range g.perms {
- groupKey := k
- groupKey.group = nil
- groupKey.ipAddr = ""
-
- ec2p := result[groupKey]
- if ec2p == nil {
- ec2p = &ec2.IPPerm{
- Protocol: k.protocol,
- FromPort: k.fromPort,
- ToPort: k.toPort,
- }
- result[groupKey] = ec2p
- }
- if k.group != nil {
- ec2p.SourceGroups = append(ec2p.SourceGroups,
- ec2.UserSecurityGroup{
- Id: k.group.id,
- Name: k.group.name,
- OwnerId: ownerId,
- })
- } else {
- ec2p.SourceIPs = append(ec2p.SourceIPs, k.ipAddr)
- }
- }
- for _, ec2p := range result {
- perms = append(perms, *ec2p)
- }
- return
-}
-
-var actions = map[string]func(*Server, http.ResponseWriter, *http.Request, string) interface{}{
- "RunInstances": (*Server).runInstances,
- "TerminateInstances": (*Server).terminateInstances,
- "DescribeInstances": (*Server).describeInstances,
- "CreateSecurityGroup": (*Server).createSecurityGroup,
- "DescribeSecurityGroups": (*Server).describeSecurityGroups,
- "DeleteSecurityGroup": (*Server).deleteSecurityGroup,
- "AuthorizeSecurityGroupIngress": (*Server).authorizeSecurityGroupIngress,
- "RevokeSecurityGroupIngress": (*Server).revokeSecurityGroupIngress,
-}
-
-const ownerId = "9876"
-
-// newAction allocates a new action and adds it to the
-// recorded list of server actions.
-func (srv *Server) newAction() *Action {
- srv.mu.Lock()
- defer srv.mu.Unlock()
-
- a := new(Action)
- srv.reqs = append(srv.reqs, a)
- return a
-}
-
-// NewServer returns a new server.
-func NewServer() (*Server, error) {
- srv := &Server{
- instances: make(map[string]*Instance),
- groups: make(map[string]*securityGroup),
- reservations: make(map[string]*reservation),
- initialInstanceState: Pending,
- }
-
- // Add default security group.
- g := &securityGroup{
- name: "default",
- description: "default group",
- id: fmt.Sprintf("sg-%d", srv.groupId.next()),
- }
- g.perms = map[permKey]bool{
- permKey{
- protocol: "icmp",
- fromPort: -1,
- toPort: -1,
- group: g,
- }: true,
- permKey{
- protocol: "tcp",
- fromPort: 0,
- toPort: 65535,
- group: g,
- }: true,
- permKey{
- protocol: "udp",
- fromPort: 0,
- toPort: 65535,
- group: g,
- }: true,
- }
- srv.groups[g.id] = g
-
- l, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- return nil, fmt.Errorf("cannot listen on localhost: %v", err)
- }
- srv.listener = l
-
- srv.url = "http://" + l.Addr().String()
-
- // we use HandlerFunc rather than *Server directly so that we
- // can avoid exporting HandlerFunc from *Server.
- go http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- srv.serveHTTP(w, req)
- }))
- return srv, nil
-}
-
-// Quit closes down the server.
-func (srv *Server) Quit() {
- srv.listener.Close()
-}
-
-// SetInitialInstanceState sets the state that any new instances will be started in.
-func (srv *Server) SetInitialInstanceState(state ec2.InstanceState) {
- srv.mu.Lock()
- srv.initialInstanceState = state
- srv.mu.Unlock()
-}
-
-// URL returns the URL of the server.
-func (srv *Server) URL() string {
- return srv.url
-}
-
-// serveHTTP serves the EC2 protocol.
-func (srv *Server) serveHTTP(w http.ResponseWriter, req *http.Request) {
- req.ParseForm()
-
- a := srv.newAction()
- a.RequestId = fmt.Sprintf("req%d", srv.reqId.next())
- a.Request = req.Form
-
- // Methods on Server that deal with parsing user data
- // may fail. To save on error handling code, we allow these
- // methods to call fatalf, which will panic with an *ec2.Error
- // which will be caught here and returned
- // to the client as a properly formed EC2 error.
- defer func() {
- switch err := recover().(type) {
- case *ec2.Error:
- a.Err = err
- err.RequestId = a.RequestId
- writeError(w, err)
- case nil:
- default:
- panic(err)
- }
- }()
-
- f := actions[req.Form.Get("Action")]
- if f == nil {
- fatalf(400, "InvalidParameterValue", "Unrecognized Action")
- }
-
- response := f(srv, w, req, a.RequestId)
- a.Response = response
-
- w.Header().Set("Content-Type", `xml version="1.0" encoding="UTF-8"`)
- xmlMarshal(w, response)
-}
-
-// Instance returns the instance for the given instance id.
-// It returns nil if there is no such instance.
-func (srv *Server) Instance(id string) *Instance {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- return srv.instances[id]
-}
-
-// writeError writes an appropriate error response.
-// TODO how should we deal with errors when the
-// error itself is potentially generated by backend-agnostic
-// code?
-func writeError(w http.ResponseWriter, err *ec2.Error) {
- // Error encapsulates an error returned by EC2.
- // TODO merge with ec2.Error when xml supports ignoring a field.
- type ec2error struct {
- Code string // EC2 error code ("UnsupportedOperation", ...)
- Message string // The human-oriented error message
- RequestId string
- }
-
- type Response struct {
- RequestId string
- Errors []ec2error `xml:"Errors>Error"`
- }
-
- w.Header().Set("Content-Type", `xml version="1.0" encoding="UTF-8"`)
- w.WriteHeader(err.StatusCode)
- xmlMarshal(w, Response{
- RequestId: err.RequestId,
- Errors: []ec2error{{
- Code: err.Code,
- Message: err.Message,
- }},
- })
-}
-
-// xmlMarshal is the same as xml.Marshal except that
-// it panics on error. The marshalling should not fail,
-// but we want to know if it does.
-func xmlMarshal(w io.Writer, x interface{}) {
- if err := xml.NewEncoder(w).Encode(x); err != nil {
- panic(fmt.Errorf("error marshalling %#v: %v", x, err))
- }
-}
-
-// formToGroups parses a set of SecurityGroup form values
-// as found in a RunInstances request, and returns the resulting
-// slice of security groups.
-// It calls fatalf if a group is not found.
-func (srv *Server) formToGroups(form url.Values) []*securityGroup {
- var groups []*securityGroup
- for name, values := range form {
- switch {
- case strings.HasPrefix(name, "SecurityGroupId."):
- if g := srv.groups[values[0]]; g != nil {
- groups = append(groups, g)
- } else {
- fatalf(400, "InvalidGroup.NotFound", "unknown group id %q", values[0])
- }
- case strings.HasPrefix(name, "SecurityGroup."):
- var found *securityGroup
- for _, g := range srv.groups {
- if g.name == values[0] {
- found = g
- }
- }
- if found == nil {
- fatalf(400, "InvalidGroup.NotFound", "unknown group name %q", values[0])
- }
- groups = append(groups, found)
- }
- }
- return groups
-}
-
-// runInstances implements the EC2 RunInstances entry point.
-func (srv *Server) runInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- min := atoi(req.Form.Get("MinCount"))
- max := atoi(req.Form.Get("MaxCount"))
- if min < 0 || max < 1 {
- fatalf(400, "InvalidParameterValue", "bad values for MinCount or MaxCount")
- }
- if min > max {
- fatalf(400, "InvalidParameterCombination", "MinCount is greater than MaxCount")
- }
- var userData []byte
- if data := req.Form.Get("UserData"); data != "" {
- var err error
- userData, err = b64.DecodeString(data)
- if err != nil {
- fatalf(400, "InvalidParameterValue", "bad UserData value: %v", err)
- }
- }
-
- // TODO attributes still to consider:
- // ImageId: accept anything, we can verify later
- // KeyName ?
- // InstanceType ?
- // KernelId ?
- // RamdiskId ?
- // AvailabilityZone ?
- // GroupName tag
- // Monitoring ignore?
- // SubnetId ?
- // DisableAPITermination bool
- // ShutdownBehavior string
- // PrivateIPAddress string
-
- srv.mu.Lock()
- defer srv.mu.Unlock()
-
- // make sure that form fields are correct before creating the reservation.
- instType := req.Form.Get("InstanceType")
- imageId := req.Form.Get("ImageId")
-
- r := srv.newReservation(srv.formToGroups(req.Form))
-
- var resp ec2.RunInstancesResp
- resp.RequestId = reqId
- resp.ReservationId = r.id
- resp.OwnerId = ownerId
-
- for i := 0; i < max; i++ {
- inst := srv.newInstance(r, instType, imageId, srv.initialInstanceState)
- inst.UserData = userData
- resp.Instances = append(resp.Instances, inst.ec2instance())
- }
- return &resp
-}
-
-func (srv *Server) group(group ec2.SecurityGroup) *securityGroup {
- if group.Id != "" {
- return srv.groups[group.Id]
- }
- for _, g := range srv.groups {
- if g.name == group.Name {
- return g
- }
- }
- return nil
-}
-
-// NewInstances creates n new instances in srv with the given instance type,
-// image ID, initial state and security groups. If any group does not already
-// exist, it will be created. NewInstances returns the ids of the new instances.
-func (srv *Server) NewInstances(n int, instType string, imageId string, state ec2.InstanceState, groups []ec2.SecurityGroup) []string {
- srv.mu.Lock()
- defer srv.mu.Unlock()
-
- rgroups := make([]*securityGroup, len(groups))
- for i, group := range groups {
- g := srv.group(group)
- if g == nil {
- fatalf(400, "InvalidGroup.NotFound", "no such group %v", g)
- }
- rgroups[i] = g
- }
- r := srv.newReservation(rgroups)
-
- ids := make([]string, n)
- for i := 0; i < n; i++ {
- inst := srv.newInstance(r, instType, imageId, state)
- ids[i] = inst.id
- }
- return ids
-}
-
-func (srv *Server) newInstance(r *reservation, instType string, imageId string, state ec2.InstanceState) *Instance {
- inst := &Instance{
- id: fmt.Sprintf("i-%d", srv.maxId.next()),
- instType: instType,
- imageId: imageId,
- state: state,
- reservation: r,
- }
- srv.instances[inst.id] = inst
- r.instances[inst.id] = inst
- return inst
-}
-
-func (srv *Server) newReservation(groups []*securityGroup) *reservation {
- r := &reservation{
- id: fmt.Sprintf("r-%d", srv.reservationId.next()),
- instances: make(map[string]*Instance),
- groups: groups,
- }
-
- srv.reservations[r.id] = r
- return r
-}
-
-func (srv *Server) terminateInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- var resp ec2.TerminateInstancesResp
- resp.RequestId = reqId
- var insts []*Instance
- for attr, vals := range req.Form {
- if strings.HasPrefix(attr, "InstanceId.") {
- id := vals[0]
- inst := srv.instances[id]
- if inst == nil {
- fatalf(400, "InvalidInstanceID.NotFound", "no such instance id %q", id)
- }
- insts = append(insts, inst)
- }
- }
- for _, inst := range insts {
- resp.StateChanges = append(resp.StateChanges, inst.terminate())
- }
- return &resp
-}
-
-func (inst *Instance) terminate() (d ec2.InstanceStateChange) {
- d.PreviousState = inst.state
- inst.state = ShuttingDown
- d.CurrentState = inst.state
- d.InstanceId = inst.id
- return d
-}
-
-func (inst *Instance) ec2instance() ec2.Instance {
- return ec2.Instance{
- InstanceId: inst.id,
- InstanceType: inst.instType,
- ImageId: inst.imageId,
- DNSName: fmt.Sprintf("%s.example.com", inst.id),
- // TODO the rest
- }
-}
-
-func (inst *Instance) matchAttr(attr, value string) (ok bool, err error) {
- switch attr {
- case "architecture":
- return value == "i386", nil
- case "instance-id":
- return inst.id == value, nil
- case "group-id":
- for _, g := range inst.reservation.groups {
- if g.id == value {
- return true, nil
- }
- }
- return false, nil
- case "group-name":
- for _, g := range inst.reservation.groups {
- if g.name == value {
- return true, nil
- }
- }
- return false, nil
- case "image-id":
- return value == inst.imageId, nil
- case "instance-state-code":
- code, err := strconv.Atoi(value)
- if err != nil {
- return false, err
- }
- return code&0xff == inst.state.Code, nil
- case "instance-state-name":
- return value == inst.state.Name, nil
- }
- return false, fmt.Errorf("unknown attribute %q", attr)
-}
-
-var (
- Pending = ec2.InstanceState{0, "pending"}
- Running = ec2.InstanceState{16, "running"}
- ShuttingDown = ec2.InstanceState{32, "shutting-down"}
- Terminated = ec2.InstanceState{16, "terminated"}
- Stopped = ec2.InstanceState{16, "stopped"}
-)
-
-func (srv *Server) createSecurityGroup(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- name := req.Form.Get("GroupName")
- if name == "" {
- fatalf(400, "InvalidParameterValue", "empty security group name")
- }
- srv.mu.Lock()
- defer srv.mu.Unlock()
- if srv.group(ec2.SecurityGroup{Name: name}) != nil {
- fatalf(400, "InvalidGroup.Duplicate", "group %q already exists", name)
- }
- g := &securityGroup{
- name: name,
- description: req.Form.Get("GroupDescription"),
- id: fmt.Sprintf("sg-%d", srv.groupId.next()),
- perms: make(map[permKey]bool),
- }
- srv.groups[g.id] = g
- // we define a local type for this because ec2.CreateSecurityGroupResp
- // contains SecurityGroup, but the response to this request
- // should not contain the security group name.
- type CreateSecurityGroupResponse struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"`
- GroupId string `xml:"groupId"`
- }
- r := &CreateSecurityGroupResponse{
- RequestId: reqId,
- Return: true,
- GroupId: g.id,
- }
- return r
-}
-
-func (srv *Server) notImplemented(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- fatalf(500, "InternalError", "not implemented")
- panic("not reached")
-}
-
-func (srv *Server) describeInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- insts := make(map[*Instance]bool)
- for name, vals := range req.Form {
- if !strings.HasPrefix(name, "InstanceId.") {
- continue
- }
- inst := srv.instances[vals[0]]
- if inst == nil {
- fatalf(400, "InvalidInstanceID.NotFound", "instance %q not found", vals[0])
- }
- insts[inst] = true
- }
-
- f := newFilter(req.Form)
-
- var resp ec2.DescribeInstancesResp
- resp.RequestId = reqId
- for _, r := range srv.reservations {
- var instances []ec2.Instance
- for _, inst := range r.instances {
- if len(insts) > 0 && !insts[inst] {
- continue
- }
- ok, err := f.ok(inst)
- if ok {
- instances = append(instances, inst.ec2instance())
- } else if err != nil {
- fatalf(400, "InvalidParameterValue", "describe instances: %v", err)
- }
- }
- if len(instances) > 0 {
- var groups []ec2.SecurityGroup
- for _, g := range r.groups {
- groups = append(groups, g.ec2SecurityGroup())
- }
- resp.Reservations = append(resp.Reservations, ec2.Reservation{
- ReservationId: r.id,
- OwnerId: ownerId,
- Instances: instances,
- SecurityGroups: groups,
- })
- }
- }
- return &resp
-}
-
-func (srv *Server) describeSecurityGroups(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- // BUG similar bug to describeInstances, but for GroupName and GroupId
- srv.mu.Lock()
- defer srv.mu.Unlock()
-
- var groups []*securityGroup
- for name, vals := range req.Form {
- var g ec2.SecurityGroup
- switch {
- case strings.HasPrefix(name, "GroupName."):
- g.Name = vals[0]
- case strings.HasPrefix(name, "GroupId."):
- g.Id = vals[0]
- default:
- continue
- }
- sg := srv.group(g)
- if sg == nil {
- fatalf(400, "InvalidGroup.NotFound", "no such group %v", g)
- }
- groups = append(groups, sg)
- }
- if len(groups) == 0 {
- for _, g := range srv.groups {
- groups = append(groups, g)
- }
- }
-
- f := newFilter(req.Form)
- var resp ec2.SecurityGroupsResp
- resp.RequestId = reqId
- for _, group := range groups {
- ok, err := f.ok(group)
- if ok {
- resp.Groups = append(resp.Groups, ec2.SecurityGroupInfo{
- OwnerId: ownerId,
- SecurityGroup: group.ec2SecurityGroup(),
- Description: group.description,
- IPPerms: group.ec2Perms(),
- })
- } else if err != nil {
- fatalf(400, "InvalidParameterValue", "describe security groups: %v", err)
- }
- }
- return &resp
-}
-
-func (srv *Server) authorizeSecurityGroupIngress(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- g := srv.group(ec2.SecurityGroup{
- Name: req.Form.Get("GroupName"),
- Id: req.Form.Get("GroupId"),
- })
- if g == nil {
- fatalf(400, "InvalidGroup.NotFound", "group not found")
- }
- perms := srv.parsePerms(req)
-
- for _, p := range perms {
- if g.perms[p] {
- fatalf(400, "InvalidPermission.Duplicate", "Permission has already been authorized on the specified group")
- }
- }
- for _, p := range perms {
- g.perms[p] = true
- }
- return &ec2.SimpleResp{
- XMLName: xml.Name{"", "AuthorizeSecurityGroupIngressResponse"},
- RequestId: reqId,
- }
-}
-
-func (srv *Server) revokeSecurityGroupIngress(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- g := srv.group(ec2.SecurityGroup{
- Name: req.Form.Get("GroupName"),
- Id: req.Form.Get("GroupId"),
- })
- if g == nil {
- fatalf(400, "InvalidGroup.NotFound", "group not found")
- }
- perms := srv.parsePerms(req)
-
- // Note EC2 does not give an error if asked to revoke an authorization
- // that does not exist.
- for _, p := range perms {
- delete(g.perms, p)
- }
- return &ec2.SimpleResp{
- XMLName: xml.Name{"", "RevokeSecurityGroupIngressResponse"},
- RequestId: reqId,
- }
-}
-
-var secGroupPat = regexp.MustCompile(`^sg-[a-z0-9]+$`)
-var ipPat = regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+$`)
-var ownerIdPat = regexp.MustCompile(`^[0-9]+$`)
-
-// parsePerms returns a slice of permKey values extracted
-// from the permission fields in req.
-func (srv *Server) parsePerms(req *http.Request) []permKey {
- // perms maps an index found in the form to its associated
- // IPPerm. For instance, the form value with key
- // "IpPermissions.3.FromPort" will be stored in perms[3].FromPort
- perms := make(map[int]ec2.IPPerm)
-
- type subgroupKey struct {
- id1, id2 int
- }
- // Each IPPerm can have many source security groups. The form key
- // for a source security group contains two indices: the index
- // of the IPPerm and the sub-index of the security group. The
- // sourceGroups map maps from a subgroupKey containing these
- // two indices to the associated security group. For instance,
- // the form value with key "IPPermissions.3.Groups.2.GroupName"
- // will be stored in sourceGroups[subgroupKey{3, 2}].Name.
- sourceGroups := make(map[subgroupKey]ec2.UserSecurityGroup)
-
- // For each value in the form we store its associated information in the
- // above maps. The maps are necessary because the form keys may
- // arrive in any order, and the indices are not
- // necessarily sequential or even small.
- for name, vals := range req.Form {
- val := vals[0]
- var id1 int
- var rest string
- if x, _ := fmt.Sscanf(name, "IpPermissions.%d.%s", &id1, &rest); x != 2 {
- continue
- }
- ec2p := perms[id1]
- switch {
- case rest == "FromPort":
- ec2p.FromPort = atoi(val)
- case rest == "ToPort":
- ec2p.ToPort = atoi(val)
- case rest == "IpProtocol":
- switch val {
- case "tcp", "udp", "icmp":
- ec2p.Protocol = val
- default:
- // check it's a well formed number
- atoi(val)
- ec2p.Protocol = val
- }
- case strings.HasPrefix(rest, "Groups."):
- k := subgroupKey{id1: id1}
- if x, _ := fmt.Sscanf(rest[len("Groups."):], "%d.%s", &k.id2, &rest); x != 2 {
- continue
- }
- g := sourceGroups[k]
- switch rest {
- case "UserId":
- // BUG if the user id is blank, this does not conform to the
- // way that EC2 handles it - a specified but blank owner id
- // can cause RevokeSecurityGroupIngress to fail with
- // "group not found" even if the security group id has been
- // correctly specified.
- // By failing here, we ensure that we fail early in this case.
- if !ownerIdPat.MatchString(val) {
- fatalf(400, "InvalidUserID.Malformed", "Invalid user ID: %q", val)
- }
- g.OwnerId = val
- case "GroupName":
- g.Name = val
- case "GroupId":
- if !secGroupPat.MatchString(val) {
- fatalf(400, "InvalidGroupId.Malformed", "Invalid group ID: %q", val)
- }
- g.Id = val
- default:
- fatalf(400, "UnknownParameter", "unknown parameter %q", name)
- }
- sourceGroups[k] = g
- case strings.HasPrefix(rest, "IpRanges."):
- var id2 int
- if x, _ := fmt.Sscanf(rest[len("IpRanges."):], "%d.%s", &id2, &rest); x != 2 {
- continue
- }
- switch rest {
- case "CidrIp":
- if !ipPat.MatchString(val) {
- fatalf(400, "InvalidPermission.Malformed", "Invalid IP range: %q", val)
- }
- ec2p.SourceIPs = append(ec2p.SourceIPs, val)
- default:
- fatalf(400, "UnknownParameter", "unknown parameter %q", name)
- }
- default:
- fatalf(400, "UnknownParameter", "unknown parameter %q", name)
- }
- perms[id1] = ec2p
- }
- // Associate each set of source groups with its IPPerm.
- for k, g := range sourceGroups {
- p := perms[k.id1]
- p.SourceGroups = append(p.SourceGroups, g)
- perms[k.id1] = p
- }
-
- // Now that we have built up the IPPerms we need, we check for
- // parameter errors and build up a permKey for each permission,
- // looking up security groups from srv as we do so.
- var result []permKey
- for _, p := range perms {
- if p.FromPort > p.ToPort {
- fatalf(400, "InvalidParameterValue", "invalid port range")
- }
- k := permKey{
- protocol: p.Protocol,
- fromPort: p.FromPort,
- toPort: p.ToPort,
- }
- for _, g := range p.SourceGroups {
- if g.OwnerId != "" && g.OwnerId != ownerId {
- fatalf(400, "InvalidGroup.NotFound", "group %q not found", g.Name)
- }
- var ec2g ec2.SecurityGroup
- switch {
- case g.Id != "":
- ec2g.Id = g.Id
- case g.Name != "":
- ec2g.Name = g.Name
- }
- k.group = srv.group(ec2g)
- if k.group == nil {
- fatalf(400, "InvalidGroup.NotFound", "group %v not found", g)
- }
- result = append(result, k)
- }
- k.group = nil
- for _, ip := range p.SourceIPs {
- k.ipAddr = ip
- result = append(result, k)
- }
- }
- return result
-}
-
-func (srv *Server) deleteSecurityGroup(w http.ResponseWriter, req *http.Request, reqId string) interface{} {
- srv.mu.Lock()
- defer srv.mu.Unlock()
- g := srv.group(ec2.SecurityGroup{
- Name: req.Form.Get("GroupName"),
- Id: req.Form.Get("GroupId"),
- })
- if g == nil {
- fatalf(400, "InvalidGroup.NotFound", "group not found")
- }
- for _, r := range srv.reservations {
- for _, h := range r.groups {
- if h == g && r.hasRunningMachine() {
- fatalf(500, "InvalidGroup.InUse", "group is currently in use by a running instance")
- }
- }
- }
- for _, sg := range srv.groups {
- // If a group refers to itself, it's ok to delete it.
- if sg == g {
- continue
- }
- for k := range sg.perms {
- if k.group == g {
- fatalf(500, "InvalidGroup.InUse", "group is currently in use by group %q", sg.id)
- }
- }
- }
-
- delete(srv.groups, g.id)
- return &ec2.SimpleResp{
- XMLName: xml.Name{"", "DeleteSecurityGroupResponse"},
- RequestId: reqId,
- }
-}
-
-func (r *reservation) hasRunningMachine() bool {
- for _, inst := range r.instances {
- if inst.state.Code != ShuttingDown.Code && inst.state.Code != Terminated.Code {
- return true
- }
- }
- return false
-}
-
-type counter int
-
-func (c *counter) next() (i int) {
- i = int(*c)
- (*c)++
- return
-}
-
-// atoi is like strconv.Atoi but is fatal if the
-// string is not well formed.
-func atoi(s string) int {
- i, err := strconv.Atoi(s)
- if err != nil {
- fatalf(400, "InvalidParameterValue", "bad number: %v", err)
- }
- return i
-}
-
-func fatalf(statusCode int, code string, f string, a ...interface{}) {
- panic(&ec2.Error{
- StatusCode: statusCode,
- Code: code,
- Message: fmt.Sprintf(f, a...),
- })
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/export_test.go b/vendor/github.com/goamz/goamz/ec2/export_test.go
deleted file mode 100644
index 78da91a07..000000000
--- a/vendor/github.com/goamz/goamz/ec2/export_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package ec2
-
-import (
- "github.com/goamz/goamz/aws"
- "time"
-)
-
-func Sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- sign(auth, method, path, params, host)
-}
-
-func fixedTime() time.Time {
- return time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC)
-}
-
-func FakeTime(fakeIt bool) {
- if fakeIt {
- timeNow = fixedTime
- } else {
- timeNow = time.Now
- }
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/responses_test.go b/vendor/github.com/goamz/goamz/ec2/responses_test.go
deleted file mode 100644
index 84186c1be..000000000
--- a/vendor/github.com/goamz/goamz/ec2/responses_test.go
+++ /dev/null
@@ -1,1084 +0,0 @@
-package ec2_test
-
-var ErrorDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<Response><Errors><Error><Code>UnsupportedOperation</Code>
-<Message>AMIs with an instance-store root device are not supported for the instance type 't1.micro'.</Message>
-</Error></Errors><RequestID>0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4</RequestID></Response>
-`
-
-// http://goo.gl/Mcm3b
-var RunInstancesExample = `
-<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <reservationId>r-47a5402e</reservationId>
- <ownerId>999988887777</ownerId>
- <groupSet>
- <item>
- <groupId>sg-67ad940e</groupId>
- <groupName>default</groupName>
- </item>
- </groupSet>
- <instancesSet>
- <item>
- <instanceId>i-2ba64342</instanceId>
- <imageId>ami-60a54009</imageId>
- <instanceState>
- <code>0</code>
- <name>pending</name>
- </instanceState>
- <privateDnsName></privateDnsName>
- <dnsName></dnsName>
- <keyName>example-key-name</keyName>
- <amiLaunchIndex>0</amiLaunchIndex>
- <instanceType>m1.small</instanceType>
- <launchTime>2007-08-07T11:51:50.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- </placement>
- <monitoring>
- <state>enabled</state>
- </monitoring>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet/>
- <hypervisor>xen</hypervisor>
- </item>
- <item>
- <instanceId>i-2bc64242</instanceId>
- <imageId>ami-60a54009</imageId>
- <instanceState>
- <code>0</code>
- <name>pending</name>
- </instanceState>
- <privateDnsName></privateDnsName>
- <dnsName></dnsName>
- <keyName>example-key-name</keyName>
- <amiLaunchIndex>1</amiLaunchIndex>
- <instanceType>m1.small</instanceType>
- <launchTime>2007-08-07T11:51:50.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- </placement>
- <monitoring>
- <state>enabled</state>
- </monitoring>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet/>
- <hypervisor>xen</hypervisor>
- </item>
- <item>
- <instanceId>i-2be64332</instanceId>
- <imageId>ami-60a54009</imageId>
- <instanceState>
- <code>0</code>
- <name>pending</name>
- </instanceState>
- <privateDnsName></privateDnsName>
- <dnsName></dnsName>
- <keyName>example-key-name</keyName>
- <amiLaunchIndex>2</amiLaunchIndex>
- <instanceType>m1.small</instanceType>
- <launchTime>2007-08-07T11:51:50.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- </placement>
- <monitoring>
- <state>enabled</state>
- </monitoring>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet/>
- <hypervisor>xen</hypervisor>
- </item>
- </instancesSet>
-</RunInstancesResponse>
-`
-
-// http://goo.gl/GRZgCD
-var RequestSpotInstancesExample = `
-<RequestSpotInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <spotInstanceRequestSet>
- <item>
- <spotInstanceRequestId>sir-1a2b3c4d</spotInstanceRequestId>
- <spotPrice>0.5</spotPrice>
- <type>one-time</type>
- <state>open</state>
- <status>
- <code>pending-evaluation</code>
- <updateTime>YYYY-MM-DDTHH:MM:SS.000Z</updateTime>
- <message>Your Spot request has been submitted for review, and is pending evaluation.</message>
- </status>
- <availabilityZoneGroup>MyAzGroup</availabilityZoneGroup>
- <launchSpecification>
- <imageId>ami-1a2b3c4d</imageId>
- <keyName>gsg-keypair</keyName>
- <groupSet>
- <item>
- <groupId>sg-1a2b3c4d</groupId>
- <groupName>websrv</groupName>
- </item>
- </groupSet>
- <instanceType>m1.small</instanceType>
- <blockDeviceMapping/>
- <monitoring>
- <enabled>false</enabled>
- </monitoring>
- <ebsOptimized>false</ebsOptimized>
- </launchSpecification>
- <createTime>YYYY-MM-DDTHH:MM:SS.000Z</createTime>
- <productDescription>Linux/UNIX</productDescription>
- </item>
- </spotInstanceRequestSet>
-</RequestSpotInstancesResponse>
-`
-
-// http://goo.gl/KsKJJk
-var DescribeSpotRequestsExample = `
-<DescribeSpotInstanceRequestsResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>b1719f2a-5334-4479-b2f1-26926EXAMPLE</requestId>
- <spotInstanceRequestSet>
- <item>
- <spotInstanceRequestId>sir-1a2b3c4d</spotInstanceRequestId>
- <spotPrice>0.5</spotPrice>
- <type>one-time</type>
- <state>active</state>
- <status>
- <code>fulfilled</code>
- <updateTime>YYYY-MM-DDTHH:MM:SS.000Z</updateTime>
- <message>Your Spot request is fulfilled.</message>
- </status>
- <launchSpecification>
- <imageId>ami-1a2b3c4d</imageId>
- <keyName>gsg-keypair</keyName>
- <groupSet>
- <item>
- <groupId>sg-1a2b3c4d</groupId>
- <groupName>websrv</groupName>
- </item>
- </groupSet>
- <instanceType>m1.small</instanceType>
- <monitoring>
- <enabled>false</enabled>
- </monitoring>
- <ebsOptimized>false</ebsOptimized>
- </launchSpecification>
- <instanceId>i-1a2b3c4d</instanceId>
- <createTime>YYYY-MM-DDTHH:MM:SS.000Z</createTime>
- <productDescription>Linux/UNIX</productDescription>
- <launchedAvailabilityZone>us-east-1a</launchedAvailabilityZone>
- </item>
- </spotInstanceRequestSet>
-</DescribeSpotInstanceRequestsResponse>
-`
-
-// http://goo.gl/DcfFgJ
-var CancelSpotRequestsExample = `
-<CancelSpotInstanceRequestsResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <spotInstanceRequestSet>
- <item>
- <spotInstanceRequestId>sir-1a2b3c4d</spotInstanceRequestId>
- <state>cancelled</state>
- </item>
- </spotInstanceRequestSet>
-</CancelSpotInstanceRequestsResponse>
-`
-
-// http://goo.gl/3BKHj
-var TerminateInstancesExample = `
-<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <instancesSet>
- <item>
- <instanceId>i-3ea74257</instanceId>
- <currentState>
- <code>32</code>
- <name>shutting-down</name>
- </currentState>
- <previousState>
- <code>16</code>
- <name>running</name>
- </previousState>
- </item>
- </instancesSet>
-</TerminateInstancesResponse>
-`
-
-// http://goo.gl/mLbmw
-var DescribeInstancesExample1 = `
-<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE</requestId>
- <reservationSet>
- <item>
- <reservationId>r-b27e30d9</reservationId>
- <ownerId>999988887777</ownerId>
- <groupSet>
- <item>
- <groupId>sg-67ad940e</groupId>
- <groupName>default</groupName>
- </item>
- </groupSet>
- <instancesSet>
- <item>
- <instanceId>i-c5cd56af</instanceId>
- <imageId>ami-1a2b3c4d</imageId>
- <instanceState>
- <code>16</code>
- <name>running</name>
- </instanceState>
- <privateDnsName>domU-12-31-39-10-56-34.compute-1.internal</privateDnsName>
- <dnsName>ec2-174-129-165-232.compute-1.amazonaws.com</dnsName>
- <reason/>
- <keyName>GSG_Keypair</keyName>
- <amiLaunchIndex>0</amiLaunchIndex>
- <productCodes/>
- <instanceType>m1.small</instanceType>
- <launchTime>2010-08-17T01:15:18.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- <groupName/>
- </placement>
- <kernelId>aki-94c527fd</kernelId>
- <ramdiskId>ari-96c527ff</ramdiskId>
- <monitoring>
- <state>disabled</state>
- </monitoring>
- <privateIpAddress>10.198.85.190</privateIpAddress>
- <ipAddress>174.129.165.232</ipAddress>
- <architecture>i386</architecture>
- <rootDeviceType>ebs</rootDeviceType>
- <rootDeviceName>/dev/sda1</rootDeviceName>
- <blockDeviceMapping>
- <item>
- <deviceName>/dev/sda1</deviceName>
- <ebs>
- <volumeId>vol-a082c1c9</volumeId>
- <status>attached</status>
- <attachTime>2010-08-17T01:15:21.000Z</attachTime>
- <deleteOnTermination>false</deleteOnTermination>
- </ebs>
- </item>
- </blockDeviceMapping>
- <instanceLifecycle>spot</instanceLifecycle>
- <spotInstanceRequestId>sir-7a688402</spotInstanceRequestId>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet/>
- <hypervisor>xen</hypervisor>
- </item>
- </instancesSet>
- <requesterId>854251627541</requesterId>
- </item>
- <item>
- <reservationId>r-b67e30dd</reservationId>
- <ownerId>999988887777</ownerId>
- <groupSet>
- <item>
- <groupId>sg-67ad940e</groupId>
- <groupName>default</groupName>
- </item>
- </groupSet>
- <instancesSet>
- <item>
- <instanceId>i-d9cd56b3</instanceId>
- <imageId>ami-1a2b3c4d</imageId>
- <instanceState>
- <code>16</code>
- <name>running</name>
- </instanceState>
- <privateDnsName>domU-12-31-39-10-54-E5.compute-1.internal</privateDnsName>
- <dnsName>ec2-184-73-58-78.compute-1.amazonaws.com</dnsName>
- <reason/>
- <keyName>GSG_Keypair</keyName>
- <amiLaunchIndex>0</amiLaunchIndex>
- <productCodes/>
- <instanceType>m1.large</instanceType>
- <launchTime>2010-08-17T01:15:19.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- <groupName/>
- </placement>
- <kernelId>aki-94c527fd</kernelId>
- <ramdiskId>ari-96c527ff</ramdiskId>
- <monitoring>
- <state>disabled</state>
- </monitoring>
- <privateIpAddress>10.198.87.19</privateIpAddress>
- <ipAddress>184.73.58.78</ipAddress>
- <architecture>i386</architecture>
- <rootDeviceType>ebs</rootDeviceType>
- <rootDeviceName>/dev/sda1</rootDeviceName>
- <blockDeviceMapping>
- <item>
- <deviceName>/dev/sda1</deviceName>
- <ebs>
- <volumeId>vol-a282c1cb</volumeId>
- <status>attached</status>
- <attachTime>2010-08-17T01:15:23.000Z</attachTime>
- <deleteOnTermination>false</deleteOnTermination>
- </ebs>
- </item>
- </blockDeviceMapping>
- <instanceLifecycle>spot</instanceLifecycle>
- <spotInstanceRequestId>sir-55a3aa02</spotInstanceRequestId>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet/>
- <hypervisor>xen</hypervisor>
- </item>
- </instancesSet>
- <requesterId>854251627541</requesterId>
- </item>
- </reservationSet>
-</DescribeInstancesResponse>
-`
-
-// http://goo.gl/mLbmw
-var DescribeInstancesExample2 = `
-<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <reservationSet>
- <item>
- <reservationId>r-bc7e30d7</reservationId>
- <ownerId>999988887777</ownerId>
- <groupSet>
- <item>
- <groupId>sg-67ad940e</groupId>
- <groupName>default</groupName>
- </item>
- </groupSet>
- <instancesSet>
- <item>
- <instanceId>i-c7cd56ad</instanceId>
- <imageId>ami-b232d0db</imageId>
- <instanceState>
- <code>16</code>
- <name>running</name>
- </instanceState>
- <privateDnsName>domU-12-31-39-01-76-06.compute-1.internal</privateDnsName>
- <dnsName>ec2-72-44-52-124.compute-1.amazonaws.com</dnsName>
- <keyName>GSG_Keypair</keyName>
- <amiLaunchIndex>0</amiLaunchIndex>
- <productCodes/>
- <instanceType>m1.small</instanceType>
- <launchTime>2010-08-17T01:15:16.000Z</launchTime>
- <placement>
- <availabilityZone>us-east-1b</availabilityZone>
- </placement>
- <kernelId>aki-94c527fd</kernelId>
- <ramdiskId>ari-96c527ff</ramdiskId>
- <monitoring>
- <state>disabled</state>
- </monitoring>
- <privateIpAddress>10.255.121.240</privateIpAddress>
- <ipAddress>72.44.52.124</ipAddress>
- <architecture>i386</architecture>
- <rootDeviceType>ebs</rootDeviceType>
- <rootDeviceName>/dev/sda1</rootDeviceName>
- <blockDeviceMapping>
- <item>
- <deviceName>/dev/sda1</deviceName>
- <ebs>
- <volumeId>vol-a482c1cd</volumeId>
- <status>attached</status>
- <attachTime>2010-08-17T01:15:26.000Z</attachTime>
- <deleteOnTermination>true</deleteOnTermination>
- </ebs>
- </item>
- </blockDeviceMapping>
- <virtualizationType>paravirtual</virtualizationType>
- <clientToken/>
- <tagSet>
- <item>
- <key>webserver</key>
- <value></value>
- </item>
- <item>
- <key>stack</key>
- <value>Production</value>
- </item>
- </tagSet>
- <hypervisor>xen</hypervisor>
- </item>
- </instancesSet>
- </item>
- </reservationSet>
-</DescribeInstancesResponse>
-`
-
-// http://goo.gl/2FBTdS
-var DescribeInstanceStatusExample = `
-<DescribeInstanceStatusResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <instanceStatusSet>
- <item>
- <instanceId>i-c7cd56ad</instanceId>
- <availabilityZone>us-east-1b</availabilityZone>
- <eventsSet>
- <item>
- <code>instance-reboot</code>
- <description>example description</description>
- <notBefore>2010-08-17T01:15:18.000Z</notBefore>
- <notAfter>2010-08-17T01:15:18.000Z</notAfter>
- </item>
- </eventsSet>
- <instanceState>
- <code>16</code>
- <name>running</name>
- </instanceState>
- <systemStatus>
- <status>ok</status>
- <details>
- <name>reachability</name>
- <status>passed</status>
- <impairedSince>2010-08-17T01:15:18.000Z</impairedSince>
- </details>
- </systemStatus>
- <instanceStatus>
- <status>ok</status>
- <details>
- <name>reachability</name>
- <status>passed</status>
- <impairedSince>2010-08-17T01:15:18.000Z</impairedSince>
- </details>
- </instanceStatus>
- </item>
- </instanceStatusSet>
- <nextToken>exampleToken</nextToken>
-</DescribeInstanceStatusResponse>
-`
-
-// http://goo.gl/icuXh5
-var ModifyInstanceExample = `
-<ModifyImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-06-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</ModifyImageAttributeResponse>
-`
-
-// http://goo.gl/9rprDN
-var AllocateAddressExample = `
-<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <publicIp>198.51.100.1</publicIp>
- <domain>vpc</domain>
- <allocationId>eipalloc-5723d13e</allocationId>
-</AllocateAddressResponse>
-`
-
-// http://goo.gl/3Q0oCc
-var ReleaseAddressExample = `
-<ReleaseAddressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</ReleaseAddressResponse>
-`
-
-// http://goo.gl/uOSQE
-var AssociateAddressExample = `
-<AssociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
- <associationId>eipassoc-fc5ca095</associationId>
-</AssociateAddressResponse>
-`
-
-// http://goo.gl/LrOa0
-var DisassociateAddressExample = `
-<DisassociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DisassociateAddressResponse>
-`
-
-//http://goo.gl/zW7J4p
-var DescribeAddressesExample = `
-<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <addressesSet>
- <item>
- <publicIp>192.0.2.1</publicIp>
- <domain>standard</domain>
- <instanceId>i-f15ebb98</instanceId>
- </item>
- <item>
- <publicIp>198.51.100.2</publicIp>
- <domain>standard</domain>
- <instanceId/>
- </item>
- <item>
- <publicIp>203.0.113.41</publicIp>
- <allocationId>eipalloc-08229861</allocationId>
- <domain>vpc</domain>
- <instanceId>i-64600030</instanceId>
- <associationId>eipassoc-f0229899</associationId>
- <networkInterfaceId>eni-ef229886</networkInterfaceId>
- <networkInterfaceOwnerId>053230519467</networkInterfaceOwnerId>
- <privateIpAddress>10.0.0.228</privateIpAddress>
- </item>
- </addressesSet>
-</DescribeAddressesResponse>
-`
-
-var DescribeAddressesAllocationIdExample = `
-<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <addressesSet>
- <item>
- <publicIp>203.0.113.41</publicIp>
- <allocationId>eipalloc-08229861</allocationId>
- <domain>vpc</domain>
- <instanceId>i-64600030</instanceId>
- <associationId>eipassoc-f0229899</associationId>
- <networkInterfaceId>eni-ef229886</networkInterfaceId>
- <networkInterfaceOwnerId>053230519467</networkInterfaceOwnerId>
- <privateIpAddress>10.0.0.228</privateIpAddress>
- </item>
- <item>
- <publicIp>146.54.2.230</publicIp>
- <allocationId>eipalloc-08364752</allocationId>
- <domain>vpc</domain>
- <instanceId>i-64693456</instanceId>
- <associationId>eipassoc-f0348693</associationId>
- <networkInterfaceId>eni-da764039</networkInterfaceId>
- <networkInterfaceOwnerId>053230519467</networkInterfaceOwnerId>
- <privateIpAddress>10.0.0.102</privateIpAddress>
- </item>
- </addressesSet>
-</DescribeAddressesResponse>
-`
-
-// http://goo.gl/cxU41
-var CreateImageExample = `
-<CreateImageResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <imageId>ami-4fa54026</imageId>
-</CreateImageResponse>
-`
-
-// http://goo.gl/V0U25
-var DescribeImagesExample = `
-<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/">
- <requestId>4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE</requestId>
- <imagesSet>
- <item>
- <imageId>ami-a2469acf</imageId>
- <imageLocation>aws-marketplace/example-marketplace-amzn-ami.1</imageLocation>
- <imageState>available</imageState>
- <imageOwnerId>123456789999</imageOwnerId>
- <isPublic>true</isPublic>
- <productCodes>
- <item>
- <productCode>a1b2c3d4e5f6g7h8i9j10k11</productCode>
- <type>marketplace</type>
- </item>
- </productCodes>
- <architecture>i386</architecture>
- <imageType>machine</imageType>
- <kernelId>aki-805ea7e9</kernelId>
- <imageOwnerAlias>aws-marketplace</imageOwnerAlias>
- <name>example-marketplace-amzn-ami.1</name>
- <description>Amazon Linux AMI i386 EBS</description>
- <rootDeviceType>ebs</rootDeviceType>
- <rootDeviceName>/dev/sda1</rootDeviceName>
- <blockDeviceMapping>
- <item>
- <deviceName>/dev/sda1</deviceName>
- <ebs>
- <snapshotId>snap-787e9403</snapshotId>
- <volumeSize>8</volumeSize>
- <deleteOnTermination>true</deleteOnTermination>
- </ebs>
- </item>
- </blockDeviceMapping>
- <virtualizationType>paravirtual</virtualizationType>
- <tagSet>
- <item>
- <key>Purpose</key>
- <value>EXAMPLE</value>
- </item>
- </tagSet>
- <hypervisor>xen</hypervisor>
- </item>
- </imagesSet>
-</DescribeImagesResponse>
-`
-
-// http://goo.gl/bHO3z
-var ImageAttributeExample = `
-<DescribeImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-07-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <imageId>ami-61a54008</imageId>
- <launchPermission>
- <item>
- <group>all</group>
- </item>
- <item>
- <userId>495219933132</userId>
- </item>
- </launchPermission>
-</DescribeImageAttributeResponse>
-`
-
-// http://goo.gl/ttcda
-var CreateSnapshotExample = `
-<CreateSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2012-10-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <snapshotId>snap-78a54011</snapshotId>
- <volumeId>vol-4d826724</volumeId>
- <status>pending</status>
- <startTime>2008-05-07T12:51:50.000Z</startTime>
- <progress>60%</progress>
- <ownerId>111122223333</ownerId>
- <volumeSize>10</volumeSize>
- <description>Daily Backup</description>
-</CreateSnapshotResponse>
-`
-
-// http://goo.gl/vwU1y
-var DeleteSnapshotExample = `
-<DeleteSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2012-10-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DeleteSnapshotResponse>
-`
-
-// http://goo.gl/nkovs
-var DescribeSnapshotsExample = `
-<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2012-10-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <snapshotSet>
- <item>
- <snapshotId>snap-1a2b3c4d</snapshotId>
- <volumeId>vol-8875daef</volumeId>
- <status>pending</status>
- <startTime>2010-07-29T04:12:01.000Z</startTime>
- <progress>30%</progress>
- <ownerId>111122223333</ownerId>
- <volumeSize>15</volumeSize>
- <description>Daily Backup</description>
- <tagSet>
- <item>
- <key>Purpose</key>
- <value>demo_db_14_backup</value>
- </item>
- </tagSet>
- </item>
- </snapshotSet>
-</DescribeSnapshotsResponse>
-`
-
-// http://goo.gl/YUjO4G
-var ModifyImageAttributeExample = `
-<ModifyImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-06-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</ModifyImageAttributeResponse>
-`
-
-// http://goo.gl/hQwPCK
-var CopyImageExample = `
-<CopyImageResponse xmlns="http://ec2.amazonaws.com/doc/2013-06-15/">
- <requestId>60bc441d-fa2c-494d-b155-5d6a3EXAMPLE</requestId>
- <imageId>ami-4d3c2b1a</imageId>
-</CopyImageResponse>
-`
-
-var CreateKeyPairExample = `
-<CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <keyName>foo</keyName>
- <keyFingerprint>
- 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
- </keyFingerprint>
- <keyMaterial>---- BEGIN RSA PRIVATE KEY ----
-MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC
-VVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6
-b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAd
-BgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcN
-MTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYD
-VQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25z
-b2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFt
-YXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ
-21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T
-rDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpE
-Ibb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4
-nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb
-FFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTb
-NYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=
------END RSA PRIVATE KEY-----
-</keyMaterial>
-</CreateKeyPairResponse>
-`
-
-var DeleteKeyPairExample = `
-<DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DeleteKeyPairResponse>
-`
-
-// http://goo.gl/Eo7Yl
-var CreateSecurityGroupExample = `
-<CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
- <groupId>sg-67ad940e</groupId>
-</CreateSecurityGroupResponse>
-`
-
-// http://goo.gl/k12Uy
-var DescribeSecurityGroupsExample = `
-<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <securityGroupInfo>
- <item>
- <ownerId>999988887777</ownerId>
- <groupName>WebServers</groupName>
- <groupId>sg-67ad940e</groupId>
- <groupDescription>Web Servers</groupDescription>
- <ipPermissions>
- <item>
- <ipProtocol>tcp</ipProtocol>
- <fromPort>80</fromPort>
- <toPort>80</toPort>
- <groups/>
- <ipRanges>
- <item>
- <cidrIp>0.0.0.0/0</cidrIp>
- </item>
- </ipRanges>
- </item>
- </ipPermissions>
- <ipPermissionsEgress>
- <item>
- <ipProtocol>tcp</ipProtocol>
- <fromPort>80</fromPort>
- <toPort>80</toPort>
- <groups/>
- <ipRanges>
- <item>
- <cidrIp>0.0.0.0/0</cidrIp>
- </item>
- </ipRanges>
- </item>
- </ipPermissionsEgress>
- </item>
- <item>
- <ownerId>999988887777</ownerId>
- <groupName>RangedPortsBySource</groupName>
- <groupId>sg-76abc467</groupId>
- <groupDescription>Group A</groupDescription>
- <ipPermissions>
- <item>
- <ipProtocol>tcp</ipProtocol>
- <fromPort>6000</fromPort>
- <toPort>7000</toPort>
- <groups/>
- <ipRanges/>
- </item>
- </ipPermissions>
- </item>
- </securityGroupInfo>
-</DescribeSecurityGroupsResponse>
-`
-
-// A dump which includes groups within ip permissions.
-var DescribeSecurityGroupsDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>87b92b57-cc6e-48b2-943f-f6f0e5c9f46c</requestId>
- <securityGroupInfo>
- <item>
- <ownerId>12345</ownerId>
- <groupName>default</groupName>
- <groupDescription>default group</groupDescription>
- <ipPermissions>
- <item>
- <ipProtocol>icmp</ipProtocol>
- <fromPort>-1</fromPort>
- <toPort>-1</toPort>
- <groups>
- <item>
- <userId>12345</userId>
- <groupName>default</groupName>
- <groupId>sg-67ad940e</groupId>
- </item>
- </groups>
- <ipRanges/>
- </item>
- <item>
- <ipProtocol>tcp</ipProtocol>
- <fromPort>0</fromPort>
- <toPort>65535</toPort>
- <groups>
- <item>
- <userId>12345</userId>
- <groupName>other</groupName>
- <groupId>sg-76abc467</groupId>
- </item>
- </groups>
- <ipRanges/>
- </item>
- </ipPermissions>
- </item>
- </securityGroupInfo>
-</DescribeSecurityGroupsResponse>
-`
-
-// http://goo.gl/QJJDO
-var DeleteSecurityGroupExample = `
-<DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DeleteSecurityGroupResponse>
-`
-
-// http://goo.gl/u2sDJ
-var AuthorizeSecurityGroupIngressExample = `
-<AuthorizeSecurityGroupIngressResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</AuthorizeSecurityGroupIngressResponse>
-`
-
-// http://goo.gl/Mz7xr
-var RevokeSecurityGroupIngressExample = `
-<RevokeSecurityGroupIngressResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</RevokeSecurityGroupIngressResponse>
-`
-
-// http://goo.gl/Vmkqc
-var CreateTagsExample = `
-<CreateTagsResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</CreateTagsResponse>
-`
-
-// http://goo.gl/awKeF
-var StartInstancesExample = `
-<StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <instancesSet>
- <item>
- <instanceId>i-10a64379</instanceId>
- <currentState>
- <code>0</code>
- <name>pending</name>
- </currentState>
- <previousState>
- <code>80</code>
- <name>stopped</name>
- </previousState>
- </item>
- </instancesSet>
-</StartInstancesResponse>
-`
-
-// http://goo.gl/436dJ
-var StopInstancesExample = `
-<StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <instancesSet>
- <item>
- <instanceId>i-10a64379</instanceId>
- <currentState>
- <code>64</code>
- <name>stopping</name>
- </currentState>
- <previousState>
- <code>16</code>
- <name>running</name>
- </previousState>
- </item>
- </instancesSet>
-</StopInstancesResponse>
-`
-
-// http://goo.gl/baoUf
-var RebootInstancesExample = `
-<RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</RebootInstancesResponse>
-`
-
-var DescribeRouteTablesExample = `
-<DescribeRouteTablesResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>6f570b0b-9c18-4b07-bdec-73740dcf861aEXAMPLE</requestId>
- <routeTableSet>
- <item>
- <routeTableId>rtb-13ad487a</routeTableId>
- <vpcId>vpc-11ad4878</vpcId>
- <routeSet>
- <item>
- <destinationCidrBlock>10.0.0.0/22</destinationCidrBlock>
- <gatewayId>local</gatewayId>
- <state>active</state>
- <origin>CreateRouteTable</origin>
- </item>
- </routeSet>
- <associationSet>
- <item>
- <routeTableAssociationId>rtbassoc-12ad487b</routeTableAssociationId>
- <routeTableId>rtb-13ad487a</routeTableId>
- <main>true</main>
- </item>
- </associationSet>
- <tagSet/>
- </item>
- <item>
- <routeTableId>rtb-f9ad4890</routeTableId>
- <vpcId>vpc-11ad4878</vpcId>
- <routeSet>
- <item>
- <destinationCidrBlock>10.0.0.0/22</destinationCidrBlock>
- <gatewayId>local</gatewayId>
- <state>active</state>
- <origin>CreateRouteTable</origin>
- </item>
- <item>
- <destinationCidrBlock>0.0.0.0/0</destinationCidrBlock>
- <gatewayId>igw-eaad4883</gatewayId>
- <state>active</state>
- </item>
- </routeSet>
- <associationSet>
- <item>
- <routeTableAssociationId>rtbassoc-faad4893</routeTableAssociationId>
- <routeTableId>rtb-f9ad4890</routeTableId>
- <subnetId>subnet-15ad487c</subnetId>
- </item>
- </associationSet>
- <tagSet/>
- </item>
- </routeTableSet>
-</DescribeRouteTablesResponse>
-`
-
-var CreateRouteTableExample = `
-<CreateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59abcd43-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <routeTable>
- <routeTableId>rtb-f9ad4890</routeTableId>
- <vpcId>vpc-11ad4878</vpcId>
- <routeSet>
- <item>
- <destinationCidrBlock>10.0.0.0/22</destinationCidrBlock>
- <gatewayId>local</gatewayId>
- <state>active</state>
- </item>
- </routeSet>
- <associationSet/>
- <tagSet/>
- </routeTable>
-</CreateRouteTableResponse>
-`
-
-var DeleteRouteTableExample = `
-<DeleteRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>49dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DeleteRouteTableResponse>
-`
-
-var AssociateRouteTableExample = `
-<AssociateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <associationId>rtbassoc-f8ad4891</associationId>
-</AssociateRouteTableResponse>
-`
-
-var DisassociateRouteTableExample = `
-<DisassociateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DisassociateRouteTableResponse>
-`
-
-var ReplaceRouteTableAssociationExample = `
-<ReplaceRouteTableAssociationResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>59dbff89-35bd-4eac-88ed-be587EXAMPLE</requestId>
- <newAssociationId>rtbassoc-faad2958</newAssociationId>
-</ReplaceRouteTableAssociationResponse>
-`
-var DescribeReservedInstancesExample = `
-<DescribeReservedInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-06-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <reservedInstancesSet>
- <item>
- <reservedInstancesId>e5a2ff3b-7d14-494f-90af-0b5d0EXAMPLE</reservedInstancesId>
- <instanceType>m1.xlarge</instanceType>
- <availabilityZone>us-east-1b</availabilityZone>
- <duration>31536000</duration>
- <fixedPrice>61.0</fixedPrice>
- <usagePrice>0.034</usagePrice>
- <instanceCount>3</instanceCount>
- <productDescription>Linux/UNIX</productDescription>
- <state>active</state>
- <instanceTenancy>default</instanceTenancy>
- <currencyCode>USD</currencyCode>
- <offeringType>Light Utilization</offeringType>
- <recurringCharges/>
- </item>
- </reservedInstancesSet>
-</DescribeReservedInstancesResponse>
-`
-
-var DescribeVpcsExample = `
-<DescribeVpcsResponse xmlns="http://ec2.amazonaws.com/doc/2015-04-15/">
- <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
- <vpcSet>
- <item>
- <vpcId>vpc-1a2b3c4d</vpcId>
- <state>available</state>
- <cidrBlock>10.0.0.0/23</cidrBlock>
- <dhcpOptionsId>dopt-7a8b9c2d</dhcpOptionsId>
- <instanceTenancy>default</instanceTenancy>
- <isDefault>false</isDefault>
- <tagSet/>
- </item>
- </vpcSet>
-</DescribeVpcsResponse>
-`
-
-var CreateVpcExample = `
-<CreateVpcResponse xmlns="http://ec2.amazonaws.com/doc/2015-04-15/">
- <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
- <vpc>
- <vpcId>vpc-1a2b3c4d</vpcId>
- <state>pending</state>
- <cidrBlock>10.0.0.0/16</cidrBlock>
- <dhcpOptionsId>dopt-1a2b3c4d2</dhcpOptionsId>
- <instanceTenancy>default</instanceTenancy>
- <tagSet/>
- </vpc>
-</CreateVpcResponse>
-`
-
-var DeleteVpcExample = `
-<DeleteVpcResponse xmlns="http://ec2.amazonaws.com/doc/2015-04-15/">
- <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
- <return>true</return>
-</DeleteVpcResponse>
-`
-
-var CreateRouteExample = `
-<CreateRouteResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
- <requestId>b4998629-3000-437f-b382-cc96fEXAMPLE</requestId>
- <return>true</return>
-</CreateRouteResponse>
-`
-
-var DeleteRouteExample = `
-<DeleteRouteResponse xmlns="http://ec2.amazonaws.com/doc/2015-04-15/">
- <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
- <return>true</return>
-</DeleteRouteResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/ec2/sign.go b/vendor/github.com/goamz/goamz/ec2/sign.go
deleted file mode 100644
index 1c30f13bb..000000000
--- a/vendor/github.com/goamz/goamz/ec2/sign.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package ec2
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "sort"
- "strings"
-)
-
-// ----------------------------------------------------------------------------
-// EC2 signing (http://goo.gl/fQmAN)
-
-var b64 = base64.StdEncoding
-
-func sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- params["AWSAccessKeyId"] = auth.AccessKey
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
- if auth.Token() != "" {
- params["SecurityToken"] = auth.Token()
- }
-
- // AWS specifies that the parameters in a signed request must
- // be provided in the natural order of the keys. This is distinct
- // from the natural order of the encoded value of key=value.
- // Percent and equals affect the sorting order.
- var keys, sarray []string
- for k, _ := range params {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(params[k]))
- }
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/sign_test.go b/vendor/github.com/goamz/goamz/ec2/sign_test.go
deleted file mode 100644
index bc6996cce..000000000
--- a/vendor/github.com/goamz/goamz/ec2/sign_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package ec2_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/ec2"
- . "gopkg.in/check.v1"
-)
-
-// EC2 ReST authentication docs: http://goo.gl/fQmAN
-
-var testAuth = aws.Auth{AccessKey: "user", SecretKey: "secret"}
-
-func (s *S) TestBasicSignature(c *C) {
- params := map[string]string{}
- ec2.Sign(testAuth, "GET", "/path", params, "localhost")
- c.Assert(params["SignatureVersion"], Equals, "2")
- c.Assert(params["SignatureMethod"], Equals, "HmacSHA256")
- expected := "6lSe5QyXum0jMVc7cOUz32/52ZnL7N5RyKRk/09yiK4="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestParamSignature(c *C) {
- params := map[string]string{
- "param1": "value1",
- "param2": "value2",
- "param3": "value3",
- }
- ec2.Sign(testAuth, "GET", "/path", params, "localhost")
- expected := "XWOR4+0lmK8bD8CGDGZ4kfuSPbb2JibLJiCl/OPu1oU="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestManyParams(c *C) {
- params := map[string]string{
- "param1": "value10",
- "param2": "value2",
- "param3": "value3",
- "param4": "value4",
- "param5": "value5",
- "param6": "value6",
- "param7": "value7",
- "param8": "value8",
- "param9": "value9",
- "param10": "value1",
- }
- ec2.Sign(testAuth, "GET", "/path", params, "localhost")
- expected := "di0sjxIvezUgQ1SIL6i+C/H8lL+U0CQ9frLIak8jkVg="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestEscaping(c *C) {
- params := map[string]string{"Nonce": "+ +"}
- ec2.Sign(testAuth, "GET", "/path", params, "localhost")
- c.Assert(params["Nonce"], Equals, "+ +")
- expected := "bqffDELReIqwjg/W0DnsnVUmfLK4wXVLO4/LuG+1VFA="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestSignatureExample1(c *C) {
- params := map[string]string{
- "Timestamp": "2009-02-01T12:53:20+00:00",
- "Version": "2007-11-07",
- "Action": "ListDomains",
- }
- ec2.Sign(aws.Auth{AccessKey: "access", SecretKey: "secret"}, "GET", "/", params, "sdb.amazonaws.com")
- expected := "okj96/5ucWBSc1uR2zXVfm6mDHtgfNv657rRtt/aunQ="
- c.Assert(params["Signature"], Equals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/vpc.go b/vendor/github.com/goamz/goamz/ec2/vpc.go
deleted file mode 100644
index 3a2ff7c6e..000000000
--- a/vendor/github.com/goamz/goamz/ec2/vpc.go
+++ /dev/null
@@ -1,399 +0,0 @@
-package ec2
-
-// RouteTable describes a route table which contains a set of rules, called routes
-// that are used to determine where network traffic is directed.
-//
-// See http://goo.gl/bI9hkg for more details.
-type RouteTable struct {
- Id string `xml:"routeTableId"`
- VpcId string `xml:"vpcId"`
- Routes []Route `xml:"routeSet>item"`
- Associations []RouteTableAssociation `xml:"associationSet>item"`
- PropagatingVgws []PropagatingVgw `xml:"propagatingVgwSet>item"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-// Route describes a route in a route table.
-//
-// See http://goo.gl/hE5Kxe for more details.
-type Route struct {
- DestinationCidrBlock string `xml:"destinationCidrBlock"` // The CIDR block used for the destination match.
- GatewayId string `xml:"gatewayId"` // The ID of a gateway attached to your VPC.
- InstanceId string `xml:"instanceId"` // The ID of a NAT instance in your VPC.
- InstanceOwnerId string `xml:"instanceOwnerId"` // The AWS account ID of the owner of the instance.
- NetworkInterfaceId string `xml:"networkInterfaceId"` // The ID of the network interface.
- State string `xml:"state"` // The state of the route. Valid values: active | blackhole
- Origin string `xml:"origin"` // Describes how the route was created. Valid values: Valid values: CreateRouteTable | CreateRoute | EnableVgwRoutePropagation
- VpcPeeringConnectionId string `xml:"vpcPeeringConnectionId"` // The ID of the VPC peering connection.
-}
-
-// RouteTableAssociation describes an association between a route table and a subnet.
-//
-// See http://goo.gl/BZB8o8 for more details.
-type RouteTableAssociation struct {
- Id string `xml:"routeTableAssociationId"` // The ID of the association between a route table and a subnet.
- RouteTableId string `xml:"routeTableId"` // The ID of the route table.
- SubnetId string `xml:"subnetId"` // The ID of the subnet.
- Main bool `xml:"main"` // Indicates whether this is the main route table.
-}
-
-// PropagatingVgw describes a virtual private gateway propagating route.
-//
-// See http://goo.gl/myGQtG for more details.
-type PropagatingVgw struct {
- GatewayId string `xml:"gatewayID"`
-}
-
-// CreateRouteTableResp represents a response from a CreateRouteTable request
-//
-// See http://goo.gl/LD0TqP for more details.
-type CreateRouteTableResp struct {
- RequestId string `xml:"requestId"`
- RouteTable RouteTable `xml:"routeTable"`
-}
-
-// CreateRouteTable creates a route table for the specified VPC.
-// After you create a route table, you can add routes and associate the table with a subnet.
-//
-// See http://goo.gl/V9h6gE for more details..
-func (ec2 *EC2) CreateRouteTable(vpcId string) (resp *CreateRouteTableResp, err error) {
- params := makeParams("CreateRouteTable")
- params["VpcId"] = vpcId
- resp = &CreateRouteTableResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// DescribeRouteTablesResp represents a response from a DescribeRouteTables call
-//
-// See http://goo.gl/T3tVsg for more details.
-type DescribeRouteTablesResp struct {
- RequestId string `xml:"requestId"`
- RouteTables []RouteTable `xml:"routeTableSet>item"`
-}
-
-// DescribeRouteTables describes one or more of your route tables
-//
-// See http://goo.gl/S0RVos for more details.
-func (ec2 *EC2) DescribeRouteTables(routeTableIds []string, filter *Filter) (resp *DescribeRouteTablesResp, err error) {
- params := makeParams("DescribeRouteTables")
- addParamsList(params, "RouteTableId", routeTableIds)
- filter.addParams(params)
- resp = &DescribeRouteTablesResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// AssociateRouteTableResp represents a response from an AssociateRouteTable call
-//
-// See http://goo.gl/T4KlYk for more details.
-type AssociateRouteTableResp struct {
- RequestId string `xml:"requestId"`
- AssociationId string `xml:"associationId"`
-}
-
-// AssociateRouteTable associates a subnet with a route table.
-//
-// The subnet and route table must be in the same VPC. This association causes
-// traffic originating from the subnet to be routed according to the routes
-// in the route table. The action returns an association ID, which you need in
-// order to disassociate the route table from the subnet later.
-// A route table can be associated with multiple subnets.
-//
-// See http://goo.gl/bfnONU for more details.
-func (ec2 *EC2) AssociateRouteTable(routeTableId, subnetId string) (resp *AssociateRouteTableResp, err error) {
- params := makeParams("AssociateRouteTable")
- params["RouteTableId"] = routeTableId
- params["SubnetId"] = subnetId
- resp = &AssociateRouteTableResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// DisassociateRouteTableResp represents the response from a DisassociateRouteTable request
-//
-// See http://goo.gl/1v4reT for more details.
-type DisassociateRouteTableResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"` // True if the request succeeds
-}
-
-// DisassociateRouteTable disassociates a subnet from a route table.
-//
-// See http://goo.gl/A4NJum for more details.
-func (ec2 *EC2) DisassociateRouteTable(associationId string) (resp *DisassociateRouteTableResp, err error) {
- params := makeParams("DisassociateRouteTable")
- params["AssociationId"] = associationId
- resp = &DisassociateRouteTableResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ReplaceRouteTableAssociationResp represents a response from a ReplaceRouteTableAssociation call
-//
-// See http://goo.gl/VhILGe for more details.
-type ReplaceRouteTableAssociationResp struct {
- RequestId string `xml:"requestId"`
- NewAssociationId string `xml:"newAssociationId"`
-}
-
-// ReplaceRouteTableAssociation changes the route table associated with a given subnet in a VPC.
-//
-// See http://goo.gl/kiit8j for more details.
-func (ec2 *EC2) ReplaceRouteTableAssociation(associationId, routeTableId string) (resp *ReplaceRouteTableAssociationResp, err error) {
- params := makeParams("ReplaceRouteTableAssociation")
- params["AssociationId"] = associationId
- params["RouteTableId"] = routeTableId
- resp = &ReplaceRouteTableAssociationResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// DeleteRouteTableResp represents a response from a DeleteRouteTable request
-//
-// See http://goo.gl/b8usig for more details.
-type DeleteRouteTableResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"` // True if the request succeeds
-}
-
-// DeleteRouteTable deletes the specified route table.
-// You must disassociate the route table from any subnets before you can delete it.
-// You can't delete the main route table.
-//
-// See http://goo.gl/crHxT2 for more details.
-func (ec2 *EC2) DeleteRouteTable(routeTableId string) (resp *DeleteRouteTableResp, err error) {
- params := makeParams("DeleteRouteTable")
- params["RouteTableId"] = routeTableId
- resp = &DeleteRouteTableResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// VPC describes a VPC.
-//
-// See http://goo.gl/WjX0Es for more details.
-type VPC struct {
- CidrBlock string `xml:"cidrBlock"`
- DHCPOptionsID string `xml:"dhcpOptionsId"`
- State string `xml:"state"`
- VpcId string `xml:"vpcId"`
- InstanceTenancy string `xml:"instanceTenancy"`
- IsDefault bool `xml:"isDefault"`
- Tags []Tag `xml:"tagSet>item"`
-}
-
-// CreateVpcResp represents a response from a CreateVpcResp request
-//
-// See http://goo.gl/QoK11F for more details.
-type CreateVpcResp struct {
- RequestId string `xml:"requestId"`
- VPC VPC `xml:"vpc"` // Information about the VPC.
-}
-
-// CreateVpc creates a VPC with the specified CIDR block.
-//
-// The smallest VPC you can create uses a /28 netmask (16 IP addresses),
-// and the largest uses a /16 netmask (65,536 IP addresses).
-//
-// By default, each instance you launch in the VPC has the default DHCP options,
-// which includes only a default DNS server that Amazon provides (AmazonProvidedDNS).
-//
-// See http://goo.gl/QoK11F for more details.
-func (ec2 *EC2) CreateVpc(cidrBlock, instanceTenancy string) (resp *CreateVpcResp, err error) {
- params := makeParams("CreateVpc")
- params["CidrBlock"] = cidrBlock
-
- if instanceTenancy != "" {
- params["InstanceTenancy"] = instanceTenancy
- }
-
- resp = &CreateVpcResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// DeleteVpcResp represents a response from a DeleteVpc request
-//
-// See http://goo.gl/qawyrz for more details.
-type DeleteVpcResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"` // True if the request succeeds
-}
-
-// DeleteVpc deletes the specified VPC.
-//
-// You must detach or delete all gateways and resources that are associated with
-// the VPC before you can delete it. For example, you must terminate all
-// instances running in the VPC, delete all security groups associated with
-// the VPC (except the default one), delete all route tables associated with
-// the VPC (except the default one), and so on.
-//
-// See http://goo.gl/qawyrz for more details.
-func (ec2 *EC2) DeleteVpc(vpcId string) (resp *DeleteVpcResp, err error) {
- params := makeParams("DeleteVpc")
- params["VpcId"] = vpcId
-
- resp = &DeleteVpcResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// DescribeVpcsResp represents a response from a DescribeVpcs request
-//
-// See http://goo.gl/DWQWvZ for more details.
-type DescribeVpcsResp struct {
- RequestId string `xml:"requestId"`
- VPCs []VPC `xml:"vpcSet>item"` // Information about one or more VPCs.
-}
-
-// DescribeVpcs describes one or more of your VPCs.
-//
-// See http://goo.gl/DWQWvZ for more details.
-func (ec2 *EC2) DescribeVpcs(vpcIds []string, filter *Filter) (resp *DescribeVpcsResp, err error) {
- params := makeParams("DescribeVpcs")
- addParamsList(params, "VpcId", vpcIds)
- filter.addParams(params)
- resp = &DescribeVpcsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
-
-// DeleteRouteResp represents a response from a DeleteRoute request
-//
-// See http://goo.gl/Uqyt3w for more details.
-type DeleteRouteResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"` // True if the request succeeds
-}
-
-// DeleteRoute deletes the specified route from the specified route table.
-//
-// See http://goo.gl/Uqyt3w for more details.
-func (ec2 *EC2) DeleteRoute(routeTableId, destinationCidrBlock string) (resp *DeleteRouteResp, err error) {
- params := makeParams("DeleteRoute")
- params["RouteTableId"] = routeTableId
- params["DestinationCidrBlock"] = destinationCidrBlock
- resp = &DeleteRouteResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// CreateRouteResp represents a response from a CreateRoute request
-//
-// See http://goo.gl/c6Bg7e for more details.
-type CreateRouteResp struct {
- RequestId string `xml:"requestId"`
- Return bool `xml:"return"` // True if the request succeeds
-}
-
-// CreateRoute structure contains the options for a CreateRoute API call.
-type CreateRoute struct {
- DestinationCidrBlock string
- GatewayId string
- InstanceId string
- NetworkInterfaceId string
- VpcPeeringConnectionId string
-}
-
-// CreateRoute creates a route in a route table within a VPC.
-// You must specify one of the following targets: Internet gateway or virtual
-// private gateway, NAT instance, VPC peering connection, or network interface.
-//
-// See http://goo.gl/c6Bg7e for more details.
-func (ec2 *EC2) CreateRoute(routeTableId string, options *CreateRoute) (resp *CreateRouteResp, err error) {
- params := makeParams("CreateRoute")
- params["RouteTableId"] = routeTableId
- if options.DestinationCidrBlock != "" {
- params["DestinationCidrBlock"] = options.DestinationCidrBlock
- }
- if options.GatewayId != "" {
- params["GatewayId"] = options.GatewayId
- }
- if options.InstanceId != "" {
- params["InstanceId"] = options.InstanceId
- }
- if options.NetworkInterfaceId != "" {
- params["NetworkInterfaceId"] = options.NetworkInterfaceId
- }
- if options.VpcPeeringConnectionId != "" {
- params["VpcPeeringConnectionId"] = options.VpcPeeringConnectionId
- }
- resp = &CreateRouteResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Subnet describes a subnet
-//
-// See http://goo.gl/bifW4R
-type Subnet struct {
- AvailabilityZone string `xml:"availabilityZone"`
- AvailableIpAddressCount int `xml:"availableIpAddressCount"`
- CidrBlock string `xml:"cidrBlock"`
- DefaultForAZ bool `xml:"defaultForAz"`
- MapPublicIpOnLaunch bool `xml:"mapPublicIpOnLaunch"`
- State string `xml:"state"`
- SubnetId string `xml:"subnetId"`
- Tags []Tag `xml:"tagSet>item"`
- VpcId string `xml:"vpcId"`
-}
-
-// DescribeSubnetsResp represents a response from a DescribeSubnets request
-//
-// See https://goo.gl/1s0UQd for more details.
-type DescribeSubnetsResp struct {
- RequestId string `xml:"requestId"`
- Subnets []Subnet `xml:"subnetSet>item"`
-}
-
-// DescribeSubnets describes one or more Subnets.
-//
-// See https://goo.gl/1s0UQd for more details.
-func (ec2 *EC2) DescribeSubnets(subnetIds []string, filter *Filter) (resp *DescribeSubnetsResp, err error) {
- params := makeParams("DescribeSubnets")
- addParamsList(params, "SubnetId", subnetIds)
- filter.addParams(params)
- resp = &DescribeSubnetsResp{}
- err = ec2.query(params, resp)
- if err != nil {
- return nil, err
- }
-
- return
-}
diff --git a/vendor/github.com/goamz/goamz/ec2/vpc_test.go b/vendor/github.com/goamz/goamz/ec2/vpc_test.go
deleted file mode 100644
index a6e67eeed..000000000
--- a/vendor/github.com/goamz/goamz/ec2/vpc_test.go
+++ /dev/null
@@ -1,224 +0,0 @@
-package ec2_test
-
-import (
- "github.com/goamz/goamz/ec2"
- . "gopkg.in/check.v1"
-)
-
-func (s *S) TestCreateRouteTable(c *C) {
- testServer.Response(200, nil, CreateRouteTableExample)
-
- resp, err := s.ec2.CreateRouteTable("vpc-11ad4878")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateRouteTable"})
- c.Assert(req.Form["VpcId"], DeepEquals, []string{"vpc-11ad4878"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59abcd43-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.RouteTable.Id, Equals, "rtb-f9ad4890")
- c.Assert(resp.RouteTable.VpcId, Equals, "vpc-11ad4878")
- c.Assert(resp.RouteTable.Routes, HasLen, 1)
- c.Assert(resp.RouteTable.Routes[0], DeepEquals, ec2.Route{
- DestinationCidrBlock: "10.0.0.0/22",
- GatewayId: "local",
- State: "active",
- })
- c.Assert(resp.RouteTable.Associations, HasLen, 0)
- c.Assert(resp.RouteTable.Tags, HasLen, 0)
-}
-
-func (s *S) TestDescribeRouteTables(c *C) {
- testServer.Response(200, nil, DescribeRouteTablesExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeRouteTables([]string{"rt1", "rt2"}, nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeRouteTables"})
- c.Assert(req.Form["RouteTableId.1"], DeepEquals, []string{"rt1"})
- c.Assert(req.Form["RouteTableId.2"], DeepEquals, []string{"rt2"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "6f570b0b-9c18-4b07-bdec-73740dcf861aEXAMPLE")
- c.Assert(resp.RouteTables, HasLen, 2)
-
- rt1 := resp.RouteTables[0]
- c.Assert(rt1.Id, Equals, "rtb-13ad487a")
- c.Assert(rt1.VpcId, Equals, "vpc-11ad4878")
- c.Assert(rt1.Routes, DeepEquals, []ec2.Route{
- {DestinationCidrBlock: "10.0.0.0/22", GatewayId: "local", State: "active", Origin: "CreateRouteTable"},
- })
- c.Assert(rt1.Associations, DeepEquals, []ec2.RouteTableAssociation{
- {Id: "rtbassoc-12ad487b", RouteTableId: "rtb-13ad487a", Main: true},
- })
-
- rt2 := resp.RouteTables[1]
- c.Assert(rt2.Id, Equals, "rtb-f9ad4890")
- c.Assert(rt2.VpcId, Equals, "vpc-11ad4878")
- c.Assert(rt2.Routes, DeepEquals, []ec2.Route{
- {DestinationCidrBlock: "10.0.0.0/22", GatewayId: "local", State: "active", Origin: "CreateRouteTable"},
- {DestinationCidrBlock: "0.0.0.0/0", GatewayId: "igw-eaad4883", State: "active"},
- })
- c.Assert(rt2.Associations, DeepEquals, []ec2.RouteTableAssociation{
- {Id: "rtbassoc-faad4893", RouteTableId: "rtb-f9ad4890", SubnetId: "subnet-15ad487c"},
- })
-}
-
-func (s *S) TestAssociateRouteTable(c *C) {
- testServer.Response(200, nil, AssociateRouteTableExample)
-
- resp, err := s.ec2.AssociateRouteTable("rtb-e4ad488d", "subnet-15ad487c")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"AssociateRouteTable"})
- c.Assert(req.Form["RouteTableId"], DeepEquals, []string{"rtb-e4ad488d"})
- c.Assert(req.Form["SubnetId"], DeepEquals, []string{"subnet-15ad487c"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.AssociationId, Equals, "rtbassoc-f8ad4891")
-}
-
-func (s *S) TestDisassociateRouteTable(c *C) {
- testServer.Response(200, nil, DisassociateRouteTableExample)
-
- resp, err := s.ec2.DisassociateRouteTable("rtbassoc-f8ad4891")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DisassociateRouteTable"})
- c.Assert(req.Form["AssociationId"], DeepEquals, []string{"rtbassoc-f8ad4891"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestReplaceRouteTableAssociation(c *C) {
- testServer.Response(200, nil, ReplaceRouteTableAssociationExample)
-
- resp, err := s.ec2.ReplaceRouteTableAssociation("rtbassoc-f8ad4891", "rtb-f9ad4890")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"ReplaceRouteTableAssociation"})
- c.Assert(req.Form["RouteTableId"], DeepEquals, []string{"rtb-f9ad4890"})
- c.Assert(req.Form["AssociationId"], DeepEquals, []string{"rtbassoc-f8ad4891"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-88ed-be587EXAMPLE")
- c.Assert(resp.NewAssociationId, Equals, "rtbassoc-faad2958")
-}
-
-func (s *S) TestDeleteRouteTable(c *C) {
- testServer.Response(200, nil, DeleteRouteTableExample)
-
- resp, err := s.ec2.DeleteRouteTable("rtb-f9ad4890")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteRouteTable"})
- c.Assert(req.Form["RouteTableId"], DeepEquals, []string{"rtb-f9ad4890"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "49dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestDescribeVpcs(c *C) {
- testServer.Response(200, nil, DescribeVpcsExample)
-
- filter := ec2.NewFilter()
- filter.Add("key1", "value1")
- filter.Add("key2", "value2", "value3")
-
- resp, err := s.ec2.DescribeVpcs([]string{"id1", "id2"}, filter)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeVpcs"})
- c.Assert(req.Form["VpcId.1"], DeepEquals, []string{"id1"})
- c.Assert(req.Form["VpcId.2"], DeepEquals, []string{"id2"})
- c.Assert(req.Form["VpcId.3"], IsNil)
- c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"})
- c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"})
- c.Assert(req.Form["Filter.1.Value.2"], IsNil)
- c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"})
- c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"})
- c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- c.Assert(resp.VPCs[0].VpcId, Equals, "vpc-1a2b3c4d")
- c.Assert(resp.VPCs, HasLen, 1)
-}
-
-func (s *S) TestCreateVpc(c *C) {
- testServer.Response(200, nil, CreateVpcExample)
-
- resp, err := s.ec2.CreateVpc("foo", "bar")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["CidrBlock"], DeepEquals, []string{"foo"})
- c.Assert(req.Form["InstanceTenancy"], DeepEquals, []string{"bar"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- c.Assert(resp.VPC.VpcId, Equals, "vpc-1a2b3c4d")
- c.Assert(resp.VPC.State, Equals, "pending")
- c.Assert(resp.VPC.CidrBlock, Equals, "10.0.0.0/16")
- c.Assert(resp.VPC.DHCPOptionsID, Equals, "dopt-1a2b3c4d2")
- c.Assert(resp.VPC.InstanceTenancy, Equals, "default")
-}
-
-func (s *S) TestDeleteVpc(c *C) {
- testServer.Response(200, nil, DeleteVpcExample)
-
- resp, err := s.ec2.DeleteVpc("id1")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["VpcId"], DeepEquals, []string{"id1"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestCreateRoute(c *C) {
- testServer.Response(200, nil, CreateRouteExample)
-
- options := ec2.CreateRoute{
- DestinationCidrBlock: "12.34.56.78/90",
- GatewayId: "foo",
- InstanceId: "i-bar",
- NetworkInterfaceId: "foobar",
- VpcPeeringConnectionId: "barfoo",
- }
-
- resp, err := s.ec2.CreateRoute("rtb-deadbeef", &options)
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["RouteTableId"], DeepEquals, []string{"rtb-deadbeef"})
- c.Assert(req.Form["DestinationCidrBlock"], DeepEquals, []string{"12.34.56.78/90"})
- c.Assert(req.Form["GatewayId"], DeepEquals, []string{"foo"})
- c.Assert(req.Form["InstanceId"], DeepEquals, []string{"i-bar"})
- c.Assert(req.Form["NetworkInterfaceId"], DeepEquals, []string{"foobar"})
- c.Assert(req.Form["VpcPeeringConnectionId"], DeepEquals, []string{"barfoo"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "b4998629-3000-437f-b382-cc96fEXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
-
-func (s *S) TestDeleteRoute(c *C) {
- testServer.Response(200, nil, DeleteRouteExample)
-
- resp, err := s.ec2.DeleteRoute("rtb-baddcafe", "foobar")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["RouteTableId"], DeepEquals, []string{"rtb-baddcafe"})
- c.Assert(req.Form["DestinationCidrBlock"], DeepEquals, []string{"foobar"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
- c.Assert(resp.Return, Equals, true)
-}
diff --git a/vendor/github.com/goamz/goamz/ecs/ecs.go b/vendor/github.com/goamz/goamz/ecs/ecs.go
deleted file mode 100644
index 89c7243d4..000000000
--- a/vendor/github.com/goamz/goamz/ecs/ecs.go
+++ /dev/null
@@ -1,1075 +0,0 @@
-//
-// ecs: This package provides types and functions to interact with the AWS EC2 Container Service API
-//
-// Depends on https://github.com/goamz/goamz
-//
-// Author Boyan Dimitrov <boyann@gmail.com>
-//
-
-package ecs
-
-import (
- "encoding/xml"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-const debug = false
-
-var timeNow = time.Now
-
-// ECS contains the details of the AWS region to perform operations against.
-type ECS struct {
- aws.Auth
- aws.Region
-}
-
-// New creates a new ECS Client.
-func New(auth aws.Auth, region aws.Region) *ECS {
- return &ECS{auth, region}
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by the AWS ECS API.
-//
-// See http://goo.gl/VZGuC for more details.
-type Error struct {
- // HTTP status code (200, 403, ...)
- StatusCode int
- // ECS error code ("UnsupportedOperation", ...)
- Code string
- // The error type
- Type string
- // The human-oriented error message
- Message string
- RequestId string `xml:"RequestID"`
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-type xmlErrors struct {
- RequestId string `xml:"RequestId"`
- Errors []Error `xml:"Error"`
-}
-
-func (e *ECS) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2014-11-13"
- data := strings.NewReader(multimap(params).Encode())
-
- hreq, err := http.NewRequest("POST", e.Region.ECSEndpoint+"/", data)
- if err != nil {
- return err
- }
-
- hreq.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
-
- token := e.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(e.Auth, "ecs", e.Region)
- signer.Sign(hreq)
-
- if debug {
- log.Printf("%v -> {\n", hreq)
- }
- r, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- log.Printf("Error calling Amazon %v", err)
- return err
- }
-
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
-
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func addParamsList(params map[string]string, label string, ids []string) {
- for i, id := range ids {
- params[label+"."+strconv.Itoa(i+1)] = id
- }
-}
-
-// ----------------------------------------------------------------------------
-// ECS types and related functions.
-
-// SimpleResp is the beic response from most actions.
-type SimpleResp struct {
- XMLName xml.Name
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// Cluster encapsulates the cluster datatype
-//
-// See
-type Cluster struct {
- ClusterArn string `xml:"clusterArn"`
- ClusterName string `xml:"clusterName"`
- Status string `xml:"status"`
-}
-
-// CreateClusterReq encapsulates the createcluster req params
-type CreateClusterReq struct {
- ClusterName string
-}
-
-// CreateClusterResp encapsulates the createcluster response
-type CreateClusterResp struct {
- Cluster Cluster `xml:"CreateClusterResult>cluster"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// CreateCluster creates a new Amazon ECS cluster. By default, your account
-// will receive a default cluster when you launch your first container instance
-func (e *ECS) CreateCluster(req *CreateClusterReq) (resp *CreateClusterResp, err error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("CreateCluster")
- params["clusterName"] = req.ClusterName
-
- resp = new(CreateClusterResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Resource describes the resources available for a container instance.
-type Resource struct {
- DoubleValue float64 `xml:"doubleValue"`
- IntegerValue int32 `xml:"integerValue"`
- LongValue int64 `xml:"longValue"`
- Name string `xml:"name"`
- StringSetValue []string `xml:"stringSetValue>member"`
- Type string `xml:"type"`
-}
-
-// ContainerInstance represents n Amazon EC2 instance that is running
-// the Amazon ECS agent and has been registered with a cluster
-type ContainerInstance struct {
- AgentConnected bool `xml:"agentConnected"`
- ContainerInstanceArn string `xml:"containerInstanceArn"`
- Ec2InstanceId string `xml:"ec2InstanceId"`
- RegisteredResources []Resource `xml:"registeredResources>member"`
- RemainingResources []Resource `xml:"remainingResources>member"`
- Status string `xml:"status"`
-}
-
-// DeregisterContainerInstanceReq encapsulates DeregisterContainerInstance request params
-type DeregisterContainerInstanceReq struct {
- Cluster string
- // arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.
- ContainerInstance string
- Force bool
-}
-
-// DeregisterContainerInstanceResp encapsulates DeregisterContainerInstance response
-type DeregisterContainerInstanceResp struct {
- ContainerInstance ContainerInstance `xml:"DeregisterContainerInstanceResult>containerInstance"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DeregisterContainerInstance deregisters an Amazon ECS container instance from the specified cluster
-func (e *ECS) DeregisterContainerInstance(req *DeregisterContainerInstanceReq) (
- resp *DeregisterContainerInstanceResp, err error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DeregisterContainerInstance")
- params["containerInstance"] = req.ContainerInstance
- params["force"] = strconv.FormatBool(req.Force)
-
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
-
- resp = new(DeregisterContainerInstanceResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// PortMapping encapsulates the PortMapping data type
-type PortMapping struct {
- ContainerPort int32 `xml:containerPort`
- HostPort int32 `xml:hostPort`
-}
-
-// KeyValuePair encapsulates the KeyValuePair data type
-type KeyValuePair struct {
- Name string `xml:"name"`
- Value string `xml:"value"`
-}
-
-// MountPoint encapsulates the MountPoint data type
-type MountPoint struct {
- ContainerPath string `xml:"containerPath"`
- ReadOnly bool `xml:"readOnly"`
- SourceVolume string `xml:"sourceVolume"`
-}
-
-// VolumeFrom encapsulates the VolumeFrom data type
-type VolumeFrom struct {
- ReadOnly bool `xml:"readOnly"`
- SourceContainer string `xml:"sourceContainer"`
-}
-
-// HostVolumeProperties encapsulates the HostVolumeProperties data type
-type HostVolumeProperties struct {
- SourcePath string `xml:"sourcePath"`
-}
-
-// Volume encapsulates the Volume data type
-type Volume struct {
- Host HostVolumeProperties `xml:"host"`
- Name string `xml:"name"`
-}
-
-// ContainerDefinition encapsulates the container definition type
-// Container definitions are used in task definitions to describe
-// the different containers that are launched as part of a task
-type ContainerDefinition struct {
- Command []string `xml:"command>member"`
- Cpu int32 `xml:"cpu"`
- EntryPoint []string `xml:"entryPoint>member"`
- Environment []KeyValuePair `xml:"environment>member"`
- Essential bool `xml:"essential"`
- Image string `xml:"image"`
- Links []string `xml:"links>member"`
- Memory int32 `xml:"memory"`
- MountPoints []MountPoint `xml:"mountPoints>member"`
- Name string `xml:"name"`
- PortMappings []PortMapping `xml:"portMappings>member"`
- VolumesFrom []VolumeFrom `xml:"volumesFrom>member"`
-}
-
-// TaskDefinition encapsulates the task definition type
-type TaskDefinition struct {
- ContainerDefinitions []ContainerDefinition `xml:"containerDefinitions>member"`
- Family string `xml:"family"`
- Revision int32 `xml:"revision"`
- TaskDefinitionArn string `xml:"taskDefinitionArn"`
- Status string `xml:"status"`
- Volumes []Volume `xml:"volumes>member"`
-}
-
-// DeregisterTaskDefinitionReq encapsulates DeregisterTaskDefinition req params
-type DeregisterTaskDefinitionReq struct {
- TaskDefinition string
-}
-
-// DeregisterTaskDefinitionResp encapsuates the DeregisterTaskDefinition response
-type DeregisterTaskDefinitionResp struct {
- TaskDefinition TaskDefinition `xml:"DeregisterTaskDefinitionResult>taskDefinition"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DeregisterTaskDefinition deregisters the specified task definition
-func (e *ECS) DeregisterTaskDefinition(req *DeregisterTaskDefinitionReq) (
- *DeregisterTaskDefinitionResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DeregisterTaskDefinition")
- params["taskDefinition"] = req.TaskDefinition
-
- resp := new(DeregisterTaskDefinitionResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Failure encapsulates the failure type
-type Failure struct {
- Arn string `xml:"arn"`
- Reason string `xml:"reason"`
-}
-
-// DescribeClustersReq encapsulates DescribeClusters req params
-type DescribeClustersReq struct {
- Clusters []string
-}
-
-// DescribeClustersResp encapsuates the DescribeClusters response
-type DescribeClustersResp struct {
- Clusters []Cluster `xml:"DescribeClustersResult>clusters>member"`
- Failures []Failure `xml:"DescribeClustersResult>failures>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeClusters describes one or more of your clusters
-func (e *ECS) DescribeClusters(req *DescribeClustersReq) (*DescribeClustersResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DescribeClusters")
- if len(req.Clusters) > 0 {
- addParamsList(params, "clusters.member", req.Clusters)
- }
-
- resp := new(DescribeClustersResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeContainerInstancesReq ecapsulates DescribeContainerInstances req params
-type DescribeContainerInstancesReq struct {
- Cluster string
- ContainerInstances []string
-}
-
-// DescribeContainerInstancesResp ecapsulates DescribeContainerInstances response
-type DescribeContainerInstancesResp struct {
- ContainerInstances []ContainerInstance `xml:"DescribeContainerInstancesResult>containerInstances>member"`
- Failures []Failure `xml:"DescribeContainerInstancesResult>failures>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeContainerInstances describes Amazon EC2 Container Service container instances
-// Returns metadata about registered and remaining resources on each container instance requested
-func (e *ECS) DescribeContainerInstances(req *DescribeContainerInstancesReq) (
- *DescribeContainerInstancesResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DescribeContainerInstances")
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if len(req.ContainerInstances) > 0 {
- addParamsList(params, "containerInstances.member", req.ContainerInstances)
- }
-
- resp := new(DescribeContainerInstancesResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DescribeTaskDefinitionReq encapsulates DescribeTaskDefinition req params
-type DescribeTaskDefinitionReq struct {
- TaskDefinition string
-}
-
-// DescribeTaskDefinitionResp encapsuates the DescribeTaskDefinition response
-type DescribeTaskDefinitionResp struct {
- TaskDefinition TaskDefinition `xml:"DescribeTaskDefinitionResult>taskDefinition"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeTaskDefinition describes a task definition
-func (e *ECS) DescribeTaskDefinition(req *DescribeTaskDefinitionReq) (
- *DescribeTaskDefinitionResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DescribeTaskDefinition")
- params["taskDefinition"] = req.TaskDefinition
-
- resp := new(DescribeTaskDefinitionResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// NetworkBinding encapsulates the network binding data type
-type NetworkBinding struct {
- BindIp string `xml:"bindIp"`
- ContainerPort int32 `xml:"containerPort"`
- HostPort int32 `xml:"hostPort"`
-}
-
-// Container encapsulates the container data type
-type Container struct {
- ContainerArn string `xml:"containerArn"`
- ExitCode int32 `xml:"exitCode"`
- LastStatus string `xml:"lastStatus"`
- Name string `xml:"name"`
- NetworkBindings []NetworkBinding `xml:"networkBindings>member"`
- Reason string `xml:"reason"`
- TaskArn string `xml:"taskArn"`
-}
-
-// ContainerOverride encapsulates the container override data type
-type ContainerOverride struct {
- Command []string `xml:"command>member"`
- Environment []KeyValuePair `xml:"environment>member"`
- Name string `xml:"name"`
-}
-
-// TaskOverride encapsulates the task override data type
-type TaskOverride struct {
- ContainerOverrides []ContainerOverride `xml:"containerOverrides>member"`
-}
-
-// Task encapsulates the task data type
-type Task struct {
- ClusterArn string `xml:"clusterArn"`
- ContainerInstanceArn string `xml:"containerInstanceArn"`
- Containers []Container `xml:"containers>member"`
- DesiredStatus string `xml:"desiredStatus"`
- LastStatus string `xml:"lastStatus"`
- Overrides TaskOverride `xml:"overrides"`
- TaskArn string `xml:"taskArn"`
- TaskDefinitionArn string `xml:"taskDefinitionArn"`
-}
-
-// DescribeTasksReq encapsulates DescribeTasks req params
-type DescribeTasksReq struct {
- Cluster string
- Tasks []string
-}
-
-// DescribeTasksResp encapsuates the DescribeTasks response
-type DescribeTasksResp struct {
- Tasks []Task `xml:"DescribeTasksResult>tasks>member"`
- Failures []Failure `xml:"DescribeTasksResult>failures>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeTasks describes a task definition
-func (e *ECS) DescribeTasks(req *DescribeTasksReq) (*DescribeTasksResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DescribeTasks")
- if len(req.Tasks) > 0 {
- addParamsList(params, "tasks.member", req.Tasks)
- }
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
-
- resp := new(DescribeTasksResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DiscoverPollEndpointReq encapsulates DiscoverPollEndpoint req params
-type DiscoverPollEndpointReq struct {
- ContainerInstance string
-}
-
-// DiscoverPollEndpointResp encapsuates the DiscoverPollEndpoint response
-type DiscoverPollEndpointResp struct {
- Endpoint string `xml:"DiscoverPollEndpointResult>endpoint"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DiscoverPollEndpoint returns an endpoint for the Amazon EC2 Container Service agent
-// to poll for updates
-func (e *ECS) DiscoverPollEndpoint(req *DiscoverPollEndpointReq) (
- *DiscoverPollEndpointResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("DiscoverPollEndpoint")
- if req.ContainerInstance != "" {
- params["containerInstance"] = req.ContainerInstance
- }
-
- resp := new(DiscoverPollEndpointResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ListClustersReq encapsulates ListClusters req params
-type ListClustersReq struct {
- MaxResults int32
- NextToken string
-}
-
-// ListClustersResp encapsuates the ListClusters response
-type ListClustersResp struct {
- ClusterArns []string `xml:"ListClustersResult>clusterArns>member"`
- NextToken string `xml:"ListClustersResult>nextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListClusters returns a list of existing clusters
-func (e *ECS) ListClusters(req *ListClustersReq) (
- *ListClustersResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("ListClusters")
- if req.MaxResults > 0 {
- params["maxResults"] = strconv.Itoa(int(req.MaxResults))
- }
- if req.NextToken != "" {
- params["nextToken"] = req.NextToken
- }
-
- resp := new(ListClustersResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ListContainerInstancesReq encapsulates ListContainerInstances req params
-type ListContainerInstancesReq struct {
- Cluster string
- MaxResults int32
- NextToken string
-}
-
-// ListContainerInstancesResp encapsuates the ListContainerInstances response
-type ListContainerInstancesResp struct {
- ContainerInstanceArns []string `xml:"ListContainerInstancesResult>containerInstanceArns>member"`
- NextToken string `xml:"ListContainerInstancesResult>nextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListContainerInstances returns a list of container instances in a specified cluster.
-func (e *ECS) ListContainerInstances(req *ListContainerInstancesReq) (
- *ListContainerInstancesResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("ListContainerInstances")
- if req.MaxResults > 0 {
- params["maxResults"] = strconv.Itoa(int(req.MaxResults))
- }
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.NextToken != "" {
- params["nextToken"] = req.NextToken
- }
-
- resp := new(ListContainerInstancesResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ListTaskDefinitionsReq encapsulates ListTaskDefinitions req params
-type ListTaskDefinitionsReq struct {
- FamilyPrefix string
- MaxResults int32
- NextToken string
-}
-
-// ListTaskDefinitionsResp encapsuates the ListTaskDefinitions response
-type ListTaskDefinitionsResp struct {
- TaskDefinitionArns []string `xml:"ListTaskDefinitionsResult>taskDefinitionArns>member"`
- NextToken string `xml:"ListTaskDefinitionsResult>nextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListTaskDefinitions Returns a list of task definitions that are registered to your account.
-func (e *ECS) ListTaskDefinitions(req *ListTaskDefinitionsReq) (
- *ListTaskDefinitionsResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("ListTaskDefinitions")
- if req.MaxResults > 0 {
- params["maxResults"] = strconv.Itoa(int(req.MaxResults))
- }
- if req.FamilyPrefix != "" {
- params["familyPrefix"] = req.FamilyPrefix
- }
- if req.NextToken != "" {
- params["nextToken"] = req.NextToken
- }
-
- resp := new(ListTaskDefinitionsResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ListTasksReq encapsulates ListTasks req params
-type ListTasksReq struct {
- Cluster string
- ContainerInstance string
- Family string
- MaxResults int32
- NextToken string
-}
-
-// ListTasksResp encapsuates the ListTasks response
-type ListTasksResp struct {
- TaskArns []string `xml:"ListTasksResult>taskArns>member"`
- NextToken string `xml:"ListTasksResult>nextToken"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListTasks Returns a list of tasks for a specified cluster.
-// You can filter the results by family name or by a particular container instance
-// with the family and containerInstance parameters.
-func (e *ECS) ListTasks(req *ListTasksReq) (
- *ListTasksResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("ListTasks")
- if req.MaxResults > 0 {
- params["maxResults"] = strconv.Itoa(int(req.MaxResults))
- }
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.ContainerInstance != "" {
- params["containerInstance"] = req.ContainerInstance
- }
- if req.Family != "" {
- params["family"] = req.Family
- }
- if req.NextToken != "" {
- params["nextToken"] = req.NextToken
- }
-
- resp := new(ListTasksResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// RegisterContainerInstanceReq encapsulates RegisterContainerInstance req params
-type RegisterContainerInstanceReq struct {
- Cluster string
- InstanceIdentityDocument string
- InstanceIdentityDocumentSignature string
- TotalResources []Resource
-}
-
-// DeregisterContainerInstanceResp encapsulates RegisterContainerInstance response
-type RegisterContainerInstanceResp struct {
- ContainerInstance ContainerInstance `xml:"RegisterContainerInstanceResult>containerInstance"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// RegisterContainerInstance registers an Amazon EC2 instance into the specified cluster.
-// This instance will become available to place containers on.
-func (e *ECS) RegisterContainerInstance(req *RegisterContainerInstanceReq) (
- resp *RegisterContainerInstanceResp, err error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("RegisterContainerInstance")
- if req.InstanceIdentityDocument != "" {
- params["instanceIdentityDocument"] = req.InstanceIdentityDocument
- }
- if req.InstanceIdentityDocumentSignature != "" {
- params["instanceIdentityDocumentSignature"] = req.InstanceIdentityDocumentSignature
- }
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- // Marshal Resources
- for i, r := range req.TotalResources {
- key := fmt.Sprintf("totalResources.member.%d", i+1)
- params[fmt.Sprintf("%s.doubleValue", key)] = strconv.FormatFloat(r.DoubleValue, 'f', 1, 64)
- params[fmt.Sprintf("%s.integerValue", key)] = strconv.Itoa(int(r.IntegerValue))
- params[fmt.Sprintf("%s.longValue", key)] = strconv.Itoa(int(r.LongValue))
- params[fmt.Sprintf("%s.name", key)] = r.Name
- params[fmt.Sprintf("%s.type", key)] = r.Type
- for k, sv := range r.StringSetValue {
- params[fmt.Sprintf("%s.stringSetValue.member.%d", key, k+1)] = sv
- }
- }
-
- resp = new(RegisterContainerInstanceResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// RegisterTaskDefinitionReq encapsulates RegisterTaskDefinition req params
-type RegisterTaskDefinitionReq struct {
- Family string
- ContainerDefinitions []ContainerDefinition
- Volumes []Volume
-}
-
-// RegisterTaskDefinitionResp encapsulates RegisterTaskDefinition response
-type RegisterTaskDefinitionResp struct {
- TaskDefinition TaskDefinition `xml:"RegisterTaskDefinitionResult>taskDefinition"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// RegisterTaskDefinition registers a new task definition from the supplied family and containerDefinitions.
-func (e *ECS) RegisterTaskDefinition(req *RegisterTaskDefinitionReq) (
- resp *RegisterTaskDefinitionResp, err error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
- params := makeParams("RegisterTaskDefinition")
- if req.Family != "" {
- params["family"] = req.Family
- }
-
- // Marshal Container Definitions
- for i, c := range req.ContainerDefinitions {
- key := fmt.Sprintf("containerDefinitions.member.%d", i+1)
- params[fmt.Sprintf("%s.cpu", key)] = strconv.Itoa(int(c.Cpu))
- params[fmt.Sprintf("%s.essential", key)] = strconv.FormatBool(c.Essential)
- params[fmt.Sprintf("%s.image", key)] = c.Image
- params[fmt.Sprintf("%s.memory", key)] = strconv.Itoa(int(c.Memory))
- params[fmt.Sprintf("%s.name", key)] = c.Name
-
- for k, cmd := range c.Command {
- params[fmt.Sprintf("%s.command.member.%d", key, k+1)] = cmd
- }
- for k, ep := range c.EntryPoint {
- params[fmt.Sprintf("%s.entryPoint.member.%d", key, k+1)] = ep
- }
- for k, env := range c.Environment {
- params[fmt.Sprintf("%s.environment.member.%d.name", key, k+1)] = env.Name
- params[fmt.Sprintf("%s.environment.member.%d.value", key, k+1)] = env.Value
- }
- for k, l := range c.Links {
- params[fmt.Sprintf("%s.links.member.%d", key, k+1)] = l
- }
- for k, p := range c.PortMappings {
- params[fmt.Sprintf("%s.portMappings.member.%d.containerPort", key, k+1)] = strconv.Itoa(int(p.ContainerPort))
- params[fmt.Sprintf("%s.portMappings.member.%d.hostPort", key, k+1)] = strconv.Itoa(int(p.HostPort))
- }
- for k, m := range c.MountPoints {
- params[fmt.Sprintf("%s.mountPoints.member.%d.containerPath", key, k+1)] = m.ContainerPath
- params[fmt.Sprintf("%s.mountPoints.member.%d.readOnly", key, k+1)] = strconv.FormatBool(m.ReadOnly)
- params[fmt.Sprintf("%s.mountPoints.member.%d.sourceVolume", key, k+1)] = m.SourceVolume
- }
- for k, v := range c.VolumesFrom {
- params[fmt.Sprintf("%s.volumesFrom.member.%d.readOnly", key, k+1)] = strconv.FormatBool(v.ReadOnly)
- params[fmt.Sprintf("%s.volumesFrom.member.%d.sourceContainer", key, k+1)] = v.SourceContainer
- }
- }
-
- for k, v := range req.Volumes {
- params[fmt.Sprintf("volumes.member.%d.name", k+1)] = v.Name
- params[fmt.Sprintf("volumes.member.%d.host.sourcePath", k+1)] = v.Host.SourcePath
- }
-
- resp = new(RegisterTaskDefinitionResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// RunTaskReq encapsulates RunTask req params
-type RunTaskReq struct {
- Cluster string
- Count int32
- Overrides TaskOverride
- TaskDefinition string
-}
-
-// RunTaskResp encapsuates the RunTask response
-type RunTaskResp struct {
- Tasks []Task `xml:"RunTaskResult>tasks>member"`
- Failures []Failure `xml:"RunTaskResult>failures>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// RunTask Start a task using random placement and the default Amazon ECS scheduler.
-// If you want to use your own scheduler or place a task on a specific container instance,
-// use StartTask instead.
-func (e *ECS) RunTask(req *RunTaskReq) (*RunTaskResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("RunTask")
- if req.Count > 0 {
- params["count"] = strconv.Itoa(int(req.Count))
- }
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.TaskDefinition != "" {
- params["taskDefinition"] = req.TaskDefinition
- }
-
- for i, co := range req.Overrides.ContainerOverrides {
- key := fmt.Sprintf("overrides.containerOverrides.member.%d", i+1)
- params[fmt.Sprintf("%s.name", key)] = co.Name
- for k, cmd := range co.Command {
- params[fmt.Sprintf("%s.command.member.%d", key, k+1)] = cmd
- }
- for k, env := range co.Environment {
- params[fmt.Sprintf("%s.environment.member.%d.name", key, k+1)] = env.Name
- params[fmt.Sprintf("%s.environment.member.%d.value", key, k+1)] = env.Value
- }
- }
-
- resp := new(RunTaskResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StartTaskReq encapsulates StartTask req params
-type StartTaskReq struct {
- Cluster string
- ContainerInstances []string
- Overrides TaskOverride
- TaskDefinition string
-}
-
-// StartTaskResp encapsuates the StartTask response
-type StartTaskResp struct {
- Tasks []Task `xml:"StartTaskResult>tasks>member"`
- Failures []Failure `xml:"StartTaskResult>failures>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// StartTask Starts a new task from the specified task definition on the specified
-// container instance or instances. If you want to use the default Amazon ECS scheduler
-// to place your task, use RunTask instead.
-func (e *ECS) StartTask(req *StartTaskReq) (*StartTaskResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("StartTask")
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.TaskDefinition != "" {
- params["taskDefinition"] = req.TaskDefinition
- }
- for i, ci := range req.ContainerInstances {
- params[fmt.Sprintf("containerInstances.member.%d", i+1)] = ci
- }
- for i, co := range req.Overrides.ContainerOverrides {
- key := fmt.Sprintf("overrides.containerOverrides.member.%d", i+1)
- params[fmt.Sprintf("%s.name", key)] = co.Name
- for k, cmd := range co.Command {
- params[fmt.Sprintf("%s.command.member.%d", key, k+1)] = cmd
- }
- }
-
- resp := new(StartTaskResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// StopTaskReq encapsulates StopTask req params
-type StopTaskReq struct {
- Cluster string
- Task string
-}
-
-// StopTaskResp encapsuates the StopTask response
-type StopTaskResp struct {
- Task Task `xml:"StopTaskResult>task"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// StopTask stops a running task
-func (e *ECS) StopTask(req *StopTaskReq) (*StopTaskResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("StopTask")
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.Task != "" {
- params["task"] = req.Task
- }
-
- resp := new(StopTaskResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SubmitContainerStateChangeReq encapsulates SubmitContainerStateChange req params
-type SubmitContainerStateChangeReq struct {
- Cluster string
- ContainerName string
- ExitCode int32
- NetworkBindings []NetworkBinding
- Reason string
- Status string
- Task string
-}
-
-// SubmitContainerStateChangeResp encapsuates the SubmitContainerStateChange response
-type SubmitContainerStateChangeResp struct {
- Acknowledgment string `xml:"SubmitContainerStateChangeResult>acknowledgment"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// SubmitContainerStateChange is used to acknowledge that a container changed states.
-// Note: This action is only used by the Amazon EC2 Container Service agent,
-// and it is not intended for use outside of the agent.
-func (e *ECS) SubmitContainerStateChange(req *SubmitContainerStateChangeReq) (
- *SubmitContainerStateChangeResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("SubmitContainerStateChange")
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
- if req.ContainerName != "" {
- params["containerName"] = req.ContainerName
- }
- if req.Reason != "" {
- params["reason"] = req.Reason
- }
- if req.Status != "" {
- params["status"] = req.Status
- }
- if req.Task != "" {
- params["task"] = req.Task
- }
- for i, nb := range req.NetworkBindings {
- key := fmt.Sprintf("networkBindings.member.%d", i+1)
- params[fmt.Sprintf("%s.bindIp", key)] = nb.BindIp
- params[fmt.Sprintf("%s.containerPort", key)] = strconv.Itoa(int(nb.ContainerPort))
- params[fmt.Sprintf("%s.hostPort", key)] = strconv.Itoa(int(nb.HostPort))
- }
- params["exitCode"] = strconv.Itoa(int(req.ExitCode))
-
- resp := new(SubmitContainerStateChangeResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// SubmitTaskStateChangeReq encapsulates SubmitTaskStateChange req params
-type SubmitTaskStateChangeReq struct {
- Cluster string
- Reason string
- Status string
- Task string
-}
-
-// SubmitTaskStateChangeResp encapsuates the SubmitTaskStateChange response
-type SubmitTaskStateChangeResp struct {
- Acknowledgment string `xml:"SubmitTaskStateChangeResult>acknowledgment"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// SubmitTaskStateChange is used to acknowledge that a task changed states.
-// Note: This action is only used by the Amazon EC2 Container Service agent,
-// and it is not intended for use outside of the agent.
-func (e *ECS) SubmitTaskStateChange(req *SubmitTaskStateChangeReq) (
- *SubmitTaskStateChangeResp, error) {
- if req == nil {
- return nil, fmt.Errorf("The req params cannot be nil")
- }
-
- params := makeParams("SubmitTaskStateChange")
- if req.Cluster != "" {
- params["cluster"] = req.Cluster
- }
-
- if req.Reason != "" {
- params["reason"] = req.Reason
- }
- if req.Status != "" {
- params["status"] = req.Status
- }
- if req.Task != "" {
- params["task"] = req.Task
- }
-
- resp := new(SubmitTaskStateChangeResp)
- if err := e.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
diff --git a/vendor/github.com/goamz/goamz/ecs/ecs_test.go b/vendor/github.com/goamz/goamz/ecs/ecs_test.go
deleted file mode 100644
index 7fe4a74ae..000000000
--- a/vendor/github.com/goamz/goamz/ecs/ecs_test.go
+++ /dev/null
@@ -1,806 +0,0 @@
-package ecs
-
-import (
- "testing"
-
- . "gopkg.in/check.v1"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/testutil"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- ecs *ECS
-}
-
-var testServer = testutil.NewHTTPServer()
-
-var mockTest bool
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.ecs = New(auth, aws.Region{ECSEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-// --------------------------------------------------------------------------
-// Detailed Unit Tests
-
-func (s *S) TestCreateCluster(c *C) {
- testServer.Response(200, nil, CreateClusterResponse)
- req := &CreateClusterReq{
- ClusterName: "default",
- }
- resp, err := s.ecs.CreateCluster(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "CreateCluster")
- c.Assert(values.Get("clusterName"), Equals, "default")
-
- c.Assert(resp.Cluster.ClusterArn, Equals, "arn:aws:ecs:region:aws_account_id:cluster/default")
- c.Assert(resp.Cluster.ClusterName, Equals, "default")
- c.Assert(resp.Cluster.Status, Equals, "ACTIVE")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDeregisterContainerInstance(c *C) {
- testServer.Response(200, nil, DeregisterContainerInstanceResponse)
- req := &DeregisterContainerInstanceReq{
- Cluster: "default",
- ContainerInstance: "uuid",
- Force: true,
- }
- resp, err := s.ecs.DeregisterContainerInstance(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DeregisterContainerInstance")
- c.Assert(values.Get("cluster"), Equals, "default")
- c.Assert(values.Get("containerInstance"), Equals, "uuid")
- c.Assert(values.Get("force"), Equals, "true")
-
- expectedResource := []Resource{
- {
- DoubleValue: 0.0,
- IntegerValue: 2048,
- LongValue: 0,
- Name: "CPU",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 3955,
- LongValue: 0,
- Name: "MEMORY",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 0,
- LongValue: 0,
- Name: "PORTS",
- StringSetValue: []string{"2376", "22", "51678", "2375"},
- Type: "STRINGSET",
- },
- }
-
- c.Assert(resp.ContainerInstance.AgentConnected, Equals, false)
- c.Assert(resp.ContainerInstance.ContainerInstanceArn, Equals, "arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID")
- c.Assert(resp.ContainerInstance.Status, Equals, "INACTIVE")
- c.Assert(resp.ContainerInstance.Ec2InstanceId, Equals, "instance_id")
- c.Assert(resp.ContainerInstance.RegisteredResources, DeepEquals, expectedResource)
- c.Assert(resp.ContainerInstance.RemainingResources, DeepEquals, expectedResource)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDeregisterTaskDefinition(c *C) {
- testServer.Response(200, nil, DeregisterTaskDefinitionResponse)
- req := &DeregisterTaskDefinitionReq{
- TaskDefinition: "sleep360:2",
- }
- resp, err := s.ecs.DeregisterTaskDefinition(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DeregisterTaskDefinition")
- c.Assert(values.Get("taskDefinition"), Equals, "sleep360:2")
-
- expected := TaskDefinition{
- Family: "sleep360",
- Revision: 2,
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- ContainerDefinitions: []ContainerDefinition{
- {
- Command: []string{"sleep", "360"},
- Cpu: 10,
- EntryPoint: []string{"/bin/sh"},
- Environment: []KeyValuePair{
- {
- Name: "envVar",
- Value: "foo",
- },
- },
- Essential: true,
- Image: "busybox",
- Memory: 10,
- Name: "sleep",
- },
- },
- }
-
- c.Assert(resp.TaskDefinition, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDescribeClusters(c *C) {
- testServer.Response(200, nil, DescribeClustersResponse)
- req := &DescribeClustersReq{
- Clusters: []string{"test", "default"},
- }
- resp, err := s.ecs.DescribeClusters(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DescribeClusters")
- c.Assert(values.Get("clusters.member.1"), Equals, "test")
- c.Assert(values.Get("clusters.member.2"), Equals, "default")
-
- expected := []Cluster{
- {
- ClusterName: "test",
- ClusterArn: "arn:aws:ecs:us-east-1:aws_account_id:cluster/test",
- Status: "ACTIVE",
- },
- {
- ClusterName: "default",
- ClusterArn: "arn:aws:ecs:us-east-1:aws_account_id:cluster/default",
- Status: "ACTIVE",
- },
- }
-
- c.Assert(resp.Clusters, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDescribeContainerInstances(c *C) {
- testServer.Response(200, nil, DescribeContainerInstancesResponse)
- req := &DescribeContainerInstancesReq{
- Cluster: "test",
- ContainerInstances: []string{"arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID"},
- }
- resp, err := s.ecs.DescribeContainerInstances(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DescribeContainerInstances")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("containerInstances.member.1"),
- Equals, "arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID")
-
- expected := []ContainerInstance{
- ContainerInstance{
- AgentConnected: true,
- ContainerInstanceArn: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID",
- Status: "ACTIVE",
- Ec2InstanceId: "instance_id",
- RegisteredResources: []Resource{
- {
- DoubleValue: 0.0,
- IntegerValue: 2048,
- LongValue: 0,
- Name: "CPU",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 3955,
- LongValue: 0,
- Name: "MEMORY",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 0,
- LongValue: 0,
- Name: "PORTS",
- StringSetValue: []string{"2376", "22", "51678", "2375"},
- Type: "STRINGSET",
- },
- },
- RemainingResources: []Resource{
- {
- DoubleValue: 0.0,
- IntegerValue: 2048,
- LongValue: 0,
- Name: "CPU",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 3955,
- LongValue: 0,
- Name: "MEMORY",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 0,
- LongValue: 0,
- Name: "PORTS",
- StringSetValue: []string{"2376", "22", "51678", "2375"},
- Type: "STRINGSET",
- },
- },
- },
- }
-
- c.Assert(resp.ContainerInstances, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDescribeTaskDefinition(c *C) {
- testServer.Response(200, nil, DescribeTaskDefinitionResponse)
- req := &DescribeTaskDefinitionReq{
- TaskDefinition: "sleep360:2",
- }
- resp, err := s.ecs.DescribeTaskDefinition(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DescribeTaskDefinition")
- c.Assert(values.Get("taskDefinition"), Equals, "sleep360:2")
-
- expected := TaskDefinition{
- Family: "sleep360",
- Revision: 2,
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- ContainerDefinitions: []ContainerDefinition{
- {
- Command: []string{"sleep", "360"},
- Cpu: 10,
- EntryPoint: []string{"/bin/sh"},
- Environment: []KeyValuePair{
- {
- Name: "envVar",
- Value: "foo",
- },
- },
- Essential: true,
- Image: "busybox",
- Memory: 10,
- Name: "sleep",
- },
- },
- }
-
- c.Assert(resp.TaskDefinition, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDescribeTasks(c *C) {
- testServer.Response(200, nil, DescribeTasksResponse)
- req := &DescribeTasksReq{
- Cluster: "test",
- Tasks: []string{"arn:aws:ecs:us-east-1:aws_account_id:task/UUID"},
- }
- resp, err := s.ecs.DescribeTasks(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DescribeTasks")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("tasks.member.1"),
- Equals, "arn:aws:ecs:us-east-1:aws_account_id:task/UUID")
-
- expected := []Task{
- Task{
- Containers: []Container{
- {
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- Name: "sleep",
- ContainerArn: "arn:aws:ecs:us-east-1:aws_account_id:container/UUID",
- LastStatus: "RUNNING",
- },
- },
- Overrides: TaskOverride{
- ContainerOverrides: []ContainerOverride{
- {
- Name: "sleep",
- },
- },
- },
- DesiredStatus: "RUNNING",
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- ContainerInstanceArn: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID",
- LastStatus: "RUNNING",
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- },
- }
-
- c.Assert(resp.Tasks, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestDiscoverPollEndpoint(c *C) {
- testServer.Response(200, nil, DiscoverPollEndpointResponse)
- req := &DiscoverPollEndpointReq{
- ContainerInstance: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID",
- }
- resp, err := s.ecs.DiscoverPollEndpoint(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "DiscoverPollEndpoint")
- c.Assert(values.Get("containerInstance"),
- Equals, "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID")
-
- c.Assert(resp.Endpoint, Equals, "https://ecs-x-1.us-east-1.amazonaws.com/")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestListClusters(c *C) {
- testServer.Response(200, nil, ListClustersResponse)
- req := &ListClustersReq{
- MaxResults: 2,
- NextToken: "Token_UUID",
- }
- resp, err := s.ecs.ListClusters(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "ListClusters")
- c.Assert(values.Get("maxResults"), Equals, "2")
- c.Assert(values.Get("nextToken"), Equals, "Token_UUID")
-
- c.Assert(resp.ClusterArns, DeepEquals, []string{"arn:aws:ecs:us-east-1:aws_account_id:cluster/default",
- "arn:aws:ecs:us-east-1:aws_account_id:cluster/test"})
- c.Assert(resp.NextToken, Equals, "token_UUID")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestListContainerInstances(c *C) {
- testServer.Response(200, nil, ListContainerInstancesResponse)
- req := &ListContainerInstancesReq{
- MaxResults: 2,
- NextToken: "Token_UUID",
- Cluster: "test",
- }
- resp, err := s.ecs.ListContainerInstances(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "ListContainerInstances")
- c.Assert(values.Get("maxResults"), Equals, "2")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("nextToken"), Equals, "Token_UUID")
-
- c.Assert(resp.ContainerInstanceArns, DeepEquals, []string{
- "arn:aws:ecs:us-east-1:aws_account_id:container-instance/uuid-1",
- "arn:aws:ecs:us-east-1:aws_account_id:container-instance/uuid-2"})
- c.Assert(resp.NextToken, Equals, "token_UUID")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestListTaskDefinitions(c *C) {
- testServer.Response(200, nil, ListTaskDefinitionsResponse)
- req := &ListTaskDefinitionsReq{
- MaxResults: 2,
- NextToken: "Token_UUID",
- FamilyPrefix: "sleep360",
- }
- resp, err := s.ecs.ListTaskDefinitions(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "ListTaskDefinitions")
- c.Assert(values.Get("maxResults"), Equals, "2")
- c.Assert(values.Get("familyPrefix"), Equals, "sleep360")
- c.Assert(values.Get("nextToken"), Equals, "Token_UUID")
-
- c.Assert(resp.TaskDefinitionArns, DeepEquals, []string{
- "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:1",
- "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2"})
- c.Assert(resp.NextToken, Equals, "token_UUID")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestListTasks(c *C) {
- testServer.Response(200, nil, ListTasksResponse)
- req := &ListTasksReq{
- MaxResults: 2,
- NextToken: "Token_UUID",
- Family: "sleep360",
- Cluster: "test",
- ContainerInstance: "container_uuid",
- }
- resp, err := s.ecs.ListTasks(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "ListTasks")
- c.Assert(values.Get("maxResults"), Equals, "2")
- c.Assert(values.Get("family"), Equals, "sleep360")
- c.Assert(values.Get("containerInstance"), Equals, "container_uuid")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("nextToken"), Equals, "Token_UUID")
-
- c.Assert(resp.TaskArns, DeepEquals, []string{
- "arn:aws:ecs:us-east-1:aws_account_id:task/uuid_1",
- "arn:aws:ecs:us-east-1:aws_account_id:task/uuid_2"})
- c.Assert(resp.NextToken, Equals, "token_UUID")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestRegisterContainerInstance(c *C) {
- testServer.Response(200, nil, RegisterContainerInstanceResponse)
-
- resources := []Resource{
- {
- DoubleValue: 0.0,
- IntegerValue: 2048,
- LongValue: 0,
- Name: "CPU",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 3955,
- LongValue: 0,
- Name: "MEMORY",
- Type: "INTEGER",
- },
- {
- DoubleValue: 0.0,
- IntegerValue: 0,
- LongValue: 0,
- Name: "PORTS",
- StringSetValue: []string{"2376", "22", "51678", "2375"},
- Type: "STRINGSET",
- },
- }
-
- req := &RegisterContainerInstanceReq{
- Cluster: "default",
- InstanceIdentityDocument: "foo",
- InstanceIdentityDocumentSignature: "baz",
- TotalResources: resources,
- }
-
- resp, err := s.ecs.RegisterContainerInstance(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "RegisterContainerInstance")
- c.Assert(values.Get("cluster"), Equals, "default")
- c.Assert(values.Get("instanceIdentityDocument"), Equals, "foo")
- c.Assert(values.Get("instanceIdentityDocumentSignature"), Equals, "baz")
- c.Assert(values.Get("totalResources.member.1.doubleValue"), Equals, "0.0")
- c.Assert(values.Get("totalResources.member.1.integerValue"), Equals, "2048")
- c.Assert(values.Get("totalResources.member.1.longValue"), Equals, "0")
- c.Assert(values.Get("totalResources.member.1.name"), Equals, "CPU")
- c.Assert(values.Get("totalResources.member.1.type"), Equals, "INTEGER")
- c.Assert(values.Get("totalResources.member.2.doubleValue"), Equals, "0.0")
- c.Assert(values.Get("totalResources.member.2.integerValue"), Equals, "3955")
- c.Assert(values.Get("totalResources.member.2.longValue"), Equals, "0")
- c.Assert(values.Get("totalResources.member.2.name"), Equals, "MEMORY")
- c.Assert(values.Get("totalResources.member.2.type"), Equals, "INTEGER")
- c.Assert(values.Get("totalResources.member.3.doubleValue"), Equals, "0.0")
- c.Assert(values.Get("totalResources.member.3.integerValue"), Equals, "0")
- c.Assert(values.Get("totalResources.member.3.longValue"), Equals, "0")
- c.Assert(values.Get("totalResources.member.3.name"), Equals, "PORTS")
- c.Assert(values.Get("totalResources.member.3.stringSetValue.member.1"), Equals, "2376")
- c.Assert(values.Get("totalResources.member.3.stringSetValue.member.2"), Equals, "22")
- c.Assert(values.Get("totalResources.member.3.stringSetValue.member.3"), Equals, "51678")
- c.Assert(values.Get("totalResources.member.3.stringSetValue.member.4"), Equals, "2375")
- c.Assert(values.Get("totalResources.member.3.type"), Equals, "STRINGSET")
-
- c.Assert(resp.ContainerInstance.AgentConnected, Equals, true)
- c.Assert(resp.ContainerInstance.ContainerInstanceArn, Equals, "arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID")
- c.Assert(resp.ContainerInstance.Status, Equals, "ACTIVE")
- c.Assert(resp.ContainerInstance.Ec2InstanceId, Equals, "instance_id")
- c.Assert(resp.ContainerInstance.RegisteredResources, DeepEquals, resources)
- c.Assert(resp.ContainerInstance.RemainingResources, DeepEquals, resources)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestRegisterTaskDefinition(c *C) {
- testServer.Response(200, nil, RegisterTaskDefinitionResponse)
-
- CDefinitions := []ContainerDefinition{
- {
- Command: []string{"sleep", "360"},
- Cpu: 10,
- EntryPoint: []string{"/bin/sh"},
- Environment: []KeyValuePair{
- {
- Name: "envVar",
- Value: "foo",
- },
- },
- Essential: true,
- Image: "busybox",
- Memory: 10,
- Name: "sleep",
- MountPoints: []MountPoint{
- {
- ContainerPath: "/tmp/myfile",
- ReadOnly: false,
- SourceVolume: "/srv/myfile",
- },
- {
- ContainerPath: "/tmp/myfile2",
- ReadOnly: true,
- SourceVolume: "/srv/myfile2",
- },
- },
- VolumesFrom: []VolumeFrom{
- {
- ReadOnly: true,
- SourceContainer: "foo",
- },
- },
- },
- }
-
- req := &RegisterTaskDefinitionReq{
- Family: "sleep360",
- ContainerDefinitions: CDefinitions,
- Volumes: []Volume{
- {
- Name: "/srv/myfile",
- Host: HostVolumeProperties{
- SourcePath: "/srv/myfile",
- },
- },
- },
- }
- resp, err := s.ecs.RegisterTaskDefinition(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "RegisterTaskDefinition")
- c.Assert(values.Get("containerDefinitions.member.1.command.member.1"), Equals, "sleep")
- c.Assert(values.Get("containerDefinitions.member.1.command.member.2"), Equals, "360")
- c.Assert(values.Get("containerDefinitions.member.1.cpu"), Equals, "10")
- c.Assert(values.Get("containerDefinitions.member.1.memory"), Equals, "10")
- c.Assert(values.Get("containerDefinitions.member.1.entryPoint.member.1"), Equals, "/bin/sh")
- c.Assert(values.Get("containerDefinitions.member.1.environment.member.1.name"), Equals, "envVar")
- c.Assert(values.Get("containerDefinitions.member.1.environment.member.1.value"), Equals, "foo")
- c.Assert(values.Get("containerDefinitions.member.1.essential"), Equals, "true")
- c.Assert(values.Get("containerDefinitions.member.1.image"), Equals, "busybox")
- c.Assert(values.Get("containerDefinitions.member.1.memory"), Equals, "10")
- c.Assert(values.Get("containerDefinitions.member.1.name"), Equals, "sleep")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.1.containerPath"), Equals, "/tmp/myfile")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.1.readOnly"), Equals, "false")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.1.sourceVolume"), Equals, "/srv/myfile")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.2.containerPath"), Equals, "/tmp/myfile2")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.2.readOnly"), Equals, "true")
- c.Assert(values.Get("containerDefinitions.member.1.mountPoints.member.2.sourceVolume"), Equals, "/srv/myfile2")
- c.Assert(values.Get("containerDefinitions.member.1.volumesFrom.member.1.readOnly"), Equals, "true")
- c.Assert(values.Get("containerDefinitions.member.1.volumesFrom.member.1.sourceContainer"), Equals, "foo")
-
- c.Assert(values.Get("family"), Equals, "sleep360")
- c.Assert(values.Get("volumes.member.1.name"), Equals, "/srv/myfile")
- c.Assert(values.Get("volumes.member.1.host.sourcePath"), Equals, "/srv/myfile")
-
- expected := TaskDefinition{
- Family: "sleep360",
- Revision: 2,
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- ContainerDefinitions: CDefinitions,
- Volumes: []Volume{
- {
- Name: "/srv/myfile",
- Host: HostVolumeProperties{
- SourcePath: "/srv/myfile",
- },
- },
- },
- }
-
- c.Assert(resp.TaskDefinition, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestRunTask(c *C) {
- testServer.Response(200, nil, RunTaskResponse)
- req := &RunTaskReq{
- Cluster: "test",
- Count: 1,
- TaskDefinition: "sleep360:2",
- }
- resp, err := s.ecs.RunTask(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "RunTask")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("count"), Equals, "1")
- c.Assert(values.Get("taskDefinition"), Equals, "sleep360:2")
-
- expected := []Task{
- Task{
- Containers: []Container{
- {
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- Name: "sleep",
- ContainerArn: "arn:aws:ecs:us-east-1:aws_account_id:container/UUID",
- LastStatus: "RUNNING",
- },
- },
- Overrides: TaskOverride{
- ContainerOverrides: []ContainerOverride{
- {
- Name: "sleep",
- },
- },
- },
- DesiredStatus: "RUNNING",
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- ContainerInstanceArn: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID",
- LastStatus: "PENDING",
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- },
- }
-
- c.Assert(resp.Tasks, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestStartTask(c *C) {
- testServer.Response(200, nil, StartTaskResponse)
- req := &StartTaskReq{
- Cluster: "test",
- ContainerInstances: []string{"containerUUID"},
- TaskDefinition: "sleep360:2",
- }
- resp, err := s.ecs.StartTask(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "StartTask")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("taskDefinition"), Equals, "sleep360:2")
- c.Assert(values.Get("containerInstances.member.1"), Equals, "containerUUID")
-
- expected := []Task{
- Task{
- Containers: []Container{
- {
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- Name: "sleep",
- ContainerArn: "arn:aws:ecs:us-east-1:aws_account_id:container/UUID",
- LastStatus: "RUNNING",
- },
- },
- Overrides: TaskOverride{
- ContainerOverrides: []ContainerOverride{
- {
- Name: "sleep",
- },
- },
- },
- DesiredStatus: "RUNNING",
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- ContainerInstanceArn: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID",
- LastStatus: "PENDING",
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- },
- }
-
- c.Assert(resp.Tasks, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestStopTask(c *C) {
- testServer.Response(200, nil, StopTaskResponse)
- req := &StopTaskReq{
- Cluster: "test",
- Task: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- }
- resp, err := s.ecs.StopTask(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "StopTask")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("task"), Equals, "arn:aws:ecs:us-east-1:aws_account_id:task/UUID")
-
- expected := Task{
- Containers: []Container{
- {
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- Name: "sleep",
- ContainerArn: "arn:aws:ecs:us-east-1:aws_account_id:container/UUID",
- LastStatus: "RUNNING",
- },
- },
- Overrides: TaskOverride{
- ContainerOverrides: []ContainerOverride{
- {
- Name: "sleep",
- },
- },
- },
- DesiredStatus: "STOPPED",
- TaskArn: "arn:aws:ecs:us-east-1:aws_account_id:task/UUID",
- ContainerInstanceArn: "arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID",
- LastStatus: "RUNNING",
- TaskDefinitionArn: "arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2",
- }
-
- c.Assert(resp.Task, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestSubmitContainerStateChange(c *C) {
- testServer.Response(200, nil, SubmitContainerStateChangeResponse)
- networkBindings := []NetworkBinding{
- {
- BindIp: "127.0.0.1",
- ContainerPort: 80,
- HostPort: 80,
- },
- }
- req := &SubmitContainerStateChangeReq{
- Cluster: "test",
- ContainerName: "container",
- ExitCode: 0,
- Reason: "reason",
- Status: "status",
- Task: "taskUUID",
- NetworkBindings: networkBindings,
- }
-
- resp, err := s.ecs.SubmitContainerStateChange(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "SubmitContainerStateChange")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("containerName"), Equals, "container")
- c.Assert(values.Get("exitCode"), Equals, "0")
- c.Assert(values.Get("reason"), Equals, "reason")
- c.Assert(values.Get("status"), Equals, "status")
- c.Assert(values.Get("task"), Equals, "taskUUID")
- c.Assert(values.Get("networkBindings.member.1.bindIp"), Equals, "127.0.0.1")
- c.Assert(values.Get("networkBindings.member.1.containerPort"), Equals, "80")
- c.Assert(values.Get("networkBindings.member.1.hostPort"), Equals, "80")
-
- c.Assert(resp.Acknowledgment, Equals, "ACK")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
-
-func (s *S) TestSubmitTaskStateChange(c *C) {
- testServer.Response(200, nil, SubmitTaskStateChangeResponse)
- req := &SubmitTaskStateChangeReq{
- Cluster: "test",
- Reason: "reason",
- Status: "status",
- Task: "taskUUID",
- }
-
- resp, err := s.ecs.SubmitTaskStateChange(req)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- c.Assert(values.Get("Version"), Equals, "2014-11-13")
- c.Assert(values.Get("Action"), Equals, "SubmitTaskStateChange")
- c.Assert(values.Get("cluster"), Equals, "test")
- c.Assert(values.Get("reason"), Equals, "reason")
- c.Assert(values.Get("status"), Equals, "status")
- c.Assert(values.Get("task"), Equals, "taskUUID")
-
- c.Assert(resp.Acknowledgment, Equals, "ACK")
- c.Assert(resp.RequestId, Equals, "8d798a29-f083-11e1-bdfb-cb223EXAMPLE")
-}
diff --git a/vendor/github.com/goamz/goamz/ecs/responses_test.go b/vendor/github.com/goamz/goamz/ecs/responses_test.go
deleted file mode 100644
index 6a4b0ce71..000000000
--- a/vendor/github.com/goamz/goamz/ecs/responses_test.go
+++ /dev/null
@@ -1,637 +0,0 @@
-package ecs
-
-var CreateClusterResponse = `
-<CreateClusterResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
- <CreateClusterResult>
- <cluster>
- <clusterArn>arn:aws:ecs:region:aws_account_id:cluster/default</clusterArn>
- <clusterName>default</clusterName>
- <status>ACTIVE</status>
- </cluster>
- </CreateClusterResult>
-</CreateClusterResponse>
-`
-var DeregisterContainerInstanceResponse = `
-<DeregisterContainerInstanceResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
- <DeregisterContainerInstanceResult>
- <containerInstance>
- <agentConnected>False</agentConnected>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID</containerInstanceArn>
- <ec2InstanceId>instance_id</ec2InstanceId>
- <status>INACTIVE</status>
- <registeredResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </registeredResources>
- <remainingResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </remainingResources>
- </containerInstance>
- </DeregisterContainerInstanceResult>
-</DeregisterContainerInstanceResponse>
-`
-
-var DeregisterTaskDefinitionResponse = `
-<DeregisterTaskDefinitionResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <DeregisterTaskDefinitionResult>
- <taskDefinition>
- <revision>2</revision>
- <family>sleep360</family>
- <containerDefinitions>
- <member>
- <portMappings/>
- <essential>true</essential>
- <environment>
- <member>
- <name>envVar</name>
- <value>foo</value>
- </member>
- </environment>
- <entryPoint>
- <member>/bin/sh</member>
- </entryPoint>
- <name>sleep</name>
- <command>
- <member>sleep</member>
- <member>360</member>
- </command>
- <cpu>10</cpu>
- <image>busybox</image>
- <memory>10</memory>
- </member>
- </containerDefinitions>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </taskDefinition>
- </DeregisterTaskDefinitionResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DeregisterTaskDefinitionResponse>
-`
-
-var DescribeClustersResponse = `
-<DescribeClustersResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <DescribeClustersResult>
- <failures/>
- <clusters>
- <member>
- <clusterName>test</clusterName>
- <clusterArn>arn:aws:ecs:us-east-1:aws_account_id:cluster/test</clusterArn>
- <status>ACTIVE</status>
- </member>
- <member>
- <clusterName>default</clusterName>
- <clusterArn>arn:aws:ecs:us-east-1:aws_account_id:cluster/default</clusterArn>
- <status>ACTIVE</status>
- </member>
- </clusters>
- </DescribeClustersResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeClustersResponse>
-`
-
-var DescribeContainerInstancesResponse = `
-<DescribeContainerInstancesResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
- <DescribeContainerInstancesResult>
- <failures/>
- <containerInstances>
- <member>
- <agentConnected>true</agentConnected>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID</containerInstanceArn>
- <ec2InstanceId>instance_id</ec2InstanceId>
- <status>ACTIVE</status>
- <registeredResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </registeredResources>
- <remainingResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </remainingResources>
- </member>
- </containerInstances>
- </DescribeContainerInstancesResult>
-</DescribeContainerInstancesResponse>
-`
-
-var DescribeTaskDefinitionResponse = `
-<DescribeTaskDefinitionResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <DescribeTaskDefinitionResult>
- <taskDefinition>
- <revision>2</revision>
- <family>sleep360</family>
- <containerDefinitions>
- <member>
- <portMappings/>
- <essential>true</essential>
- <environment>
- <member>
- <name>envVar</name>
- <value>foo</value>
- </member>
- </environment>
- <entryPoint>
- <member>/bin/sh</member>
- </entryPoint>
- <name>sleep</name>
- <command>
- <member>sleep</member>
- <member>360</member>
- </command>
- <cpu>10</cpu>
- <image>busybox</image>
- <memory>10</memory>
- </member>
- </containerDefinitions>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </taskDefinition>
- </DescribeTaskDefinitionResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeTaskDefinitionResponse>
-`
-
-var DescribeTasksResponse = `
-<DescribeTasksResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <DescribeTasksResult>
- <failures/>
- <tasks>
- <member>
- <containers>
- <member>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <name>sleep</name>
- <containerArn>arn:aws:ecs:us-east-1:aws_account_id:container/UUID</containerArn>
- <networkBindings/>
- <lastStatus>RUNNING</lastStatus>
- </member>
- </containers>
- <overrides>
- <containerOverrides>
- <member>
- <name>sleep</name>
- </member>
- </containerOverrides>
- </overrides>
- <desiredStatus>RUNNING</desiredStatus>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID</containerInstanceArn>
- <lastStatus>RUNNING</lastStatus>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </member>
- </tasks>
- </DescribeTasksResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DescribeTasksResponse>
-`
-
-var DiscoverPollEndpointResponse = `
-<DiscoverPollEndpointResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <DiscoverPollEndpointResult>
- <endpoint>https://ecs-x-1.us-east-1.amazonaws.com/</endpoint>
- </DiscoverPollEndpointResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</DiscoverPollEndpointResponse>
-`
-
-var ListClustersResponse = `
-<ListClustersResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ListClustersResult>
- <clusterArns>
- <member>arn:aws:ecs:us-east-1:aws_account_id:cluster/default</member>
- <member>arn:aws:ecs:us-east-1:aws_account_id:cluster/test</member>
- </clusterArns>
- <nextToken>token_UUID</nextToken>
- </ListClustersResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</ListClustersResponse>
-`
-
-var ListContainerInstancesResponse = `
-<ListContainerInstancesResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ListContainerInstancesResult>
- <containerInstanceArns>
- <member>arn:aws:ecs:us-east-1:aws_account_id:container-instance/uuid-1</member>
- <member>arn:aws:ecs:us-east-1:aws_account_id:container-instance/uuid-2</member>
- </containerInstanceArns>
- <nextToken>token_UUID</nextToken>
- </ListContainerInstancesResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</ListContainerInstancesResponse>
-`
-
-var ListTaskDefinitionsResponse = `
-<ListTaskDefinitionsResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ListTaskDefinitionsResult>
- <taskDefinitionArns>
- <member>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:1</member>
- <member>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</member>
- </taskDefinitionArns>
- <nextToken>token_UUID</nextToken>
- </ListTaskDefinitionsResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</ListTaskDefinitionsResponse>
-`
-
-var ListTasksResponse = `
-<ListTasksResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ListTasksResult>
- <taskArns>
- <member>arn:aws:ecs:us-east-1:aws_account_id:task/uuid_1</member>
- <member>arn:aws:ecs:us-east-1:aws_account_id:task/uuid_2</member>
- </taskArns>
- <nextToken>token_UUID</nextToken>
- </ListTasksResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</ListTasksResponse>
-`
-
-var RegisterContainerInstanceResponse = `
-<RegisterContainerInstanceResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
- <RegisterContainerInstanceResult>
- <containerInstance>
- <agentConnected>True</agentConnected>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/container_instance_UUID</containerInstanceArn>
- <ec2InstanceId>instance_id</ec2InstanceId>
- <status>ACTIVE</status>
- <registeredResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </registeredResources>
- <remainingResources>
- <member>
- <integerValue>2048</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>CPU</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>3955</integerValue>
- <longValue>0</longValue>
- <type>INTEGER</type>
- <name>MEMORY</name>
- <doubleValue>0.0</doubleValue>
- </member>
- <member>
- <integerValue>0</integerValue>
- <longValue>0</longValue>
- <type>STRINGSET</type>
- <stringSetValue>
- <member>2376</member>
- <member>22</member>
- <member>51678</member>
- <member>2375</member>
- </stringSetValue>
- <name>PORTS</name>
- <doubleValue>0.0</doubleValue>
- </member>
- </remainingResources>
- </containerInstance>
- </RegisterContainerInstanceResult>
-</RegisterContainerInstanceResponse>
-`
-
-var RegisterTaskDefinitionResponse = `
-<RegisterTaskDefinitionResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <RegisterTaskDefinitionResult>
- <taskDefinition>
- <revision>2</revision>
- <family>sleep360</family>
- <containerDefinitions>
- <member>
- <portMappings/>
- <essential>true</essential>
- <environment>
- <member>
- <name>envVar</name>
- <value>foo</value>
- </member>
- </environment>
- <entryPoint>
- <member>/bin/sh</member>
- </entryPoint>
- <name>sleep</name>
- <command>
- <member>sleep</member>
- <member>360</member>
- </command>
- <cpu>10</cpu>
- <image>busybox</image>
- <memory>10</memory>
- <mountPoints>
- <member>
- <containerPath>/tmp/myfile</containerPath>
- <readOnly>false</readOnly>
- <sourceVolume>/srv/myfile</sourceVolume>
- </member>
- <member>
- <containerPath>/tmp/myfile2</containerPath>
- <readOnly>true</readOnly>
- <sourceVolume>/srv/myfile2</sourceVolume>
- </member>
- </mountPoints>
- <volumesFrom>
- <member>
- <readOnly>true</readOnly>
- <sourceContainer>foo</sourceContainer>
- </member>
- </volumesFrom>
- </member>
- </containerDefinitions>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- <volumes>
- <member>
- <name>/srv/myfile</name>
- <host>
- <sourcePath>/srv/myfile</sourcePath>
- </host>
- </member>
- </volumes>
- </taskDefinition>
- </RegisterTaskDefinitionResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</RegisterTaskDefinitionResponse>
-`
-
-var RunTaskResponse = `
-<RunTaskResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <RunTaskResult>
- <failures/>
- <tasks>
- <member>
- <containers>
- <member>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <name>sleep</name>
- <containerArn>arn:aws:ecs:us-east-1:aws_account_id:container/UUID</containerArn>
- <networkBindings/>
- <lastStatus>RUNNING</lastStatus>
- </member>
- </containers>
- <overrides>
- <containerOverrides>
- <member>
- <name>sleep</name>
- </member>
- </containerOverrides>
- </overrides>
- <desiredStatus>RUNNING</desiredStatus>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID</containerInstanceArn>
- <lastStatus>PENDING</lastStatus>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </member>
- </tasks>
- </RunTaskResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</RunTaskResponse>
-`
-
-var StartTaskResponse = `
-<StartTaskResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <StartTaskResult>
- <failures/>
- <tasks>
- <member>
- <containers>
- <member>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <name>sleep</name>
- <containerArn>arn:aws:ecs:us-east-1:aws_account_id:container/UUID</containerArn>
- <networkBindings/>
- <lastStatus>RUNNING</lastStatus>
- </member>
- </containers>
- <overrides>
- <containerOverrides>
- <member>
- <name>sleep</name>
- </member>
- </containerOverrides>
- </overrides>
- <desiredStatus>RUNNING</desiredStatus>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID</containerInstanceArn>
- <lastStatus>PENDING</lastStatus>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </member>
- </tasks>
- </StartTaskResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</StartTaskResponse>
-`
-
-var StopTaskResponse = `
-<StopTaskResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <StopTaskResult>
- <task>
- <containers>
- <member>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <name>sleep</name>
- <containerArn>arn:aws:ecs:us-east-1:aws_account_id:container/UUID</containerArn>
- <networkBindings/>
- <lastStatus>RUNNING</lastStatus>
- </member>
- </containers>
- <overrides>
- <containerOverrides>
- <member>
- <name>sleep</name>
- </member>
- </containerOverrides>
- </overrides>
- <desiredStatus>STOPPED</desiredStatus>
- <taskArn>arn:aws:ecs:us-east-1:aws_account_id:task/UUID</taskArn>
- <containerInstanceArn>arn:aws:ecs:us-east-1:aws_account_id:container-instance/UUID</containerInstanceArn>
- <lastStatus>RUNNING</lastStatus>
- <taskDefinitionArn>arn:aws:ecs:us-east-1:aws_account_id:task-definition/sleep360:2</taskDefinitionArn>
- </task>
- </StopTaskResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</StopTaskResponse>
-`
-
-var SubmitContainerStateChangeResponse = `
-<SubmitContainerStateChangeResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <SubmitContainerStateChangeResult>
- <acknowledgment>ACK</acknowledgment>
- </SubmitContainerStateChangeResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</SubmitContainerStateChangeResponse>
-`
-
-var SubmitTaskStateChangeResponse = `
-<SubmitTaskStateChangeResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/">
- <SubmitTaskStateChangeResult>
- <acknowledgment>ACK</acknowledgment>
- </SubmitTaskStateChangeResult>
- <ResponseMetadata>
- <RequestId>8d798a29-f083-11e1-bdfb-cb223EXAMPLE</RequestId>
- </ResponseMetadata>
-</SubmitTaskStateChangeResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/elb/elb.go b/vendor/github.com/goamz/goamz/elb/elb.go
deleted file mode 100644
index 0127435a7..000000000
--- a/vendor/github.com/goamz/goamz/elb/elb.go
+++ /dev/null
@@ -1,435 +0,0 @@
-// This package provides types and functions to interact Elastic Load Balancing service
-package elb
-
-import (
- "encoding/xml"
- "fmt"
- "net/http"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-type ELB struct {
- aws.Auth
- aws.Region
-}
-
-func New(auth aws.Auth, region aws.Region) *ELB {
- return &ELB{auth, region}
-}
-
-// The CreateLoadBalancer type encapsulates options for the respective request in AWS.
-// The creation of a Load Balancer may differ inside EC2 and VPC.
-//
-// See http://goo.gl/4QFKi for more details.
-type CreateLoadBalancer struct {
- Name string
- AvailabilityZones []string
- Listeners []Listener
- Scheme string
- SecurityGroups []string
- Subnets []string
-}
-
-// Listener to configure in Load Balancer.
-//
-// See http://goo.gl/NJQCj for more details.
-type Listener struct {
- InstancePort int
- InstanceProtocol string
- LoadBalancerPort int
- Protocol string
- SSLCertificateId string
-}
-
-// Response to a CreateLoadBalance request.
-//
-// See http://goo.gl/4QFKi for more details.
-type CreateLoadBalancerResp struct {
- DNSName string `xml:"CreateLoadBalancerResult>DNSName"`
-}
-
-type SimpleResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// Creates a Load Balancer in Amazon.
-//
-// See http://goo.gl/4QFKi for more details.
-func (elb *ELB) CreateLoadBalancer(options *CreateLoadBalancer) (resp *CreateLoadBalancerResp, err error) {
- params := makeCreateParams(options)
- resp = new(CreateLoadBalancerResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return
-}
-
-// Deletes a Load Balancer.
-//
-// See http://goo.gl/sDmPp for more details.
-func (elb *ELB) DeleteLoadBalancer(name string) (resp *SimpleResp, err error) {
- params := map[string]string{
- "Action": "DeleteLoadBalancer",
- "LoadBalancerName": name,
- }
- resp = new(SimpleResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type RegisterInstancesResp struct {
- InstanceIds []string `xml:"RegisterInstancesWithLoadBalancerResult>Instances>member>InstanceId"`
-}
-
-// Register N instances with a given Load Balancer.
-//
-// See http://goo.gl/x9hru for more details.
-func (elb *ELB) RegisterInstancesWithLoadBalancer(instanceIds []string, lbName string) (resp *RegisterInstancesResp, err error) {
- // TODO: change params order and use ..., e.g (lbName string, instanceIds ...string)
- params := map[string]string{
- "Action": "RegisterInstancesWithLoadBalancer",
- "LoadBalancerName": lbName,
- }
- for i, instanceId := range instanceIds {
- key := fmt.Sprintf("Instances.member.%d.InstanceId", i+1)
- params[key] = instanceId
- }
- resp = new(RegisterInstancesResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Deregister N instances from a given Load Balancer.
-//
-// See http://goo.gl/Hgo4U for more details.
-func (elb *ELB) DeregisterInstancesFromLoadBalancer(instanceIds []string, lbName string) (resp *SimpleResp, err error) {
- // TODO: change params order and use ..., e.g (lbName string, instanceIds ...string)
- params := map[string]string{
- "Action": "DeregisterInstancesFromLoadBalancer",
- "LoadBalancerName": lbName,
- }
- for i, instanceId := range instanceIds {
- key := fmt.Sprintf("Instances.member.%d.InstanceId", i+1)
- params[key] = instanceId
- }
- resp = new(SimpleResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type DescribeLoadBalancerResp struct {
- LoadBalancerDescriptions []LoadBalancerDescription `xml:"DescribeLoadBalancersResult>LoadBalancerDescriptions>member"`
-}
-
-type LoadBalancerDescription struct {
- AvailabilityZones []string `xml:"AvailabilityZones>member"`
- BackendServerDescriptions []BackendServerDescriptions `xml:"BackendServerDescriptions>member"`
- CanonicalHostedZoneName string `xml:"CanonicalHostedZoneName"`
- CanonicalHostedZoneNameId string `xml:"CanonicalHostedZoneNameID"`
- CreatedTime time.Time `xml:"CreatedTime"`
- DNSName string `xml:"DNSName"`
- HealthCheck HealthCheck `xml:"HealthCheck"`
- Instances []Instance `xml:"Instances>member"`
- ListenerDescriptions []ListenerDescription `xml:"ListenerDescriptions>member"`
- LoadBalancerName string `xml:"LoadBalancerName"`
- Policies Policies `xml:"Policies"`
- Scheme string `xml:"Scheme"`
- SecurityGroups []string `xml:"SecurityGroups>member"` //vpc only
- SourceSecurityGroup SourceSecurityGroup `xml:"SourceSecurityGroup"`
- Subnets []string `xml:"Subnets>member"`
- VPCId string `xml:"VPCId"`
-}
-
-// Describe Load Balancers.
-// It can be used to describe all Load Balancers or specific ones.
-//
-// See http://goo.gl/wofJA for more details.
-func (elb *ELB) DescribeLoadBalancers(names ...string) (*DescribeLoadBalancerResp, error) {
- params := map[string]string{"Action": "DescribeLoadBalancers"}
- for i, name := range names {
- index := fmt.Sprintf("LoadBalancerNames.member.%d", i+1)
- params[index] = name
- }
- resp := new(DescribeLoadBalancerResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type BackendServerDescriptions struct {
- InstancePort int `xml:"InstancePort"`
- PolicyNames []string `xml:"PolicyNames>member"`
-}
-
-type HealthCheck struct {
- HealthyThreshold int `xml:"HealthyThreshold"`
- Interval int `xml:"Interval"`
- Target string `xml:"Target"`
- Timeout int `xml:"Timeout"`
- UnhealthyThreshold int `xml:"UnhealthyThreshold"`
-}
-
-type Instance struct {
- InstanceId string `xml:"InstanceId"`
-}
-
-type ListenerDescription struct {
- Listener Listener `xml:"Listener"`
- PolicyNames []string `xml:"PolicyNames>member"`
-}
-
-type Policies struct {
- AppCookieStickinessPolicies []AppCookieStickinessPolicies `xml:"AppCookieStickinessPolicies>member"`
- LBCookieStickinessPolicies []LBCookieStickinessPolicies `xml:"LBCookieStickinessPolicies>member"`
- OtherPolicies []string `xml:"OtherPolicies>member"`
-}
-
-// see http://goo.gl/clXGV for more information.
-type AppCookieStickinessPolicies struct {
- CookieName string `xml:"CookieName"`
- PolicyName string `xml:"PolicyName"`
-}
-
-type LBCookieStickinessPolicies struct {
- CookieExpirationPeriod int `xml:"CookieExpirationPeriod"`
- PolicyName string `xml:"PolicyName"`
-}
-
-type SourceSecurityGroup struct {
- GroupName string `xml:"GroupName"`
- OwnerAlias string `xml:"OwnerAlias"`
-}
-
-// Represents a XML response for DescribeInstanceHealth action
-//
-// See http://goo.gl/ovIB1 for more information.
-type DescribeInstanceHealthResp struct {
- InstanceStates []InstanceState `xml:"DescribeInstanceHealthResult>InstanceStates>member"`
-}
-
-// See http://goo.gl/dzWfP for more information.
-type InstanceState struct {
- Description string `xml:"Description"`
- InstanceId string `xml:"InstanceId"`
- ReasonCode string `xml:"ReasonCode"`
- State string `xml:"State"`
-}
-
-// Describe instance health.
-//
-// See http://goo.gl/ovIB1 for more information.
-func (elb *ELB) DescribeInstanceHealth(lbName string, instanceIds ...string) (*DescribeInstanceHealthResp, error) {
- params := map[string]string{
- "Action": "DescribeInstanceHealth",
- "LoadBalancerName": lbName,
- }
- for i, iId := range instanceIds {
- key := fmt.Sprintf("Instances.member.%d.InstanceId", i+1)
- params[key] = iId
- }
- resp := new(DescribeInstanceHealthResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type HealthCheckResp struct {
- HealthCheck *HealthCheck `xml:"ConfigureHealthCheckResult>HealthCheck"`
-}
-
-// Configure health check for a LB
-//
-// See http://goo.gl/2HE6a for more information
-func (elb *ELB) ConfigureHealthCheck(lbName string, healthCheck *HealthCheck) (*HealthCheckResp, error) {
- params := map[string]string{
- "Action": "ConfigureHealthCheck",
- "LoadBalancerName": lbName,
- "HealthCheck.HealthyThreshold": strconv.Itoa(healthCheck.HealthyThreshold),
- "HealthCheck.Interval": strconv.Itoa(healthCheck.Interval),
- "HealthCheck.Target": healthCheck.Target,
- "HealthCheck.Timeout": strconv.Itoa(healthCheck.Timeout),
- "HealthCheck.UnhealthyThreshold": strconv.Itoa(healthCheck.UnhealthyThreshold),
- }
- resp := new(HealthCheckResp)
- if err := elb.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Add tags to the named ELB
-//
-// Note that AWS only accepts one ELB name at a time (even though it is sent as a list)
-//
-// See http://goo.gl/6JW4Wf for the rest of the details
-func (elb *ELB) AddTags(elbName string, tags map[string]string) (*SimpleResp, error) {
- var sortedKeys []string
- params := make(map[string]string)
- response := &SimpleResp{}
-
- for tagKey := range tags {
- sortedKeys = append(sortedKeys, tagKey)
- }
-
- sort.Strings(sortedKeys)
-
- for _, key := range sortedKeys {
- number := len(tags)
- params[fmt.Sprintf("Tags.member.%d.Key", number)] = key
- params[fmt.Sprintf("Tags.member.%d.Value", number)] = tags[key]
- delete(tags, key)
- }
-
- params["Action"] = "AddTags"
- params["LoadBalancerNames.member.1"] = elbName
-
- if err := elb.query(params, response); err != nil {
- return nil, err
- }
-
- return response, nil
-}
-
-// Remove tags from the named ELB
-//
-// Note that AWS only accepts one ELB name at a time (even though it is sent as a list)
-//
-// see http://goo.gl/ochFqo for more details
-
-func (elb *ELB) RemoveTags(elbName string, tagKeys []string) (*SimpleResp, error) {
- response := &SimpleResp{}
- params := make(map[string]string)
-
- params["Action"] = "RemoveTags"
- params["LoadBalancerNames.member.1"] = elbName
-
- for i, tagKey := range tagKeys {
- params[fmt.Sprintf("Tags.member.%d.Key", i+1)] = tagKey
- }
-
- if err := elb.query(params, response); err != nil {
- return nil, err
- }
-
- return response, nil
-}
-
-func (elb *ELB) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2012-06-01"
- params["Timestamp"] = time.Now().In(time.UTC).Format(time.RFC3339)
- data := strings.NewReader(multimap(params).Encode())
- hreq, err := http.NewRequest("GET", elb.Region.ELBEndpoint+"/", data)
- if err != nil {
- return err
- }
-
- hreq.URL.RawQuery = multimap(params).Encode()
- token := elb.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(elb.Auth, "elasticloadbalancing", elb.Region)
- signer.Sign(hreq)
-
- r, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- return err
- }
- defer r.Body.Close()
- if r.StatusCode != 200 {
- return buildError(r)
- }
- return xml.NewDecoder(r.Body).Decode(resp)
-}
-
-// Error encapsulates an error returned by ELB.
-type Error struct {
- // HTTP status code
- StatusCode int
- // AWS error code
- Code string
- // The human-oriented error message
- Message string
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-type xmlErrors struct {
- Errors []Error `xml:"Error"`
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-func makeCreateParams(createLB *CreateLoadBalancer) map[string]string {
- params := make(map[string]string)
- params["LoadBalancerName"] = createLB.Name
- params["Action"] = "CreateLoadBalancer"
- if createLB.Scheme != "" {
- params["Scheme"] = createLB.Scheme
- }
- for i, s := range createLB.SecurityGroups {
- key := fmt.Sprintf("SecurityGroups.member.%d", i+1)
- params[key] = s
- }
- for i, s := range createLB.Subnets {
- key := fmt.Sprintf("Subnets.member.%d", i+1)
- params[key] = s
- }
- for i, l := range createLB.Listeners {
- key := "Listeners.member.%d.%s"
- index := i + 1
- params[fmt.Sprintf(key, index, "InstancePort")] = strconv.Itoa(l.InstancePort)
- params[fmt.Sprintf(key, index, "InstanceProtocol")] = l.InstanceProtocol
- params[fmt.Sprintf(key, index, "Protocol")] = l.Protocol
- params[fmt.Sprintf(key, index, "LoadBalancerPort")] = strconv.Itoa(l.LoadBalancerPort)
- }
- for i, az := range createLB.AvailabilityZones {
- key := fmt.Sprintf("AvailabilityZones.member.%d", i+1)
- params[key] = az
- }
- return params
-}
diff --git a/vendor/github.com/goamz/goamz/elb/elb_test.go b/vendor/github.com/goamz/goamz/elb/elb_test.go
deleted file mode 100644
index db799fdfc..000000000
--- a/vendor/github.com/goamz/goamz/elb/elb_test.go
+++ /dev/null
@@ -1,369 +0,0 @@
-package elb_test
-
-import (
- "time"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/elb"
- . "gopkg.in/check.v1"
-)
-
-type S struct {
- HTTPSuite
- elb *elb.ELB
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpSuite(c *C) {
- s.HTTPSuite.SetUpSuite(c)
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.elb = elb.New(auth, aws.Region{ELBEndpoint: testServer.URL})
-}
-
-func (s *S) TestCreateLoadBalancer(c *C) {
- testServer.PrepareResponse(200, nil, CreateLoadBalancer)
- createLB := &elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a", "us-east-1b"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- Protocol: "http",
- LoadBalancerPort: 80,
- },
- },
- }
- resp, err := s.elb.CreateLoadBalancer(createLB)
- c.Assert(err, IsNil)
- defer s.elb.DeleteLoadBalancer(createLB.Name)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Action"), Equals, "CreateLoadBalancer")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(values.Get("AvailabilityZones.member.1"), Equals, "us-east-1a")
- c.Assert(values.Get("AvailabilityZones.member.2"), Equals, "us-east-1b")
- c.Assert(values.Get("Listeners.member.1.InstancePort"), Equals, "80")
- c.Assert(values.Get("Listeners.member.1.InstanceProtocol"), Equals, "http")
- c.Assert(values.Get("Listeners.member.1.Protocol"), Equals, "http")
- c.Assert(values.Get("Listeners.member.1.LoadBalancerPort"), Equals, "80")
- c.Assert(resp.DNSName, Equals, "testlb-339187009.us-east-1.elb.amazonaws.com")
-}
-
-func (s *S) TestCreateLoadBalancerWithSubnetsAndMoreListeners(c *C) {
- testServer.PrepareResponse(200, nil, CreateLoadBalancer)
- createLB := &elb.CreateLoadBalancer{
- Name: "testlb",
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- Protocol: "http",
- LoadBalancerPort: 80,
- },
- {
- InstancePort: 8080,
- InstanceProtocol: "http",
- Protocol: "http",
- LoadBalancerPort: 8080,
- },
- },
- Subnets: []string{"subnetid-1", "subnetid-2"},
- SecurityGroups: []string{"sg-1", "sg-2"},
- }
- _, err := s.elb.CreateLoadBalancer(createLB)
- c.Assert(err, IsNil)
- defer s.elb.DeleteLoadBalancer(createLB.Name)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Listeners.member.1.InstancePort"), Equals, "80")
- c.Assert(values.Get("Listeners.member.1.LoadBalancerPort"), Equals, "80")
- c.Assert(values.Get("Listeners.member.2.InstancePort"), Equals, "8080")
- c.Assert(values.Get("Listeners.member.2.LoadBalancerPort"), Equals, "8080")
- c.Assert(values.Get("Subnets.member.1"), Equals, "subnetid-1")
- c.Assert(values.Get("Subnets.member.2"), Equals, "subnetid-2")
- c.Assert(values.Get("SecurityGroups.member.1"), Equals, "sg-1")
- c.Assert(values.Get("SecurityGroups.member.2"), Equals, "sg-2")
-}
-
-func (s *S) TestCreateLoadBalancerWithWrongParamsCombination(c *C) {
- testServer.PrepareResponse(400, nil, CreateLoadBalancerBadRequest)
- createLB := &elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a", "us-east-1b"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- Protocol: "http",
- LoadBalancerPort: 80,
- },
- },
- Subnets: []string{"subnetid-1", "subnetid2"},
- }
- resp, err := s.elb.CreateLoadBalancer(createLB)
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*elb.Error)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "Only one of SubnetIds or AvailabilityZones may be specified")
- c.Assert(e.Code, Equals, "ValidationError")
-}
-
-func (s *S) TestDeleteLoadBalancer(c *C) {
- testServer.PrepareResponse(200, nil, DeleteLoadBalancer)
- resp, err := s.elb.DeleteLoadBalancer("testlb")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "DeleteLoadBalancer")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(resp.RequestId, Equals, "8d7223db-49d7-11e2-bba9-35ba56032fe1")
-}
-
-func (s *S) TestRegisterInstancesWithLoadBalancer(c *C) {
- testServer.PrepareResponse(200, nil, RegisterInstancesWithLoadBalancer)
- resp, err := s.elb.RegisterInstancesWithLoadBalancer([]string{"i-b44db8ca", "i-461ecf38"}, "testlb")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "RegisterInstancesWithLoadBalancer")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(values.Get("Instances.member.1.InstanceId"), Equals, "i-b44db8ca")
- c.Assert(values.Get("Instances.member.2.InstanceId"), Equals, "i-461ecf38")
- c.Assert(resp.InstanceIds, DeepEquals, []string{"i-b44db8ca", "i-461ecf38"})
-}
-
-func (s *S) TestRegisterInstancesWithLoadBalancerBadRequest(c *C) {
- testServer.PrepareResponse(400, nil, RegisterInstancesWithLoadBalancerBadRequest)
- resp, err := s.elb.RegisterInstancesWithLoadBalancer([]string{"i-b44db8ca", "i-461ecf38"}, "absentLB")
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*elb.Error)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "There is no ACTIVE Load Balancer named 'absentLB'")
- c.Assert(e.Code, Equals, "LoadBalancerNotFound")
-}
-
-func (s *S) TestDeregisterInstancesFromLoadBalancer(c *C) {
- testServer.PrepareResponse(200, nil, DeregisterInstancesFromLoadBalancer)
- resp, err := s.elb.DeregisterInstancesFromLoadBalancer([]string{"i-b44db8ca", "i-461ecf38"}, "testlb")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "DeregisterInstancesFromLoadBalancer")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(values.Get("Instances.member.1.InstanceId"), Equals, "i-b44db8ca")
- c.Assert(values.Get("Instances.member.2.InstanceId"), Equals, "i-461ecf38")
- c.Assert(resp.RequestId, Equals, "d6490837-49fd-11e2-bba9-35ba56032fe1")
-}
-
-func (s *S) TestDeregisterInstancesFromLoadBalancerBadRequest(c *C) {
- testServer.PrepareResponse(400, nil, DeregisterInstancesFromLoadBalancerBadRequest)
- resp, err := s.elb.DeregisterInstancesFromLoadBalancer([]string{"i-b44db8ca", "i-461ecf38"}, "testlb")
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*elb.Error)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "There is no ACTIVE Load Balancer named 'absentlb'")
- c.Assert(e.Code, Equals, "LoadBalancerNotFound")
-}
-
-func (s *S) TestDescribeLoadBalancers(c *C) {
- testServer.PrepareResponse(200, nil, DescribeLoadBalancers)
- resp, err := s.elb.DescribeLoadBalancers()
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "DescribeLoadBalancers")
- t, _ := time.Parse(time.RFC3339, "2012-12-27T11:51:52.970Z")
- expected := &elb.DescribeLoadBalancerResp{
- []elb.LoadBalancerDescription{
- {
- AvailabilityZones: []string{"us-east-1a"},
- BackendServerDescriptions: []elb.BackendServerDescriptions(nil),
- CanonicalHostedZoneName: "testlb-2087227216.us-east-1.elb.amazonaws.com",
- CanonicalHostedZoneNameId: "Z3DZXE0Q79N41H",
- CreatedTime: t,
- DNSName: "testlb-2087227216.us-east-1.elb.amazonaws.com",
- HealthCheck: elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "TCP:80",
- Timeout: 5,
- UnhealthyThreshold: 2,
- },
- Instances: []elb.Instance(nil),
- ListenerDescriptions: []elb.ListenerDescription{
- {
- Listener: elb.Listener{
- Protocol: "HTTP",
- LoadBalancerPort: 80,
- InstanceProtocol: "HTTP",
- InstancePort: 80,
- },
- },
- },
- LoadBalancerName: "testlb",
- //Policies: elb.Policies(nil),
- Scheme: "internet-facing",
- SecurityGroups: []string(nil),
- SourceSecurityGroup: elb.SourceSecurityGroup{
- GroupName: "amazon-elb-sg",
- OwnerAlias: "amazon-elb",
- },
- Subnets: []string(nil),
- },
- },
- }
- c.Assert(resp, DeepEquals, expected)
-}
-
-func (s *S) TestDescribeLoadBalancersByName(c *C) {
- testServer.PrepareResponse(200, nil, DescribeLoadBalancers)
- s.elb.DescribeLoadBalancers("somelb")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "DescribeLoadBalancers")
- c.Assert(values.Get("LoadBalancerNames.member.1"), Equals, "somelb")
-}
-
-func (s *S) TestDescribeLoadBalancersBadRequest(c *C) {
- testServer.PrepareResponse(400, nil, DescribeLoadBalancersBadRequest)
- resp, err := s.elb.DescribeLoadBalancers()
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, `^Cannot find Load Balancer absentlb \(LoadBalancerNotFound\)$`)
-}
-
-func (s *S) TestDescribeInstanceHealth(c *C) {
- testServer.PrepareResponse(200, nil, DescribeInstanceHealth)
- resp, err := s.elb.DescribeInstanceHealth("testlb", "i-b44db8ca")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "DescribeInstanceHealth")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(values.Get("Instances.member.1.InstanceId"), Equals, "i-b44db8ca")
- c.Assert(len(resp.InstanceStates) > 0, Equals, true)
- c.Assert(resp.InstanceStates[0].Description, Equals, "Instance registration is still in progress.")
- c.Assert(resp.InstanceStates[0].InstanceId, Equals, "i-b44db8ca")
- c.Assert(resp.InstanceStates[0].State, Equals, "OutOfService")
- c.Assert(resp.InstanceStates[0].ReasonCode, Equals, "ELB")
-}
-
-func (s *S) TestDescribeInstanceHealthBadRequest(c *C) {
- testServer.PrepareResponse(400, nil, DescribeInstanceHealthBadRequest)
- resp, err := s.elb.DescribeInstanceHealth("testlb", "i-foooo")
- c.Assert(err, NotNil)
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, ".*i-foooo.*(InvalidInstance).*")
-}
-
-func (s *S) TestConfigureHealthCheck(c *C) {
- testServer.PrepareResponse(200, nil, ConfigureHealthCheck)
- hc := elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "HTTP:80/",
- Timeout: 5,
- UnhealthyThreshold: 2,
- }
- resp, err := s.elb.ConfigureHealthCheck("testlb", &hc)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("Action"), Equals, "ConfigureHealthCheck")
- c.Assert(values.Get("LoadBalancerName"), Equals, "testlb")
- c.Assert(values.Get("HealthCheck.HealthyThreshold"), Equals, "10")
- c.Assert(values.Get("HealthCheck.Interval"), Equals, "30")
- c.Assert(values.Get("HealthCheck.Target"), Equals, "HTTP:80/")
- c.Assert(values.Get("HealthCheck.Timeout"), Equals, "5")
- c.Assert(values.Get("HealthCheck.UnhealthyThreshold"), Equals, "2")
- c.Assert(resp.HealthCheck.HealthyThreshold, Equals, 10)
- c.Assert(resp.HealthCheck.Interval, Equals, 30)
- c.Assert(resp.HealthCheck.Target, Equals, "HTTP:80/")
- c.Assert(resp.HealthCheck.Timeout, Equals, 5)
- c.Assert(resp.HealthCheck.UnhealthyThreshold, Equals, 2)
-}
-
-func (s *S) TestConfigureHealthCheckBadRequest(c *C) {
- testServer.PrepareResponse(400, nil, ConfigureHealthCheckBadRequest)
- hc := elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "HTTP:80/",
- Timeout: 5,
- UnhealthyThreshold: 2,
- }
- resp, err := s.elb.ConfigureHealthCheck("foolb", &hc)
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, ".*foolb.*(LoadBalancerNotFound).*")
-}
-
-func (s *S) TestAddTags(c *C) {
- testServer.PrepareResponse(200, nil, AddTagsSuccessResponse)
- tagsToAdd := map[string]string{
- "my-key": "my-value",
- "my-super-silly-tag": "its-another-valid-value",
- }
-
- resp, err := s.elb.AddTags("my-elb", tagsToAdd)
- c.Assert(err, IsNil)
-
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Action"), Equals, "AddTags")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("LoadBalancerNames.member.1"), Equals, "my-elb")
- c.Assert(values.Get("Tags.member.1.Key"), Equals, "my-super-silly-tag")
- c.Assert(values.Get("Tags.member.1.Value"), Equals, "its-another-valid-value")
- c.Assert(values.Get("Tags.member.2.Key"), Equals, "my-key")
- c.Assert(values.Get("Tags.member.2.Value"), Equals, "my-value")
-
- c.Assert(resp.RequestId, Equals, "360e81f7-1100-11e4-b6ed-0f30SOME-SAUCY-EXAMPLE")
-}
-
-func (s *S) TestAddBadTags(c *C) {
- testServer.PrepareResponse(400, nil, TagsBadRequest)
- tagsToAdd := map[string]string{
- "my-first-key": "an invalid value",
- }
-
- resp, err := s.elb.AddTags("my-bad-elb", tagsToAdd)
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, ".*(InvalidParameterValue).*")
-}
-
-func (s *S) TestRemoveTags(c *C) {
- testServer.PrepareResponse(200, nil, RemoveTagsSuccessResponse)
- tagKeysToRemove := []string{"a-key-one", "a-key-two"}
-
- resp, err := s.elb.RemoveTags("my-test-elb-1", tagKeysToRemove)
- c.Assert(err, IsNil)
-
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Version"), Equals, "2012-06-01")
- c.Assert(values.Get("Action"), Equals, "RemoveTags")
- c.Assert(values.Get("Timestamp"), Not(Equals), "")
- c.Assert(values.Get("LoadBalancerNames.member.1"), Equals, "my-test-elb-1")
- c.Assert([]string{values.Get("Tags.member.1.Key"), values.Get("Tags.member.2.Key")}, DeepEquals, tagKeysToRemove)
- c.Assert(resp.RequestId, Equals, "83c88b9d-12b7-11e3-8b82-87b12DIFFEXAMPLE")
-}
-
-func (s *S) TestRemoveTagsFailure(c *C) {
- testServer.PrepareResponse(400, nil, TagsBadRequest)
-
- resp, err := s.elb.RemoveTags("my-test-elb", []string{"non-existant-tag"})
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, ".*(InvalidParameterValue).*")
-}
diff --git a/vendor/github.com/goamz/goamz/elb/elbi_test.go b/vendor/github.com/goamz/goamz/elb/elbi_test.go
deleted file mode 100644
index 4c21f9e38..000000000
--- a/vendor/github.com/goamz/goamz/elb/elbi_test.go
+++ /dev/null
@@ -1,308 +0,0 @@
-package elb_test
-
-import (
- "flag"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/ec2"
- "github.com/goamz/goamz/elb"
- . "gopkg.in/check.v1"
-)
-
-var amazon = flag.Bool("amazon", false, "Enable tests against amazon server")
-
-// AmazonServer represents an Amazon AWS server.
-type AmazonServer struct {
- auth aws.Auth
-}
-
-func (s *AmazonServer) SetUp(c *C) {
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err)
- }
- s.auth = auth
-}
-
-var _ = Suite(&AmazonClientSuite{})
-
-// AmazonClientSuite tests the client against a live AWS server.
-type AmazonClientSuite struct {
- srv AmazonServer
- ClientTests
-}
-
-// ClientTests defines integration tests designed to test the client.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ClientTests struct {
- elb *elb.ELB
- ec2 *ec2.EC2
-}
-
-func (s *AmazonClientSuite) SetUpSuite(c *C) {
- if !*amazon {
- c.Skip("AmazonClientSuite tests not enabled")
- }
- s.srv.SetUp(c)
- s.elb = elb.New(s.srv.auth, aws.USEast)
- s.ec2 = ec2.New(s.srv.auth, aws.USEast)
-}
-
-func (s *ClientTests) TestCreateAndDeleteLoadBalancer(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- resp, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- defer s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Assert(resp.DNSName, Not(Equals), "")
- deleteResp, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Assert(err, IsNil)
- c.Assert(deleteResp.RequestId, Not(Equals), "")
-}
-
-func (s *ClientTests) TestCreateLoadBalancerError(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Subnets: []string{"subnetid-1"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- resp, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*elb.Error)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Matches, "Only one of .* or .* may be specified")
- c.Assert(e.Code, Equals, "ValidationError")
-}
-
-func (s *ClientTests) createInstanceAndLB(c *C) (*elb.CreateLoadBalancer, string) {
- options := ec2.RunInstancesOptions{
- ImageId: "ami-ccf405a5",
- InstanceType: "t1.micro",
- AvailabilityZone: "us-east-1c",
- }
- resp1, err := s.ec2.RunInstances(&options)
- c.Assert(err, IsNil)
- instId := resp1.Instances[0].InstanceId
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1c"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- _, err = s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- return &createLBReq, instId
-}
-
-// Cost: 0.02 USD
-func (s *ClientTests) TestCreateRegisterAndDeregisterInstanceWithLoadBalancer(c *C) {
- createLBReq, instId := s.createInstanceAndLB(c)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- _, err = s.ec2.TerminateInstances([]string{instId})
- c.Check(err, IsNil)
- }()
- resp, err := s.elb.RegisterInstancesWithLoadBalancer([]string{instId}, createLBReq.Name)
- c.Assert(err, IsNil)
- c.Assert(resp.InstanceIds, DeepEquals, []string{instId})
- resp2, err := s.elb.DeregisterInstancesFromLoadBalancer([]string{instId}, createLBReq.Name)
- c.Assert(err, IsNil)
- c.Assert(resp2, Not(Equals), "")
-}
-
-func (s *ClientTests) TestDescribeLoadBalancers(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- _, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- }()
- resp, err := s.elb.DescribeLoadBalancers()
- c.Assert(err, IsNil)
- c.Assert(len(resp.LoadBalancerDescriptions) > 0, Equals, true)
- c.Assert(resp.LoadBalancerDescriptions[0].AvailabilityZones, DeepEquals, []string{"us-east-1a"})
- c.Assert(resp.LoadBalancerDescriptions[0].LoadBalancerName, Equals, "testlb")
- c.Assert(resp.LoadBalancerDescriptions[0].Scheme, Equals, "internet-facing")
- hc := elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "TCP:80",
- Timeout: 5,
- UnhealthyThreshold: 2,
- }
- c.Assert(resp.LoadBalancerDescriptions[0].HealthCheck, DeepEquals, hc)
- ld := []elb.ListenerDescription{
- {
- Listener: elb.Listener{
- Protocol: "HTTP",
- LoadBalancerPort: 80,
- InstanceProtocol: "HTTP",
- InstancePort: 80,
- },
- },
- }
- c.Assert(resp.LoadBalancerDescriptions[0].ListenerDescriptions, DeepEquals, ld)
- ssg := elb.SourceSecurityGroup{
- GroupName: "amazon-elb-sg",
- OwnerAlias: "amazon-elb",
- }
- c.Assert(resp.LoadBalancerDescriptions[0].SourceSecurityGroup, DeepEquals, ssg)
-}
-
-func (s *ClientTests) TestDescribeLoadBalancersBadRequest(c *C) {
- resp, err := s.elb.DescribeLoadBalancers("absentlb")
- c.Assert(err, NotNil)
- c.Assert(resp, IsNil)
- c.Assert(err, ErrorMatches, ".*(LoadBalancerNotFound).*")
-}
-
-func (s *ClientTests) TestDescribeInstanceHealth(c *C) {
- createLBReq, instId := s.createInstanceAndLB(c)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- _, err = s.ec2.TerminateInstances([]string{instId})
- c.Check(err, IsNil)
- }()
- _, err := s.elb.RegisterInstancesWithLoadBalancer([]string{instId}, createLBReq.Name)
- c.Assert(err, IsNil)
- resp, err := s.elb.DescribeInstanceHealth(createLBReq.Name, instId)
- c.Assert(err, IsNil)
- c.Assert(len(resp.InstanceStates) > 0, Equals, true)
- c.Assert(resp.InstanceStates[0].Description, Equals, "Instance is in pending state.")
- c.Assert(resp.InstanceStates[0].InstanceId, Equals, instId)
- c.Assert(resp.InstanceStates[0].State, Equals, "OutOfService")
- c.Assert(resp.InstanceStates[0].ReasonCode, Equals, "Instance")
-}
-
-func (s *ClientTests) TestDescribeInstanceHealthBadRequest(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- _, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- }()
- resp, err := s.elb.DescribeInstanceHealth(createLBReq.Name, "i-foo")
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, ".*i-foo.*(InvalidInstance).*")
-}
-
-func (s *ClientTests) TestConfigureHealthCheck(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- _, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- }()
- hc := elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "HTTP:80/",
- Timeout: 5,
- UnhealthyThreshold: 2,
- }
- resp, err := s.elb.ConfigureHealthCheck(createLBReq.Name, &hc)
- c.Assert(err, IsNil)
- c.Assert(resp.HealthCheck.HealthyThreshold, Equals, 10)
- c.Assert(resp.HealthCheck.Interval, Equals, 30)
- c.Assert(resp.HealthCheck.Target, Equals, "HTTP:80/")
- c.Assert(resp.HealthCheck.Timeout, Equals, 5)
- c.Assert(resp.HealthCheck.UnhealthyThreshold, Equals, 2)
-}
-
-func (s *ClientTests) TestConfigureHealthCheckBadRequest(c *C) {
- createLBReq := elb.CreateLoadBalancer{
- Name: "testlb",
- AvailabilityZones: []string{"us-east-1a"},
- Listeners: []elb.Listener{
- {
- InstancePort: 80,
- InstanceProtocol: "http",
- LoadBalancerPort: 80,
- Protocol: "http",
- },
- },
- }
- _, err := s.elb.CreateLoadBalancer(&createLBReq)
- c.Assert(err, IsNil)
- defer func() {
- _, err := s.elb.DeleteLoadBalancer(createLBReq.Name)
- c.Check(err, IsNil)
- }()
- hc := elb.HealthCheck{
- HealthyThreshold: 10,
- Interval: 30,
- Target: "HTTP:80",
- Timeout: 5,
- UnhealthyThreshold: 2,
- }
- resp, err := s.elb.ConfigureHealthCheck(createLBReq.Name, &hc)
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- expected := "HealthCheck HTTP Target must specify a port followed by a path that begins with a slash. e.g. HTTP:80/ping/this/path (ValidationError)"
- c.Assert(err.Error(), Equals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/elb/elbt_test.go b/vendor/github.com/goamz/goamz/elb/elbt_test.go
deleted file mode 100644
index 2ea529452..000000000
--- a/vendor/github.com/goamz/goamz/elb/elbt_test.go
+++ /dev/null
@@ -1,243 +0,0 @@
-package elb_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/elb"
- "github.com/goamz/goamz/elb/elbtest"
- . "gopkg.in/check.v1"
-)
-
-// LocalServer represents a local elbtest fake server.
-type LocalServer struct {
- auth aws.Auth
- region aws.Region
- srv *elbtest.Server
-}
-
-func (s *LocalServer) SetUp(c *C) {
- srv, err := elbtest.NewServer()
- c.Assert(err, IsNil)
- c.Assert(srv, NotNil)
- s.srv = srv
- s.region = aws.Region{ELBEndpoint: srv.URL()}
-}
-
-// LocalServerSuite defines tests that will run
-// against the local elbtest server. It includes
-// selected tests from ClientTests;
-// when the elbtest functionality is sufficient, it should
-// include all of them, and ClientTests can be simply embedded.
-type LocalServerSuite struct {
- srv LocalServer
- ServerTests
- clientTests ClientTests
-}
-
-// ServerTests defines a set of tests designed to test
-// the elbtest local fake elb server.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ServerTests struct {
- elb *elb.ELB
-}
-
-// AmazonServerSuite runs the elbtest server tests against a live ELB server.
-// It will only be activated if the -all flag is specified.
-type AmazonServerSuite struct {
- srv AmazonServer
- ServerTests
-}
-
-var _ = Suite(&AmazonServerSuite{})
-
-func (s *AmazonServerSuite) SetUpSuite(c *C) {
- if !*amazon {
- c.Skip("AmazonServerSuite tests not enabled")
- }
- s.srv.SetUp(c)
- s.ServerTests.elb = elb.New(s.srv.auth, aws.USEast)
-}
-
-var _ = Suite(&LocalServerSuite{})
-
-func (s *LocalServerSuite) SetUpSuite(c *C) {
- s.srv.SetUp(c)
- s.ServerTests.elb = elb.New(s.srv.auth, s.srv.region)
- s.clientTests.elb = elb.New(s.srv.auth, s.srv.region)
-}
-
-func (s *LocalServerSuite) TestCreateLoadBalancer(c *C) {
- s.clientTests.TestCreateAndDeleteLoadBalancer(c)
-}
-
-func (s *LocalServerSuite) TestCreateLoadBalancerError(c *C) {
- s.clientTests.TestCreateLoadBalancerError(c)
-}
-
-func (s *LocalServerSuite) TestDescribeLoadBalancer(c *C) {
- s.clientTests.TestDescribeLoadBalancers(c)
-}
-
-func (s *LocalServerSuite) TestDescribeLoadBalancerListsAddedByNewLoadbalancerFunc(c *C) {
- srv := s.srv.srv
- srv.NewLoadBalancer("wierdlb")
- defer srv.RemoveLoadBalancer("wierdlb")
- resp, err := s.clientTests.elb.DescribeLoadBalancers()
- c.Assert(err, IsNil)
- isPresent := false
- for _, desc := range resp.LoadBalancerDescriptions {
- if desc.LoadBalancerName == "wierdlb" {
- isPresent = true
- }
- }
- c.Assert(isPresent, Equals, true)
-}
-
-func (s *LocalServerSuite) TestDescribeLoadBalancerListsInstancesAddedByRegisterInstancesFunc(c *C) {
- srv := s.srv.srv
- lbName := "somelb"
- srv.NewLoadBalancer(lbName)
- defer srv.RemoveLoadBalancer(lbName)
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.RegisterInstance(instId, lbName) // no need to deregister, since we're removing the lb
- resp, err := s.clientTests.elb.DescribeLoadBalancers()
- c.Assert(err, IsNil)
- c.Assert(len(resp.LoadBalancerDescriptions) > 0, Equals, true)
- c.Assert(len(resp.LoadBalancerDescriptions[0].Instances) > 0, Equals, true)
- c.Assert(resp.LoadBalancerDescriptions[0].Instances, DeepEquals, []elb.Instance{{InstanceId: instId}})
- srv.DeregisterInstance(instId, lbName)
- resp, err = s.clientTests.elb.DescribeLoadBalancers()
- c.Assert(err, IsNil)
- c.Assert(resp.LoadBalancerDescriptions[0].Instances, DeepEquals, []elb.Instance(nil))
-}
-
-func (s *LocalServerSuite) TestDescribeLoadBalancersBadRequest(c *C) {
- s.clientTests.TestDescribeLoadBalancersBadRequest(c)
-}
-
-func (s *LocalServerSuite) TestRegisterInstanceWithLoadBalancer(c *C) {
- srv := s.srv.srv
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- resp, err := s.clientTests.elb.RegisterInstancesWithLoadBalancer([]string{instId}, "testlb")
- c.Assert(err, IsNil)
- c.Assert(resp.InstanceIds, DeepEquals, []string{instId})
-}
-
-func (s *LocalServerSuite) TestRegisterInstanceWithLoadBalancerWithAbsentInstance(c *C) {
- srv := s.srv.srv
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- resp, err := s.clientTests.elb.RegisterInstancesWithLoadBalancer([]string{"i-212"}, "testlb")
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, `^InvalidInstance found in \[i-212\]. Invalid id: "i-212" \(InvalidInstance\)$`)
- c.Assert(resp, IsNil)
-}
-
-func (s *LocalServerSuite) TestRegisterInstanceWithLoadBalancerWithAbsentLoadBalancer(c *C) {
- // the verification if the lb exists is done before the instances, so there is no need to create
- // fixture instances for this test, it'll never get that far
- resp, err := s.clientTests.elb.RegisterInstancesWithLoadBalancer([]string{"i-212"}, "absentlb")
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, `^There is no ACTIVE Load Balancer named 'absentlb' \(LoadBalancerNotFound\)$`)
- c.Assert(resp, IsNil)
-}
-
-func (s *LocalServerSuite) TestDeregisterInstanceWithLoadBalancer(c *C) {
- // there is no need to register the instance first, amazon returns the same response
- // in both cases (instance registered or not)
- srv := s.srv.srv
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- resp, err := s.clientTests.elb.DeregisterInstancesFromLoadBalancer([]string{instId}, "testlb")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Not(Equals), "")
-}
-
-func (s *LocalServerSuite) TestDeregisterInstanceWithLoadBalancerWithAbsentLoadBalancer(c *C) {
- resp, err := s.clientTests.elb.DeregisterInstancesFromLoadBalancer([]string{"i-212"}, "absentlb")
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, `^There is no ACTIVE Load Balancer named 'absentlb' \(LoadBalancerNotFound\)$`)
-}
-
-func (s *LocalServerSuite) TestDeregisterInstancewithLoadBalancerWithAbsentInstance(c *C) {
- srv := s.srv.srv
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- resp, err := s.clientTests.elb.DeregisterInstancesFromLoadBalancer([]string{"i-212"}, "testlb")
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- c.Assert(err, ErrorMatches, `^InvalidInstance found in \[i-212\]. Invalid id: "i-212" \(InvalidInstance\)$`)
-}
-
-func (s *LocalServerSuite) TestDescribeInstanceHealth(c *C) {
- srv := s.srv.srv
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- resp, err := s.clientTests.elb.DescribeInstanceHealth("testlb", instId)
- c.Assert(err, IsNil)
- c.Assert(len(resp.InstanceStates) > 0, Equals, true)
- c.Assert(resp.InstanceStates[0].Description, Equals, "Instance is in pending state.")
- c.Assert(resp.InstanceStates[0].InstanceId, Equals, instId)
- c.Assert(resp.InstanceStates[0].State, Equals, "OutOfService")
- c.Assert(resp.InstanceStates[0].ReasonCode, Equals, "Instance")
-}
-
-func (s *LocalServerSuite) TestDescribeInstanceHealthBadRequest(c *C) {
- s.clientTests.TestDescribeInstanceHealthBadRequest(c)
-}
-
-func (s *LocalServerSuite) TestDescribeInstanceHealthWithoutSpecifyingInstances(c *C) {
- srv := s.srv.srv
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.NewLoadBalancer("testlb")
- defer srv.RemoveLoadBalancer("testlb")
- srv.RegisterInstance(instId, "testlb")
- resp, err := s.clientTests.elb.DescribeInstanceHealth("testlb")
- c.Assert(err, IsNil)
- c.Assert(len(resp.InstanceStates) > 0, Equals, true)
- c.Assert(resp.InstanceStates[0].Description, Equals, "Instance is in pending state.")
- c.Assert(resp.InstanceStates[0].InstanceId, Equals, instId)
- c.Assert(resp.InstanceStates[0].State, Equals, "OutOfService")
- c.Assert(resp.InstanceStates[0].ReasonCode, Equals, "Instance")
-}
-
-func (s *LocalServerSuite) TestDescribeInstanceHealthChangingIt(c *C) {
- srv := s.srv.srv
- instId := srv.NewInstance()
- defer srv.RemoveInstance(instId)
- srv.NewLoadBalancer("somelb")
- defer srv.RemoveLoadBalancer("somelb")
- srv.RegisterInstance(instId, "somelb")
- state := elb.InstanceState{
- Description: "Instance has failed at least the UnhealthyThreshold number of health checks consecutively",
- InstanceId: instId,
- State: "OutOfService",
- ReasonCode: "Instance",
- }
- srv.ChangeInstanceState("somelb", state)
- resp, err := s.clientTests.elb.DescribeInstanceHealth("somelb")
- c.Assert(err, IsNil)
- c.Assert(len(resp.InstanceStates) > 0, Equals, true)
- c.Assert(resp.InstanceStates[0].Description, Equals, "Instance has failed at least the UnhealthyThreshold number of health checks consecutively")
- c.Assert(resp.InstanceStates[0].InstanceId, Equals, instId)
- c.Assert(resp.InstanceStates[0].State, Equals, "OutOfService")
- c.Assert(resp.InstanceStates[0].ReasonCode, Equals, "Instance")
-}
-
-func (s *LocalServerSuite) TestConfigureHealthCheck(c *C) {
- s.clientTests.TestConfigureHealthCheck(c)
-}
-
-func (s *LocalServerSuite) TestConfigureHealthCheckBadRequest(c *C) {
- s.clientTests.TestConfigureHealthCheckBadRequest(c)
-}
diff --git a/vendor/github.com/goamz/goamz/elb/elbtest/server.go b/vendor/github.com/goamz/goamz/elb/elbtest/server.go
deleted file mode 100644
index 9b8f79d4e..000000000
--- a/vendor/github.com/goamz/goamz/elb/elbtest/server.go
+++ /dev/null
@@ -1,551 +0,0 @@
-// Package elbtest implements a fake ELB provider with the capability of
-// inducing errors on any given operation, and retrospectively determining what
-// operations have been carried out.
-package elbtest
-
-import (
- "encoding/xml"
- "fmt"
- "github.com/goamz/goamz/elb"
- "net"
- "net/http"
- "net/url"
- "regexp"
- "strconv"
- "strings"
- "sync"
-)
-
-// Server implements an ELB simulator for use in testing.
-type Server struct {
- url string
- listener net.Listener
- mutex sync.Mutex
- reqId int
- lbs map[string]*elb.LoadBalancerDescription
- lbsReqs map[string]url.Values
- instances []string
- instanceStates map[string][]*elb.InstanceState
- instCount int
-}
-
-// Starts and returns a new server
-func NewServer() (*Server, error) {
- l, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- return nil, fmt.Errorf("cannot listen on localhost: %v", err)
- }
- srv := &Server{
- listener: l,
- url: "http://" + l.Addr().String(),
- lbs: make(map[string]*elb.LoadBalancerDescription),
- instanceStates: make(map[string][]*elb.InstanceState),
- }
- go http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- srv.serveHTTP(w, req)
- }))
- return srv, nil
-}
-
-// Quit closes down the server.
-func (srv *Server) Quit() {
- srv.listener.Close()
-}
-
-// URL returns the URL of the server.
-func (srv *Server) URL() string {
- return srv.url
-}
-
-type xmlErrors struct {
- XMLName string `xml:"ErrorResponse"`
- Error elb.Error
-}
-
-func (srv *Server) error(w http.ResponseWriter, err *elb.Error) {
- w.WriteHeader(err.StatusCode)
- xmlErr := xmlErrors{Error: *err}
- if e := xml.NewEncoder(w).Encode(xmlErr); e != nil {
- panic(e)
- }
-}
-
-func (srv *Server) serveHTTP(w http.ResponseWriter, req *http.Request) {
- req.ParseForm()
- srv.mutex.Lock()
- defer srv.mutex.Unlock()
- f := actions[req.Form.Get("Action")]
- if f == nil {
- srv.error(w, &elb.Error{
- StatusCode: 400,
- Code: "InvalidParameterValue",
- Message: "Unrecognized Action",
- })
- }
- reqId := fmt.Sprintf("req%0X", srv.reqId)
- srv.reqId++
- if resp, err := f(srv, w, req, reqId); err == nil {
- if err := xml.NewEncoder(w).Encode(resp); err != nil {
- panic(err)
- }
- } else {
- switch err.(type) {
- case *elb.Error:
- srv.error(w, err.(*elb.Error))
- default:
- panic(err)
- }
- }
-}
-
-func (srv *Server) createLoadBalancer(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- composition := map[string]string{
- "AvailabilityZones.member.1": "Subnets.member.1",
- }
- if err := srv.validateComposition(req, composition); err != nil {
- return nil, err
- }
- required := []string{
- "Listeners.member.1.InstancePort",
- "Listeners.member.1.InstanceProtocol",
- "Listeners.member.1.Protocol",
- "Listeners.member.1.LoadBalancerPort",
- "LoadBalancerName",
- }
- if err := srv.validate(req, required); err != nil {
- return nil, err
- }
- path := req.FormValue("Path")
- if path == "" {
- path = "/"
- }
- lbName := req.FormValue("LoadBalancerName")
- srv.lbs[lbName] = srv.makeLoadBalancerDescription(req.Form)
- srv.lbs[lbName].DNSName = fmt.Sprintf("%s-some-aws-stuff.us-east-1.elb.amazonaws.com", lbName)
- return elb.CreateLoadBalancerResp{
- DNSName: srv.lbs[lbName].DNSName,
- }, nil
-}
-
-func (srv *Server) deleteLoadBalancer(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"LoadBalancerName"}); err != nil {
- return nil, err
- }
- srv.RemoveLoadBalancer(req.FormValue("LoadBalancerName"))
- return elb.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) registerInstancesWithLoadBalancer(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- required := []string{"LoadBalancerName", "Instances.member.1.InstanceId"}
- if err := srv.validate(req, required); err != nil {
- return nil, err
- }
- lbName := req.FormValue("LoadBalancerName")
- if err := srv.lbExists(lbName); err != nil {
- return nil, err
- }
- instIds := []string{}
- instances := []elb.Instance{}
- i := 1
- instId := req.FormValue(fmt.Sprintf("Instances.member.%d.InstanceId", i))
- for instId != "" {
- if err := srv.instanceExists(instId); err != nil {
- return nil, err
- }
- instIds = append(instIds, instId)
- instances = append(instances, elb.Instance{InstanceId: instId})
- i++
- instId = req.FormValue(fmt.Sprintf("Instances.member.%d.InstanceId", i))
- }
- srv.instanceStates[lbName] = append(srv.instanceStates[lbName], srv.makeInstanceState(instId))
- srv.lbs[lbName].Instances = append(srv.lbs[lbName].Instances, instances...)
- return elb.RegisterInstancesResp{InstanceIds: instIds}, nil
-}
-
-func (srv *Server) deregisterInstancesFromLoadBalancer(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- required := []string{"LoadBalancerName"}
- if err := srv.validate(req, required); err != nil {
- return nil, err
- }
- lbName := req.FormValue("LoadBalancerName")
- if err := srv.lbExists(lbName); err != nil {
- return nil, err
- }
- i := 1
- lb := srv.lbs[lbName]
- instId := req.FormValue(fmt.Sprintf("Instances.member.%d.InstanceId", i))
- for instId != "" {
- if err := srv.instanceExists(instId); err != nil {
- return nil, err
- }
- i++
- removeInstanceFromLB(lb, instId)
- instId = req.FormValue(fmt.Sprintf("Instances.member.%d.InstanceId", i))
- }
- srv.lbs[lbName] = lb
- srv.removeInstanceStatesFromLoadBalancer(lbName, instId)
- return elb.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) describeLoadBalancers(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- i := 1
- lbName := req.FormValue(fmt.Sprintf("LoadBalancerNames.member.%d", i))
- for lbName != "" {
- key := fmt.Sprintf("LoadBalancerNames.member.%d", i)
- if req.FormValue(key) != "" {
- if err := srv.lbExists(req.FormValue(key)); err != nil {
- return nil, err
- }
- }
- i++
- lbName = req.FormValue(fmt.Sprintf("LoadBalancerNames.member.%d", i))
- }
- lbsDesc := make([]elb.LoadBalancerDescription, len(srv.lbs))
- i = 0
- for _, lb := range srv.lbs {
- lbsDesc[i] = *lb
- i++
- }
- resp := elb.DescribeLoadBalancerResp{
- LoadBalancerDescriptions: lbsDesc,
- }
- return resp, nil
-}
-
-// getParameters returns the value all parameters from a request that matches a
-// prefix.
-//
-// For example, for the prefix "Subnets.member.", it will return a slice
-// containing the value of keys "Subnets.member.1", "Subnets.member.2" ...
-// "Subnets.member.N". The prefix must include the trailing dot.
-func (srv *Server) getParameters(prefix string, values url.Values) []string {
- i, key := 1, ""
- var k = func(n int) string {
- return fmt.Sprintf(prefix+"%d", n)
- }
- var result []string
- for i, key = 2, k(i); values.Get(key) != ""; i, key = i+1, k(i) {
- result = append(result, values.Get(key))
- }
- return result
-}
-
-func (srv *Server) makeInstanceState(id string) *elb.InstanceState {
- return &elb.InstanceState{
- Description: "Instance is in pending state.",
- InstanceId: id,
- State: "OutOfService",
- ReasonCode: "Instance",
- }
-}
-
-func removeInstanceFromLB(lb *elb.LoadBalancerDescription, id string) {
- index := -1
- for i, instance := range lb.Instances {
- if instance.InstanceId == id {
- index = i
- break
- }
- }
- if index > -1 {
- copy(lb.Instances[index:], lb.Instances[index+1:])
- lb.Instances = lb.Instances[:len(lb.Instances)-1]
- }
-}
-
-func (srv *Server) removeInstanceStatesFromLoadBalancer(lb, id string) {
- for i, state := range srv.instanceStates[lb] {
- if state.InstanceId == id {
- a := srv.instanceStates[lb]
- a[i], a = a[len(a)-1], a[:len(a)-1]
- srv.instanceStates[lb] = a
- return
- }
- }
-}
-
-func (srv *Server) makeLoadBalancerDescription(value url.Values) *elb.LoadBalancerDescription {
- lds := []elb.ListenerDescription{}
- i := 1
- protocol := value.Get(fmt.Sprintf("Listeners.member.%d.Protocol", i))
- for protocol != "" {
- key := fmt.Sprintf("Listeners.member.%d.", i)
- lInstPort, _ := strconv.Atoi(value.Get(key + "InstancePort"))
- lLBPort, _ := strconv.Atoi(value.Get(key + "LoadBalancerPort"))
- lDescription := elb.ListenerDescription{
- Listener: elb.Listener{
- Protocol: strings.ToUpper(protocol),
- InstanceProtocol: strings.ToUpper(value.Get(key + "InstanceProtocol")),
- LoadBalancerPort: lLBPort,
- InstancePort: lInstPort,
- },
- }
- i++
- protocol = value.Get(fmt.Sprintf("Listeners.member.%d.Protocol", i))
- lds = append(lds, lDescription)
- }
- sourceSecGroup := srv.makeSourceSecGroup(value)
- lbDesc := elb.LoadBalancerDescription{
- AvailabilityZones: srv.getParameters("AvailabilityZones.member.", value),
- Subnets: srv.getParameters("Subnets.member.", value),
- SecurityGroups: srv.getParameters("SecurityGroups.member.", value),
- HealthCheck: srv.makeHealthCheck(value),
- ListenerDescriptions: lds,
- Scheme: value.Get("Scheme"),
- SourceSecurityGroup: sourceSecGroup,
- LoadBalancerName: value.Get("LoadBalancerName"),
- }
- if lbDesc.Scheme == "" {
- lbDesc.Scheme = "internet-facing"
- }
- return &lbDesc
-}
-
-func (srv *Server) makeHealthCheck(value url.Values) elb.HealthCheck {
- ht := 10
- timeout := 5
- ut := 2
- interval := 30
- target := "TCP:80"
- if v := value.Get("HealthCheck.HealthyThreshold"); v != "" {
- ht, _ = strconv.Atoi(v)
- }
- if v := value.Get("HealthCheck.Timeout"); v != "" {
- timeout, _ = strconv.Atoi(v)
- }
- if v := value.Get("HealthCheck.UnhealthyThreshold"); v != "" {
- ut, _ = strconv.Atoi(v)
- }
- if v := value.Get("HealthCheck.Interval"); v != "" {
- interval, _ = strconv.Atoi(v)
- }
- if v := value.Get("HealthCheck.Target"); v != "" {
- target = v
- }
- return elb.HealthCheck{
- HealthyThreshold: ht,
- Interval: interval,
- Target: target,
- Timeout: timeout,
- UnhealthyThreshold: ut,
- }
-}
-
-func (srv *Server) makeSourceSecGroup(value url.Values) elb.SourceSecurityGroup {
- name := "amazon-elb-sg"
- alias := "amazon-elb"
- if v := value.Get("SourceSecurityGroup.GroupName"); v != "" {
- name = v
- }
- if v := value.Get("SourceSecurityGroup.OwnerAlias"); v != "" {
- alias = v
- }
- return elb.SourceSecurityGroup{
- GroupName: name,
- OwnerAlias: alias,
- }
-}
-
-func (srv *Server) describeInstanceHealth(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.lbExists(req.FormValue("LoadBalancerName")); err != nil {
- return nil, err
- }
- resp := elb.DescribeInstanceHealthResp{
- InstanceStates: []elb.InstanceState{},
- }
- for _, state := range srv.instanceStates[req.FormValue("LoadBalancerName")] {
- resp.InstanceStates = append(resp.InstanceStates, *state)
- }
- i := 1
- instanceId := req.FormValue("Instances.member.1.InstanceId")
- for instanceId != "" {
- if err := srv.instanceExists(instanceId); err != nil {
- return nil, err
- }
- is := elb.InstanceState{
- Description: "Instance is in pending state.",
- InstanceId: instanceId,
- State: "OutOfService",
- ReasonCode: "Instance",
- }
- resp.InstanceStates = append(resp.InstanceStates, is)
- i++
- instanceId = req.FormValue(fmt.Sprintf("Instances.member.%d.InstanceId", i))
- }
- return resp, nil
-}
-
-func (srv *Server) configureHealthCheck(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- required := []string{
- "LoadBalancerName",
- "HealthCheck.HealthyThreshold",
- "HealthCheck.Interval",
- "HealthCheck.Target",
- "HealthCheck.Timeout",
- "HealthCheck.UnhealthyThreshold",
- }
- if err := srv.validate(req, required); err != nil {
- return nil, err
- }
- target := req.FormValue("HealthCheck.Target")
- r, err := regexp.Compile(`[\w]+:[\d]+\/+`)
- if err != nil {
- panic(err)
- }
- if m := r.FindStringSubmatch(target); m == nil {
- return nil, &elb.Error{
- StatusCode: 400,
- Code: "ValidationError",
- Message: "HealthCheck HTTP Target must specify a port followed by a path that begins with a slash. e.g. HTTP:80/ping/this/path",
- }
- }
- ht, _ := strconv.Atoi(req.FormValue("HealthCheck.HealthyThreshold"))
- interval, _ := strconv.Atoi(req.FormValue("HealthCheck.Interval"))
- timeout, _ := strconv.Atoi(req.FormValue("HealthCheck.Timeout"))
- ut, _ := strconv.Atoi(req.FormValue("HealthCheck.UnhealthyThreshold"))
- return elb.HealthCheckResp{
- HealthCheck: &elb.HealthCheck{
- HealthyThreshold: ht,
- Interval: interval,
- Target: target,
- Timeout: timeout,
- UnhealthyThreshold: ut,
- },
- }, nil
-}
-
-func (srv *Server) instanceExists(id string) error {
- for _, instId := range srv.instances {
- if instId == id {
- return nil
- }
- }
- return &elb.Error{
- StatusCode: 400,
- Code: "InvalidInstance",
- Message: fmt.Sprintf("InvalidInstance found in [%s]. Invalid id: \"%s\"", id, id),
- }
-}
-
-func (srv *Server) lbExists(name string) error {
- if _, ok := srv.lbs[name]; !ok {
- return &elb.Error{
- StatusCode: 400,
- Code: "LoadBalancerNotFound",
- Message: fmt.Sprintf("There is no ACTIVE Load Balancer named '%s'", name),
- }
- }
- return nil
-}
-
-func (srv *Server) validate(req *http.Request, required []string) error {
- for _, field := range required {
- if req.FormValue(field) == "" {
- return &elb.Error{
- StatusCode: 400,
- Code: "ValidationError",
- Message: fmt.Sprintf("%s is required.", field),
- }
- }
- }
- return nil
-}
-
-// Validates the composition of the fields.
-//
-// Some fields cannot be together in the same request, such as AvailabilityZones and Subnets.
-// A sample map with the above requirement would be
-// c := map[string]string{
-// "AvailabilityZones.member.1": "Subnets.member.1",
-// }
-//
-// The server also requires that at least one of those fields are specified.
-func (srv *Server) validateComposition(req *http.Request, composition map[string]string) error {
- for k, v := range composition {
- if req.FormValue(k) != "" && req.FormValue(v) != "" {
- return &elb.Error{
- StatusCode: 400,
- Code: "ValidationError",
- Message: fmt.Sprintf("Only one of %s or %s may be specified", k, v),
- }
- }
- if req.FormValue(k) == "" && req.FormValue(v) == "" {
- return &elb.Error{
- StatusCode: 400,
- Code: "ValidationError",
- Message: fmt.Sprintf("Either %s or %s must be specified", k, v),
- }
- }
- }
- return nil
-}
-
-// Creates a fake instance in the server
-func (srv *Server) NewInstance() string {
- srv.instCount++
- instId := fmt.Sprintf("i-%d", srv.instCount)
- srv.instances = append(srv.instances, instId)
- return instId
-}
-
-// Removes a fake instance from the server
-//
-// If no instance is found it does nothing
-func (srv *Server) RemoveInstance(instId string) {
- for i, id := range srv.instances {
- if id == instId {
- srv.instances[i], srv.instances = srv.instances[len(srv.instances)-1], srv.instances[:len(srv.instances)-1]
- }
- }
-}
-
-// Creates a fake load balancer in the fake server
-func (srv *Server) NewLoadBalancer(name string) {
- srv.lbs[name] = &elb.LoadBalancerDescription{
- LoadBalancerName: name,
- DNSName: fmt.Sprintf("%s-some-aws-stuff.sa-east-1.amazonaws.com", name),
- }
-}
-
-// Removes a fake load balancer from the fake server
-func (srv *Server) RemoveLoadBalancer(name string) {
- delete(srv.lbs, name)
-}
-
-// Register a fake instance with a fake Load Balancer
-//
-// If the Load Balancer does not exists it does nothing
-func (srv *Server) RegisterInstance(instId, lbName string) {
- lb, ok := srv.lbs[lbName]
- if !ok {
- fmt.Println("lb not found :/")
- return
- }
- lb.Instances = append(lb.Instances, elb.Instance{InstanceId: instId})
- srv.instanceStates[lbName] = append(srv.instanceStates[lbName], srv.makeInstanceState(instId))
-}
-
-func (srv *Server) DeregisterInstance(instId, lbName string) {
- removeInstanceFromLB(srv.lbs[lbName], instId)
- srv.removeInstanceStatesFromLoadBalancer(lbName, instId)
-}
-
-func (srv *Server) ChangeInstanceState(lb string, state elb.InstanceState) {
- states := srv.instanceStates[lb]
- for i, s := range states {
- if s.InstanceId == state.InstanceId {
- srv.instanceStates[lb][i] = &state
- return
- }
- }
-}
-
-var actions = map[string]func(*Server, http.ResponseWriter, *http.Request, string) (interface{}, error){
- "CreateLoadBalancer": (*Server).createLoadBalancer,
- "DeleteLoadBalancer": (*Server).deleteLoadBalancer,
- "RegisterInstancesWithLoadBalancer": (*Server).registerInstancesWithLoadBalancer,
- "DeregisterInstancesFromLoadBalancer": (*Server).deregisterInstancesFromLoadBalancer,
- "DescribeLoadBalancers": (*Server).describeLoadBalancers,
- "DescribeInstanceHealth": (*Server).describeInstanceHealth,
- "ConfigureHealthCheck": (*Server).configureHealthCheck,
-}
diff --git a/vendor/github.com/goamz/goamz/elb/export_test.go b/vendor/github.com/goamz/goamz/elb/export_test.go
deleted file mode 100644
index 49a2d50fe..000000000
--- a/vendor/github.com/goamz/goamz/elb/export_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package elb
-
-import (
- "github.com/goamz/goamz/aws"
-)
-
-func Sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- sign(auth, method, path, params, host)
-}
diff --git a/vendor/github.com/goamz/goamz/elb/response_test.go b/vendor/github.com/goamz/goamz/elb/response_test.go
deleted file mode 100644
index 637d1e140..000000000
--- a/vendor/github.com/goamz/goamz/elb/response_test.go
+++ /dev/null
@@ -1,234 +0,0 @@
-package elb_test
-
-var CreateLoadBalancer = `
-<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <CreateLoadBalancerResult>
- <DNSName>testlb-339187009.us-east-1.elb.amazonaws.com</DNSName>
- </CreateLoadBalancerResult>
- <ResponseMetadata>
- <RequestId>0c3a8e29-490e-11e2-8647-e14ad5151f1f</RequestId>
- </ResponseMetadata>
-</CreateLoadBalancerResponse>
-`
-
-var CreateLoadBalancerBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>ValidationError</Code>
- <Message>Only one of SubnetIds or AvailabilityZones may be specified</Message>
- </Error>
- <RequestId>159253fc-49dc-11e2-a47d-cde463c91a3c</RequestId>
-</ErrorResponse>
-`
-
-var DeleteLoadBalancer = `
-<DeleteLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <DeleteLoadBalancerResult/>
- <ResponseMetadata>
- <RequestId>8d7223db-49d7-11e2-bba9-35ba56032fe1</RequestId>
- </ResponseMetadata>
-</DeleteLoadBalancerResponse>
-`
-
-var RegisterInstancesWithLoadBalancer = `
-<RegisterInstancesWithLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <RegisterInstancesWithLoadBalancerResult>
- <Instances>
- <member>
- <InstanceId>i-b44db8ca</InstanceId>
- </member>
- <member>
- <InstanceId>i-461ecf38</InstanceId>
- </member>
- </Instances>
- </RegisterInstancesWithLoadBalancerResult>
- <ResponseMetadata>
- <RequestId>0fc82478-49e1-11e2-b947-8768f15220aa</RequestId>
- </ResponseMetadata>
-</RegisterInstancesWithLoadBalancerResponse>
-`
-
-var RegisterInstancesWithLoadBalancerBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>LoadBalancerNotFound</Code>
- <Message>There is no ACTIVE Load Balancer named 'absentLB'</Message>
- </Error>
- <RequestId>19a0bb97-49f7-11e2-90b4-6bb9ec8331bf</RequestId>
-</ErrorResponse>
-`
-
-var DeregisterInstancesFromLoadBalancer = `
-<DeregisterInstancesFromLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <DeregisterInstancesFromLoadBalancerResult>
- <Instances/>
- </DeregisterInstancesFromLoadBalancerResult>
- <ResponseMetadata>
- <RequestId>d6490837-49fd-11e2-bba9-35ba56032fe1</RequestId>
- </ResponseMetadata>
-</DeregisterInstancesFromLoadBalancerResponse>
-`
-
-var DeregisterInstancesFromLoadBalancerBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>LoadBalancerNotFound</Code>
- <Message>There is no ACTIVE Load Balancer named 'absentlb'</Message>
- </Error>
- <RequestId>498e2b4a-4aa1-11e2-8839-d19a879f2eec</RequestId>
-</ErrorResponse>
-`
-
-var DescribeLoadBalancers = `
-<DescribeLoadBalancersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <DescribeLoadBalancersResult>
- <LoadBalancerDescriptions>
- <member>
- <SecurityGroups/>
- <CreatedTime>2012-12-27T11:51:52.970Z</CreatedTime>
- <LoadBalancerName>testlb</LoadBalancerName>
- <HealthCheck>
- <Interval>30</Interval>
- <Target>TCP:80</Target>
- <HealthyThreshold>10</HealthyThreshold>
- <Timeout>5</Timeout>
- <UnhealthyThreshold>2</UnhealthyThreshold>
- </HealthCheck>
- <ListenerDescriptions>
- <member>
- <PolicyNames/>
- <Listener>
- <Protocol>HTTP</Protocol>
- <LoadBalancerPort>80</LoadBalancerPort>
- <InstanceProtocol>HTTP</InstanceProtocol>
- <InstancePort>80</InstancePort>
- </Listener>
- </member>
- </ListenerDescriptions>
- <Instances/>
- <Policies>
- <AppCookieStickinessPolicies/>
- <OtherPolicies/>
- <LBCookieStickinessPolicies/>
- </Policies>
- <AvailabilityZones>
- <member>us-east-1a</member>
- </AvailabilityZones>
- <CanonicalHostedZoneName>testlb-2087227216.us-east-1.elb.amazonaws.com</CanonicalHostedZoneName>
- <CanonicalHostedZoneNameID>Z3DZXE0Q79N41H</CanonicalHostedZoneNameID>
- <Scheme>internet-facing</Scheme>
- <SourceSecurityGroup>
- <OwnerAlias>amazon-elb</OwnerAlias>
- <GroupName>amazon-elb-sg</GroupName>
- </SourceSecurityGroup>
- <DNSName>testlb-2087227216.us-east-1.elb.amazonaws.com</DNSName>
- <BackendServerDescriptions/>
- <Subnets/>
- </member>
- </LoadBalancerDescriptions>
- </DescribeLoadBalancersResult>
- <ResponseMetadata>
- <RequestId>e2e81963-5055-11e2-99c7-434205631d9b</RequestId>
- </ResponseMetadata>
-</DescribeLoadBalancersResponse>
-`
-
-var DescribeLoadBalancersBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>LoadBalancerNotFound</Code>
- <Message>Cannot find Load Balancer absentlb</Message>
- </Error>
- <RequestId>f14f348e-50f7-11e2-9831-f770dd71c209</RequestId>
-</ErrorResponse>
-`
-
-var DescribeInstanceHealth = `
-<DescribeInstanceHealthResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <DescribeInstanceHealthResult>
- <InstanceStates>
- <member>
- <Description>Instance registration is still in progress.</Description>
- <InstanceId>i-b44db8ca</InstanceId>
- <State>OutOfService</State>
- <ReasonCode>ELB</ReasonCode>
- </member>
- </InstanceStates>
- </DescribeInstanceHealthResult>
- <ResponseMetadata>
- <RequestId>da0d0f9e-5669-11e2-9f81-319facce7423</RequestId>
- </ResponseMetadata>
-</DescribeInstanceHealthResponse>
-`
-
-var DescribeInstanceHealthBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>InvalidInstance</Code>
- <Message>Could not find EC2 instance i-foooo.</Message>
- </Error>
- <RequestId>352e00d6-566c-11e2-a46d-313272bbb522</RequestId>
-</ErrorResponse>
-`
-
-var ConfigureHealthCheck = `
-<ConfigureHealthCheckResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <ConfigureHealthCheckResult>
- <HealthCheck>
- <Interval>30</Interval>
- <Target>HTTP:80/</Target>
- <HealthyThreshold>10</HealthyThreshold>
- <Timeout>5</Timeout>
- <UnhealthyThreshold>2</UnhealthyThreshold>
- </HealthCheck>
- </ConfigureHealthCheckResult>
- <ResponseMetadata>
- <RequestId>a882d12c-5694-11e2-b647-594652c9487c</RequestId>
- </ResponseMetadata>
-</ConfigureHealthCheckResponse>
-`
-
-var ConfigureHealthCheckBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>LoadBalancerNotFound</Code>
- <Message>There is no ACTIVE Load Balancer named 'foolb'</Message>
- </Error>
- <RequestId>2d9fe4a5-5697-11e2-9415-e325c02171d7</RequestId>
-</ErrorResponse>
-`
-
-var AddTagsSuccessResponse = `
-<AddTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06- 01/">
- <AddTagsResult/>
- <ResponseMetadata>
- <RequestId>360e81f7-1100-11e4-b6ed-0f30SOME-SAUCY-EXAMPLE</RequestId>
- </ResponseMetadata>
-</AddTagsResponse>
-`
-
-var TagsBadRequest = `
-<ErrorResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <Error>
- <Type>Sender</Type>
- <Code>InvalidParameterValue</Code>
- <Message>An invalid or out-of-range value was supplied for the input parameter.</Message>
- </Error>
- <RequestId>terrible-request-id</RequestId>
-</ErrorResponse>
-`
-
-var RemoveTagsSuccessResponse = `
-<RemoveTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
- <RemoveTagsResult/>
- <ResponseMetadata>
- <RequestId>83c88b9d-12b7-11e3-8b82-87b12DIFFEXAMPLE</RequestId>
- </ResponseMetadata>
-</RemoveTagsResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/elb/sign.go b/vendor/github.com/goamz/goamz/elb/sign.go
deleted file mode 100644
index b7da14772..000000000
--- a/vendor/github.com/goamz/goamz/elb/sign.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package elb
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "sort"
- "strings"
-)
-
-var b64 = base64.StdEncoding
-
-func sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- params["AWSAccessKeyId"] = auth.AccessKey
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
-
- var keys, sarray []string
- for k := range params {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(params[k]))
- }
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
diff --git a/vendor/github.com/goamz/goamz/elb/sign_test.go b/vendor/github.com/goamz/goamz/elb/sign_test.go
deleted file mode 100644
index 0dda1667e..000000000
--- a/vendor/github.com/goamz/goamz/elb/sign_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package elb_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/elb"
- . "gopkg.in/check.v1"
-)
-
-var testAuth = aws.Auth{AccessKey: "user", SecretKey: "secret"}
-
-func (s *S) TestBasicSignature(c *C) {
- params := map[string]string{}
- elb.Sign(testAuth, "GET", "/path", params, "localhost")
- c.Assert(params["SignatureVersion"], Equals, "2")
- c.Assert(params["SignatureMethod"], Equals, "HmacSHA256")
- expected := "6lSe5QyXum0jMVc7cOUz32/52ZnL7N5RyKRk/09yiK4="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestParamSignature(c *C) {
- params := map[string]string{
- "param1": "value1",
- "param2": "value2",
- "param3": "value3",
- }
- elb.Sign(testAuth, "GET", "/path", params, "localhost")
- expected := "XWOR4+0lmK8bD8CGDGZ4kfuSPbb2JibLJiCl/OPu1oU="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestManyParams(c *C) {
- params := map[string]string{
- "param1": "value10",
- "param2": "value2",
- "param3": "value3",
- "param4": "value4",
- "param5": "value5",
- "param6": "value6",
- "param7": "value7",
- "param8": "value8",
- "param9": "value9",
- "param10": "value1",
- }
- elb.Sign(testAuth, "GET", "/path", params, "localhost")
- expected := "di0sjxIvezUgQ1SIL6i+C/H8lL+U0CQ9frLIak8jkVg="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestEscaping(c *C) {
- params := map[string]string{"Nonce": "+ +"}
- elb.Sign(testAuth, "GET", "/path", params, "localhost")
- c.Assert(params["Nonce"], Equals, "+ +")
- expected := "bqffDELReIqwjg/W0DnsnVUmfLK4wXVLO4/LuG+1VFA="
- c.Assert(params["Signature"], Equals, expected)
-}
-
-func (s *S) TestSignatureExample1(c *C) {
- params := map[string]string{
- "Timestamp": "2009-02-01T12:53:20+00:00",
- "Version": "2007-11-07",
- "Action": "ListDomains",
- }
- elb.Sign(aws.Auth{AccessKey: "access", SecretKey: "secret"}, "GET", "/", params, "sdb.amazonaws.com")
- expected := "okj96/5ucWBSc1uR2zXVfm6mDHtgfNv657rRtt/aunQ="
- c.Assert(params["Signature"], Equals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/elb/suite_test.go b/vendor/github.com/goamz/goamz/elb/suite_test.go
deleted file mode 100644
index fe4c81d47..000000000
--- a/vendor/github.com/goamz/goamz/elb/suite_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package elb_test
-
-import (
- "fmt"
- "net/http"
- "net/url"
- "os"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-type HTTPSuite struct{}
-
-var testServer = NewTestHTTPServer("http://localhost:4444", 5*time.Second)
-
-func (s *HTTPSuite) SetUpSuite(c *C) {
- testServer.Start()
-}
-
-func (s *HTTPSuite) TearDownTest(c *C) {
- testServer.FlushRequests()
-}
-
-type TestHTTPServer struct {
- URL string
- Timeout time.Duration
- started bool
- request chan *http.Request
- response chan *testResponse
- pending chan bool
-}
-
-type testResponse struct {
- Status int
- Headers map[string]string
- Body string
-}
-
-func NewTestHTTPServer(url string, timeout time.Duration) *TestHTTPServer {
- return &TestHTTPServer{URL: url, Timeout: timeout}
-}
-
-func (s *TestHTTPServer) Start() {
- if s.started {
- return
- }
- s.started = true
-
- s.request = make(chan *http.Request, 64)
- s.response = make(chan *testResponse, 64)
- s.pending = make(chan bool, 64)
-
- url, _ := url.Parse(s.URL)
- go http.ListenAndServe(url.Host, s)
-
- s.PrepareResponse(202, nil, "Nothing.")
- for {
- // Wait for it to be up.
- resp, err := http.Get(s.URL)
- if err == nil && resp.StatusCode == 202 {
- break
- }
- time.Sleep(1e8)
- }
- s.WaitRequest() // Consume dummy request.
-}
-
-// FlushRequests discards requests which were not yet consumed by WaitRequest.
-func (s *TestHTTPServer) FlushRequests() {
- for {
- select {
- case <-s.request:
- default:
- return
- }
- }
-}
-
-func (s *TestHTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- s.request <- req
- var resp *testResponse
- select {
- case resp = <-s.response:
- case <-time.After(s.Timeout):
- fmt.Fprintf(os.Stderr, "ERROR: Timeout waiting for test to provide response\n")
- resp = &testResponse{500, nil, ""}
- }
- if resp.Headers != nil {
- h := w.Header()
- for k, v := range resp.Headers {
- h.Set(k, v)
- }
- }
- if resp.Status != 0 {
- w.WriteHeader(resp.Status)
- }
- w.Write([]byte(resp.Body))
-}
-
-func (s *TestHTTPServer) WaitRequest() *http.Request {
- select {
- case req := <-s.request:
- req.ParseForm()
- return req
- case <-time.After(s.Timeout):
- panic("Timeout waiting for goamz request")
- }
- panic("unreached")
-}
-
-func (s *TestHTTPServer) PrepareResponse(status int, headers map[string]string, body string) {
- s.response <- &testResponse{status, headers, body}
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/example_test.go b/vendor/github.com/goamz/goamz/exp/mturk/example_test.go
deleted file mode 100644
index 806ce95fd..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/example_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package mturk_test
-
-import (
- "fmt"
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/mturk"
-)
-
-var turk *mturk.MTurk
-
-func ExampleNew() {
- // These are your AWS tokens. Note that Turk do not support IAM.
- // So you'll have to use your main profile's tokens.
- var auth = aws.Auth{AccessKey: "<ACCESS_KEY>", SecretKey: "<SECRET_KEY>"}
- turk = mturk.New(auth, true) // true to use sandbox mode
-}
-
-func Examplemturk_CreateHIT_withExternalQuestion() {
- question := mturk.ExternalQuestion{
- ExternalURL: "http://www.amazon.com",
- FrameHeight: 200,
- }
- reward := mturk.Price{
- Amount: "0.01",
- CurrencyCode: "USD",
- }
-
- hit, err := turk.CreateHIT("title", "description", question, reward, 30, 30, "key1,key2", 3, nil, "annotation")
-
- if err == nil {
- fmt.Println(hit)
- }
-}
-
-func Examplemturk_CreateHIT_withHTMLQuestion() {
- question := mturk.HTMLQuestion{
- HTMLContent: mturk.HTMLContent{`<![CDATA[
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
- <script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
- </head>
- <body>
- <form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
- <input type='hidden' value='' name='assignmentId' id='assignmentId'/>
- <h1>What's up?</h1>
- <p><textarea name='comment' cols='80' rows='3'></textarea></p>
- <p><input type='submit' id='submitButton' value='Submit' /></p></form>
- <script language='Javascript'>turkSetAssignmentID();</script>
- </body>
-</html>
-]]>`},
- FrameHeight: 200,
- }
- reward := mturk.Price{
- Amount: "0.01",
- CurrencyCode: "USD",
- }
-
- hit, err := turk.CreateHIT("title", "description", question, reward, 30, 30, "key1,key2", 3, nil, "")
-
- if err == nil {
- fmt.Println(hit)
- }
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/export_test.go b/vendor/github.com/goamz/goamz/exp/mturk/export_test.go
deleted file mode 100644
index 736678a56..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/export_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package mturk
-
-import (
- "github.com/goamz/goamz/aws"
-)
-
-func Sign(auth aws.Auth, service, method, timestamp string, params map[string]string) {
- sign(auth, service, method, timestamp, params)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/mturk.go b/vendor/github.com/goamz/goamz/exp/mturk/mturk.go
deleted file mode 100644
index fbbf700c2..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/mturk.go
+++ /dev/null
@@ -1,480 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 Canonical Ltd.
-//
-// Written by Graham Miller <graham.miller@gmail.com>
-
-// This package is in an experimental state, and does not currently
-// follow conventions and style of the rest of goamz or common
-// Go conventions. It must be polished before it's considered a
-// first-class package in goamz.
-package mturk
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "github.com/goamz/goamz/aws"
- "net/http"
- //"net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-type MTurk struct {
- aws.Auth
- URL *url.URL
-}
-
-func New(auth aws.Auth, sandbox bool) *MTurk {
- mt := &MTurk{Auth: auth}
- var err error
- if sandbox {
- mt.URL, err = url.Parse("https://mechanicalturk.sandbox.amazonaws.com/")
- } else {
- mt.URL, err = url.Parse("https://mechanicalturk.amazonaws.com/")
- }
- if err != nil {
- panic(err.Error())
- }
- return mt
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by MTurk.
-type Error struct {
- StatusCode int // HTTP status code (200, 403, ...)
- Code string // EC2 error code ("UnsupportedOperation", ...)
- Message string // The human-oriented error message
- RequestId string
-}
-
-func (err *Error) Error() string {
- return err.Message
-}
-
-// The request stanza included in several response types, for example
-// in a "CreateHITResponse". http://goo.gl/qGeKf
-type xmlRequest struct {
- RequestId string
- IsValid string
- Errors []Error `xml:"Errors>Error"`
-}
-
-/*
-A Price represents an amount of money in a given currency.
-
-Reference:
-http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_PriceDataStructureArticle.html
-*/
-type Price struct {
- // The amount of money, as a number. The amount is in the currency specified
- // by the CurrencyCode. For example, if CurrencyCode is USD, the amount will
- // be in United States dollars (e.g. 12.75 is $12.75 US).
- Amount string
-
- // A code that represents the country and units of the currency. Its value is
- // Type an ISO 4217 currency code, such as USD for United States dollars.
- //
- // Constraints: Currently only USD is supported.
- CurrencyCode string
-
- // A textual representation of the price, using symbols and formatting
- // appropriate for the currency. Symbols are represented using the Unicode
- // character set. You do not need to specify FormattedPrice in a request.
- // It is only provided by the service in responses, as a convenience to
- // your application.
- FormattedPrice string
-}
-
-/*
-Really just a country string.
-
-Reference:
-
-- http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_LocaleDataStructureArticle.html
-- http://www.iso.org/iso/country_codes/country_codes
-*/
-type Locale string
-
-/*
-A QualificationRequirement describes a Qualification a Worker must
-have before the Worker is allowed to accept a HIT. A requirement may optionally
-state that a Worker must have the Qualification to preview the HIT.
-
-Reference:
-
-http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_QualificationRequirementDataStructureArticle.html
-*/
-type QualificationRequirement struct {
- // The ID of the Qualification type for the requirement.
- // See http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_QualificationRequirementDataStructureArticle.html#ApiReference_QualificationType-IDs
- QualificationTypeId string
-
- // The kind of comparison to make against a Qualification's value.
- // Two values can be compared to see if one value is "LessThan",
- // "LessThanOrEqualTo", "GreaterThan", "GreaterThanOrEqualTo", "EqualTo", or
- // "NotEqualTo" the other. A Qualification requirement can also test if a
- // Qualification "Exists" in the user's profile, regardless of its value.
- Comparator string
-
- // The integer value to compare against the Qualification's value.
- IntegerValue int
-
- // The locale value to compare against the Qualification's value, if the
- // Qualification being compared is the locale Qualification.
- LocaleValue Locale
-
- // If true, the question data for the HIT will not be shown when a Worker
- // whose Qualifications do not meet this requirement tries to preview the HIT.
- // That is, a Worker's Qualifications must meet all of the requirements for
- // which RequiredToPreview is true in order to preview the HIT.
- //
- // If a Worker meets all of the requirements where RequiredToPreview is true
- // (or if there are no such requirements), but does not meet all of the
- // requirements for the HIT, the Worker will be allowed to preview the HIT's
- // question data, but will not be allowed to accept and complete the HIT.
- RequiredToPreview bool
-}
-
-// Data structure holding the contents of an "external"
-// question. http://goo.gl/NP8Aa
-type ExternalQuestion struct {
- XMLName xml.Name `xml:"http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd ExternalQuestion"`
- ExternalURL string
- FrameHeight int
-}
-
-// Holds the html content of the HTMLQuestion.
-type HTMLContent struct {
- Content string `xml:",innerxml"`
-}
-
-// Data structure holding the contents of an "html"
-// question. http://goo.gl/hQn5An
-type HTMLQuestion struct {
- XMLName xml.Name `xml:"http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd HTMLQuestion"`
- HTMLContent HTMLContent
-
- FrameHeight int
-}
-
-// The data structure representing a "human interface task" (HIT)
-// Currently only supports "external" questions, because Go
-// structs don't support union types. http://goo.gl/NP8Aa
-// This type is returned, for example, from SearchHITs
-// http://goo.gl/PskcX
-type HIT struct {
- Request xmlRequest
-
- HITId string
- HITTypeId string
- CreationTime string
- Title string
- Description string
- Keywords string
- HITStatus string
- Reward Price
- LifetimeInSeconds uint
- AssignmentDurationInSeconds uint
- MaxAssignments uint
- AutoApprovalDelayInSeconds uint
- QualificationRequirement QualificationRequirement
- Question interface{}
- RequesterAnnotation string
- NumberofSimilarHITs uint
- HITReviewStatus string
- NumberOfAssignmentsPending uint
- NumberOfAssignmentsAvailable uint
- NumberOfAssignmentsCompleted uint
-}
-
-// The main data structure returned by SearchHITs
-// http://goo.gl/PskcX
-type SearchHITsResult struct {
- NumResults uint
- PageNumber uint
- TotalNumResults uint
- HITs []HIT `xml:"HIT"`
-}
-
-// The wrapper data structure returned by SearchHITs
-// http://goo.gl/PskcX
-type SearchHITsResponse struct {
- RequestId string `xml:"OperationRequest>RequestId"`
- SearchHITsResult SearchHITsResult
-}
-
-// The wrapper data structure returned by CreateHIT
-// http://goo.gl/PskcX
-type CreateHITResponse struct {
- RequestId string `xml:"OperationRequest>RequestId"`
- HIT HIT
-}
-
-type Assignment struct {
- AssignmentId string
- WorkerId string
- HITId string
- AssignmentStatus string
- AutoApprovalTime string
- AcceptTime string
- SubmitTime string
- ApprovalTime string
- Answer string
-}
-
-func (a Assignment) Answers() (answers map[string]string) {
- answers = make(map[string]string)
-
- decoder := xml.NewDecoder(strings.NewReader(a.Answer))
-
- for {
- token, _ := decoder.Token()
- if token == nil {
- break
- }
- switch startElement := token.(type) {
- case xml.StartElement:
- if startElement.Name.Local == "Answer" {
- var answer struct {
- QuestionIdentifier string
- FreeText string
- }
-
- decoder.DecodeElement(&answer, &startElement)
- answers[answer.QuestionIdentifier] = answer.FreeText
- }
- }
- }
-
- return
-}
-
-type GetAssignmentsForHITResponse struct {
- RequestId string `xml:"OperationRequest>RequestId"`
- GetAssignmentsForHITResult struct {
- Request xmlRequest
- NumResults uint
- TotalNumResults uint
- PageNumber uint
- Assignment Assignment
- }
-}
-
-/*
-CreateHIT corresponds to the "CreateHIT" operation of the Mechanical Turk
-API. Currently only supports "external" questions (see "HIT" struct above).
-
-Here are the detailed description for the parameters:
-
- title Required. A title should be short and descriptive about the
- kind of task the HIT contains. On the Amazon Mechanical Turk
- web site, the HIT title appears in search results, and
- everywhere the HIT is mentioned.
- description Required. A description includes detailed information about the
- kind of task the HIT contains. On the Amazon Mechanical Turk
- web site, the HIT description appears in the expanded view of
- search results, and in the HIT and assignment screens. A good
- description gives the user enough information to evaluate the
- HIT before accepting it.
- question Required. The data the person completing the HIT uses to produce
- the results. Consstraints: Must be a QuestionForm data structure,
- an ExternalQuestion data structure, or an HTMLQuestion data
- structure. The XML question data must not be larger than 64
- kilobytes (65,535 bytes) in size, including whitespace.
- reward Required. The amount of money the Requester will pay a Worker
- for successfully completing the HIT.
- assignmentDurationInSeconds Required. The amount of time, in seconds, that
- a Worker has to complete the HIT after accepting
- it. If a Worker does not complete the assignment
- within the specified duration, the assignment is
- considered abandoned. If the HIT is still
- active (that is, its lifetime has not elapsed),
- the assignment becomes available for other users
- to find and accept. Valid Values: any integer
- between 30 (30 seconds) and 31536000 (365 days).
- lifetimeInSeconds Required. An amount of time, in seconds, after which the
- HIT is no longer available for users to accept. After
- the lifetime of the HIT elapses, the HIT no longer
- appears in HIT searches, even if not all of the
- assignments for the HIT have been accepted. Valid Values:
- any integer between 30 (30 seconds) and 31536000 (365 days).
- keywords One or more words or phrases that describe the HIT,
- separated by commas. These words are used in searches to
- find HITs. Constraints: cannot be more than 1,000
- characters.
- maxAssignments The number of times the HIT can be accepted and completed
- before the HIT becomes unavailable. Valid Values: any
- integer between 1 and 1000000000 (1 billion). Default: 1
- qualificationRequirement A condition that a Worker's Qualifications must
- meet before the Worker is allowed to accept and
- complete the HIT. Constraints: no more than 10
- QualificationRequirement for each HIT.
- requesterAnnotation An arbitrary data field. The RequesterAnnotation
- parameter lets your application attach arbitrary data to
- the HIT for tracking purposes. For example, the
- RequesterAnnotation parameter could be an identifier
- internal to the Requester's application that corresponds
- with the HIT. Constraints: must not be longer than 255
- characters in length.
-
-Reference:
-http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_CreateHITOperation.html
-*/
-func (mt *MTurk) CreateHIT(
- title, description string,
- question interface{},
- reward Price,
- assignmentDurationInSeconds,
- lifetimeInSeconds uint,
- keywords string,
- maxAssignments uint,
- qualificationRequirement *QualificationRequirement,
- requesterAnnotation string) (h *HIT, err error) {
-
- params := make(map[string]string)
- params["Title"] = title
- params["Description"] = description
- params["Question"], err = xmlEncode(&question)
- if err != nil {
- return
- }
- params["Reward.1.Amount"] = reward.Amount
- params["Reward.1.CurrencyCode"] = reward.CurrencyCode
- params["AssignmentDurationInSeconds"] = strconv.FormatUint(uint64(assignmentDurationInSeconds), 10)
-
- params["LifetimeInSeconds"] = strconv.FormatUint(uint64(lifetimeInSeconds), 10)
- if keywords != "" {
- params["Keywords"] = keywords
- }
- if maxAssignments != 0 {
- params["MaxAssignments"] = strconv.FormatUint(uint64(maxAssignments), 10)
- }
- if qualificationRequirement != nil {
- params["QualificationRequirement"], err = xmlEncode(qualificationRequirement)
- if err != nil {
- return
- }
- }
- if requesterAnnotation != "" {
- params["RequesterAnnotation"] = requesterAnnotation
- }
-
- var response CreateHITResponse
- err = mt.query(params, "CreateHIT", &response)
- if err == nil {
- h = &response.HIT
- }
- return
-}
-
-// Corresponds to the "CreateHIT" operation of the Mechanical Turk
-// API, using an existing "hit type". http://goo.gl/cDBRc Currently only
-// supports "external" questions (see "HIT" struct above). If
-// "maxAssignments" or "requesterAnnotation" are the zero value for
-// their types, they will not be included in the request.
-func (mt *MTurk) CreateHITOfType(hitTypeId string, q ExternalQuestion, lifetimeInSeconds uint, maxAssignments uint, requesterAnnotation string) (h *HIT, err error) {
- params := make(map[string]string)
- params["HITTypeId"] = hitTypeId
- params["Question"], err = xmlEncode(&q)
- if err != nil {
- return
- }
- params["LifetimeInSeconds"] = strconv.FormatUint(uint64(lifetimeInSeconds), 10)
- if maxAssignments != 0 {
- params["MaxAssignments"] = strconv.FormatUint(uint64(maxAssignments), 10)
- }
- if requesterAnnotation != "" {
- params["RequesterAnnotation"] = requesterAnnotation
- }
-
- var response CreateHITResponse
- err = mt.query(params, "CreateHIT", &response)
- if err == nil {
- h = &response.HIT
- }
- return
-}
-
-// Get the Assignments for a HIT.
-func (mt *MTurk) GetAssignmentsForHIT(hitId string) (r *Assignment, err error) {
- params := make(map[string]string)
- params["HITId"] = hitId
- var response GetAssignmentsForHITResponse
- err = mt.query(params, "GetAssignmentsForHIT", &response)
- if err == nil {
- r = &response.GetAssignmentsForHITResult.Assignment
- }
- return
-}
-
-// Corresponds to "SearchHITs" operation of Mechanical Turk. http://goo.gl/PskcX
-// Currenlty supports none of the optional parameters.
-func (mt *MTurk) SearchHITs() (s *SearchHITsResult, err error) {
- params := make(map[string]string)
- var response SearchHITsResponse
- err = mt.query(params, "SearchHITs", &response)
- if err == nil {
- s = &response.SearchHITsResult
- }
- return
-}
-
-// Adds common parameters to the "params" map, signs the request,
-// adds the signature to the "params" map and sends the request
-// to the server. It then unmarshals the response in to the "resp"
-// parameter using xml.Unmarshal()
-func (mt *MTurk) query(params map[string]string, operation string, resp interface{}) error {
- service := "AWSMechanicalTurkRequester"
- timestamp := time.Now().UTC().Format("2006-01-02T15:04:05Z")
-
- params["AWSAccessKeyId"] = mt.Auth.AccessKey
- params["Service"] = service
- params["Timestamp"] = timestamp
- params["Operation"] = operation
-
- // make a copy
- url := *mt.URL
-
- sign(mt.Auth, service, operation, timestamp, params)
- url.RawQuery = multimap(params).Encode()
- r, err := http.Get(url.String())
- if err != nil {
- return err
- }
- //dump, _ := httputil.DumpResponse(r, true)
- //println("DUMP:\n", string(dump))
- if r.StatusCode != 200 {
- return errors.New(fmt.Sprintf("%d: unexpected status code", r.StatusCode))
- }
- dec := xml.NewDecoder(r.Body)
- err = dec.Decode(resp)
- r.Body.Close()
- return err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-func xmlEncode(i interface{}) (s string, err error) {
- var buf []byte
- buf, err = xml.Marshal(i)
- if err != nil {
- return
- }
- s = string(buf)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/mturk_test.go b/vendor/github.com/goamz/goamz/exp/mturk/mturk_test.go
deleted file mode 100644
index 0c546571f..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/mturk_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package mturk_test
-
-import (
- "net/url"
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/mturk"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- mturk *mturk.MTurk
-}
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- u, err := url.Parse(testServer.URL)
- if err != nil {
- panic(err.Error())
- }
-
- s.mturk = &mturk.MTurk{
- Auth: auth,
- URL: u,
- }
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestCreateHITExternalQuestion(c *C) {
- testServer.Response(200, nil, BasicHitResponse)
-
- question := mturk.ExternalQuestion{
- ExternalURL: "http://www.amazon.com",
- FrameHeight: 200,
- }
- reward := mturk.Price{
- Amount: "0.01",
- CurrencyCode: "USD",
- }
- hit, err := s.mturk.CreateHIT("title", "description", question, reward, 1, 2, "key1,key2", 3, nil, "annotation")
-
- testServer.WaitRequest()
-
- c.Assert(err, IsNil)
- c.Assert(hit, NotNil)
-
- c.Assert(hit.HITId, Equals, "28J4IXKO2L927XKJTHO34OCDNASCDW")
- c.Assert(hit.HITTypeId, Equals, "2XZ7D1X3V0FKQVW7LU51S7PKKGFKDF")
-}
-
-func (s *S) TestCreateHITHTMLQuestion(c *C) {
- testServer.Response(200, nil, BasicHitResponse)
-
- question := mturk.HTMLQuestion{
- HTMLContent: mturk.HTMLContent{`<![CDATA[
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
- <script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
- </head>
- <body>
- <form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
- <input type='hidden' value='' name='assignmentId' id='assignmentId'/>
- <h1>What's up?</h1>
- <p><textarea name='comment' cols='80' rows='3'></textarea></p>
- <p><input type='submit' id='submitButton' value='Submit' /></p></form>
- <script language='Javascript'>turkSetAssignmentID();</script>
- </body>
-</html>
-]]>`},
- FrameHeight: 200,
- }
- reward := mturk.Price{
- Amount: "0.01",
- CurrencyCode: "USD",
- }
- hit, err := s.mturk.CreateHIT("title", "description", question, reward, 1, 2, "key1,key2", 3, nil, "annotation")
-
- testServer.WaitRequest()
-
- c.Assert(err, IsNil)
- c.Assert(hit, NotNil)
-
- c.Assert(hit.HITId, Equals, "28J4IXKO2L927XKJTHO34OCDNASCDW")
- c.Assert(hit.HITTypeId, Equals, "2XZ7D1X3V0FKQVW7LU51S7PKKGFKDF")
-}
-
-func (s *S) TestSearchHITs(c *C) {
- testServer.Response(200, nil, SearchHITResponse)
-
- hitResult, err := s.mturk.SearchHITs()
-
- c.Assert(err, IsNil)
- c.Assert(hitResult, NotNil)
-
- c.Assert(hitResult.NumResults, Equals, uint(1))
- c.Assert(hitResult.PageNumber, Equals, uint(1))
- c.Assert(hitResult.TotalNumResults, Equals, uint(1))
-
- c.Assert(len(hitResult.HITs), Equals, 1)
- c.Assert(hitResult.HITs[0].HITId, Equals, "2BU26DG67D1XTE823B3OQ2JF2XWF83")
- c.Assert(hitResult.HITs[0].HITTypeId, Equals, "22OWJ5OPB0YV6IGL5727KP9U38P5XR")
- c.Assert(hitResult.HITs[0].CreationTime, Equals, "2011-12-28T19:56:20Z")
- c.Assert(hitResult.HITs[0].Title, Equals, "test hit")
- c.Assert(hitResult.HITs[0].Description, Equals, "please disregard, testing only")
- c.Assert(hitResult.HITs[0].HITStatus, Equals, "Reviewable")
- c.Assert(hitResult.HITs[0].MaxAssignments, Equals, uint(1))
- c.Assert(hitResult.HITs[0].Reward.Amount, Equals, "0.01")
- c.Assert(hitResult.HITs[0].Reward.CurrencyCode, Equals, "USD")
- c.Assert(hitResult.HITs[0].AutoApprovalDelayInSeconds, Equals, uint(2592000))
- c.Assert(hitResult.HITs[0].AssignmentDurationInSeconds, Equals, uint(30))
- c.Assert(hitResult.HITs[0].NumberOfAssignmentsPending, Equals, uint(0))
- c.Assert(hitResult.HITs[0].NumberOfAssignmentsAvailable, Equals, uint(1))
- c.Assert(hitResult.HITs[0].NumberOfAssignmentsCompleted, Equals, uint(0))
-}
-
-func (s *S) TestGetAssignmentsForHIT_NoAnswer(c *C) {
- testServer.Response(200, nil, GetAssignmentsForHITNoAnswerResponse)
-
- assignment, err := s.mturk.GetAssignmentsForHIT("emptyassignment")
-
- testServer.WaitRequest()
-
- c.Assert(err, IsNil)
- c.Assert(assignment, NotNil)
-
- c.Assert(assignment.HITId, Equals, "")
-}
-
-func (s *S) TestGetAssignmentsForHIT_Answer(c *C) {
- testServer.Response(200, nil, GetAssignmentsForHITAnswerResponse)
-
- assignment, err := s.mturk.GetAssignmentsForHIT("emptyassignment")
-
- testServer.WaitRequest()
-
- c.Assert(err, IsNil)
- c.Assert(assignment, NotNil)
-
- c.Assert(assignment.AssignmentId, Equals, "2QKNTL0XULRGFAQWUWDD05FP94V2O3")
- c.Assert(assignment.WorkerId, Equals, "A1ZUQ2YDM61713")
- c.Assert(assignment.HITId, Equals, "2W36VCPWZ9RN5DX1MBJ7VN3D6WEPAM")
- c.Assert(assignment.AssignmentStatus, Equals, "Submitted")
- c.Assert(assignment.AutoApprovalTime, Equals, "2014-02-26T09:39:48Z")
- c.Assert(assignment.AcceptTime, Equals, "2014-01-27T09:39:38Z")
- c.Assert(assignment.SubmitTime, Equals, "2014-01-27T09:39:48Z")
- c.Assert(assignment.ApprovalTime, Equals, "")
-
- answers := assignment.Answers()
- c.Assert(len(answers), Equals, 4)
- c.Assert(answers["tags"], Equals, "asd")
- c.Assert(answers["text_in_image"], Equals, "asd")
- c.Assert(answers["is_pattern"], Equals, "yes")
- c.Assert(answers["is_map"], Equals, "yes")
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/responses_test.go b/vendor/github.com/goamz/goamz/exp/mturk/responses_test.go
deleted file mode 100644
index abc483945..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/responses_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package mturk_test
-
-var BasicHitResponse = `<?xml version="1.0"?>
-<CreateHITResponse><OperationRequest><RequestId>643b794b-66b6-4427-bb8a-4d3df5c9a20e</RequestId></OperationRequest><HIT><Request><IsValid>True</IsValid></Request><HITId>28J4IXKO2L927XKJTHO34OCDNASCDW</HITId><HITTypeId>2XZ7D1X3V0FKQVW7LU51S7PKKGFKDF</HITTypeId></HIT></CreateHITResponse>
-`
-
-var SearchHITResponse = `<?xml version="1.0"?>
-<SearchHITsResponse><OperationRequest><RequestId>38862d9c-f015-4177-a2d3-924110a9d6f2</RequestId></OperationRequest><SearchHITsResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><HIT><HITId>2BU26DG67D1XTE823B3OQ2JF2XWF83</HITId><HITTypeId>22OWJ5OPB0YV6IGL5727KP9U38P5XR</HITTypeId><CreationTime>2011-12-28T19:56:20Z</CreationTime><Title>test hit</Title><Description>please disregard, testing only</Description><HITStatus>Reviewable</HITStatus><MaxAssignments>1</MaxAssignments><Reward><Amount>0.01</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$0.01</FormattedPrice></Reward><AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds><Expiration>2011-12-28T19:56:50Z</Expiration><AssignmentDurationInSeconds>30</AssignmentDurationInSeconds><NumberOfAssignmentsPending>0</NumberOfAssignmentsPending><NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable><NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted></HIT></SearchHITsResult></SearchHITsResponse>
-`
-
-var GetAssignmentsForHITNoAnswerResponse = `<?xml version="1.0"?>
-<GetAssignmentsForHITResponse><OperationRequest><RequestId>536934be-a35b-4e4e-9822-72fbf36d5862</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>0</NumResults><TotalNumResults>0</TotalNumResults><PageNumber>1</PageNumber></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
-`
-
-var GetAssignmentsForHITAnswerResponse = `<?xml version="1.0"?>
-<GetAssignmentsForHITResponse><OperationRequest><RequestId>2f113bdf-2e3e-4c5a-a396-3ed01384ecb9</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><Assignment><AssignmentId>2QKNTL0XULRGFAQWUWDD05FP94V2O3</AssignmentId><WorkerId>A1ZUQ2YDM61713</WorkerId><HITId>2W36VCPWZ9RN5DX1MBJ7VN3D6WEPAM</HITId><AssignmentStatus>Submitted</AssignmentStatus><AutoApprovalTime>2014-02-26T09:39:48Z</AutoApprovalTime><AcceptTime>2014-01-27T09:39:38Z</AcceptTime><SubmitTime>2014-01-27T09:39:48Z</SubmitTime><Answer>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
-&lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"&gt;
-&lt;Answer&gt;
-&lt;QuestionIdentifier&gt;tags&lt;/QuestionIdentifier&gt;
-&lt;FreeText&gt;asd&lt;/FreeText&gt;
-&lt;/Answer&gt;
-&lt;Answer&gt;
-&lt;QuestionIdentifier&gt;text_in_image&lt;/QuestionIdentifier&gt;
-&lt;FreeText&gt;asd&lt;/FreeText&gt;
-&lt;/Answer&gt;
-&lt;Answer&gt;
-&lt;QuestionIdentifier&gt;is_pattern&lt;/QuestionIdentifier&gt;
-&lt;FreeText&gt;yes&lt;/FreeText&gt;
-&lt;/Answer&gt;
-&lt;Answer&gt;
-&lt;QuestionIdentifier&gt;is_map&lt;/QuestionIdentifier&gt;
-&lt;FreeText&gt;yes&lt;/FreeText&gt;
-&lt;/Answer&gt;
-&lt;/QuestionFormAnswers&gt;
-</Answer></Assignment></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/sign.go b/vendor/github.com/goamz/goamz/exp/mturk/sign.go
deleted file mode 100644
index f2ff8cbfe..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/sign.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package mturk
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
-)
-
-var b64 = base64.StdEncoding
-
-// ----------------------------------------------------------------------------
-// Mechanical Turk signing (http://goo.gl/wrzfn)
-func sign(auth aws.Auth, service, method, timestamp string, params map[string]string) {
- payload := service + method + timestamp
- hash := hmac.New(sha1.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/mturk/sign_test.go b/vendor/github.com/goamz/goamz/exp/mturk/sign_test.go
deleted file mode 100644
index 49296eb73..000000000
--- a/vendor/github.com/goamz/goamz/exp/mturk/sign_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package mturk_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/mturk"
- . "gopkg.in/check.v1"
-)
-
-// Mechanical Turk REST authentication docs: http://goo.gl/wrzfn
-
-var testAuth = aws.Auth{AccessKey: "user", SecretKey: "secret"}
-
-// == fIJy9wCApBNL2R4J2WjJGtIBFX4=
-func (s *S) TestBasicSignature(c *C) {
- params := map[string]string{}
- mturk.Sign(testAuth, "AWSMechanicalTurkRequester", "CreateHIT", "2012-02-16T20:30:47Z", params)
- expected := "b/TnvzrdeD/L/EyzdFrznPXhido="
- c.Assert(params["Signature"], Equals, expected)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/export_test.go b/vendor/github.com/goamz/goamz/exp/sdb/export_test.go
deleted file mode 100644
index 7807a914a..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/export_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package sdb
-
-import (
- "github.com/goamz/goamz/aws"
-)
-
-func Sign(auth aws.Auth, method, path string, params map[string][]string, headers map[string][]string) {
- sign(auth, method, path, params, headers)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/responses_test.go b/vendor/github.com/goamz/goamz/exp/sdb/responses_test.go
deleted file mode 100644
index 034c2b31c..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/responses_test.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package sdb_test
-
-var TestCreateDomainXmlOK = `
-<?xml version="1.0"?>
-<CreateDomainResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <ResponseMetadata>
- <RequestId>63264005-7a5f-e01a-a224-395c63b89f6d</RequestId>
- <BoxUsage>0.0055590279</BoxUsage>
- </ResponseMetadata>
-</CreateDomainResponse>
-`
-
-var TestListDomainsXmlOK = `
-<?xml version="1.0"?>
-<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <ListDomainsResult>
- <DomainName>Account</DomainName>
- <DomainName>Domain</DomainName>
- <DomainName>Record</DomainName>
- </ListDomainsResult>
- <ResponseMetadata>
- <RequestId>15fcaf55-9914-63c2-21f3-951e31193790</RequestId>
- <BoxUsage>0.0000071759</BoxUsage>
- </ResponseMetadata>
-</ListDomainsResponse>
-`
-
-var TestListDomainsWithNextTokenXmlOK = `
-<?xml version="1.0"?>
-<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <ListDomainsResult>
- <DomainName>Domain1-200706011651</DomainName>
- <DomainName>Domain2-200706011652</DomainName>
- <NextToken>TWV0ZXJpbmdUZXN0RG9tYWluMS0yMDA3MDYwMTE2NTY=</NextToken>
- </ListDomainsResult>
- <ResponseMetadata>
- <RequestId>eb13162f-1b95-4511-8b12-489b86acfd28</RequestId>
- <BoxUsage>0.0000219907</BoxUsage>
- </ResponseMetadata>
-</ListDomainsResponse>
-`
-
-var TestDeleteDomainXmlOK = `
-<?xml version="1.0"?>
-<DeleteDomainResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <ResponseMetadata>
- <RequestId>039e1e25-9a64-2a74-93da-2fda36122a97</RequestId>
- <BoxUsage>0.0055590278</BoxUsage>
- </ResponseMetadata>
-</DeleteDomainResponse>
-`
-
-var TestDomainMetadataXmlNoSuchDomain = `
-<?xml version="1.0"?>
-<Response xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <Errors>
- <Error>
- <Code>NoSuchDomain</Code>
- <Message>The specified domain does not exist.</Message>
- <BoxUsage>0.0000071759</BoxUsage>
- </Error>
- </Errors>
- <RequestID>e050cea2-a772-f90e-2cb0-98ebd42c2898</RequestID>
-</Response>
-`
-
-var TestPutAttrsXmlOK = `
-<?xml version="1.0"?>
-<PutAttributesResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <ResponseMetadata>
- <RequestId>490206ce-8292-456c-a00f-61b335eb202b</RequestId>
- <BoxUsage>0.0000219907</BoxUsage>
- </ResponseMetadata>
-</PutAttributesResponse>
-`
-
-var TestAttrsXmlOK = `
-<?xml version="1.0"?>
-<GetAttributesResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <GetAttributesResult>
- <Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
- <Attribute><Name>Size</Name><Value>Med</Value></Attribute>
- </GetAttributesResult>
- <ResponseMetadata>
- <RequestId>b1e8f1f7-42e9-494c-ad09-2674e557526d</RequestId>
- <BoxUsage>0.0000219942</BoxUsage>
- </ResponseMetadata>
-</GetAttributesResponse>
-`
-
-var TestSelectXmlOK = `
-<?xml version="1.0"?>
-<SelectResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
- <SelectResult>
- <Item>
- <Name>Item_03</Name>
- <Attribute><Name>Category</Name><Value>Clothes</Value></Attribute>
- <Attribute><Name>Subcategory</Name><Value>Pants</Value></Attribute>
- <Attribute><Name>Name</Name><Value>Sweatpants</Value></Attribute>
- <Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
- <Attribute><Name>Color</Name><Value>Yellow</Value></Attribute>
- <Attribute><Name>Color</Name><Value>Pink</Value></Attribute>
- <Attribute><Name>Size</Name><Value>Large</Value></Attribute>
- </Item>
- <Item>
- <Name>Item_06</Name>
- <Attribute><Name>Category</Name><Value>Motorcycle Parts</Value></Attribute>
- <Attribute><Name>Subcategory</Name><Value>Bodywork</Value></Attribute>
- <Attribute><Name>Name</Name><Value>Fender Eliminator</Value></Attribute>
- <Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
- <Attribute><Name>Make</Name><Value>Yamaha</Value></Attribute>
- <Attribute><Name>Model</Name><Value>R1</Value></Attribute>
- </Item>
- </SelectResult>
- <ResponseMetadata>
- <RequestId>b1e8f1f7-42e9-494c-ad09-2674e557526d</RequestId>
- <BoxUsage>0.0000219907</BoxUsage>
- </ResponseMetadata>
-</SelectResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/sdb.go b/vendor/github.com/goamz/goamz/exp/sdb/sdb.go
deleted file mode 100644
index 0d13f4a9e..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/sdb.go
+++ /dev/null
@@ -1,413 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 AppsAttic Ltd.
-//
-// sdb package written by:
-//
-// Andrew Chilton <chilts@appsattic.com>
-// Brad Rydzewski <brad.rydzewski@gmail.com>
-
-// This package is in an experimental state, and does not currently
-// follow conventions and style of the rest of goamz or common
-// Go conventions. It must be polished before it's considered a
-// first-class package in goamz.
-package sdb
-
-// BUG: SelectResp isn't properly organized. It must change.
-
-//
-
-import (
- "encoding/xml"
- "github.com/goamz/goamz/aws"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "time"
-)
-
-const debug = false
-
-// The SDB type encapsulates operations with a specific SimpleDB region.
-type SDB struct {
- aws.Auth
- aws.Region
- private byte // Reserve the right of using private data.
-}
-
-// New creates a new SDB.
-func New(auth aws.Auth, region aws.Region) *SDB {
- return &SDB{auth, region, 0}
-}
-
-// The Domain type represents a collection of items that are described
-// by name-value attributes.
-type Domain struct {
- *SDB
- Name string
-}
-
-// Domain returns a Domain with the given name.
-func (sdb *SDB) Domain(name string) *Domain {
- return &Domain{sdb, name}
-}
-
-// The Item type represent individual objects that contain one or more
-// name-value attributes stored within a SDB Domain as rows.
-type Item struct {
- *SDB
- *Domain
- Name string
-}
-
-// Item returns an Item with the given name.
-func (domain *Domain) Item(name string) *Item {
- return &Item{domain.SDB, domain, name}
-}
-
-// The Attr type represent categories of data that can be assigned to items.
-type Attr struct {
- Name string
- Value string
-}
-
-// ----------------------------------------------------------------------------
-// Service-level operations.
-
-// --- ListDomains
-
-// Response to a ListDomains request.
-//
-// See http://goo.gl/3u0Cf for more details.
-type ListDomainsResp struct {
- Domains []string `xml:"ListDomainsResult>DomainName"`
- NextToken string `xml:"ListDomainsResult>NextToken"`
- ResponseMetadata ResponseMetadata
-}
-
-// ListDomains lists all domains in sdb.
-//
-// See http://goo.gl/Dsw15 for more details.
-func (sdb *SDB) ListDomains() (resp *ListDomainsResp, err error) {
- return sdb.ListDomainsN(0, "")
-}
-
-// ListDomainsN lists domains in sdb up to maxDomains.
-// If nextToken is not empty, domains listed will start at the given token.
-//
-// See http://goo.gl/Dsw15 for more details.
-func (sdb *SDB) ListDomainsN(maxDomains int, nextToken string) (resp *ListDomainsResp, err error) {
- params := makeParams("ListDomains")
- if maxDomains != 0 {
- params["MaxNumberOfDomains"] = []string{strconv.Itoa(maxDomains)}
- }
- if nextToken != "" {
- params["NextToken"] = []string{nextToken}
- }
- resp = &ListDomainsResp{}
- err = sdb.query(nil, nil, params, nil, resp)
- return
-}
-
-// --- SelectExpression
-
-// Response to a Select request.
-//
-// See http://goo.gl/GTsSZ for more details.
-type SelectResp struct {
- Items []struct {
- Name string
- Attrs []Attr `xml:"Attribute"`
- } `xml:"SelectResult>Item"`
- ResponseMetadata ResponseMetadata
-}
-
-// Select returns a set of items and attributes that match expr.
-// Select is similar to the standard SQL SELECT statement.
-//
-// See http://goo.gl/GTsSZ for more details.
-func (sdb *SDB) Select(expr string, consistent bool) (resp *SelectResp, err error) {
- resp = &SelectResp{}
- params := makeParams("Select")
- params["SelectExpression"] = []string{expr}
- if consistent {
- params["ConsistentRead"] = []string{"true"}
- }
- err = sdb.query(nil, nil, params, nil, resp)
- return
-}
-
-// ----------------------------------------------------------------------------
-// Domain-level operations.
-
-// --- CreateDomain
-
-// CreateDomain creates a new domain.
-//
-// See http://goo.gl/jDjGH for more details.
-func (domain *Domain) CreateDomain() (resp *SimpleResp, err error) {
- params := makeParams("CreateDomain")
- resp = &SimpleResp{}
- err = domain.SDB.query(domain, nil, params, nil, resp)
- return
-}
-
-// DeleteDomain deletes an existing domain.
-//
-// See http://goo.gl/S0dCL for more details.
-func (domain *Domain) DeleteDomain() (resp *SimpleResp, err error) {
- params := makeParams("DeleteDomain")
- resp = &SimpleResp{}
- err = domain.SDB.query(domain, nil, params, nil, resp)
- return
-}
-
-// ----------------------------------------------------------------------------
-// Item-level operations.
-
-type PutAttrs struct {
- attrs []Attr
- expected []Attr
- replace map[string]bool
- missing map[string]bool
-}
-
-func (pa *PutAttrs) Add(name, value string) {
- pa.attrs = append(pa.attrs, Attr{name, value})
-}
-
-func (pa *PutAttrs) Replace(name, value string) {
- pa.Add(name, value)
- if pa.replace == nil {
- pa.replace = make(map[string]bool)
- }
- pa.replace[name] = true
-}
-
-// The PutAttrs request will only succeed if the existing
-// item in SimpleDB contains a matching name / value pair.
-func (pa *PutAttrs) IfValue(name, value string) {
- pa.expected = append(pa.expected, Attr{name, value})
-}
-
-// Flag to test the existence of an attribute while performing
-// conditional updates. X can be any positive integer or 0.
-//
-// This should set Expected.N.Name=name and Expected.N.Exists=false
-func (pa *PutAttrs) IfMissing(name string) {
- if pa.missing == nil {
- pa.missing = make(map[string]bool)
- }
- pa.missing[name] = true
-}
-
-// PutAttrs adds attrs to item.
-//
-// See http://goo.gl/yTAV4 for more details.
-func (item *Item) PutAttrs(attrs *PutAttrs) (resp *SimpleResp, err error) {
- params := makeParams("PutAttributes")
- resp = &SimpleResp{}
-
- // copy these attrs over to the parameters
- itemNum := 1
- for _, attr := range attrs.attrs {
- itemNumStr := strconv.Itoa(itemNum)
-
- // do the name, value and replace
- params["Attribute."+itemNumStr+".Name"] = []string{attr.Name}
- params["Attribute."+itemNumStr+".Value"] = []string{attr.Value}
-
- if _, ok := attrs.replace[attr.Name]; ok {
- params["Attribute."+itemNumStr+".Replace"] = []string{"true"}
- }
-
- itemNum++
- }
-
- //append expected values to params
- expectedNum := 1
- for _, attr := range attrs.expected {
- expectedNumStr := strconv.Itoa(expectedNum)
- params["Expected."+expectedNumStr+".Name"] = []string{attr.Name}
- params["Expected."+expectedNumStr+".Value"] = []string{attr.Value}
-
- if attrs.missing[attr.Name] {
- params["Expected."+expectedNumStr+".Exists"] = []string{"false"}
- }
- expectedNum++
- }
-
- err = item.query(params, nil, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// Response to an Attrs request.
-//
-// See http://goo.gl/45X1M for more details.
-type AttrsResp struct {
- Attrs []Attr `xml:"GetAttributesResult>Attribute"`
- ResponseMetadata ResponseMetadata
-}
-
-// Attrs returns one or more of the named attributes, or
-// all of item's attributes if names is nil.
-// If consistent is true, previous writes will necessarily
-// be observed.
-//
-// See http://goo.gl/45X1M for more details.
-func (item *Item) Attrs(names []string, consistent bool) (resp *AttrsResp, err error) {
- params := makeParams("GetAttributes")
- params["ItemName"] = []string{item.Name}
- if consistent {
- params["ConsistentRead"] = []string{"true"}
- }
-
- // Copy these attributes over to the parameters
- for i, name := range names {
- params["AttributeName."+strconv.Itoa(i+1)] = []string{name}
- }
-
- resp = &AttrsResp{}
- err = item.query(params, nil, resp)
- if err != nil {
- return nil, err
- }
- return
-}
-
-// ----------------------------------------------------------------------------
-// Generic data structures for all requests/responses.
-
-// Error encapsulates an error returned by SDB.
-type Error struct {
- StatusCode int // HTTP status code (200, 403, ...)
- StatusMsg string // HTTP status message ("Service Unavailable", "Bad Request", ...)
- Code string // SimpleDB error code ("InvalidParameterValue", ...)
- Message string // The human-oriented error message
- RequestId string // A unique ID for this request
- BoxUsage float64 // The measure of machine utilization for this request.
-}
-
-func (err *Error) Error() string {
- return err.Message
-}
-
-// SimpleResp represents a response to an SDB request which on success
-// will return no other information besides ResponseMetadata.
-type SimpleResp struct {
- ResponseMetadata ResponseMetadata
-}
-
-// ResponseMetadata
-type ResponseMetadata struct {
- RequestId string // A unique ID for tracking the request
- BoxUsage float64 // The measure of machine utilization for this request.
-}
-
-func buildError(r *http.Response) error {
- err := Error{}
- err.StatusCode = r.StatusCode
- err.StatusMsg = r.Status
- xml.NewDecoder(r.Body).Decode(&err)
- return &err
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-func (item *Item) query(params url.Values, headers http.Header, resp interface{}) error {
- return item.Domain.SDB.query(item.Domain, item, params, headers, resp)
-}
-
-func (domain *Domain) query(item *Item, params url.Values, headers http.Header, resp interface{}) error {
- return domain.SDB.query(domain, item, params, headers, resp)
-}
-
-func (sdb *SDB) query(domain *Domain, item *Item, params url.Values, headers http.Header, resp interface{}) error {
- // all SimpleDB operations have path="/"
- method := "GET"
- path := "/"
-
- // if we have been given no headers or params, create them
- if headers == nil {
- headers = map[string][]string{}
- }
- if params == nil {
- params = map[string][]string{}
- }
-
- // setup some default parameters
- params["Version"] = []string{"2009-04-15"}
- params["Timestamp"] = []string{time.Now().UTC().Format(time.RFC3339)}
-
- // set the DomainName param (every request must have one)
- if domain != nil {
- params["DomainName"] = []string{domain.Name}
- }
-
- // set the ItemName if we have one
- if item != nil {
- params["ItemName"] = []string{item.Name}
- }
-
- // check the endpoint URL
- u, err := url.Parse(sdb.Region.SDBEndpoint)
- if err != nil {
- return err
- }
- headers["Host"] = []string{u.Host}
- sign(sdb.Auth, method, path, params, headers)
-
- u.Path = path
- if len(params) > 0 {
- u.RawQuery = params.Encode()
- }
- req := http.Request{
- URL: u,
- Method: method,
- ProtoMajor: 1,
- ProtoMinor: 1,
- Close: true,
- Header: headers,
- }
-
- if v, ok := headers["Content-Length"]; ok {
- req.ContentLength, _ = strconv.ParseInt(v[0], 10, 64)
- delete(headers, "Content-Length")
- }
-
- r, err := http.DefaultClient.Do(&req)
- if err != nil {
- return err
- }
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
-
- // status code is always 200 when successful (since we're always doing a GET)
- if r.StatusCode != 200 {
- return buildError(r)
- }
-
- // everything was fine, so unmarshal the XML and return what it's err is (if any)
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func makeParams(action string) map[string][]string {
- params := make(map[string][]string)
- params["Action"] = []string{action}
- return params
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/sdb_test.go b/vendor/github.com/goamz/goamz/exp/sdb/sdb_test.go
deleted file mode 100644
index 83e7f9f86..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/sdb_test.go
+++ /dev/null
@@ -1,219 +0,0 @@
-package sdb_test
-
-import (
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/sdb"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- sdb *sdb.SDB
-}
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.sdb = sdb.New(auth, aws.Region{SDBEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestCreateDomainOK(c *C) {
- testServer.Response(200, nil, TestCreateDomainXmlOK)
-
- domain := s.sdb.Domain("domain")
- resp, err := domain.CreateDomain()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "63264005-7a5f-e01a-a224-395c63b89f6d")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0055590279)
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListDomainsOK(c *C) {
- testServer.Response(200, nil, TestListDomainsXmlOK)
-
- resp, err := s.sdb.ListDomains()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "15fcaf55-9914-63c2-21f3-951e31193790")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000071759)
- c.Assert(resp.Domains, DeepEquals, []string{"Account", "Domain", "Record"})
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListDomainsWithNextTokenXmlOK(c *C) {
- testServer.Response(200, nil, TestListDomainsWithNextTokenXmlOK)
-
- resp, err := s.sdb.ListDomains()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "eb13162f-1b95-4511-8b12-489b86acfd28")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000219907)
- c.Assert(resp.Domains, DeepEquals, []string{"Domain1-200706011651", "Domain2-200706011652"})
- c.Assert(resp.NextToken, Equals, "TWV0ZXJpbmdUZXN0RG9tYWluMS0yMDA3MDYwMTE2NTY=")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDeleteDomainOK(c *C) {
- testServer.Response(200, nil, TestDeleteDomainXmlOK)
-
- domain := s.sdb.Domain("domain")
- resp, err := domain.DeleteDomain()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "039e1e25-9a64-2a74-93da-2fda36122a97")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0055590278)
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestPutAttrsOK(c *C) {
- testServer.Response(200, nil, TestPutAttrsXmlOK)
-
- domain := s.sdb.Domain("MyDomain")
- item := domain.Item("Item123")
-
- putAttrs := new(sdb.PutAttrs)
- putAttrs.Add("FirstName", "john")
- putAttrs.Add("LastName", "smith")
- putAttrs.Replace("MiddleName", "jacob")
-
- putAttrs.IfValue("FirstName", "john")
- putAttrs.IfMissing("FirstName")
-
- resp, err := item.PutAttrs(putAttrs)
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Form["Action"], DeepEquals, []string{"PutAttributes"})
- c.Assert(req.Form["ItemName"], DeepEquals, []string{"Item123"})
- c.Assert(req.Form["DomainName"], DeepEquals, []string{"MyDomain"})
- c.Assert(req.Form["Attribute.1.Name"], DeepEquals, []string{"FirstName"})
- c.Assert(req.Form["Attribute.1.Value"], DeepEquals, []string{"john"})
- c.Assert(req.Form["Attribute.2.Name"], DeepEquals, []string{"LastName"})
- c.Assert(req.Form["Attribute.2.Value"], DeepEquals, []string{"smith"})
- c.Assert(req.Form["Attribute.3.Name"], DeepEquals, []string{"MiddleName"})
- c.Assert(req.Form["Attribute.3.Value"], DeepEquals, []string{"jacob"})
- c.Assert(req.Form["Attribute.3.Replace"], DeepEquals, []string{"true"})
-
- c.Assert(req.Form["Expected.1.Name"], DeepEquals, []string{"FirstName"})
- c.Assert(req.Form["Expected.1.Value"], DeepEquals, []string{"john"})
- c.Assert(req.Form["Expected.1.Exists"], DeepEquals, []string{"false"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "490206ce-8292-456c-a00f-61b335eb202b")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000219907)
-
-}
-
-func (s *S) TestAttrsOK(c *C) {
- testServer.Response(200, nil, TestAttrsXmlOK)
-
- domain := s.sdb.Domain("MyDomain")
- item := domain.Item("Item123")
-
- resp, err := item.Attrs(nil, true)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Form["Action"], DeepEquals, []string{"GetAttributes"})
- c.Assert(req.Form["ItemName"], DeepEquals, []string{"Item123"})
- c.Assert(req.Form["DomainName"], DeepEquals, []string{"MyDomain"})
- c.Assert(req.Form["ConsistentRead"], DeepEquals, []string{"true"})
-
- c.Assert(resp.Attrs[0].Name, Equals, "Color")
- c.Assert(resp.Attrs[0].Value, Equals, "Blue")
- c.Assert(resp.Attrs[1].Name, Equals, "Size")
- c.Assert(resp.Attrs[1].Value, Equals, "Med")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "b1e8f1f7-42e9-494c-ad09-2674e557526d")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000219942)
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAttrsSelectOK(c *C) {
- testServer.Response(200, nil, TestAttrsXmlOK)
-
- domain := s.sdb.Domain("MyDomain")
- item := domain.Item("Item123")
-
- resp, err := item.Attrs([]string{"Color", "Size"}, true)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Form["Action"], DeepEquals, []string{"GetAttributes"})
- c.Assert(req.Form["ItemName"], DeepEquals, []string{"Item123"})
- c.Assert(req.Form["DomainName"], DeepEquals, []string{"MyDomain"})
- c.Assert(req.Form["ConsistentRead"], DeepEquals, []string{"true"})
- c.Assert(req.Form["AttributeName.1"], DeepEquals, []string{"Color"})
- c.Assert(req.Form["AttributeName.2"], DeepEquals, []string{"Size"})
-
- c.Assert(resp.Attrs[0].Name, Equals, "Color")
- c.Assert(resp.Attrs[0].Value, Equals, "Blue")
- c.Assert(resp.Attrs[1].Name, Equals, "Size")
- c.Assert(resp.Attrs[1].Value, Equals, "Med")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "b1e8f1f7-42e9-494c-ad09-2674e557526d")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000219942)
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSelectOK(c *C) {
- testServer.Response(200, nil, TestSelectXmlOK)
-
- resp, err := s.sdb.Select("select Color from MyDomain where Color like 'Blue%'", true)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Form["Action"], DeepEquals, []string{"Select"})
- c.Assert(req.Form["ConsistentRead"], DeepEquals, []string{"true"})
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "b1e8f1f7-42e9-494c-ad09-2674e557526d")
- c.Assert(resp.ResponseMetadata.BoxUsage, Equals, 0.0000219907)
- c.Assert(len(resp.Items), Equals, 2)
- c.Assert(resp.Items[0].Name, Equals, "Item_03")
- c.Assert(resp.Items[1].Name, Equals, "Item_06")
- c.Assert(resp.Items[0].Attrs[0].Name, Equals, "Category")
- c.Assert(resp.Items[0].Attrs[0].Value, Equals, "Clothes")
-
- c.Assert(err, IsNil)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/sign.go b/vendor/github.com/goamz/goamz/exp/sdb/sign.go
deleted file mode 100644
index 040ed5385..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/sign.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package sdb
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "net/http"
- "net/url"
- "sort"
- "strings"
-)
-
-var b64 = base64.StdEncoding
-
-// ----------------------------------------------------------------------------
-// SimpleDB signing (http://goo.gl/CaY81)
-
-func sign(auth aws.Auth, method, path string, params url.Values, headers http.Header) {
- var host string
- for k, v := range headers {
- k = strings.ToLower(k)
- switch k {
- case "host":
- host = v[0]
- }
- }
-
- // set up some defaults used for signing the request
- params["AWSAccessKeyId"] = []string{auth.AccessKey}
- params["SignatureVersion"] = []string{"2"}
- params["SignatureMethod"] = []string{"HmacSHA256"}
- if auth.Token() != "" {
- params["SecurityToken"] = []string{auth.Token()}
- }
-
- // join up all the incoming params
- var sarray []string
- for k, v := range params {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(v[0]))
- }
- sort.StringSlice(sarray).Sort()
- joined := strings.Join(sarray, "&")
-
- // create the payload, sign it and create the signature
- payload := strings.Join([]string{method, host, "/", joined}, "\n")
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- // add the signature to the outgoing params
- params["Signature"] = []string{string(signature)}
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sdb/sign_test.go b/vendor/github.com/goamz/goamz/exp/sdb/sign_test.go
deleted file mode 100644
index f45ad15e1..000000000
--- a/vendor/github.com/goamz/goamz/exp/sdb/sign_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package sdb_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/sdb"
- . "gopkg.in/check.v1"
-)
-
-// SimpleDB ReST authentication docs: http://goo.gl/CaY81
-
-var testAuth = aws.Auth{AccessKey: "access-key-id-s8eBOWuU", SecretKey: "secret-access-key-UkQjTLd9"}
-
-func (s *S) TestSignExampleDomainCreate(c *C) {
- method := "GET"
- params := map[string][]string{
- "Action": {"CreateDomain"},
- "DomainName": {"MyDomain"},
- "Timestamp": {"2011-08-20T07:23:57+12:00"},
- "Version": {"2009-04-15"},
- }
- headers := map[string][]string{
- "Host": {"sdb.amazonaws.com"},
- }
- sdb.Sign(testAuth, method, "", params, headers)
- expected := "ot2JaeeqMRJqgAqW67hkzUlffgxdOz4RykbrECB+tDU="
- c.Assert(params["Signature"], DeepEquals, []string{expected})
-}
-
-// Do a few test methods which takes combinations of params
diff --git a/vendor/github.com/goamz/goamz/exp/ses/ses.go b/vendor/github.com/goamz/goamz/exp/ses/ses.go
deleted file mode 100644
index 3896c5253..000000000
--- a/vendor/github.com/goamz/goamz/exp/ses/ses.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// ses.go
-package ses
-
-import (
- "encoding/xml"
- "github.com/goamz/goamz/aws"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
- "strings"
-)
-
-type SES struct {
- auth aws.Auth
- region aws.Region
- client *http.Client
-}
-
-// Initializes a pointer to an SES struct which can be used
-// to perform SES API calls.
-func NewSES(auth aws.Auth, region aws.Region) *SES {
- ses := SES{auth, region, nil}
- return &ses
-}
-
-// Sends an email to the specifications stored in the Email struct.
-func (ses *SES) SendEmail(email *Email) error {
- data := make(url.Values)
-
- index := 0
- for i := range email.destination.bccAddresses {
- if len(email.destination.bccAddresses[i]) > 0 {
- index += 1
- key := "Destination.BccAddresses.member." + strconv.Itoa(index)
- data.Add(key, email.destination.bccAddresses[i])
- }
- }
-
- index = 0
- for i := range email.destination.ccAddresses {
- if len(email.destination.ccAddresses[i]) > 0 {
- index += 1
- key := "Destination.CcAddresses.member." + strconv.Itoa(index)
- data.Add(key, email.destination.ccAddresses[i])
- }
- }
-
- index = 0
- for i := range email.destination.toAddresses {
- if len(email.destination.toAddresses[i]) > 0 {
- index += 1
- key := "Destination.ToAddresses.member." + strconv.Itoa(index)
- data.Add(key, email.destination.toAddresses[i])
- }
- }
-
- index = 0
- for i := range email.replyTo {
- if len(email.replyTo[i]) > 0 {
- index += 1
- key := "ReplyToAddresses.member." + strconv.Itoa(index)
- data.Add(key, email.replyTo[i])
- }
- }
-
- if len(email.message.Subject.Data) > 0 {
- if len(email.message.Subject.Charset) > 0 {
- data.Add("Message.Subject.Charset", email.message.Subject.Charset)
- }
- data.Add("Message.Subject.Data", email.message.Subject.Data)
- }
-
- if len(email.message.Body.Html.Data) > 0 {
- if len(email.message.Body.Html.Charset) > 0 {
- data.Add("Message.Body.Html.Charset", email.message.Body.Html.Charset)
- }
- data.Add("Message.Body.Html.Data", email.message.Body.Html.Data)
- }
-
- if len(email.message.Body.Text.Data) > 0 {
- if len(email.message.Body.Text.Charset) > 0 {
- data.Add("Message.Body.Text.Charset", email.message.Body.Text.Charset)
- }
- data.Add("Message.Body.Text.Data", email.message.Body.Text.Data)
- }
-
- if len(email.returnPath) > 0 {
- data.Add("ReturnPath", email.returnPath)
- }
-
- if len(email.source) > 0 {
- data.Add("Source", email.source)
- }
-
- return ses.doPost("SendEmail", data)
-}
-
-// Do an SES POST action.
-func (ses *SES) doPost(action string, data url.Values) error {
- req := http.Request{
- Method: "POST",
- ProtoMajor: 1,
- ProtoMinor: 1,
- Close: true,
- Header: http.Header{}}
-
- URL, err := url.Parse(ses.region.SESEndpoint)
- if err != nil {
- return err
- }
- URL.Path = "/"
-
- req.URL = URL
- req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
- token := ses.auth.Token()
- if token != "" {
- req.Header.Set("X-Amz-Security-Token", token)
- }
- sign(ses.auth, "POST", req.Header)
-
- data.Add("AWSAccessKeyId", ses.auth.AccessKey)
- data.Add("Action", action)
-
- body := data.Encode()
- req.Header.Add("Content-Length", strconv.Itoa(len(body)))
- req.Body = ioutil.NopCloser(strings.NewReader(body))
-
- if ses.client == nil {
- ses.client = &http.Client{}
- }
-
- resp, err := ses.client.Do(&req)
- if err != nil {
- return err
- }
- if resp.StatusCode > 204 {
- defer resp.Body.Close()
- return buildError(resp)
- }
-
- return nil
-}
-
-func buildError(r *http.Response) *SESError {
- rootElem := errorResponse{}
- xml.NewDecoder(r.Body).Decode(&rootElem)
- return &rootElem.Error
-}
diff --git a/vendor/github.com/goamz/goamz/exp/ses/ses_test.go b/vendor/github.com/goamz/goamz/exp/ses/ses_test.go
deleted file mode 100644
index ae93215ed..000000000
--- a/vendor/github.com/goamz/goamz/exp/ses/ses_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// ses_test
-package ses_test
-
-import (
- "bytes"
- "net/url"
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/ses"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- ses *ses.SES
-}
-
-var _ = Suite(&S{})
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.ses = ses.NewSES(auth, aws.Region{Name: "faux-region-1", S3Endpoint: testServer.URL})
-}
-
-func (s *S) TearDownStrategy(c *C) {
-
-}
-
-func (s *S) SetUpTest(c *C) {
-
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestSendEmail(c *C) {
- testServer.Response(200, nil, "")
-
- email := ses.NewEmail()
- email.AddTo("test@test.com")
- email.AddSource("test@test.com")
- email.SetSubject("test")
- email.SetBodyHtml("test")
-
- s.ses.SendEmail(email)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- buf := new(bytes.Buffer)
- buf.ReadFrom(req.Body)
- body, _ := url.ParseQuery(buf.String())
-
- c.Assert(body, Not(IsNil))
- c.Assert(body["Destination.ToAddresses.member.1"], Equals, "test@test.com")
- c.Assert(body["Source"], Equals, "test@test.com")
- c.Assert(body["Message.Subject.Data"], Equals, "test")
- c.Assert(body["Message.Body.Html.Data"], Equals, "test")
-}
diff --git a/vendor/github.com/goamz/goamz/exp/ses/ses_types.go b/vendor/github.com/goamz/goamz/exp/ses/ses_types.go
deleted file mode 100644
index d26e83740..000000000
--- a/vendor/github.com/goamz/goamz/exp/ses/ses_types.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// ses_types
-package ses
-
-// Private internal representation of message body.
-type Body struct {
- Html Content
- Text Content
-}
-
-// Content data structure with charset and payload (Data).
-type Content struct {
- Charset string
- Data string
-}
-
-// Email data structure. Should be main data structure used
-// for sending emails using SES.
-type Email struct {
- destination *destination
- message Message
- replyTo []string
- returnPath string
- source string
-}
-
-// Private internal representation for email destinations.
-type destination struct {
- bccAddresses []string
- ccAddresses []string
- toAddresses []string
-}
-
-// Message data structure.
-type Message struct {
- Body Body
- Subject Content
-}
-
-// SES Error structure.
-type SESError struct {
- Type string
- Code string
- Message string
- Detail string
- RequestId string
-}
-
-type errorResponse struct {
- Error SESError
-}
-
-func (err *SESError) Error() string {
- return err.Message
-}
-
-// Returns a pointer to an empty but initialized Email.
-func NewEmail() *Email {
- return &Email{
- destination: newDestination(),
- replyTo: make([]string, 5)}
-}
-
-// Private function to return an initialized destination.
-func newDestination() *destination {
- return &destination{
- bccAddresses: make([]string, 5),
- ccAddresses: make([]string, 5),
- toAddresses: make([]string, 5)}
-}
-
-// Add a BCC destination to Email.
-func (em *Email) AddBCC(address string) {
- em.destination.bccAddresses = append(em.destination.bccAddresses, address)
-}
-
-// Add multiple BCC destinations to Email.
-func (em *Email) AddBCCs(addresses []string) {
- em.destination.bccAddresses = append(em.destination.bccAddresses, addresses...)
-}
-
-// Add a CC destination to Email.
-func (em *Email) AddCC(address string) {
- em.destination.ccAddresses = append(em.destination.ccAddresses, address)
-}
-
-// Add multiple CC destinations to Email.
-func (em *Email) AddCCs(addresses []string) {
- em.destination.ccAddresses = append(em.destination.ccAddresses, addresses...)
-}
-
-// Add a To destination to Email.
-func (em *Email) AddTo(address string) {
- em.destination.toAddresses = append(em.destination.toAddresses, address)
-}
-
-// Add multiple To destinations to Email.
-func (em *Email) AddTos(addresses []string) {
- em.destination.toAddresses = append(em.destination.toAddresses, addresses...)
-}
-
-// Add a reply-to address to Email.
-func (em *Email) AddReplyTo(address string) {
- em.replyTo = append(em.replyTo, address)
-}
-
-// Add multiple reply-to addresses to Email.
-func (em *Email) AddReplyTos(addresses []string) {
- em.replyTo = append(em.replyTo, addresses...)
-}
-
-// Set the return path for Email.
-func (em *Email) SetReturnPath(path string) {
- em.returnPath = path
-}
-
-// Set the source address for Email.
-func (em *Email) SetSource(source string) {
- em.source = source
-}
-
-// Set the Email message.
-func (em *Email) SetMessage(message Message) {
- em.message = message
-}
-
-// Set the subject for the Email message.
-// Uses ASCII as charset.
-func (em *Email) SetSubject(subject string) {
- em.message.Subject = Content{Data: subject}
-}
-
-// Set the subject for the Email message.
-// Uses the charset (or ASCII if none) of Content.
-func (em *Email) SetSubjectAsContent(subject Content) {
- em.message.Subject = subject
-}
-
-// Sets the HTML body of the Email message.
-// Uses ASCII as charset.
-func (em *Email) SetBodyHtml(html string) {
- em.message.Body.Html = Content{Data: html}
-}
-
-// Sets the HTML body of the Email message.
-// Uses the charset (or ASCII if none) of Content.
-func (em *Email) SetBodyHtmlAsContent(html Content) {
- em.message.Body.Html = html
-}
-
-// Sets the raw text body of the Email message.
-// Uses ASCII as charset.
-func (em *Email) SetBodyRawText(text string) {
- em.message.Body.Text = Content{Data: text}
-}
-
-// Sets the raw test body of the Email message.
-// Uses the charset (or ASCII if none) of Content.
-func (em *Email) SetBodyRawTextAsContent(text Content) {
- em.message.Body.Text = text
-}
diff --git a/vendor/github.com/goamz/goamz/exp/ses/sign.go b/vendor/github.com/goamz/goamz/exp/ses/sign.go
deleted file mode 100644
index 5c9c840c8..000000000
--- a/vendor/github.com/goamz/goamz/exp/ses/sign.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// sign
-package ses
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "fmt"
- "github.com/goamz/goamz/aws"
- "time"
-)
-
-const (
- AMZ_DATE_STYLE = "Mon, 02 Jan 2006 15:04:05 -0700"
-)
-
-// Sign SES request as dictated by Amazon's Version 3 signature method.
-func sign(auth aws.Auth, method string, headers map[string][]string) {
- date := time.Now().UTC().Format(AMZ_DATE_STYLE)
- h := hmac.New(sha256.New, []byte(auth.SecretKey))
- h.Write([]byte(date))
- signature := base64.StdEncoding.EncodeToString(h.Sum(nil))
- authHeader := fmt.Sprintf("AWS3-HTTPS AWSAccessKeyId=%s, Algorithm=HmacSHA256, Signature=%s", auth.AccessKey, signature)
- headers["Date"] = []string{date}
- headers["X-Amzn-Authorization"] = []string{authHeader}
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/Makefile b/vendor/github.com/goamz/goamz/exp/sns/Makefile
deleted file mode 100644
index 1e5b9da3b..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=launchpad.net/goamz/sns
-
-GOFILES=\
- sns.go\
- sign.go\
-
-include $(GOROOT)/src/Make.pkg
-
-GOFMT=gofmt
-BADFMT=$(shell $(GOFMT) -l $(GOFILES) 2> /dev/null)
-
-gofmt: $(BADFMT)
- @for F in $(BADFMT); do $(GOFMT) -w $$F && echo $$F; done
-
-ifneq ($(BADFMT),)
-ifneq ($(MAKECMDGOALS), gofmt)
-#$(warning WARNING: make gofmt: $(BADFMT))
-endif
-endif
diff --git a/vendor/github.com/goamz/goamz/exp/sns/README b/vendor/github.com/goamz/goamz/exp/sns/README
deleted file mode 100644
index 87770adb5..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/README
+++ /dev/null
@@ -1 +0,0 @@
-Amazon Simple Notification Service API for Golang.
diff --git a/vendor/github.com/goamz/goamz/exp/sns/endpoint.go b/vendor/github.com/goamz/goamz/exp/sns/endpoint.go
deleted file mode 100644
index c6e6e4433..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/endpoint.go
+++ /dev/null
@@ -1,132 +0,0 @@
-package sns
-
-import (
- "fmt"
- "strconv"
-)
-
-type DeleteEndpointResponse struct {
- ResponseMetadata
-}
-
-type GetEndpointAttributesResponse struct {
- Attributes []AttributeEntry `xml:"GetEndpointAttributesResult>Attributes>entry"`
- ResponseMetadata
-}
-
-type PlatformEndpointOpt struct {
- Attributes []AttributeEntry
- PlatformApplicationArn string
- CustomUserData string
- Token string
-}
-
-type CreatePlatformEndpointResponse struct {
- EndpointArn string `xml:"CreatePlatformEndpointResult>EndpointArn"`
- ResponseMetadata
-}
-
-type PlatformEndpoints struct {
- EndpointArn string `xml:"EndpointArn"`
- Attributes []AttributeEntry `xml:"Attributes>entry"`
-}
-
-type ListEndpointsByPlatformApplicationResponse struct {
- Endpoints []PlatformEndpoints `xml:"ListEndpointsByPlatformApplicationResult>Endpoints>member"`
- ResponseMetadata
-}
-
-type SetEndpointAttributesOpt struct {
- Attributes []AttributeEntry
- EndpointArn string
-}
-
-type SetEndpointAttributesResponse struct {
- ResponseMetadata
-}
-
-// DeleteEndpoint
-//
-// See http://goo.gl/9SlUD9 for more details.
-func (sns *SNS) DeleteEndpoint(endpointArn string) (resp *DeleteEndpointResponse, err error) {
- resp = &DeleteEndpointResponse{}
- params := makeParams("DeleteEndpoint")
-
- params["EndpointArn"] = endpointArn
-
- err = sns.query(params, resp)
-
- return
-}
-
-// GetEndpointAttributes
-//
-// See http://goo.gl/c8E5X1 for more details.
-func (sns *SNS) GetEndpointAttributes(endpointArn string) (resp *GetEndpointAttributesResponse, err error) {
- resp = &GetEndpointAttributesResponse{}
-
- params := makeParams("GetEndpointAttributes")
-
- params["EndpointArn"] = endpointArn
-
- err = sns.query(params, resp)
-
- return
-}
-
-// CreatePlatformEndpoint
-//
-// See http://goo.gl/4tnngi for more details.
-func (sns *SNS) CreatePlatformEndpoint(options *PlatformEndpointOpt) (resp *CreatePlatformEndpointResponse, err error) {
-
- resp = &CreatePlatformEndpointResponse{}
- params := makeParams("CreatePlatformEndpoint")
-
- params["PlatformApplicationArn"] = options.PlatformApplicationArn
- params["Token"] = options.Token
-
- if options.CustomUserData != "" {
- params["CustomUserData"] = options.CustomUserData
- }
-
- err = sns.query(params, resp)
-
- return
-}
-
-// ListEndpointsByPlatformApplication
-//
-// See http://goo.gl/L7ioyR for more detail.
-func (sns *SNS) ListEndpointsByPlatformApplication(platformApplicationArn, nextToken string) (resp *ListEndpointsByPlatformApplicationResponse, err error) {
- resp = &ListEndpointsByPlatformApplicationResponse{}
-
- params := makeParams("ListEndpointsByPlatformApplication")
-
- params["PlatformApplicationArn"] = platformApplicationArn
-
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- err = sns.query(params, resp)
- return
-
-}
-
-// SetEndpointAttributes
-//
-// See http://goo.gl/GTktCj for more detail.
-func (sns *SNS) SetEndpointAttributes(options *SetEndpointAttributesOpt) (resp *SetEndpointAttributesResponse, err error) {
- resp = &SetEndpointAttributesResponse{}
- params := makeParams("SetEndpointAttributes")
-
- params["EndpointArn"] = options.EndpointArn
-
- for i, attr := range options.Attributes {
- params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key
- params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value
- }
-
- err = sns.query(params, resp)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/permissions.go b/vendor/github.com/goamz/goamz/exp/sns/permissions.go
deleted file mode 100644
index e7c73629f..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/permissions.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package sns
-
-import (
- "strconv"
-)
-
-type Permission struct {
- ActionName string
- AccountId string
-}
-
-type AddPermissionResponse struct {
- ResponseMetadata
-}
-
-// AddPermission
-//
-// See http://goo.gl/mbY4a for more details.
-func (sns *SNS) AddPermission(permissions []Permission, Label, TopicArn string) (resp *AddPermissionResponse, err error) {
- resp = &AddPermissionResponse{}
- params := makeParams("AddPermission")
-
- for i, p := range permissions {
- params["AWSAccountId.member."+strconv.Itoa(i+1)] = p.AccountId
- params["ActionName.member."+strconv.Itoa(i+1)] = p.ActionName
- }
-
- params["Label"] = Label
- params["TopicArn"] = TopicArn
-
- err = sns.query(params, resp)
- return
-}
-
-type RemovePermissionResponse struct {
- ResponseMetadata
-}
-
-// RemovePermission
-//
-// See http://goo.gl/wGl5j for more details.
-func (sns *SNS) RemovePermission(Label, TopicArn string) (resp *RemovePermissionResponse, err error) {
- resp = &RemovePermissionResponse{}
- params := makeParams("RemovePermission")
-
- params["Label"] = Label
- params["TopicArn"] = TopicArn
-
- err = sns.query(params, resp)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/platform.go b/vendor/github.com/goamz/goamz/exp/sns/platform.go
deleted file mode 100644
index b650cdda7..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/platform.go
+++ /dev/null
@@ -1,135 +0,0 @@
-package sns
-
-import (
- "fmt"
- "strconv"
-)
-
-type CreatePlatformApplicationResponse struct {
- PlatformApplicationArn string `xml:"CreatePlatformApplicationResult>PlatformApplicationArn"`
- ResponseMetadata
-}
-
-type PlatformApplicationOpt struct {
- Attributes []AttributeEntry
- Name string
- Platform string
-}
-
-type DeletePlatformApplicationResponse struct {
- ResponseMetadata
-}
-
-type GetPlatformApplicationAttributesResponse struct {
- Attributes []AttributeEntry `xml:"GetPlatformApplicationAttributesResult>Attributes>entry"`
- ResponseMetadata
-}
-
-type SetPlatformApplicationAttributesOpt struct {
- Attributes []AttributeEntry
- PlatformApplicationArn string
-}
-
-type SetPlatformApplicationAttributesResponse struct {
- ResponseMetadata
-}
-
-type PlatformApplication struct {
- Attributes []AttributeEntry `xml:"Attributes>entry"`
- PlatformApplicationArn string
-}
-
-type ListPlatformApplicationsResponse struct {
- NextToken string
- PlatformApplications []PlatformApplication `xml:"ListPlatformApplicationsResult>PlatformApplications>member"`
- ResponseMetadata
-}
-
-// CreatePlatformApplication
-//
-// See http://goo.gl/Mbbl6Z for more details.
-
-func (sns *SNS) CreatePlatformApplication(options *PlatformApplicationOpt) (resp *CreatePlatformApplicationResponse, err error) {
- resp = &CreatePlatformApplicationResponse{}
- params := makeParams("CreatePlatformApplication")
-
- params["Platform"] = options.Platform
- params["Name"] = options.Name
-
- for i, attr := range options.Attributes {
- params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key
- params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value
- }
-
- err = sns.query(params, resp)
-
- return
-
-}
-
-// DeletePlatformApplication
-//
-// See http://goo.gl/6GB3DN for more details.
-func (sns *SNS) DeletePlatformApplication(platformApplicationArn string) (resp *DeletePlatformApplicationResponse, err error) {
- resp = &DeletePlatformApplicationResponse{}
-
- params := makeParams("DeletePlatformApplication")
-
- params["PlatformApplicationArn"] = platformApplicationArn
-
- err = sns.query(params, resp)
-
- return
-}
-
-// GetPlatformApplicationAttributes
-//
-// See http://goo.gl/GswJ8I for more details.
-func (sns *SNS) GetPlatformApplicationAttributes(platformApplicationArn, nextToken string) (resp *GetPlatformApplicationAttributesResponse, err error) {
- resp = &GetPlatformApplicationAttributesResponse{}
-
- params := makeParams("GetPlatformApplicationAttributes")
-
- params["PlatformApplicationArn"] = platformApplicationArn
-
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- err = sns.query(params, resp)
-
- return
-}
-
-// ListPlatformApplications
-//
-// See http://goo.gl/vQ3ooV for more detail.
-func (sns *SNS) ListPlatformApplications(nextToken string) (resp *ListPlatformApplicationsResponse, err error) {
- resp = &ListPlatformApplicationsResponse{}
- params := makeParams("ListPlatformApplications")
-
- if nextToken != "" {
- params["NextToken"] = nextToken
- }
-
- err = sns.query(params, resp)
- return
-}
-
-// SetPlatformApplicationAttributes
-//
-// See http://goo.gl/RWnzzb for more detail.
-func (sns *SNS) SetPlatformApplicationAttributes(options *SetPlatformApplicationAttributesOpt) (resp *SetPlatformApplicationAttributesResponse, err error) {
- resp = &SetPlatformApplicationAttributesResponse{}
- params := makeParams("SetPlatformApplicationAttributes")
-
- params["PlatformApplicationArn"] = options.PlatformApplicationArn
-
- for i, attr := range options.Attributes {
- params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key
- params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value
- }
-
- err = sns.query(params, resp)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/responses_test.go b/vendor/github.com/goamz/goamz/exp/sns/responses_test.go
deleted file mode 100644
index 53a06429d..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/responses_test.go
+++ /dev/null
@@ -1,317 +0,0 @@
-package sns_test
-
-var TestListTopicsXmlOK = `
-<?xml version="1.0"?>
-<ListTopicsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ListTopicsResult>
- <Topics>
- <member>
- <TopicArn>arn:aws:sns:us-west-1:331995417492:Transcoding</TopicArn>
- </member>
- </Topics>
- </ListTopicsResult>
- <ResponseMetadata>
- <RequestId>bd10b26c-e30e-11e0-ba29-93c3aca2f103</RequestId>
- </ResponseMetadata>
-</ListTopicsResponse>
-`
-
-var TestCreateTopicXmlOK = `
-<?xml version="1.0"?>
-<CreateTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <CreateTopicResult>
- <TopicArn>arn:aws:sns:us-east-1:123456789012:My-Topic</TopicArn>
- </CreateTopicResult>
- <ResponseMetadata>
- <RequestId>a8dec8b3-33a4-11df-8963-01868b7c937a</RequestId>
- </ResponseMetadata>
-</CreateTopicResponse>
-`
-
-var TestDeleteTopicXmlOK = `
-<DeleteTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>f3aa9ac9-3c3d-11df-8235-9dab105e9c32</RequestId>
- </ResponseMetadata>
-</DeleteTopicResponse>
-`
-
-var TestListSubscriptionsXmlOK = `
-<ListSubscriptionsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ListSubscriptionsResult>
- <Subscriptions>
- <member>
- <TopicArn>arn:aws:sns:us-east-1:698519295917:My-Topic</TopicArn>
- <Protocol>email</Protocol>
- <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn>
- <Owner>123456789012</Owner>
- <Endpoint>example@amazon.com</Endpoint>
- </member>
- </Subscriptions>
- </ListSubscriptionsResult>
- <ResponseMetadata>
- <RequestId>384ac68d-3775-11df-8963-01868b7c937a</RequestId>
- </ResponseMetadata>
-</ListSubscriptionsResponse>
-`
-
-var TestGetTopicAttributesXmlOK = `
-<GetTopicAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <GetTopicAttributesResult>
- <Attributes>
- <entry>
- <key>Owner</key>
- <value>123456789012</value>
- </entry>
- <entry>
- <key>Policy</key>
- <value>{"Version":"2008-10-17","Id":"us-east-1/698519295917/test__default_policy_ID","Statement" : [{"Effect":"Allow","Sid":"us-east-1/698519295917/test__default_statement_ID","Principal" : {"AWS": "*"},"Action":["SNS:GetTopicAttributes","SNS:SetTopicAttributes","SNS:AddPermission","SNS:RemovePermission","SNS:DeleteTopic","SNS:Subscribe","SNS:ListSubscriptionsByTopic","SNS:Publish","SNS:Receive"],"Resource":"arn:aws:sns:us-east-1:698519295917:test","Condition" : {"StringLike" : {"AWS:SourceArn": "arn:aws:*:*:698519295917:*"}}}]}</value>
- </entry>
- <entry>
- <key>TopicArn</key>
- <value>arn:aws:sns:us-east-1:123456789012:My-Topic</value>
- </entry>
- </Attributes>
- </GetTopicAttributesResult>
- <ResponseMetadata>
- <RequestId>057f074c-33a7-11df-9540-99d0768312d3</RequestId>
- </ResponseMetadata>
-</GetTopicAttributesResponse>
-`
-
-var TestPublishXmlOK = `
-<PublishResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <PublishResult>
- <MessageId>94f20ce6-13c5-43a0-9a9e-ca52d816e90b</MessageId>
- </PublishResult>
- <ResponseMetadata>
- <RequestId>f187a3c1-376f-11df-8963-01868b7c937a</RequestId>
- </ResponseMetadata>
-</PublishResponse>
-`
-
-var TestSetTopicAttributesXmlOK = `
-<SetTopicAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>a8763b99-33a7-11df-a9b7-05d48da6f042</RequestId>
- </ResponseMetadata>
-</SetTopicAttributesResponse>
-`
-
-var TestSubscribeXmlOK = `
-<SubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <SubscribeResult>
- <SubscriptionArn>pending confirmation</SubscriptionArn>
- </SubscribeResult>
- <ResponseMetadata>
- <RequestId>a169c740-3766-11df-8963-01868b7c937a</RequestId>
- </ResponseMetadata>
-</SubscribeResponse>
-`
-
-var TestUnsubscribeXmlOK = `
-<UnsubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>18e0ac39-3776-11df-84c0-b93cc1666b84</RequestId>
- </ResponseMetadata>
-</UnsubscribeResponse>
-`
-
-var TestConfirmSubscriptionXmlOK = `
-<ConfirmSubscriptionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ConfirmSubscriptionResult>
- <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn>
- </ConfirmSubscriptionResult>
- <ResponseMetadata>
- <RequestId>7a50221f-3774-11df-a9b7-05d48da6f042</RequestId>
- </ResponseMetadata>
-</ConfirmSubscriptionResponse>
-`
-
-var TestAddPermissionXmlOK = `
-<AddPermissionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>6a213e4e-33a8-11df-9540-99d0768312d3</RequestId>
- </ResponseMetadata>
-</AddPermissionResponse>
-`
-
-var TestRemovePermissionXmlOK = `
-<RemovePermissionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>d170b150-33a8-11df-995a-2d6fbe836cc1</RequestId>
- </ResponseMetadata>
-</RemovePermissionResponse>
-`
-
-var TestListSubscriptionsByTopicXmlOK = `
-<ListSubscriptionsByTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ListSubscriptionsByTopicResult>
- <Subscriptions>
- <member>
- <TopicArn>arn:aws:sns:us-east-1:123456789012:My-Topic</TopicArn>
- <Protocol>email</Protocol>
- <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn>
- <Owner>123456789012</Owner>
- <Endpoint>example@amazon.com</Endpoint>
- </member>
- </Subscriptions>
- </ListSubscriptionsByTopicResult>
- <ResponseMetadata>
- <RequestId>b9275252-3774-11df-9540-99d0768312d3</RequestId>
- </ResponseMetadata>
-</ListSubscriptionsByTopicResponse>
-`
-
-var TestCreatePlatformApplicationXmlOK = `
-<CreatePlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <CreatePlatformApplicationResult>
- <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp</PlatformApplicationArn>
- </CreatePlatformApplicationResult>
- <ResponseMetadata>
- <RequestId>b6f0e78b-e9d4-5a0e-b973-adc04e8a4ff9</RequestId>
- </ResponseMetadata>
-</CreatePlatformApplicationResponse>
-`
-
-var TestCreatePlatformEndpointXmlOK = `
-<CreatePlatformEndpointResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <CreatePlatformEndpointResult>
- <EndpointArn>arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3</EndpointArn>
- </CreatePlatformEndpointResult>
- <ResponseMetadata>
- <RequestId>6613341d-3e15-53f7-bf3c-7e56994ba278</RequestId>
- </ResponseMetadata>
-</CreatePlatformEndpointResponse>
-`
-
-var DeleteEndpointXmlOK = `
-<DeleteEndpointResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>c1d2b191-353c-5a5f-8969-fbdd3900afa8</RequestId>
- </ResponseMetadata>
-</DeleteEndpointResponse>
-`
-
-var TestDeletePlatformApplicationXmlOK = `
-<DeletePlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>097dac18-7a77-5823-a8dd-e65476dcb037</RequestId>
- </ResponseMetadata>
-</DeletePlatformApplicationResponse>
-`
-
-var TestGetEndpointAttributesXmlOK = `
-<GetEndpointAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <GetEndpointAttributesResult>
- <Attributes>
- <entry>
- <key>Enabled</key>
- <value>true</value>
- </entry>
- <entry>
- <key>CustomUserData</key>
- <value>UserId=01234567</value>
- </entry>
- <entry>
- <key>Token</key>
- <value>APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE</value>
- </entry>
- </Attributes>
- </GetEndpointAttributesResult>
- <ResponseMetadata>
- <RequestId>6c725a19-a142-5b77-94f9-1055a9ea04e7</RequestId>
- </ResponseMetadata>
-</GetEndpointAttributesResponse>
-`
-
-var TestGetPlatformApplicationAttributesXmlOK = `
-<GetPlatformApplicationAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <GetPlatformApplicationAttributesResult>
- <Attributes>
- <entry>
- <key>AllowEndpointPolicies</key>
- <value>false</value>
- </entry>
- </Attributes>
- </GetPlatformApplicationAttributesResult>
- <ResponseMetadata>
- <RequestId>74848df2-87f6-55ed-890c-c7be80442462</RequestId>
- </ResponseMetadata>
-</GetPlatformApplicationAttributesResponse>
-`
-
-var TestListEndpointsByPlatformApplicationXmlOK = `
-<ListEndpointsByPlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ListEndpointsByPlatformApplicationResult>
- <Endpoints>
- <member>
- <EndpointArn>arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3</EndpointArn>
- <Attributes>
- <entry>
- <key>Enabled</key>
- <value>true</value>
- </entry>
- <entry>
- <key>CustomUserData</key>
- <value>UserId=27576823</value>
- </entry>
- <entry>
- <key>Token</key>
- <value>APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE</value>
- </entry>
- </Attributes>
- </member>
- </Endpoints>
- </ListEndpointsByPlatformApplicationResult>
- <ResponseMetadata>
- <RequestId>9a48768c-dac8-5a60-aec0-3cc27ea08d96</RequestId>
- </ResponseMetadata>
-</ListEndpointsByPlatformApplicationResponse>
-`
-
-var TestListPlatformApplicationsXmlOK = `
-<ListPlatformApplicationsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ListPlatformApplicationsResult>
- <PlatformApplications>
- <member>
- <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/APNS_SANDBOX/apnspushapp</PlatformApplicationArn>
- <Attributes>
- <entry>
- <key>AllowEndpointPolicies</key>
- <value>false</value>
- </entry>
- </Attributes>
- </member>
- <member>
- <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp</PlatformApplicationArn>
- <Attributes>
- <entry>
- <key>AllowEndpointPolicies</key>
- <value>false</value>
- </entry>
- </Attributes>
- </member>
- </PlatformApplications>
- </ListPlatformApplicationsResult>
- <ResponseMetadata>
- <RequestId>315a335e-85d8-52df-9349-791283cbb529</RequestId>
- </ResponseMetadata>
-</ListPlatformApplicationsResponse>
-`
-
-var TestSetEndpointAttributesXmlOK = `
-<SetEndpointAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>2fe0bfc7-3e85-5ee5-a9e2-f58b35e85f6a</RequestId>
- </ResponseMetadata>
-</SetEndpointAttributesResponse>
-`
-
-var TestSetPlatformApplicationAttributesXmlOK = `
-<SetPlatformApplicationAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
- <ResponseMetadata>
- <RequestId>cf577bcc-b3dc-5463-88f1-3180b9412395</RequestId>
- </ResponseMetadata>
-</SetPlatformApplicationAttributesResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/exp/sns/sign.go b/vendor/github.com/goamz/goamz/exp/sns/sign.go
deleted file mode 100644
index 0c35f05ae..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/sign.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package sns
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "sort"
- "strings"
-)
-
-var b64 = base64.StdEncoding
-
-/*
-func sign(auth aws.Auth, method, path string, params url.Values, headers http.Header) {
- var host string
- for k, v := range headers {
- k = strings.ToLower(k)
- switch k {
- case "host":
- host = v[0]
- }
- }
-
- params["AWSAccessKeyId"] = []string{auth.AccessKey}
- params["SignatureVersion"] = []string{"2"}
- params["SignatureMethod"] = []string{"HmacSHA256"}
- if auth.Token() != "" {
- params["SecurityToken"] = auth.Token()
- }
-
- var sarry []string
- for k, v := range params {
- sarry = append(sarry, aws.Encode(k) + "=" + aws.Encode(v[0]))
- }
-
- sort.StringSlice(sarry).Sort()
- joined := strings.Join(sarry, "&")
-
- payload := strings.Join([]string{method, host, "/", joined}, "\n")
- hash := hmac.NewSHA256([]byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum())
-
- params["Signature"] = []string{"AWS " + string(signature)}
- println("Payload:", payload)
- println("Signature:", strings.Join(params["Signature"], "|"))
-}*/
-
-func sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- params["AWSAccessKeyId"] = auth.AccessKey
- if auth.Token() != "" {
- params["SecurityToken"] = auth.Token()
- }
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
-
- var sarray []string
- for k, v := range params {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(v))
- }
- sort.StringSlice(sarray).Sort()
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/sns.go b/vendor/github.com/goamz/goamz/exp/sns/sns.go
deleted file mode 100644
index 4d4622211..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/sns.go
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 Memeo Inc.
-//
-// Written by Prudhvi Krishna Surapaneni <me@prudhvi.net>
-
-// This package is in an experimental state, and does not currently
-// follow conventions and style of the rest of goamz or common
-// Go conventions. It must be polished before it's considered a
-// first-class package in goamz.
-package sns
-
-// BUG(niemeyer): Package needs documentation.
-
-import (
- "encoding/xml"
- "net/http"
- "net/url"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-// The SNS type encapsulates operation with an SNS region.
-type SNS struct {
- aws.Auth
- aws.Region
- private byte // Reserve the right of using private data.
-}
-
-type AttributeEntry struct {
- Key string `xml:"key"`
- Value string `xml:"value"`
-}
-
-type ResponseMetadata struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
- BoxUsage float64 `xml:"ResponseMetadata>BoxUsage"`
-}
-
-func New(auth aws.Auth, region aws.Region) *SNS {
- return &SNS{auth, region, 0}
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-type Error struct {
- StatusCode int
- Code string
- Message string
- RequestId string
-}
-
-func (err *Error) Error() string {
- return err.Message
-}
-
-type xmlErrors struct {
- RequestId string
- Errors []Error `xml:"Errors>Error"`
-}
-
-func (sns *SNS) query(params map[string]string, resp interface{}) error {
- params["Timestamp"] = time.Now().UTC().Format(time.RFC3339)
- u, err := url.Parse(sns.Region.SNSEndpoint)
- if err != nil {
- return err
- }
-
- sign(sns.Auth, "GET", "/", params, u.Host)
- u.RawQuery = multimap(params).Encode()
- r, err := http.Get(u.String())
- if err != nil {
- return err
- }
- defer r.Body.Close()
-
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func buildError(r *http.Response) error {
- errors := xmlErrors{}
- xml.NewDecoder(r.Body).Decode(&errors)
- var err Error
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/sns_test.go b/vendor/github.com/goamz/goamz/exp/sns/sns_test.go
deleted file mode 100644
index 054db13d3..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/sns_test.go
+++ /dev/null
@@ -1,455 +0,0 @@
-package sns_test
-
-import (
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/exp/sns"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- sns *sns.SNS
-}
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.sns = sns.New(auth, aws.Region{SNSEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestListTopicsOK(c *C) {
- testServer.Response(200, nil, TestListTopicsXmlOK)
-
- resp, err := s.sns.ListTopics(nil)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.Topics[0].SNS, Equals, s.sns)
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "bd10b26c-e30e-11e0-ba29-93c3aca2f103")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCreateTopic(c *C) {
- testServer.Response(200, nil, TestCreateTopicXmlOK)
-
- resp, err := s.sns.CreateTopic("My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.Topic.SNS, Equals, s.sns)
- c.Assert(resp.Topic.TopicArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "a8dec8b3-33a4-11df-8963-01868b7c937a")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDeleteTopic(c *C) {
- testServer.Response(200, nil, TestDeleteTopicXmlOK)
-
- t := sns.Topic{s.sns, "arn:aws:sns:us-east-1:123456789012:My-Topic"}
- resp, err := t.Delete()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "f3aa9ac9-3c3d-11df-8235-9dab105e9c32")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListSubscriptions(c *C) {
- testServer.Response(200, nil, TestListSubscriptionsXmlOK)
-
- resp, err := s.sns.ListSubscriptions(nil)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Subscriptions), Not(Equals), 0)
- c.Assert(resp.Subscriptions[0].Protocol, Equals, "email")
- c.Assert(resp.Subscriptions[0].Endpoint, Equals, "example@amazon.com")
- c.Assert(resp.Subscriptions[0].SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca")
- c.Assert(resp.Subscriptions[0].TopicArn, Equals, "arn:aws:sns:us-east-1:698519295917:My-Topic")
- c.Assert(resp.Subscriptions[0].Owner, Equals, "123456789012")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGetTopicAttributes(c *C) {
- testServer.Response(200, nil, TestGetTopicAttributesXmlOK)
-
- resp, err := s.sns.GetTopicAttributes("arn:aws:sns:us-east-1:123456789012:My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Attributes), Not(Equals), 0)
- c.Assert(resp.Attributes[0].Key, Equals, "Owner")
- c.Assert(resp.Attributes[0].Value, Equals, "123456789012")
- c.Assert(resp.Attributes[1].Key, Equals, "Policy")
- c.Assert(resp.Attributes[1].Value, Equals, `{"Version":"2008-10-17","Id":"us-east-1/698519295917/test__default_policy_ID","Statement" : [{"Effect":"Allow","Sid":"us-east-1/698519295917/test__default_statement_ID","Principal" : {"AWS": "*"},"Action":["SNS:GetTopicAttributes","SNS:SetTopicAttributes","SNS:AddPermission","SNS:RemovePermission","SNS:DeleteTopic","SNS:Subscribe","SNS:ListSubscriptionsByTopic","SNS:Publish","SNS:Receive"],"Resource":"arn:aws:sns:us-east-1:698519295917:test","Condition" : {"StringLike" : {"AWS:SourceArn": "arn:aws:*:*:698519295917:*"}}}]}`)
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "057f074c-33a7-11df-9540-99d0768312d3")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestPublish(c *C) {
- testServer.Response(200, nil, TestPublishXmlOK)
-
- pubOpt := &sns.PublishOpt{"foobar", "", "subject", "arn:aws:sns:us-east-1:123456789012:My-Topic"}
- resp, err := s.sns.Publish(pubOpt)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.MessageId, Equals, "94f20ce6-13c5-43a0-9a9e-ca52d816e90b")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "f187a3c1-376f-11df-8963-01868b7c937a")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSetTopicAttributes(c *C) {
- testServer.Response(200, nil, TestSetTopicAttributesXmlOK)
-
- resp, err := s.sns.SetTopicAttributes("DisplayName", "MyTopicName", "arn:aws:sns:us-east-1:123456789012:My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "a8763b99-33a7-11df-a9b7-05d48da6f042")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSubscribe(c *C) {
- testServer.Response(200, nil, TestSubscribeXmlOK)
-
- resp, err := s.sns.Subscribe("example@amazon.com", "email", "arn:aws:sns:us-east-1:123456789012:My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.SubscriptionArn, Equals, "pending confirmation")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "a169c740-3766-11df-8963-01868b7c937a")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestUnsubscribe(c *C) {
- testServer.Response(200, nil, TestUnsubscribeXmlOK)
-
- resp, err := s.sns.Unsubscribe("arn:aws:sns:us-east-1:123456789012:My-Topic:a169c740-3766-11df-8963-01868b7c937a")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "18e0ac39-3776-11df-84c0-b93cc1666b84")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestConfirmSubscription(c *C) {
- testServer.Response(200, nil, TestConfirmSubscriptionXmlOK)
-
- opt := &sns.ConfirmSubscriptionOpt{"", "51b2ff3edb475b7d91550e0ab6edf0c1de2a34e6ebaf6", "arn:aws:sns:us-east-1:123456789012:My-Topic"}
- resp, err := s.sns.ConfirmSubscription(opt)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "7a50221f-3774-11df-a9b7-05d48da6f042")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAddPermission(c *C) {
- testServer.Response(200, nil, TestAddPermissionXmlOK)
- perm := make([]sns.Permission, 2)
- perm[0].ActionName = "Publish"
- perm[1].ActionName = "GetTopicAttributes"
- perm[0].AccountId = "987654321000"
- perm[1].AccountId = "876543210000"
-
- resp, err := s.sns.AddPermission(perm, "NewPermission", "arn:aws:sns:us-east-1:123456789012:My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "6a213e4e-33a8-11df-9540-99d0768312d3")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestRemovePermission(c *C) {
- testServer.Response(200, nil, TestRemovePermissionXmlOK)
-
- resp, err := s.sns.RemovePermission("NewPermission", "arn:aws:sns:us-east-1:123456789012:My-Topic")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "d170b150-33a8-11df-995a-2d6fbe836cc1")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListSubscriptionByTopic(c *C) {
- testServer.Response(200, nil, TestListSubscriptionsByTopicXmlOK)
-
- opt := &sns.ListSubscriptionByTopicOpt{"", "arn:aws:sns:us-east-1:123456789012:My-Topic"}
- resp, err := s.sns.ListSubscriptionByTopic(opt)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Subscriptions), Not(Equals), 0)
- c.Assert(resp.Subscriptions[0].TopicArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic")
- c.Assert(resp.Subscriptions[0].SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca")
- c.Assert(resp.Subscriptions[0].Owner, Equals, "123456789012")
- c.Assert(resp.Subscriptions[0].Endpoint, Equals, "example@amazon.com")
- c.Assert(resp.Subscriptions[0].Protocol, Equals, "email")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCreatePlatformApplication(c *C) {
- testServer.Response(200, nil, TestCreatePlatformApplicationXmlOK)
-
- attrs := []sns.AttributeEntry{
- sns.AttributeEntry{Key: "PlatformCredential", Value: "AIzaSyClE2lcV2zEKTLYYo645zfk2jhQPFeyxDo"},
- sns.AttributeEntry{Key: "PlatformPrincipal", Value: "There is no principal for GCM"},
- }
- opt := &sns.PlatformApplicationOpt{Name: "gcmpushapp", Platform: "GCM", Attributes: attrs}
- resp, err := s.sns.CreatePlatformApplication(opt)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp")
- c.Assert(resp.RequestId, Equals, "b6f0e78b-e9d4-5a0e-b973-adc04e8a4ff9")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCreatePlatformEndpoint(c *C) {
- testServer.Response(200, nil, TestCreatePlatformEndpointXmlOK)
-
- opt := &sns.PlatformEndpointOpt{PlatformApplicationArn: "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp",
- CustomUserData: "UserId=27576823", Token: "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE"}
-
- resp, err := s.sns.CreatePlatformEndpoint(opt)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.EndpointArn, Equals, "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3")
- c.Assert(resp.RequestId, Equals, "6613341d-3e15-53f7-bf3c-7e56994ba278")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDeleteEndpoint(c *C) {
- testServer.Response(200, nil, DeleteEndpointXmlOK)
-
- resp, err := s.sns.DeleteEndpoint("arn:aws:sns:us-west-2:123456789012:endpoint/GCM%/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "c1d2b191-353c-5a5f-8969-fbdd3900afa8")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDeletePlatformApplication(c *C) {
- testServer.Response(200, nil, TestDeletePlatformApplicationXmlOK)
-
- resp, err := s.sns.DeletePlatformApplication("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "097dac18-7a77-5823-a8dd-e65476dcb037")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGetEndpointAttributes(c *C) {
- testServer.Response(200, nil, TestGetEndpointAttributesXmlOK)
-
- resp, err := s.sns.GetEndpointAttributes("arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Attributes), Equals, 3)
- c.Assert(resp.Attributes[0].Key, Equals, "Enabled")
- c.Assert(resp.Attributes[0].Value, Equals, "true")
-
- c.Assert(resp.Attributes[1].Key, Equals, "CustomUserData")
- c.Assert(resp.Attributes[1].Value, Equals, "UserId=01234567")
-
- c.Assert(resp.Attributes[2].Key, Equals, "Token")
- c.Assert(resp.Attributes[2].Value, Equals, "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE")
-
- c.Assert(resp.RequestId, Equals, "6c725a19-a142-5b77-94f9-1055a9ea04e7")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGetPlatformApplicationAttributes(c *C) {
- testServer.Response(200, nil, TestGetPlatformApplicationAttributesXmlOK)
-
- resp, err := s.sns.GetPlatformApplicationAttributes("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", "")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Attributes), Not(Equals), 0)
- c.Assert(resp.Attributes[0].Key, Equals, "AllowEndpointPolicies")
- c.Assert(resp.Attributes[0].Value, Equals, "false")
- c.Assert(resp.RequestId, Equals, "74848df2-87f6-55ed-890c-c7be80442462")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListEndpointsByPlatformApplication(c *C) {
- testServer.Response(200, nil, TestListEndpointsByPlatformApplicationXmlOK)
-
- resp, err := s.sns.ListEndpointsByPlatformApplication("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", "")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Endpoints), Not(Equals), 0)
- c.Assert(resp.Endpoints[0].EndpointArn, Equals, "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3")
- c.Assert(len(resp.Endpoints[0].Attributes), Equals, 3)
- c.Assert(resp.Endpoints[0].Attributes[0].Key, Equals, "Enabled")
- c.Assert(resp.Endpoints[0].Attributes[0].Value, Equals, "true")
- c.Assert(resp.Endpoints[0].Attributes[1].Key, Equals, "CustomUserData")
- c.Assert(resp.Endpoints[0].Attributes[1].Value, Equals, "UserId=27576823")
- c.Assert(resp.Endpoints[0].Attributes[2].Key, Equals, "Token")
- c.Assert(resp.Endpoints[0].Attributes[2].Value, Equals, "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE")
-
- c.Assert(resp.RequestId, Equals, "9a48768c-dac8-5a60-aec0-3cc27ea08d96")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestListPlatformApplications(c *C) {
- testServer.Response(200, nil, TestListPlatformApplicationsXmlOK)
-
- resp, err := s.sns.ListPlatformApplications("")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.PlatformApplications), Not(Equals), 0)
-
- c.Assert(resp.PlatformApplications[0].PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/APNS_SANDBOX/apnspushapp")
- c.Assert(len(resp.PlatformApplications[0].Attributes), Equals, 1)
- c.Assert(resp.PlatformApplications[0].Attributes[0].Key, Equals, "AllowEndpointPolicies")
- c.Assert(resp.PlatformApplications[0].Attributes[0].Value, Equals, "false")
-
- c.Assert(resp.PlatformApplications[1].PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp")
- c.Assert(len(resp.PlatformApplications[1].Attributes), Equals, 1)
- c.Assert(resp.PlatformApplications[1].Attributes[0].Key, Equals, "AllowEndpointPolicies")
- c.Assert(resp.PlatformApplications[1].Attributes[0].Value, Equals, "false")
-
- c.Assert(resp.RequestId, Equals, "315a335e-85d8-52df-9349-791283cbb529")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSetEndpointAttributes(c *C) {
- testServer.Response(200, nil, TestSetEndpointAttributesXmlOK)
-
- attrs := []sns.AttributeEntry{
- sns.AttributeEntry{Key: "CustomUserData", Value: "My custom userdata"},
- }
-
- opts := &sns.SetEndpointAttributesOpt{
- EndpointArn: "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3",
- Attributes: attrs}
-
- resp, err := s.sns.SetEndpointAttributes(opts)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "2fe0bfc7-3e85-5ee5-a9e2-f58b35e85f6a")
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSetPlatformApplicationAttributes(c *C) {
- testServer.Response(200, nil, TestSetPlatformApplicationAttributesXmlOK)
-
- attrs := []sns.AttributeEntry{
- sns.AttributeEntry{Key: "EventEndpointCreated", Value: "arn:aws:sns:us-west-2:123456789012:topicarn"},
- }
-
- opts := &sns.SetPlatformApplicationAttributesOpt{
- PlatformApplicationArn: "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp",
- Attributes: attrs}
-
- resp, err := s.sns.SetPlatformApplicationAttributes(opts)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.RequestId, Equals, "cf577bcc-b3dc-5463-88f1-3180b9412395")
-
- c.Assert(err, IsNil)
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/subscription.go b/vendor/github.com/goamz/goamz/exp/sns/subscription.go
deleted file mode 100644
index cbfef8b2c..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/subscription.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package sns
-
-type Subscription struct {
- Endpoint string
- Owner string
- Protocol string
- SubscriptionArn string
- TopicArn string
-}
-
-type ListSubscriptionsResp struct {
- Subscriptions []Subscription `xml:"ListSubscriptionsResult>Subscriptions>member"`
- NextToken string
- ResponseMetadata
-}
-
-type PublishOpt struct {
- Message string
- MessageStructure string
- Subject string
- TopicArn string
- TargetArn string
-}
-
-type PublishResp struct {
- MessageId string `xml:"PublishResult>MessageId"`
- ResponseMetadata
-}
-
-type SubscribeResponse struct {
- SubscriptionArn string `xml:"SubscribeResult>SubscriptionArn"`
- ResponseMetadata
-}
-
-type UnsubscribeResponse struct {
- ResponseMetadata
-}
-
-type ConfirmSubscriptionResponse struct {
- SubscriptionArn string `xml:"ConfirmSubscriptionResult>SubscriptionArn"`
- ResponseMetadata
-}
-
-type ConfirmSubscriptionOpt struct {
- AuthenticateOnUnsubscribe string
- Token string
- TopicArn string
-}
-
-type ListSubscriptionByTopicResponse struct {
- Subscriptions []Subscription `xml:"ListSubscriptionsByTopicResult>Subscriptions>member"`
- ResponseMetadata
-}
-
-type ListSubscriptionByTopicOpt struct {
- NextToken string
- TopicArn string
-}
-
-// Publish
-//
-// See http://goo.gl/AY2D8 for more details.
-func (sns *SNS) Publish(options *PublishOpt) (resp *PublishResp, err error) {
- resp = &PublishResp{}
- params := makeParams("Publish")
-
- if options.Subject != "" {
- params["Subject"] = options.Subject
- }
-
- if options.MessageStructure != "" {
- params["MessageStructure"] = options.MessageStructure
- }
-
- if options.Message != "" {
- params["Message"] = options.Message
- }
-
- if options.TopicArn != "" {
- params["TopicArn"] = options.TopicArn
- }
-
- if options.TargetArn != "" {
- params["TargetArn"] = options.TargetArn
- }
-
- err = sns.query(params, resp)
- return
-}
-
-// Subscribe
-//
-// See http://goo.gl/c3iGS for more details.
-func (sns *SNS) Subscribe(Endpoint, Protocol, TopicArn string) (resp *SubscribeResponse, err error) {
- resp = &SubscribeResponse{}
- params := makeParams("Subscribe")
-
- params["Endpoint"] = Endpoint
- params["Protocol"] = Protocol
- params["TopicArn"] = TopicArn
-
- err = sns.query(params, resp)
- return
-}
-
-// Unsubscribe
-//
-// See http://goo.gl/4l5Ge for more details.
-func (sns *SNS) Unsubscribe(SubscriptionArn string) (resp *UnsubscribeResponse, err error) {
- resp = &UnsubscribeResponse{}
- params := makeParams("Unsubscribe")
-
- params["SubscriptionArn"] = SubscriptionArn
-
- err = sns.query(params, resp)
- return
-}
-
-// ConfirmSubscription
-//
-// See http://goo.gl/3hXzH for more details.
-func (sns *SNS) ConfirmSubscription(options *ConfirmSubscriptionOpt) (resp *ConfirmSubscriptionResponse, err error) {
- resp = &ConfirmSubscriptionResponse{}
- params := makeParams("ConfirmSubscription")
-
- if options.AuthenticateOnUnsubscribe != "" {
- params["AuthenticateOnUnsubscribe"] = options.AuthenticateOnUnsubscribe
- }
-
- params["Token"] = options.Token
- params["TopicArn"] = options.TopicArn
-
- err = sns.query(params, resp)
- return
-}
-
-// ListSubscriptions
-//
-// See http://goo.gl/k3aGn for more details.
-func (sns *SNS) ListSubscriptions(NextToken *string) (resp *ListSubscriptionsResp, err error) {
- resp = &ListSubscriptionsResp{}
- params := makeParams("ListSubscriptions")
- if NextToken != nil {
- params["NextToken"] = *NextToken
- }
- err = sns.query(params, resp)
- return
-}
-
-// ListSubscriptionByTopic
-//
-// See http://goo.gl/LaVcC for more details.
-func (sns *SNS) ListSubscriptionByTopic(options *ListSubscriptionByTopicOpt) (resp *ListSubscriptionByTopicResponse, err error) {
- resp = &ListSubscriptionByTopicResponse{}
- params := makeParams("ListSbubscriptionByTopic")
-
- if options.NextToken != "" {
- params["NextToken"] = options.NextToken
- }
-
- params["TopicArn"] = options.TopicArn
-
- err = sns.query(params, resp)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/exp/sns/topic.go b/vendor/github.com/goamz/goamz/exp/sns/topic.go
deleted file mode 100644
index 601325ec9..000000000
--- a/vendor/github.com/goamz/goamz/exp/sns/topic.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package sns
-
-import (
- "errors"
-)
-
-type Topic struct {
- SNS *SNS
- TopicArn string
-}
-
-type ListTopicsResp struct {
- Topics []Topic `xml:"ListTopicsResult>Topics>member"`
- NextToken string
- ResponseMetadata
-}
-
-type CreateTopicResp struct {
- Topic Topic `xml:"CreateTopicResult"`
- ResponseMetadata
-}
-
-type DeleteTopicResp struct {
- ResponseMetadata
-}
-
-type GetTopicAttributesResp struct {
- Attributes []AttributeEntry `xml:"GetTopicAttributesResult>Attributes>entry"`
- ResponseMetadata
-}
-
-type SetTopicAttributesResponse struct {
- ResponseMetadata
-}
-
-// ListTopics
-//
-// See http://goo.gl/lfrMK for more details.
-func (sns *SNS) ListTopics(NextToken *string) (resp *ListTopicsResp, err error) {
- resp = &ListTopicsResp{}
- params := makeParams("ListTopics")
- if NextToken != nil {
- params["NextToken"] = *NextToken
- }
-
- err = sns.query(params, resp)
- for i, _ := range resp.Topics {
- resp.Topics[i].SNS = sns
- }
- return
-}
-
-// CreateTopic
-//
-// See http://goo.gl/m9aAt for more details.
-func (sns *SNS) CreateTopic(Name string) (resp *CreateTopicResp, err error) {
- resp = &CreateTopicResp{}
- params := makeParams("CreateTopic")
- params["Name"] = Name
- err = sns.query(params, resp)
- resp.Topic.SNS = sns
- return
-}
-
-// Delete
-//
-// Helper function for deleting a topic
-func (topic *Topic) Delete() (resp *DeleteTopicResp, err error) {
- resp = &DeleteTopicResp{}
- params := makeParams("DeleteTopic")
- params["TopicArn"] = topic.TopicArn
- err = topic.SNS.query(params, resp)
- return
-}
-
-// GetTopicAttributes
-//
-// See http://goo.gl/WXRoX for more details.
-func (sns *SNS) GetTopicAttributes(TopicArn string) (resp *GetTopicAttributesResp, err error) {
- resp = &GetTopicAttributesResp{}
- params := makeParams("GetTopicAttributes")
- params["TopicArn"] = TopicArn
- err = sns.query(params, resp)
- return
-}
-
-// SetTopicAttributes
-//
-// See http://goo.gl/oVYW7 for more details.
-func (sns *SNS) SetTopicAttributes(AttributeName, AttributeValue, TopicArn string) (resp *SetTopicAttributesResponse, err error) {
- resp = &SetTopicAttributesResponse{}
- params := makeParams("SetTopicAttributes")
-
- if AttributeName == "" || TopicArn == "" {
- return nil, errors.New("Invalid Attribute Name or TopicArn")
- }
-
- params["AttributeName"] = AttributeName
- params["AttributeValue"] = AttributeValue
- params["TopicArn"] = TopicArn
-
- err = sns.query(params, resp)
- return
-}
diff --git a/vendor/github.com/goamz/goamz/iam/iam.go b/vendor/github.com/goamz/goamz/iam/iam.go
deleted file mode 100644
index 7271f1bf6..000000000
--- a/vendor/github.com/goamz/goamz/iam/iam.go
+++ /dev/null
@@ -1,643 +0,0 @@
-// The iam package provides types and functions for interaction with the AWS
-// Identity and Access Management (IAM) service.
-package iam
-
-import (
- "encoding/xml"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-// The IAM type encapsulates operations operations with the IAM endpoint.
-type IAM struct {
- aws.Auth
- aws.Region
- httpClient *http.Client
-}
-
-// New creates a new IAM instance.
-func New(auth aws.Auth, region aws.Region) *IAM {
- return NewWithClient(auth, region, aws.RetryingClient)
-}
-
-func NewWithClient(auth aws.Auth, region aws.Region, httpClient *http.Client) *IAM {
- return &IAM{auth, region, httpClient}
-}
-
-func (iam *IAM) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2010-05-08"
- params["Timestamp"] = time.Now().In(time.UTC).Format(time.RFC3339)
- endpoint, err := url.Parse(iam.IAMEndpoint)
- if err != nil {
- return err
- }
- sign(iam.Auth, "GET", "/", params, endpoint.Host)
- endpoint.RawQuery = multimap(params).Encode()
- r, err := iam.httpClient.Get(endpoint.String())
- if err != nil {
- return err
- }
- defer r.Body.Close()
- if r.StatusCode > 200 {
- return buildError(r)
- }
-
- return xml.NewDecoder(r.Body).Decode(resp)
-}
-
-func (iam *IAM) postQuery(params map[string]string, resp interface{}) error {
- endpoint, err := url.Parse(iam.IAMEndpoint)
- if err != nil {
- return err
- }
- params["Version"] = "2010-05-08"
- params["Timestamp"] = time.Now().In(time.UTC).Format(time.RFC3339)
- sign(iam.Auth, "POST", "/", params, endpoint.Host)
- encoded := multimap(params).Encode()
- body := strings.NewReader(encoded)
- req, err := http.NewRequest("POST", endpoint.String(), body)
- if err != nil {
- return err
- }
- req.Header.Set("Host", endpoint.Host)
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- req.Header.Set("Content-Length", strconv.Itoa(len(encoded)))
- r, err := http.DefaultClient.Do(req)
- if err != nil {
- return err
- }
- defer r.Body.Close()
- if r.StatusCode > 200 {
- return buildError(r)
- }
- return xml.NewDecoder(r.Body).Decode(resp)
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-// Response to a CreateUser request.
-//
-// See http://goo.gl/JS9Gz for more details.
-type CreateUserResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
- User User `xml:"CreateUserResult>User"`
-}
-
-// User encapsulates a user managed by IAM.
-//
-// See http://goo.gl/BwIQ3 for more details.
-type User struct {
- Arn string
- Path string
- Id string `xml:"UserId"`
- Name string `xml:"UserName"`
-}
-
-// CreateUser creates a new user in IAM.
-//
-// See http://goo.gl/JS9Gz for more details.
-func (iam *IAM) CreateUser(name, path string) (*CreateUserResp, error) {
- params := map[string]string{
- "Action": "CreateUser",
- "Path": path,
- "UserName": name,
- }
- resp := new(CreateUserResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response for GetUser requests.
-//
-// See http://goo.gl/ZnzRN for more details.
-type GetUserResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
- User User `xml:"GetUserResult>User"`
-}
-
-// GetUser gets a user from IAM.
-//
-// See http://goo.gl/ZnzRN for more details.
-func (iam *IAM) GetUser(name string) (*GetUserResp, error) {
- params := map[string]string{
- "Action": "GetUser",
- "UserName": name,
- }
- resp := new(GetUserResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteUser deletes a user from IAM.
-//
-// See http://goo.gl/jBuCG for more details.
-func (iam *IAM) DeleteUser(name string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "DeleteUser",
- "UserName": name,
- }
- resp := new(SimpleResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a CreateGroup request.
-//
-// See http://goo.gl/n7NNQ for more details.
-type CreateGroupResp struct {
- Group Group `xml:"CreateGroupResult>Group"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// Group encapsulates a group managed by IAM.
-//
-// See http://goo.gl/ae7Vs for more details.
-type Group struct {
- Arn string
- Id string `xml:"GroupId"`
- Name string `xml:"GroupName"`
- Path string
-}
-
-// CreateGroup creates a new group in IAM.
-//
-// The path parameter can be used to identify which division or part of the
-// organization the user belongs to.
-//
-// If path is unset ("") it defaults to "/".
-//
-// See http://goo.gl/n7NNQ for more details.
-func (iam *IAM) CreateGroup(name string, path string) (*CreateGroupResp, error) {
- params := map[string]string{
- "Action": "CreateGroup",
- "GroupName": name,
- }
- if path != "" {
- params["Path"] = path
- }
- resp := new(CreateGroupResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a ListGroups request.
-//
-// See http://goo.gl/W2TRj for more details.
-type GroupsResp struct {
- Groups []Group `xml:"ListGroupsResult>Groups>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// Groups list the groups that have the specified path prefix.
-//
-// The parameter pathPrefix is optional. If pathPrefix is "", all groups are
-// returned.
-//
-// See http://goo.gl/W2TRj for more details.
-func (iam *IAM) Groups(pathPrefix string) (*GroupsResp, error) {
- params := map[string]string{
- "Action": "ListGroups",
- }
- if pathPrefix != "" {
- params["PathPrefix"] = pathPrefix
- }
- resp := new(GroupsResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteGroup deletes a group from IAM.
-//
-// See http://goo.gl/d5i2i for more details.
-func (iam *IAM) DeleteGroup(name string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "DeleteGroup",
- "GroupName": name,
- }
- resp := new(SimpleResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a CreateAccessKey request.
-//
-// See http://goo.gl/L46Py for more details.
-type CreateAccessKeyResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
- AccessKey AccessKey `xml:"CreateAccessKeyResult>AccessKey"`
-}
-
-// AccessKey encapsulates an access key generated for a user.
-//
-// See http://goo.gl/LHgZR for more details.
-type AccessKey struct {
- UserName string
- Id string `xml:"AccessKeyId"`
- Secret string `xml:"SecretAccessKey,omitempty"`
- Status string
-}
-
-// CreateAccessKey creates a new access key in IAM.
-//
-// See http://goo.gl/L46Py for more details.
-func (iam *IAM) CreateAccessKey(userName string) (*CreateAccessKeyResp, error) {
- params := map[string]string{
- "Action": "CreateAccessKey",
- "UserName": userName,
- }
- resp := new(CreateAccessKeyResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to AccessKeys request.
-//
-// See http://goo.gl/Vjozx for more details.
-type AccessKeysResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
- AccessKeys []AccessKey `xml:"ListAccessKeysResult>AccessKeyMetadata>member"`
-}
-
-// AccessKeys lists all acccess keys associated with a user.
-//
-// The userName parameter is optional. If set to "", the userName is determined
-// implicitly based on the AWS Access Key ID used to sign the request.
-//
-// See http://goo.gl/Vjozx for more details.
-func (iam *IAM) AccessKeys(userName string) (*AccessKeysResp, error) {
- params := map[string]string{
- "Action": "ListAccessKeys",
- }
- if userName != "" {
- params["UserName"] = userName
- }
- resp := new(AccessKeysResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteAccessKey deletes an access key from IAM.
-//
-// The userName parameter is optional. If set to "", the userName is determined
-// implicitly based on the AWS Access Key ID used to sign the request.
-//
-// See http://goo.gl/hPGhw for more details.
-func (iam *IAM) DeleteAccessKey(id, userName string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "DeleteAccessKey",
- "AccessKeyId": id,
- }
- if userName != "" {
- params["UserName"] = userName
- }
- resp := new(SimpleResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response to a GetUserPolicy request.
-//
-// See http://goo.gl/BH04O for more details.
-type GetUserPolicyResp struct {
- Policy UserPolicy `xml:"GetUserPolicyResult"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// UserPolicy encapsulates an IAM group policy.
-//
-// See http://goo.gl/C7hgS for more details.
-type UserPolicy struct {
- Name string `xml:"PolicyName"`
- UserName string `xml:"UserName"`
- Document string `xml:"PolicyDocument"`
-}
-
-// GetUserPolicy gets a user policy in IAM.
-//
-// See http://goo.gl/BH04O for more details.
-func (iam *IAM) GetUserPolicy(userName, policyName string) (*GetUserPolicyResp, error) {
- params := map[string]string{
- "Action": "GetUserPolicy",
- "UserName": userName,
- "PolicyName": policyName,
- }
- resp := new(GetUserPolicyResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
- return nil, nil
-}
-
-// PutUserPolicy creates a user policy in IAM.
-//
-// See http://goo.gl/ldCO8 for more details.
-func (iam *IAM) PutUserPolicy(userName, policyName, policyDocument string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "PutUserPolicy",
- "UserName": userName,
- "PolicyName": policyName,
- "PolicyDocument": policyDocument,
- }
- resp := new(SimpleResp)
- if err := iam.postQuery(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// DeleteUserPolicy deletes a user policy from IAM.
-//
-// See http://goo.gl/7Jncn for more details.
-func (iam *IAM) DeleteUserPolicy(userName, policyName string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "DeleteUserPolicy",
- "PolicyName": policyName,
- "UserName": userName,
- }
- resp := new(SimpleResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response for AddUserToGroup requests.
-//
-// See http://goo.gl/ZnzRN for more details.
-type AddUserToGroupResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// AddUserToGroup adds a user to a specific group
-//
-// See http://goo.gl/ZnzRN for more details.
-func (iam *IAM) AddUserToGroup(name, group string) (*AddUserToGroupResp, error) {
-
- params := map[string]string{
- "Action": "AddUserToGroup",
- "GroupName": group,
- "UserName": name}
- resp := new(AddUserToGroupResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response for a ListAccountAliases request.
-//
-// See http://goo.gl/MMN79v for more details.
-type ListAccountAliasesResp struct {
- AccountAliases []string `xml:"ListAccountAliasesResult>AccountAliases>member"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// ListAccountAliases lists the account aliases associated with the account
-//
-// See http://goo.gl/MMN79v for more details.
-func (iam *IAM) ListAccountAliases() (*ListAccountAliasesResp, error) {
- params := map[string]string{
- "Action": "ListAccountAliases",
- }
- resp := new(ListAccountAliasesResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response for a CreateAccountAlias request.
-//
-// See http://goo.gl/oU5C4H for more details.
-type CreateAccountAliasResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// CreateAccountAlias creates an alias for your AWS account.
-//
-// See http://goo.gl/oU5C4H for more details.
-func (iam *IAM) CreateAccountAlias(alias string) (*CreateAccountAliasResp, error) {
- params := map[string]string{
- "Action": "CreateAccountAlias",
- "AccountAlias": alias,
- }
- resp := new(CreateAccountAliasResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Response for a DeleteAccountAlias request.
-//
-// See http://goo.gl/hKalgg for more details.
-type DeleteAccountAliasResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DeleteAccountAlias deletes the specified AWS account alias.
-//
-// See http://goo.gl/hKalgg for more details.
-func (iam *IAM) DeleteAccountAlias(alias string) (*DeleteAccountAliasResp, error) {
- params := map[string]string{
- "Action": "DeleteAccountAlias",
- "AccountAlias": alias,
- }
- resp := new(DeleteAccountAliasResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-type SimpleResp struct {
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-type xmlErrors struct {
- Errors []Error `xml:"Error"`
-}
-
-// ServerCertificateMetadata represents a ServerCertificateMetadata object
-//
-// See http://goo.gl/Rfu7LD for more details.
-type ServerCertificateMetadata struct {
- Arn string `xml:"Arn"`
- Expiration time.Time `xml:"Expiration"`
- Path string `xml:"Path"`
- ServerCertificateId string `xml:"ServerCertificateId"`
- ServerCertificateName string `xml:"ServerCertificateName"`
- UploadDate time.Time `xml:"UploadDate"`
-}
-
-// UploadServerCertificateResponse wraps up for UploadServerCertificate request.
-//
-// See http://goo.gl/bomzce for more details.
-type UploadServerCertificateResponse struct {
- ServerCertificateMetadata ServerCertificateMetadata `xml:"UploadServerCertificateResult>ServerCertificateMetadata"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// UploadServerCertificateParams wraps up the params to be passed for the UploadServerCertificate request
-//
-// See http://goo.gl/bomzce for more details.
-type UploadServerCertificateParams struct {
- ServerCertificateName string
- PrivateKey string
- CertificateBody string
- CertificateChain string
- Path string
-}
-
-// UploadServerCertificate uploads a server certificate entity for the AWS account.
-//
-// Required Params: ServerCertificateName, PrivateKey, CertificateBody
-//
-// See http://goo.gl/bomzce for more details.
-func (iam *IAM) UploadServerCertificate(options *UploadServerCertificateParams) (
- *UploadServerCertificateResponse, error) {
- params := map[string]string{
- "Action": "UploadServerCertificate",
- "ServerCertificateName": options.ServerCertificateName,
- "PrivateKey": options.PrivateKey,
- "CertificateBody": options.CertificateBody,
- }
- if options.CertificateChain != "" {
- params["CertificateChain"] = options.CertificateChain
- }
- if options.Path != "" {
- params["Path"] = options.Path
- }
-
- resp := new(UploadServerCertificateResponse)
- if err := iam.postQuery(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// ListServerCertificates lists all available certificates for the AWS account specified
-//
-// Required Params: None
-//
-// Optional Params: Marker, and, PathPrefix
-//
-// See http://goo.gl/bwn0Nb for specifics
-
-type ListServerCertificatesParams struct {
- Marker string
- PathPrefix string
-}
-
-type ListServerCertificatesResp struct {
- ServerCertificates []ServerCertificateMetadata `xml:"ListServerCertificatesResult>ServerCertificateMetadataList>member>ServerCertificateMetadata"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
- IsTruncated bool `xml:"ListServerCertificatesResult>IsTruncated"`
-}
-
-func (iam *IAM) ListServerCertificates(options *ListServerCertificatesParams) (
- *ListServerCertificatesResp, error) {
- params := map[string]string{
- "Action": "ListServerCertificates",
- }
-
- if options.Marker != "" {
- params["Marker"] = options.Marker
- }
-
- if options.PathPrefix != "" {
- params["PathPrefix"] = options.PathPrefix
- }
-
- resp := new(ListServerCertificatesResp)
- if err := iam.query(params, resp); err != nil {
- return nil, err
- }
-
- return resp, nil
-}
-
-// DeleteServerCertificate deletes the specified server certificate.
-//
-// See http://goo.gl/W4nmxQ for more details.
-func (iam *IAM) DeleteServerCertificate(serverCertificateName string) (*SimpleResp, error) {
- params := map[string]string{
- "Action": "DeleteServerCertificate",
- "ServerCertificateName": serverCertificateName,
- }
-
- resp := new(SimpleResp)
- if err := iam.postQuery(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// Error encapsulates an IAM error.
-type Error struct {
- // HTTP status code of the error.
- StatusCode int
-
- // AWS code of the error.
- Code string
-
- // Message explaining the error.
- Message string
-}
-
-func (e *Error) Error() string {
- var prefix string
- if e.Code != "" {
- prefix = e.Code + ": "
- }
- if prefix == "" && e.StatusCode > 0 {
- prefix = strconv.Itoa(e.StatusCode) + ": "
- }
- return prefix + e.Message
-}
diff --git a/vendor/github.com/goamz/goamz/iam/iam_test.go b/vendor/github.com/goamz/goamz/iam/iam_test.go
deleted file mode 100644
index e73935670..000000000
--- a/vendor/github.com/goamz/goamz/iam/iam_test.go
+++ /dev/null
@@ -1,450 +0,0 @@
-package iam_test
-
-import (
- "strings"
- "testing"
- "time"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/iam"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- iam *iam.IAM
-}
-
-var _ = Suite(&S{})
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.iam = iam.NewWithClient(auth, aws.Region{IAMEndpoint: testServer.URL}, testutil.DefaultClient)
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestCreateUser(c *C) {
- testServer.Response(200, nil, CreateUserExample)
- resp, err := s.iam.CreateUser("Bob", "/division_abc/subdivision_xyz/")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "CreateUser")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(values.Get("Path"), Equals, "/division_abc/subdivision_xyz/")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- expected := iam.User{
- Path: "/division_abc/subdivision_xyz/",
- Name: "Bob",
- Id: "AIDACKCEVSQ6C2EXAMPLE",
- Arn: "arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob",
- }
- c.Assert(resp.User, DeepEquals, expected)
-}
-
-func (s *S) TestCreateUserConflict(c *C) {
- testServer.Response(409, nil, DuplicateUserExample)
- resp, err := s.iam.CreateUser("Bob", "/division_abc/subdivision_xyz/")
- testServer.WaitRequest()
- c.Assert(resp, IsNil)
- c.Assert(err, NotNil)
- e, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(e.Message, Equals, "User with name Bob already exists.")
- c.Assert(e.Code, Equals, "EntityAlreadyExists")
-}
-
-func (s *S) TestGetUser(c *C) {
- testServer.Response(200, nil, GetUserExample)
- resp, err := s.iam.GetUser("Bob")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "GetUser")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- expected := iam.User{
- Path: "/division_abc/subdivision_xyz/",
- Name: "Bob",
- Id: "AIDACKCEVSQ6C2EXAMPLE",
- Arn: "arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob",
- }
- c.Assert(resp.User, DeepEquals, expected)
-}
-
-func (s *S) TestDeleteUser(c *C) {
- testServer.Response(200, nil, RequestIdExample)
- resp, err := s.iam.DeleteUser("Bob")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteUser")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestCreateGroup(c *C) {
- testServer.Response(200, nil, CreateGroupExample)
- resp, err := s.iam.CreateGroup("Admins", "/admins/")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "CreateGroup")
- c.Assert(values.Get("GroupName"), Equals, "Admins")
- c.Assert(values.Get("Path"), Equals, "/admins/")
- c.Assert(err, IsNil)
- c.Assert(resp.Group.Path, Equals, "/admins/")
- c.Assert(resp.Group.Name, Equals, "Admins")
- c.Assert(resp.Group.Id, Equals, "AGPACKCEVSQ6C2EXAMPLE")
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestCreateGroupWithoutPath(c *C) {
- testServer.Response(200, nil, CreateGroupExample)
- _, err := s.iam.CreateGroup("Managers", "")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "CreateGroup")
- c.Assert(err, IsNil)
- _, ok := map[string][]string(values)["Path"]
- c.Assert(ok, Equals, false)
-}
-
-func (s *S) TestDeleteGroup(c *C) {
- testServer.Response(200, nil, RequestIdExample)
- resp, err := s.iam.DeleteGroup("Admins")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteGroup")
- c.Assert(values.Get("GroupName"), Equals, "Admins")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestListGroups(c *C) {
- testServer.Response(200, nil, ListGroupsExample)
- resp, err := s.iam.Groups("/division_abc/")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "ListGroups")
- c.Assert(values.Get("PathPrefix"), Equals, "/division_abc/")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- expected := []iam.Group{
- {
- Path: "/division_abc/subdivision_xyz/",
- Name: "Admins",
- Id: "AGPACKCEVSQ6C2EXAMPLE",
- Arn: "arn:aws:iam::123456789012:group/Admins",
- },
- {
- Path: "/division_abc/subdivision_xyz/product_1234/engineering/",
- Name: "Test",
- Id: "AGP2MAB8DPLSRHEXAMPLE",
- Arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test",
- },
- {
- Path: "/division_abc/subdivision_xyz/product_1234/",
- Name: "Managers",
- Id: "AGPIODR4TAW7CSEXAMPLE",
- Arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers",
- },
- }
- c.Assert(resp.Groups, DeepEquals, expected)
-}
-
-func (s *S) TestListGroupsWithoutPathPrefix(c *C) {
- testServer.Response(200, nil, ListGroupsExample)
- _, err := s.iam.Groups("")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "ListGroups")
- c.Assert(err, IsNil)
- _, ok := map[string][]string(values)["PathPrefix"]
- c.Assert(ok, Equals, false)
-}
-
-func (s *S) TestCreateAccessKey(c *C) {
- testServer.Response(200, nil, CreateAccessKeyExample)
- resp, err := s.iam.CreateAccessKey("Bob")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "CreateAccessKey")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.AccessKey.UserName, Equals, "Bob")
- c.Assert(resp.AccessKey.Id, Equals, "AKIAIOSFODNN7EXAMPLE")
- c.Assert(resp.AccessKey.Secret, Equals, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY")
- c.Assert(resp.AccessKey.Status, Equals, "Active")
-}
-
-func (s *S) TestDeleteAccessKey(c *C) {
- testServer.Response(200, nil, RequestIdExample)
- resp, err := s.iam.DeleteAccessKey("ysa8hasdhasdsi", "Bob")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteAccessKey")
- c.Assert(values.Get("AccessKeyId"), Equals, "ysa8hasdhasdsi")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestDeleteAccessKeyBlankUserName(c *C) {
- testServer.Response(200, nil, RequestIdExample)
- _, err := s.iam.DeleteAccessKey("ysa8hasdhasdsi", "")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteAccessKey")
- c.Assert(values.Get("AccessKeyId"), Equals, "ysa8hasdhasdsi")
- _, ok := map[string][]string(values)["UserName"]
- c.Assert(ok, Equals, false)
-}
-
-func (s *S) TestAccessKeys(c *C) {
- testServer.Response(200, nil, ListAccessKeyExample)
- resp, err := s.iam.AccessKeys("Bob")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "ListAccessKeys")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
- c.Assert(resp.AccessKeys, HasLen, 2)
- c.Assert(resp.AccessKeys[0].Id, Equals, "AKIAIOSFODNN7EXAMPLE")
- c.Assert(resp.AccessKeys[0].UserName, Equals, "Bob")
- c.Assert(resp.AccessKeys[0].Status, Equals, "Active")
- c.Assert(resp.AccessKeys[1].Id, Equals, "AKIAI44QH8DHBEXAMPLE")
- c.Assert(resp.AccessKeys[1].UserName, Equals, "Bob")
- c.Assert(resp.AccessKeys[1].Status, Equals, "Inactive")
-}
-
-func (s *S) TestAccessKeysBlankUserName(c *C) {
- testServer.Response(200, nil, ListAccessKeyExample)
- _, err := s.iam.AccessKeys("")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "ListAccessKeys")
- _, ok := map[string][]string(values)["UserName"]
- c.Assert(ok, Equals, false)
-}
-
-func (s *S) TestGetUserPolicy(c *C) {
- testServer.Response(200, nil, GetUserPolicyExample)
- resp, err := s.iam.GetUserPolicy("Bob", "AllAccessPolicy")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "GetUserPolicy")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(values.Get("PolicyName"), Equals, "AllAccessPolicy")
- c.Assert(err, IsNil)
- c.Assert(resp.Policy.UserName, Equals, "Bob")
- c.Assert(resp.Policy.Name, Equals, "AllAccessPolicy")
- c.Assert(strings.TrimSpace(resp.Policy.Document), Equals, `{"Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}`)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestPutUserPolicy(c *C) {
- document := `{
- "Statement": [
- {
- "Action": [
- "s3:*"
- ],
- "Effect": "Allow",
- "Resource": [
- "arn:aws:s3:::8shsns19s90ajahadsj/*",
- "arn:aws:s3:::8shsns19s90ajahadsj"
- ]
- }]
- }`
- testServer.Response(200, nil, RequestIdExample)
- resp, err := s.iam.PutUserPolicy("Bob", "AllAccessPolicy", document)
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.FormValue("Action"), Equals, "PutUserPolicy")
- c.Assert(req.FormValue("PolicyName"), Equals, "AllAccessPolicy")
- c.Assert(req.FormValue("UserName"), Equals, "Bob")
- c.Assert(req.FormValue("PolicyDocument"), Equals, document)
- c.Assert(req.FormValue("Version"), Equals, "2010-05-08")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestDeleteUserPolicy(c *C) {
- testServer.Response(200, nil, RequestIdExample)
- resp, err := s.iam.DeleteUserPolicy("Bob", "AllAccessPolicy")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteUserPolicy")
- c.Assert(values.Get("PolicyName"), Equals, "AllAccessPolicy")
- c.Assert(values.Get("UserName"), Equals, "Bob")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestAddUserToGroup(c *C) {
- testServer.Response(200, nil, AddUserToGroupExample)
- resp, err := s.iam.AddUserToGroup("admin1", "Admins")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "AddUserToGroup")
- c.Assert(values.Get("GroupName"), Equals, "Admins")
- c.Assert(values.Get("UserName"), Equals, "admin1")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestListAccountAliases(c *C) {
- testServer.Response(200, nil, ListAccountAliasesExample)
- resp, err := s.iam.ListAccountAliases()
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "ListAccountAliases")
- c.Assert(err, IsNil)
- c.Assert(resp.AccountAliases[0], Equals, "foocorporation")
- c.Assert(resp.RequestId, Equals, "c5a076e9-f1b0-11df-8fbe-45274EXAMPLE")
-}
-
-func (s *S) TestCreateAccountAlias(c *C) {
- testServer.Response(200, nil, CreateAccountAliasExample)
- resp, err := s.iam.CreateAccountAlias("foobaz")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "CreateAccountAlias")
- c.Assert(values.Get("AccountAlias"), Equals, "foobaz")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "36b5db08-f1b0-11df-8fbe-45274EXAMPLE")
-}
-
-func (s *S) TestDeleteAccountAlias(c *C) {
- testServer.Response(200, nil, DeleteAccountAliasExample)
- resp, err := s.iam.DeleteAccountAlias("foobaz")
- values := testServer.WaitRequest().URL.Query()
- c.Assert(values.Get("Action"), Equals, "DeleteAccountAlias")
- c.Assert(values.Get("AccountAlias"), Equals, "foobaz")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestUploadServerCertificate(c *C) {
- testServer.Response(200, nil, UploadServerCertificateExample)
-
- certificateBody := `
------BEGIN CERTIFICATE-----
-MIICdzCCAeCgAwIBAgIGANc+Ha2wMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNVBAYT
-AlVTMRMwEQYDVQQKEwpBbWF6b24uY29tMQwwCgYDVQQLEwNBV1MxITAfBgNVBAMT
-GEFXUyBMaW1pdGVkLUFzc3VyYW5jZSBDQTAeFw0wOTAyMDQxNzE5MjdaFw0xMDAy
-MDQxNzE5MjdaMFIxCzAJBgNVBAYTAlVTMRMwEQYDVQQKEwpBbWF6b24uY29tMRcw
-FQYDVQQLEw5BV1MtRGV2ZWxvcGVyczEVMBMGA1UEAxMMNTdxNDl0c3ZwYjRtMIGf
-MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpB/vsOwmT/O0td1RqzKjttSBaPjbr
-dqwNe9BrOyB08fw2+Ch5oonZYXfGUrT6mkYXH5fQot9HvASrzAKHO596FdJA6DmL
-ywdWe1Oggk7zFSXO1Xv+3vPrJtaYxYo3eRIp7w80PMkiOv6M0XK8ubcTouODeJbf
-suDqcLnLDxwsvwIDAQABo1cwVTAOBgNVHQ8BAf8EBAMCBaAwFgYDVR0lAQH/BAww
-CgYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQULGNaBphBumaKbDRK
-CAi0mH8B3mowDQYJKoZIhvcNAQEFBQADgYEAuKxhkXaCLGcqDuweKtO/AEw9ZePH
-wr0XqsaIK2HZboqruebXEGsojK4Ks0WzwgrEynuHJwTn760xe39rSqXWIOGrOBaX
-wFpWHVjTFMKk+tSDG1lssLHyYWWdFFU4AnejRGORJYNaRHgVTKjHphc5jEhHm0BX
-AEaHzTpmEXAMPLE=
------END CERTIFICATE-----
-`
- privateKey := `
------BEGIN DSA PRIVATE KEY-----
-MIIBugIBTTKBgQD33xToSXPJ6hr37L3+KNi3/7DgywlBcvlFPPSHIw3ORuO/22mT
-8Cy5fT89WwNvZ3BPKWU6OZ38TQv3eWjNc/3U3+oqVNG2poX5nCPOtO1b96HYX2mR
-3FTdH6FRKbQEhpDzZ6tRrjTHjMX6sT3JRWkBd2c4bGu+HUHO1H7QvrCTeQIVTKMs
-TCKCyrLiGhUWuUGNJUMU6y6zToGTHl84Tz7TPwDGDXuy/Dk5s4jTVr+xibROC/gS
-Qrs4Dzz3T1ze6lvU8S1KT9UsOB5FUJNTTPCPey+Lo4mmK6b23XdTyCIT8e2fsm2j
-jHHC1pIPiTkdLS3j6ZYjF8LY6TENFng+LDY/xwPOl7TJVoD3J/WXC2J9CEYq9o34
-kq6WWn3CgYTuo54nXUgnoCb3xdG8COFrg+oTbIkHTSzs3w5o/GGgKK7TDF3UlJjq
-vHNyJQ6kWBrQRR1Xp5KYQ4c/Dm5kef+62mH53HpcCELguWVcffuVQpmq3EWL9Zp9
-jobTJQ2VHjb5IVxiO6HRSd27di3njyrzUuJCyHSDTqwLJmTThpd6OTIUTL3Tc4m2
-62TITdw53KWJEXAMPLE=
------END DSA PRIVATE KEY-----
-`
- params := &iam.UploadServerCertificateParams{
- ServerCertificateName: "ProdServerCert",
- Path: "/company/servercerts/",
- PrivateKey: privateKey,
- CertificateBody: certificateBody,
- }
-
- resp, err := s.iam.UploadServerCertificate(params)
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.FormValue("Action"), Equals, "UploadServerCertificate")
- c.Assert(req.FormValue("CertificateBody"), Equals, certificateBody)
- c.Assert(req.FormValue("PrivateKey"), Equals, privateKey)
- c.Assert(req.FormValue("ServerCertificateName"), Equals, "ProdServerCert")
- c.Assert(req.FormValue("CertificateChain"), Equals, "")
- c.Assert(req.FormValue("Path"), Equals, "/company/servercerts/")
- c.Assert(req.FormValue("Version"), Equals, "2010-05-08")
- c.Assert(err, IsNil)
-
- ud, _ := time.Parse(time.RFC3339, "2010-05-08T01:02:03.004Z")
- exp, _ := time.Parse(time.RFC3339, "2012-05-08T01:02:03.004Z")
- expected := iam.ServerCertificateMetadata{
- Arn: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert",
- ServerCertificateName: "ProdServerCert",
- ServerCertificateId: "ASCACKCEVSQ6C2EXAMPLE",
- Path: "/company/servercerts/",
- UploadDate: ud,
- Expiration: exp,
- }
- c.Assert(resp.ServerCertificateMetadata, DeepEquals, expected)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
-
-func (s *S) TestListServerCertificates(c *C) {
- testServer.Response(200, nil, ListServerCertificatesExample)
- params := &iam.ListServerCertificatesParams{
- Marker: "my-fake-marker",
- PathPrefix: "/some/fake/path",
- }
-
- resp, err := s.iam.ListServerCertificates(params)
- req := testServer.WaitRequest()
-
- c.Assert(err, IsNil)
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.FormValue("Action"), Equals, "ListServerCertificates")
- c.Assert(req.FormValue("Marker"), Equals, "my-fake-marker")
- c.Assert(req.FormValue("PathPrefix"), Equals, "/some/fake/path")
- c.Assert(req.FormValue("Version"), Equals, "2010-05-08")
-
- uploadDate, _ := time.Parse(time.RFC3339, "2010-05-08T01:02:03.004Z")
- expirationDate, _ := time.Parse(time.RFC3339, "2012-05-08T01:02:03.004Z")
- expected := []iam.ServerCertificateMetadata{
- {
- Arn: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert",
- ServerCertificateName: "ProdServerCert",
- ServerCertificateId: "ASCACKCEVSQ6C2EXAMPLE1",
- Path: "/some/fake/path",
- UploadDate: uploadDate,
- Expiration: expirationDate,
- },
- {
- Arn: "arn:aws:iam::123456789012:server-certificate/company/servercerts/BetaServerCert",
- ServerCertificateName: "BetaServerCert",
- ServerCertificateId: "ASCACKCEVSQ6C2EXAMPLE2",
- Path: "/some/fake/path",
- UploadDate: uploadDate,
- Expiration: expirationDate,
- },
- {
- Arn: "arn:aws:iam::123456789012:server-certificate/company/servercerts/TestServerCert",
- ServerCertificateName: "TestServerCert",
- ServerCertificateId: "ASCACKCEVSQ6C2EXAMPLE3",
- Path: "/some/fake/path",
- UploadDate: uploadDate,
- Expiration: expirationDate,
- },
- }
-
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eTHISDIFFERENTTEST")
- c.Assert(resp.IsTruncated, Equals, false)
- c.Assert(resp.ServerCertificates, DeepEquals, expected)
-}
-
-func (s *S) TestDeleteServerCertificate(c *C) {
- testServer.Response(200, nil, DeleteServerCertificateExample)
- resp, err := s.iam.DeleteServerCertificate("ProdServerCert")
- req := testServer.WaitRequest()
- c.Assert(req.FormValue("Action"), Equals, "DeleteServerCertificate")
- c.Assert(req.FormValue("ServerCertificateName"), Equals, "ProdServerCert")
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
-}
diff --git a/vendor/github.com/goamz/goamz/iam/iami_test.go b/vendor/github.com/goamz/goamz/iam/iami_test.go
deleted file mode 100644
index 26f32386f..000000000
--- a/vendor/github.com/goamz/goamz/iam/iami_test.go
+++ /dev/null
@@ -1,209 +0,0 @@
-package iam_test
-
-import (
- "net/url"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/iam"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-// AmazonServer represents an Amazon AWS server.
-type AmazonServer struct {
- auth aws.Auth
-}
-
-func (s *AmazonServer) SetUp(c *C) {
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err)
- }
- s.auth = auth
-}
-
-var _ = Suite(&AmazonClientSuite{})
-
-// AmazonClientSuite tests the client against a live AWS server.
-type AmazonClientSuite struct {
- srv AmazonServer
- ClientTests
-}
-
-func (s *AmazonClientSuite) SetUpSuite(c *C) {
- if !testutil.Amazon {
- c.Skip("AmazonClientSuite tests not enabled")
- }
- s.srv.SetUp(c)
- s.iam = iam.New(s.srv.auth, aws.USEast)
-}
-
-// ClientTests defines integration tests designed to test the client.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ClientTests struct {
- iam *iam.IAM
-}
-
-func (s *ClientTests) TestCreateAndDeleteUser(c *C) {
- createResp, err := s.iam.CreateUser("gopher", "/gopher/")
- c.Assert(err, IsNil)
- getResp, err := s.iam.GetUser("gopher")
- c.Assert(err, IsNil)
- c.Assert(createResp.User, DeepEquals, getResp.User)
- _, err = s.iam.DeleteUser("gopher")
- c.Assert(err, IsNil)
-}
-
-func (s *ClientTests) TestCreateUserError(c *C) {
- _, err := s.iam.CreateUser("gopher", "/gopher/")
- c.Assert(err, IsNil)
- defer s.iam.DeleteUser("gopher")
- _, err = s.iam.CreateUser("gopher", "/")
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 409)
- c.Assert(iamErr.Code, Equals, "EntityAlreadyExists")
- c.Assert(iamErr.Message, Equals, "User with name gopher already exists.")
-}
-
-func (s *ClientTests) TestDeleteUserError(c *C) {
- _, err := s.iam.DeleteUser("gopher")
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 404)
- c.Assert(iamErr.Code, Equals, "NoSuchEntity")
- c.Assert(iamErr.Message, Equals, "The user with name gopher cannot be found.")
-}
-
-func (s *ClientTests) TestGetUserError(c *C) {
- _, err := s.iam.GetUser("gopher")
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 404)
- c.Assert(iamErr.Code, Equals, "NoSuchEntity")
- c.Assert(iamErr.Message, Equals, "The user with name gopher cannot be found.")
-}
-
-func (s *ClientTests) TestCreateListAndDeleteAccessKey(c *C) {
- createUserResp, err := s.iam.CreateUser("gopher", "/gopher/")
- c.Assert(err, IsNil)
- defer s.iam.DeleteUser(createUserResp.User.Name)
- createKeyResp, err := s.iam.CreateAccessKey(createUserResp.User.Name)
- c.Assert(err, IsNil)
- listKeyResp, err := s.iam.AccessKeys(createUserResp.User.Name)
- c.Assert(err, IsNil)
- c.Assert(listKeyResp.AccessKeys, HasLen, 1)
- createKeyResp.AccessKey.Secret = ""
- c.Assert(listKeyResp.AccessKeys[0], DeepEquals, createKeyResp.AccessKey)
- _, err = s.iam.DeleteAccessKey(createKeyResp.AccessKey.Id, createUserResp.User.Name)
- c.Assert(err, IsNil)
-}
-
-func (s *ClientTests) TestCreateAccessKeyError(c *C) {
- _, err := s.iam.CreateAccessKey("unknowngopher")
- c.Assert(err, NotNil)
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 404)
- c.Assert(iamErr.Code, Equals, "NoSuchEntity")
- c.Assert(iamErr.Message, Equals, "The user with name unknowngopher cannot be found.")
-}
-
-func (s *ClientTests) TestListAccessKeysUserNotFound(c *C) {
- _, err := s.iam.AccessKeys("unknowngopher")
- c.Assert(err, NotNil)
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 404)
- c.Assert(iamErr.Code, Equals, "NoSuchEntity")
- c.Assert(iamErr.Message, Equals, "The user with name unknowngopher cannot be found.")
-}
-
-func (s *ClientTests) TestListAccessKeysUserWithoutKeys(c *C) {
- createUserResp, err := s.iam.CreateUser("gopher", "/")
- c.Assert(err, IsNil)
- defer s.iam.DeleteUser(createUserResp.User.Name)
- resp, err := s.iam.AccessKeys(createUserResp.User.Name)
- c.Assert(err, IsNil)
- c.Assert(resp.AccessKeys, HasLen, 0)
-}
-
-func (s *ClientTests) TestCreateListAndDeleteGroup(c *C) {
- cResp1, err := s.iam.CreateGroup("Finances", "/finances/")
- c.Assert(err, IsNil)
- cResp2, err := s.iam.CreateGroup("DevelopmentManagers", "/development/managers/")
- c.Assert(err, IsNil)
- lResp, err := s.iam.Groups("/development/")
- c.Assert(err, IsNil)
- c.Assert(lResp.Groups, HasLen, 1)
- c.Assert(cResp2.Group, DeepEquals, lResp.Groups[0])
- lResp, err = s.iam.Groups("")
- c.Assert(err, IsNil)
- c.Assert(lResp.Groups, HasLen, 2)
- if lResp.Groups[0].Name == cResp1.Group.Name {
- c.Assert([]iam.Group{cResp1.Group, cResp2.Group}, DeepEquals, lResp.Groups)
- } else {
- c.Assert([]iam.Group{cResp2.Group, cResp1.Group}, DeepEquals, lResp.Groups)
- }
- _, err = s.iam.DeleteGroup("DevelopmentManagers")
- c.Assert(err, IsNil)
- lResp, err = s.iam.Groups("/development/")
- c.Assert(err, IsNil)
- c.Assert(lResp.Groups, HasLen, 0)
- _, err = s.iam.DeleteGroup("Finances")
- c.Assert(err, IsNil)
-}
-
-func (s *ClientTests) TestCreateGroupError(c *C) {
- _, err := s.iam.CreateGroup("Finances", "/finances/")
- c.Assert(err, IsNil)
- defer s.iam.DeleteGroup("Finances")
- _, err = s.iam.CreateGroup("Finances", "/something-else/")
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 409)
- c.Assert(iamErr.Code, Equals, "EntityAlreadyExists")
- c.Assert(iamErr.Message, Equals, "Group with name Finances already exists.")
-}
-
-func (s *ClientTests) TestDeleteGroupError(c *C) {
- _, err := s.iam.DeleteGroup("Finances")
- iamErr, ok := err.(*iam.Error)
- c.Assert(ok, Equals, true)
- c.Assert(iamErr.StatusCode, Equals, 404)
- c.Assert(iamErr.Code, Equals, "NoSuchEntity")
- c.Assert(iamErr.Message, Equals, "The group with name Finances cannot be found.")
-}
-
-func (s *ClientTests) TestPutGetAndDeleteUserPolicy(c *C) {
- userResp, err := s.iam.CreateUser("gopher", "/gopher/")
- c.Assert(err, IsNil)
- defer s.iam.DeleteUser(userResp.User.Name)
- document := `{
- "Statement": [
- {
- "Action": [
- "s3:*"
- ],
- "Effect": "Allow",
- "Resource": [
- "arn:aws:s3:::8shsns19s90ajahadsj/*",
- "arn:aws:s3:::8shsns19s90ajahadsj"
- ]
- }]
- }`
- _, err = s.iam.PutUserPolicy(userResp.User.Name, "EverythingS3", document)
- c.Assert(err, IsNil)
- resp, err := s.iam.GetUserPolicy(userResp.User.Name, "EverythingS3")
- c.Assert(err, IsNil)
- c.Assert(resp.Policy.Name, Equals, "EverythingS3")
- c.Assert(resp.Policy.UserName, Equals, userResp.User.Name)
- gotDocument, err := url.QueryUnescape(resp.Policy.Document)
- c.Assert(err, IsNil)
- c.Assert(gotDocument, Equals, document)
- _, err = s.iam.DeleteUserPolicy(userResp.User.Name, "EverythingS3")
- c.Assert(err, IsNil)
- _, err = s.iam.GetUserPolicy(userResp.User.Name, "EverythingS3")
- c.Assert(err, NotNil)
-}
diff --git a/vendor/github.com/goamz/goamz/iam/iamt_test.go b/vendor/github.com/goamz/goamz/iam/iamt_test.go
deleted file mode 100644
index 9d89f43e3..000000000
--- a/vendor/github.com/goamz/goamz/iam/iamt_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package iam_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/iam"
- "github.com/goamz/goamz/iam/iamtest"
- . "gopkg.in/check.v1"
-)
-
-// LocalServer represents a local ec2test fake server.
-type LocalServer struct {
- auth aws.Auth
- region aws.Region
- srv *iamtest.Server
-}
-
-func (s *LocalServer) SetUp(c *C) {
- srv, err := iamtest.NewServer()
- c.Assert(err, IsNil)
- c.Assert(srv, NotNil)
-
- s.srv = srv
- s.region = aws.Region{IAMEndpoint: srv.URL()}
-}
-
-// LocalServerSuite defines tests that will run
-// against the local iamtest server. It includes
-// tests from ClientTests.
-type LocalServerSuite struct {
- srv LocalServer
- ClientTests
-}
-
-var _ = Suite(&LocalServerSuite{})
-
-func (s *LocalServerSuite) SetUpSuite(c *C) {
- s.srv.SetUp(c)
- s.ClientTests.iam = iam.New(s.srv.auth, s.srv.region)
-}
diff --git a/vendor/github.com/goamz/goamz/iam/iamtest/server.go b/vendor/github.com/goamz/goamz/iam/iamtest/server.go
deleted file mode 100644
index 08991d2f8..000000000
--- a/vendor/github.com/goamz/goamz/iam/iamtest/server.go
+++ /dev/null
@@ -1,432 +0,0 @@
-// Package iamtest implements a fake IAM provider with the capability of
-// inducing errors on any given operation, and retrospectively determining what
-// operations have been carried out.
-package iamtest
-
-import (
- "encoding/json"
- "encoding/xml"
- "fmt"
- "github.com/goamz/goamz/iam"
- "net"
- "net/http"
- "strings"
- "sync"
-)
-
-type action struct {
- srv *Server
- w http.ResponseWriter
- req *http.Request
- reqId string
-}
-
-// Server implements an IAM simulator for use in tests.
-type Server struct {
- reqId int
- url string
- listener net.Listener
- users []iam.User
- groups []iam.Group
- accessKeys []iam.AccessKey
- userPolicies []iam.UserPolicy
- mutex sync.Mutex
-}
-
-func NewServer() (*Server, error) {
- l, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- return nil, fmt.Errorf("cannot listen on localhost: %v", err)
- }
- srv := &Server{
- listener: l,
- url: "http://" + l.Addr().String(),
- }
- go http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- srv.serveHTTP(w, req)
- }))
- return srv, nil
-}
-
-// Quit closes down the server.
-func (srv *Server) Quit() error {
- return srv.listener.Close()
-}
-
-// URL returns a URL for the server.
-func (srv *Server) URL() string {
- return srv.url
-}
-
-type xmlErrors struct {
- XMLName string `xml:"ErrorResponse"`
- Error iam.Error
-}
-
-func (srv *Server) error(w http.ResponseWriter, err *iam.Error) {
- w.WriteHeader(err.StatusCode)
- xmlErr := xmlErrors{Error: *err}
- if e := xml.NewEncoder(w).Encode(xmlErr); e != nil {
- panic(e)
- }
-}
-
-func (srv *Server) serveHTTP(w http.ResponseWriter, req *http.Request) {
- req.ParseForm()
- srv.mutex.Lock()
- defer srv.mutex.Unlock()
- action := req.FormValue("Action")
- if action == "" {
- srv.error(w, &iam.Error{
- StatusCode: 400,
- Code: "MissingAction",
- Message: "Missing action",
- })
- }
- if a, ok := actions[action]; ok {
- reqId := fmt.Sprintf("req%0X", srv.reqId)
- srv.reqId++
- if resp, err := a(srv, w, req, reqId); err == nil {
- if err := xml.NewEncoder(w).Encode(resp); err != nil {
- panic(err)
- }
- } else {
- switch err.(type) {
- case *iam.Error:
- srv.error(w, err.(*iam.Error))
- default:
- panic(err)
- }
- }
- } else {
- srv.error(w, &iam.Error{
- StatusCode: 400,
- Code: "InvalidAction",
- Message: "Invalid action: " + action,
- })
- }
-}
-
-func (srv *Server) createUser(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName"}); err != nil {
- return nil, err
- }
- path := req.FormValue("Path")
- if path == "" {
- path = "/"
- }
- name := req.FormValue("UserName")
- for _, user := range srv.users {
- if user.Name == name {
- return nil, &iam.Error{
- StatusCode: 409,
- Code: "EntityAlreadyExists",
- Message: fmt.Sprintf("User with name %s already exists.", name),
- }
- }
- }
- user := iam.User{
- Id: "USER" + reqId + "EXAMPLE",
- Arn: fmt.Sprintf("arn:aws:iam:::123456789012:user%s%s", path, name),
- Name: name,
- Path: path,
- }
- srv.users = append(srv.users, user)
- return iam.CreateUserResp{
- RequestId: reqId,
- User: user,
- }, nil
-}
-
-func (srv *Server) getUser(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName"}); err != nil {
- return nil, err
- }
- name := req.FormValue("UserName")
- index, err := srv.findUser(name)
- if err != nil {
- return nil, err
- }
- return iam.GetUserResp{RequestId: reqId, User: srv.users[index]}, nil
-}
-
-func (srv *Server) deleteUser(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName"}); err != nil {
- return nil, err
- }
- name := req.FormValue("UserName")
- index, err := srv.findUser(name)
- if err != nil {
- return nil, err
- }
- copy(srv.users[index:], srv.users[index+1:])
- srv.users = srv.users[:len(srv.users)-1]
- return iam.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) createAccessKey(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName"}); err != nil {
- return nil, err
- }
- userName := req.FormValue("UserName")
- if _, err := srv.findUser(userName); err != nil {
- return nil, err
- }
- key := iam.AccessKey{
- Id: fmt.Sprintf("%s%d", userName, len(srv.accessKeys)),
- Secret: "",
- UserName: userName,
- Status: "Active",
- }
- srv.accessKeys = append(srv.accessKeys, key)
- return iam.CreateAccessKeyResp{RequestId: reqId, AccessKey: key}, nil
-}
-
-func (srv *Server) deleteAccessKey(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"AccessKeyId", "UserName"}); err != nil {
- return nil, err
- }
- key := req.FormValue("AccessKeyId")
- index := -1
- for i, ak := range srv.accessKeys {
- if ak.Id == key {
- index = i
- break
- }
- }
- if index < 0 {
- return nil, &iam.Error{
- StatusCode: 404,
- Code: "NoSuchEntity",
- Message: "No such key.",
- }
- }
- copy(srv.accessKeys[index:], srv.accessKeys[index+1:])
- srv.accessKeys = srv.accessKeys[:len(srv.accessKeys)-1]
- return iam.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) listAccessKeys(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName"}); err != nil {
- return nil, err
- }
- userName := req.FormValue("UserName")
- if _, err := srv.findUser(userName); err != nil {
- return nil, err
- }
- var keys []iam.AccessKey
- for _, k := range srv.accessKeys {
- if k.UserName == userName {
- keys = append(keys, k)
- }
- }
- return iam.AccessKeysResp{
- RequestId: reqId,
- AccessKeys: keys,
- }, nil
-}
-
-func (srv *Server) createGroup(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"GroupName"}); err != nil {
- return nil, err
- }
- name := req.FormValue("GroupName")
- path := req.FormValue("Path")
- for _, group := range srv.groups {
- if group.Name == name {
- return nil, &iam.Error{
- StatusCode: 409,
- Code: "EntityAlreadyExists",
- Message: fmt.Sprintf("Group with name %s already exists.", name),
- }
- }
- }
- group := iam.Group{
- Id: "GROUP " + reqId + "EXAMPLE",
- Arn: fmt.Sprintf("arn:aws:iam:::123456789012:group%s%s", path, name),
- Name: name,
- Path: path,
- }
- srv.groups = append(srv.groups, group)
- return iam.CreateGroupResp{
- RequestId: reqId,
- Group: group,
- }, nil
-}
-
-func (srv *Server) listGroups(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- pathPrefix := req.FormValue("PathPrefix")
- if pathPrefix == "" {
- return iam.GroupsResp{
- RequestId: reqId,
- Groups: srv.groups,
- }, nil
- }
- var groups []iam.Group
- for _, group := range srv.groups {
- if strings.HasPrefix(group.Path, pathPrefix) {
- groups = append(groups, group)
- }
- }
- return iam.GroupsResp{
- RequestId: reqId,
- Groups: groups,
- }, nil
-}
-
-func (srv *Server) deleteGroup(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"GroupName"}); err != nil {
- return nil, err
- }
- name := req.FormValue("GroupName")
- index := -1
- for i, group := range srv.groups {
- if group.Name == name {
- index = i
- break
- }
- }
- if index == -1 {
- return nil, &iam.Error{
- StatusCode: 404,
- Code: "NoSuchEntity",
- Message: fmt.Sprintf("The group with name %s cannot be found.", name),
- }
- }
- copy(srv.groups[index:], srv.groups[index+1:])
- srv.groups = srv.groups[:len(srv.groups)-1]
- return iam.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) putUserPolicy(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName", "PolicyDocument", "PolicyName"}); err != nil {
- return nil, err
- }
- var exists bool
- policyName := req.FormValue("PolicyName")
- userName := req.FormValue("UserName")
- for _, policy := range srv.userPolicies {
- if policyName == policy.Name && userName == policy.UserName {
- exists = true
- break
- }
- }
- if !exists {
- policy := iam.UserPolicy{
- Name: policyName,
- UserName: userName,
- Document: req.FormValue("PolicyDocument"),
- }
- var dumb interface{}
- if err := json.Unmarshal([]byte(policy.Document), &dumb); err != nil {
- return nil, &iam.Error{
- StatusCode: 400,
- Code: "MalformedPolicyDocument",
- Message: "Malformed policy document",
- }
- }
- srv.userPolicies = append(srv.userPolicies, policy)
- }
- return iam.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) deleteUserPolicy(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName", "PolicyName"}); err != nil {
- return nil, err
- }
- policyName := req.FormValue("PolicyName")
- userName := req.FormValue("UserName")
- index := -1
- for i, policy := range srv.userPolicies {
- if policyName == policy.Name && userName == policy.UserName {
- index = i
- break
- }
- }
- if index < 0 {
- return nil, &iam.Error{
- StatusCode: 404,
- Code: "NoSuchEntity",
- Message: "No such user policy",
- }
- }
- copy(srv.userPolicies[index:], srv.userPolicies[index+1:])
- srv.userPolicies = srv.userPolicies[:len(srv.userPolicies)-1]
- return iam.SimpleResp{RequestId: reqId}, nil
-}
-
-func (srv *Server) getUserPolicy(w http.ResponseWriter, req *http.Request, reqId string) (interface{}, error) {
- if err := srv.validate(req, []string{"UserName", "PolicyName"}); err != nil {
- return nil, err
- }
- policyName := req.FormValue("PolicyName")
- userName := req.FormValue("UserName")
- index := -1
- for i, policy := range srv.userPolicies {
- if policyName == policy.Name && userName == policy.UserName {
- index = i
- break
- }
- }
- if index < 0 {
- return nil, &iam.Error{
- StatusCode: 404,
- Code: "NoSuchEntity",
- Message: "No such user policy",
- }
- }
- return iam.GetUserPolicyResp{
- Policy: srv.userPolicies[index],
- RequestId: reqId,
- }, nil
-}
-
-func (srv *Server) findUser(userName string) (int, error) {
- var (
- err error
- index = -1
- )
- for i, user := range srv.users {
- if user.Name == userName {
- index = i
- break
- }
- }
- if index < 0 {
- err = &iam.Error{
- StatusCode: 404,
- Code: "NoSuchEntity",
- Message: fmt.Sprintf("The user with name %s cannot be found.", userName),
- }
- }
- return index, err
-}
-
-// Validates the presence of required request parameters.
-func (srv *Server) validate(req *http.Request, required []string) error {
- for _, r := range required {
- if req.FormValue(r) == "" {
- return &iam.Error{
- StatusCode: 400,
- Code: "InvalidParameterCombination",
- Message: fmt.Sprintf("%s is required.", r),
- }
- }
- }
- return nil
-}
-
-var actions = map[string]func(*Server, http.ResponseWriter, *http.Request, string) (interface{}, error){
- "CreateUser": (*Server).createUser,
- "DeleteUser": (*Server).deleteUser,
- "GetUser": (*Server).getUser,
- "CreateAccessKey": (*Server).createAccessKey,
- "DeleteAccessKey": (*Server).deleteAccessKey,
- "ListAccessKeys": (*Server).listAccessKeys,
- "PutUserPolicy": (*Server).putUserPolicy,
- "DeleteUserPolicy": (*Server).deleteUserPolicy,
- "GetUserPolicy": (*Server).getUserPolicy,
- "CreateGroup": (*Server).createGroup,
- "DeleteGroup": (*Server).deleteGroup,
- "ListGroups": (*Server).listGroups,
-}
diff --git a/vendor/github.com/goamz/goamz/iam/responses_test.go b/vendor/github.com/goamz/goamz/iam/responses_test.go
deleted file mode 100644
index d8a0b2c4c..000000000
--- a/vendor/github.com/goamz/goamz/iam/responses_test.go
+++ /dev/null
@@ -1,261 +0,0 @@
-package iam_test
-
-// http://goo.gl/EUIvl
-var CreateUserExample = `
-<CreateUserResponse>
- <CreateUserResult>
- <User>
- <Path>/division_abc/subdivision_xyz/</Path>
- <UserName>Bob</UserName>
- <UserId>AIDACKCEVSQ6C2EXAMPLE</UserId>
- <Arn>arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob</Arn>
- </User>
- </CreateUserResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateUserResponse>
-`
-
-var DuplicateUserExample = `
-<ErrorResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
- <Error>
- <Type>Sender</Type>
- <Code>EntityAlreadyExists</Code>
- <Message>User with name Bob already exists.</Message>
- </Error>
- <RequestId>1d5f5000-1316-11e2-a60f-91a8e6fb6d21</RequestId>
-</ErrorResponse>
-`
-
-var GetUserExample = `
-<GetUserResponse>
- <GetUserResult>
- <User>
- <Path>/division_abc/subdivision_xyz/</Path>
- <UserName>Bob</UserName>
- <UserId>AIDACKCEVSQ6C2EXAMPLE</UserId>
- <Arn>arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob</Arn>
- </User>
- </GetUserResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</GetUserResponse>
-`
-
-var CreateGroupExample = `
-<CreateGroupResponse>
- <CreateGroupResult>
- <Group>
- <Path>/admins/</Path>
- <GroupName>Admins</GroupName>
- <GroupId>AGPACKCEVSQ6C2EXAMPLE</GroupId>
- <Arn>arn:aws:iam::123456789012:group/Admins</Arn>
- </Group>
- </CreateGroupResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateGroupResponse>
-`
-
-var ListGroupsExample = `
-<ListGroupsResponse>
- <ListGroupsResult>
- <Groups>
- <member>
- <Path>/division_abc/subdivision_xyz/</Path>
- <GroupName>Admins</GroupName>
- <GroupId>AGPACKCEVSQ6C2EXAMPLE</GroupId>
- <Arn>arn:aws:iam::123456789012:group/Admins</Arn>
- </member>
- <member>
- <Path>/division_abc/subdivision_xyz/product_1234/engineering/</Path>
- <GroupName>Test</GroupName>
- <GroupId>AGP2MAB8DPLSRHEXAMPLE</GroupId>
- <Arn>arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test</Arn>
- </member>
- <member>
- <Path>/division_abc/subdivision_xyz/product_1234/</Path>
- <GroupName>Managers</GroupName>
- <GroupId>AGPIODR4TAW7CSEXAMPLE</GroupId>
- <Arn>arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers</Arn>
- </member>
- </Groups>
- <IsTruncated>false</IsTruncated>
- </ListGroupsResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</ListGroupsResponse>
-`
-
-var RequestIdExample = `
-<AddUserToGroupResponse>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</AddUserToGroupResponse>
-`
-
-var CreateAccessKeyExample = `
-<CreateAccessKeyResponse>
- <CreateAccessKeyResult>
- <AccessKey>
- <UserName>Bob</UserName>
- <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>
- <Status>Active</Status>
- <SecretAccessKey>wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY</SecretAccessKey>
- </AccessKey>
- </CreateAccessKeyResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateAccessKeyResponse>
-`
-
-var ListAccessKeyExample = `
-<ListAccessKeysResponse>
- <ListAccessKeysResult>
- <UserName>Bob</UserName>
- <AccessKeyMetadata>
- <member>
- <UserName>Bob</UserName>
- <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>
- <Status>Active</Status>
- </member>
- <member>
- <UserName>Bob</UserName>
- <AccessKeyId>AKIAI44QH8DHBEXAMPLE</AccessKeyId>
- <Status>Inactive</Status>
- </member>
- </AccessKeyMetadata>
- <IsTruncated>false</IsTruncated>
- </ListAccessKeysResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</ListAccessKeysResponse>
-`
-
-var GetUserPolicyExample = `
-<GetUserPolicyResponse>
- <GetUserPolicyResult>
- <UserName>Bob</UserName>
- <PolicyName>AllAccessPolicy</PolicyName>
- <PolicyDocument>
- {"Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}
- </PolicyDocument>
- </GetUserPolicyResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</GetUserPolicyResponse>
-`
-
-var AddUserToGroupExample = `
-<AddUserToGroupResponse>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</AddUserToGroupResponse>
-`
-
-var ListAccountAliasesExample = `
-<ListAccountAliasesResponse>
- <ListAccountAliasesResult>
- <IsTruncated>false</IsTruncated>
- <AccountAliases>
- <member>foocorporation</member>
- </AccountAliases>
- </ListAccountAliasesResult>
- <ResponseMetadata>
- <RequestId>c5a076e9-f1b0-11df-8fbe-45274EXAMPLE</RequestId>
- </ResponseMetadata>
-</ListAccountAliasesResponse>
-`
-
-var CreateAccountAliasExample = `
-<CreateAccountAliasResponse>
- <ResponseMetadata>
- <RequestId>36b5db08-f1b0-11df-8fbe-45274EXAMPLE</RequestId>
- </ResponseMetadata>
-</CreateAccountAliasResponse>
-`
-
-var DeleteAccountAliasExample = `
-<DeleteAccountAliasResponse>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
- </ResponseMetadata>
-</DeleteAccountAliasResponse>
-`
-
-var UploadServerCertificateExample = `
-<UploadServerCertificateResponse>
-<UploadServerCertificateResult>
- <ServerCertificateMetadata>
- <ServerCertificateName>ProdServerCert</ServerCertificateName>
- <Path>/company/servercerts/</Path>
- <Arn>arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert</Arn>
- <UploadDate>2010-05-08T01:02:03.004Z</UploadDate>
- <ServerCertificateId>ASCACKCEVSQ6C2EXAMPLE</ServerCertificateId>
- <Expiration>2012-05-08T01:02:03.004Z</Expiration>
- </ServerCertificateMetadata>
-</UploadServerCertificateResult>
-<ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
-</ResponseMetadata>
-</UploadServerCertificateResponse>
-`
-var ListServerCertificatesExample = `
-<ListServerCertificatesResponse>
-<ListServerCertificatesResult>
- <IsTruncated>false</IsTruncated>
- <ServerCertificateMetadataList>
- <member>
- <ServerCertificateMetadata>
- <ServerCertificateName>ProdServerCert</ServerCertificateName>
- <Path>/some/fake/path</Path>
- <Arn>arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert</Arn>
- <UploadDate>2010-05-08T01:02:03.004Z</UploadDate>
- <ServerCertificateId>ASCACKCEVSQ6C2EXAMPLE1</ServerCertificateId>
- <Expiration>2012-05-08T01:02:03.004Z</Expiration>
- </ServerCertificateMetadata>
- </member>
- <member>
- <ServerCertificateMetadata>
- <ServerCertificateName>BetaServerCert</ServerCertificateName>
- <Path>/some/fake/path</Path>
- <Arn>arn:aws:iam::123456789012:server-certificate/company/servercerts/BetaServerCert</Arn>
- <UploadDate>2010-05-08T01:02:03.004Z</UploadDate>
- <ServerCertificateId>ASCACKCEVSQ6C2EXAMPLE2</ServerCertificateId>
- <Expiration>2012-05-08T01:02:03.004Z</Expiration>
- </ServerCertificateMetadata>
- </member>
- <member>
- <ServerCertificateMetadata>
- <ServerCertificateName>TestServerCert</ServerCertificateName>
- <Path>/some/fake/path</Path>
- <Arn>arn:aws:iam::123456789012:server-certificate/company/servercerts/TestServerCert</Arn>
- <UploadDate>2010-05-08T01:02:03.004Z</UploadDate>
- <ServerCertificateId>ASCACKCEVSQ6C2EXAMPLE3</ServerCertificateId>
- <Expiration>2012-05-08T01:02:03.004Z</Expiration>
- </ServerCertificateMetadata>
- </member>
- </ServerCertificateMetadataList>
-</ListServerCertificatesResult>
-<ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8eTHISDIFFERENTTEST</RequestId>
-</ResponseMetadata>
-</ListServerCertificatesResponse>
-`
-
-var DeleteServerCertificateExample = `
-<DeleteServerCertificateResponse>
-<ResponseMetadata>
-<RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
-</ResponseMetadata>
-</DeleteServerCertificateResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/iam/sign.go b/vendor/github.com/goamz/goamz/iam/sign.go
deleted file mode 100644
index b704fd8d6..000000000
--- a/vendor/github.com/goamz/goamz/iam/sign.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package iam
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "sort"
- "strings"
-)
-
-// ----------------------------------------------------------------------------
-// Version 2 signing (http://goo.gl/RSRp5)
-
-var b64 = base64.StdEncoding
-
-func sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- params["AWSAccessKeyId"] = auth.AccessKey
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
- if auth.Token() != "" {
- params["SecurityToken"] = auth.Token()
- }
-
- var sarray []string
- for k, v := range params {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(v))
- }
- sort.StringSlice(sarray).Sort()
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}
diff --git a/vendor/github.com/goamz/goamz/rds/rds.go b/vendor/github.com/goamz/goamz/rds/rds.go
deleted file mode 100644
index f00b52c64..000000000
--- a/vendor/github.com/goamz/goamz/rds/rds.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package rds
-
-import (
- "encoding/xml"
- "github.com/goamz/goamz/aws"
- "log"
- "net/http/httputil"
- "strconv"
-)
-
-const debug = false
-
-const (
- ServiceName = "rds"
- ApiVersion = "2013-09-09"
-)
-
-// The RDS type encapsulates operations within a specific EC2 region.
-type RDS struct {
- Service aws.AWSService
-}
-
-// New creates a new RDS Client.
-func New(auth aws.Auth, region aws.Region) (*RDS, error) {
- service, err := aws.NewService(auth, region.RDSEndpoint)
- if err != nil {
- return nil, err
- }
- return &RDS{
- Service: service,
- }, nil
-}
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// query dispatches a request to the RDS API signed with a version 2 signature
-func (rds *RDS) query(method, path string, params map[string]string, resp interface{}) error {
- // Add basic RDS param
- params["Version"] = ApiVersion
-
- r, err := rds.Service.Query(method, path, params)
- if err != nil {
- return err
- }
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
-
- if r.StatusCode != 200 {
- return rds.Service.BuildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-// ----------------------------------------------------------------------------
-// API methods and corresponding response types.
-
-// Response to a DescribeDBInstances request
-//
-// See http://goo.gl/KSPlAl for more details.
-type DescribeDBInstancesResponse struct {
- DBInstances []DBInstance `xml:"DescribeDBInstancesResult>DBInstances>DBInstance"` // The list of database instances
- Marker string `xml:"DescribeDBInstancesResult>Marker"` // An optional pagination token provided by a previous request
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// DescribeDBInstances - Returns a description of each Database Instance
-// Supports pagination by using the "Marker" parameter, and "maxRecords" for subsequent calls
-// Unfortunately RDS does not currently support filtering
-//
-// See http://goo.gl/lzZMyz for more details.
-func (rds *RDS) DescribeDBInstances(id string, maxRecords int, marker string) (*DescribeDBInstancesResponse, error) {
-
- params := aws.MakeParams("DescribeDBInstances")
-
- if id != "" {
- params["DBInstanceIdentifier"] = id
- }
-
- if maxRecords != 0 {
- params["MaxRecords"] = strconv.Itoa(maxRecords)
- }
- if marker != "" {
- params["Marker"] = marker
- }
-
- resp := &DescribeDBInstancesResponse{}
- err := rds.query("POST", "/", params, resp)
- return resp, err
-}
diff --git a/vendor/github.com/goamz/goamz/rds/rds_test.go b/vendor/github.com/goamz/goamz/rds/rds_test.go
deleted file mode 100644
index ac277d4d7..000000000
--- a/vendor/github.com/goamz/goamz/rds/rds_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package rds_test
-
-import (
- "testing"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/rds"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- rds *rds.RDS
-}
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- var err error
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.rds, err = rds.New(auth, aws.Region{RDSEndpoint: aws.ServiceInfo{testServer.URL, aws.V2Signature}})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestDescribeDBInstancesExample1(c *C) {
- testServer.Response(200, nil, DescribeDBInstancesExample1)
-
- resp, err := s.rds.DescribeDBInstances("simcoprod01", 0, "")
-
- req := testServer.WaitRequest()
- c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeDBInstances"})
- c.Assert(req.Form["DBInstanceIdentifier"], DeepEquals, []string{"simcoprod01"})
-
- c.Assert(err, IsNil)
- c.Assert(resp.RequestId, Equals, "9135fff3-8509-11e0-bd9b-a7b1ece36d51")
- c.Assert(resp.DBInstances, HasLen, 1)
-
- db0 := resp.DBInstances[0]
- c.Assert(db0.AllocatedStorage, Equals, 10)
- c.Assert(db0.AutoMinorVersionUpgrade, Equals, true)
- c.Assert(db0.AvailabilityZone, Equals, "us-east-1a")
- c.Assert(db0.BackupRetentionPeriod, Equals, 1)
-
- c.Assert(db0.DBInstanceClass, Equals, "db.m1.large")
- c.Assert(db0.DBInstanceIdentifier, Equals, "simcoprod01")
- c.Assert(db0.DBInstanceStatus, Equals, "available")
- c.Assert(db0.DBName, Equals, "simcoprod")
-
- c.Assert(db0.Endpoint.Address, Equals, "simcoprod01.cu7u2t4uz396.us-east-1.rds.amazonaws.com")
- c.Assert(db0.Endpoint.Port, Equals, 3306)
- c.Assert(db0.Engine, Equals, "mysql")
- c.Assert(db0.EngineVersion, Equals, "5.1.50")
- c.Assert(db0.InstanceCreateTime, Equals, "2011-05-23T06:06:43.110Z")
-
- c.Assert(db0.LatestRestorableTime, Equals, "2011-05-23T06:50:00Z")
- c.Assert(db0.LicenseModel, Equals, "general-public-license")
- c.Assert(db0.MasterUsername, Equals, "master")
- c.Assert(db0.MultiAZ, Equals, false)
- c.Assert(db0.OptionGroupMemberships, HasLen, 1)
- c.Assert(db0.OptionGroupMemberships[0].Name, Equals, "default.mysql5.1")
- c.Assert(db0.OptionGroupMemberships[0].Status, Equals, "in-sync")
-
- c.Assert(db0.PreferredBackupWindow, Equals, "00:00-00:30")
- c.Assert(db0.PreferredMaintenanceWindow, Equals, "sat:07:30-sat:08:00")
- c.Assert(db0.PubliclyAccessible, Equals, false)
-}
diff --git a/vendor/github.com/goamz/goamz/rds/responses_test.go b/vendor/github.com/goamz/goamz/rds/responses_test.go
deleted file mode 100644
index b7912f84b..000000000
--- a/vendor/github.com/goamz/goamz/rds/responses_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package rds_test
-
-var DescribeDBInstancesExample1 = `
-<DescribeDBInstancesResponse xmlns="http://rds.amazonaws.com/doc/2013-09-09/">
- <DescribeDBInstancesResult>
- <DBInstances>
- <DBInstance>
- <ReadReplicaDBInstanceIdentifiers/>
- <LatestRestorableTime>2011-05-23T06:50:00Z</LatestRestorableTime>
- <Engine>mysql</Engine>
- <PendingModifiedValues/>
- <BackupRetentionPeriod>1</BackupRetentionPeriod>
- <MultiAZ>false</MultiAZ>
- <LicenseModel>general-public-license</LicenseModel>
- <DBInstanceStatus>available</DBInstanceStatus>
- <EngineVersion>5.1.50</EngineVersion>
- <Endpoint>
- <Port>3306</Port>
- <Address>simcoprod01.cu7u2t4uz396.us-east-1.rds.amazonaws.com</Address>
- </Endpoint>
- <DBInstanceIdentifier>simcoprod01</DBInstanceIdentifier>
- <DBName>simcoprod</DBName>
- <DBParameterGroups>
- <DBParameterGroup>
- <ParameterApplyStatus>in-sync</ParameterApplyStatus>
- <DBParameterGroupName>default.mysql5.1</DBParameterGroupName>
- </DBParameterGroup>
- </DBParameterGroups>
- <DBSecurityGroups>
- <DBSecurityGroup>
- <Status>active</Status>
- <DBSecurityGroupName>default</DBSecurityGroupName>
- </DBSecurityGroup>
- </DBSecurityGroups>
- <PreferredBackupWindow>00:00-00:30</PreferredBackupWindow>
- <AutoMinorVersionUpgrade>true</AutoMinorVersionUpgrade>
- <PreferredMaintenanceWindow>sat:07:30-sat:08:00</PreferredMaintenanceWindow>
- <AvailabilityZone>us-east-1a</AvailabilityZone>
- <InstanceCreateTime>2011-05-23T06:06:43.110Z</InstanceCreateTime>
- <AllocatedStorage>10</AllocatedStorage>
- <OptionGroupMemberships>
- <OptionGroupMembership>
- <OptionGroupName>default.mysql5.1</OptionGroupName>
- <Status>in-sync</Status>
- </OptionGroupMembership>
- </OptionGroupMemberships>
- <DBInstanceClass>db.m1.large</DBInstanceClass>
- <MasterUsername>master</MasterUsername>
- <PubliclyAccessible>false</PubliclyAccessible>
- </DBInstance>
- </DBInstances>
- </DescribeDBInstancesResult>
- <ResponseMetadata>
- <RequestId>9135fff3-8509-11e0-bd9b-a7b1ece36d51</RequestId>
- </ResponseMetadata>
-</DescribeDBInstancesResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/rds/types.go b/vendor/github.com/goamz/goamz/rds/types.go
deleted file mode 100644
index aa9c4024f..000000000
--- a/vendor/github.com/goamz/goamz/rds/types.go
+++ /dev/null
@@ -1,388 +0,0 @@
-package rds
-
-// AvailabilityZone contains Availability Zone information
-// See http://goo.gl/GWF4zF for more details.
-type AvailabilityZone struct {
- Name string `xml:"Name"`
- ProvisionedIopsCapable bool `xml:"ProvisionedIopsCapable"`
-}
-
-// CharacterSet represents a character set used by a Database Engine
-// See http://goo.gl/0BXwFp for more details.
-type CharacterSet struct {
- Name string `xml:"CharacterSetName"`
- Description string `xml:"CharacterSetDescription"`
-}
-
-// DBEngineVersion describes a version of a Database Engine
-// See http://goo.gl/a5l6cv for more details.
-type DBEngineVersion struct {
- DBEngineDescription string `xml:"DBEngineDescription"` // The description of the database engine
- DBEngineVersionDescription string `xml:"DBEngineVersionDescription"` // The description of the database engine version
- DBParameterGroupFamily string `xml:"DBParameterGroupFamily"` // The name of the DB parameter group family for the database engine
- DefaultCharacterSet CharacterSet `xml:"DefaultCharacterSet"` // The default character set for new instances of this engine version, if the CharacterSetName parameter of the CreateDBInstance API is not specified
- Engine string `xml:"Engine"` // The name of the database engine
- EngineVersion string `xml:"EngineVersion"` // The version number of the database engine
- SupportedCharacterSets []CharacterSet `xml:"SupportedCharacterSets"` // A list of the character sets supported by this engine for the CharacterSetName parameter of the CreateDBInstance API
-}
-
-// DBInstance encapsulates an instance of a Database
-// See http://goo.gl/rQFpAe for more details.
-type DBInstance struct {
- AllocatedStorage int `xml:"AllocatedStorage"` // Specifies the allocated storage size specified in gigabytes.
- AutoMinorVersionUpgrade bool `xml:"AutoMinorVersionUpgrade"` // Indicates that minor version patches are applied automatically.
- AvailabilityZone string `xml:"AvailabilityZone"` // Specifies the name of the Availability Zone the DB instance is located in.
- BackupRetentionPeriod int `xml:"BackupRetentionPeriod"` // Specifies the number of days for which automatic DB snapshots are retained.
- CharacterSetName string `xml:"CharacterSetName"` // If present, specifies the name of the character set that this instance is associated with.
- DBInstanceClass string `xml:"DBInstanceClass"` // Contains the name of the compute and memory capacity class of the DB instance.
- DBInstanceIdentifier string `xml:"DBInstanceIdentifier"` // Contains a user-supplied database identifier. This is the unique key that identifies a DB instance.
- DBInstanceStatus string `xml:"DBInstanceStatus"` // Specifies the current state of this database.
- DBName string `xml:"DBName"` // The meaning of this parameter differs according to the database engine you use.
- DBParameterGroups []DBParameterGroupStatus `xml:"DBParameterGroups>DBParameterGroup"` // Provides the list of DB parameter groups applied to this DB instance.
- DBSecurityGroups []DBSecurityGroupMembership `xml:"DBSecurityGroups>DBSecurityGroup"` // Provides List of DB security group elements containing only DBSecurityGroup.Name and DBSecurityGroup.Status subelements.
- DBSubnetGroup DBSubnetGroup `xml:"DBSubnetGroup"` // Specifies information on the subnet group associated with the DB instance, including the name, description, and subnets in the subnet group.
- Endpoint Endpoint `xml:"Endpoint"` // Specifies the connection endpoint.
- Engine string `xml:"Engine"` // Provides the name of the database engine to be used for this DB instance.
- EngineVersion string `xml:"EngineVersion"` // Indicates the database engine version.
- InstanceCreateTime string `xml:"InstanceCreateTime"` // Provides the date and time the DB instance was created.
- Iops int `xml:"Iops"` // Specifies the Provisioned IOPS (I/O operations per second) value.
- LatestRestorableTime string `xml:"LatestRestorableTime"` // Specifies the latest time to which a database can be restored with point-in-time restore.
- LicenseModel string `xml:"LicenseModel"` // License model information for this DB instance.
- MasterUsername string `xml:"MasterUsername"` // Contains the master username for the DB instance.
- MultiAZ bool `xml:"MultiAZ"` // Specifies if the DB instance is a Multi-AZ deployment.
- OptionGroupMemberships []OptionGroupMembership `xml:"OptionGroupMemberships>OptionGroupMembership"` // Provides the list of option group memberships for this DB instance.
- PendingModifiedValues PendingModifiedValues `xml:"PendingModifiedValues"` // Specifies that changes to the DB instance are pending. This element is only included when changes are pending. Specific changes are identified by subelements.
- PreferredBackupWindow string `xml:"PreferredBackupWindow"` // Specifies the daily time range during which automated backups are created if automated backups are enabled, as determined by the BackupRetentionPeriod.
- PreferredMaintenanceWindow string `xml:"PreferredMaintenanceWindow"` // Specifies the weekly time range (in UTC) during which system maintenance can occur.
- PubliclyAccessible bool `xml:"PubliclyAccessible"` // Specifies the accessibility options for the DB instance. A value of true specifies an Internet-facing instance with a publicly resolvable DNS name, which resolves to a public IP address. A value of false specifies an internal instance with a DNS name that resolves to a private IP address.
- ReadReplicaDBInstanceIdentifiers []string `xml:"ReadReplicaDBInstanceIdentifiers"` // Contains one or more identifiers of the read replicas associated with this DB instance.
- ReadReplicaSourceDBInstanceIdentifier string `xml:"ReadReplicaSourceDBInstanceIdentifier"` // Contains the identifier of the source DB instance if this DB instance is a read replica.
- SecondaryAvailabilityZone string `xml:"SecondaryAvailabilityZone"` // If present, specifies the name of the secondary Availability Zone for a DB instance with multi-AZ support.
- StatusInfos []DBInstanceStatusInfo `xml:"StatusInfos"` // The status of a read replica. If the instance is not a read replica, this will be blank.
- VpcSecurityGroups []VpcSecurityGroupMembership `xml:"VpcSecurityGroups"` // Provides List of VPC security group elements that the DB instance belongs to.
-}
-
-// DBInstanceStatusInfo provides a list of status information for a DB instance
-// See http://goo.gl/WuePdz for more details.
-type DBInstanceStatusInfo struct {
- Message string `xml:"Message"` // Details of the error if there is an error for the instance. If the instance is not in an error state, this value is blank.
- Normal bool `xml:"Normal"` // Boolean value that is true if the instance is operating normally, or false if the instance is in an error state.
- Status string `xml:"Status"` // Status of the DB instance. For a StatusType of read replica, the values can be replicating, error, stopped, or terminated.
- StatusType string `xml:"StatusType"` // This value is currently "read replication."
-}
-
-// DBParameterGroup contains the result of a successful invocation of the CreateDBParameterGroup action
-// See http://goo.gl/a8BCTy for more details.
-type DBParameterGroup struct {
- Name string `xml:"DBParameterGroupName"`
- Description string `xml:"Description"`
- Family string `xml:"DBParameterGroupFamily"`
-}
-
-// DBParameterGroupStatus represents the status of the DB parameter group
-// See http://goo.gl/X318cI for more details.
-type DBParameterGroupStatus struct {
- Name string `xml:"DBParameterGroupName"`
- Status string `xml:"ParameterApplyStatus"`
-}
-
-// DBSecurityGroup represents a RDS DB Security Group which controls network access to a DB instance that is not inside a VPC
-// See http://goo.gl/JF5oJy for more details.
-type DBSecurityGroup struct {
- Name string `xml:"DBSecurityGroupName"`
- Description string `xml:"DBSecurityGroupDescription"`
- EC2SecurityGroups []EC2SecurityGroup `xml:"EC2SecurityGroups"`
- IPRanges []IPRange `xml:"IPRanges"`
- OwnerId string `xml:"OwnerId"`
- VpcId string `xml:"VpcId"`
-}
-
-// DBSecurityGroupMembership represents a DBSecurityGroup which a Database Instance belongs to
-// See http://goo.gl/QjTK0b for more details.
-type DBSecurityGroupMembership struct {
- Name string `xml:"DBSecurityGroupName"`
- Status string `xml:"Status"`
-}
-
-// DBSnapshot represents a snapshot of a Database (a backup of the Instance data)
-// See http://goo.gl/wkf0L9 for more details.
-type DBSnapshot struct {
- AllocatedStorage int `xml:"AllocatedStorage"` // Specifies the allocated storage size in gigabytes (GB)
- AvailabilityZone string `xml:"AvailabilityZone"`
- DBInstanceIdentifier string `xml:"DBInstanceIdentifier"`
- DBSnapshotIdentifier string `xml:"DBSnapshotIdentifier"`
- Engine string `xml:"Engine"`
- EngineVersion string `xml:"EngineVersion"`
- InstanceCreateTime string `xml:"InstanceCreateTime"`
- Iops int `xml:"Iops"`
- LicenseModel string `xml:"LicenseModel"`
- MasterUsername string `xml:"MasterUsername"`
- OptionGroupName string `xml:"OptionGroupName"`
- PercentProgress int `xml:"PercentProgress"`
- Port int `xml:"Port"`
- SnapshotCreateTime string `xml:"SnapshotCreateTime"`
- SnapshotType string `xml:"SnapshotType"`
- SourceRegion string `xml:"SourceRegion"`
- Status string `xml:"Status"`
- VpcId string `xml:"VpcId"`
-}
-
-// DBSubnetGroup is a collection of subnets that is designated for an RDS DB Instance in a VPC
-// See http://goo.gl/8vMPkE for more details.
-type DBSubnetGroup struct {
- Name string `xml:"DBSubnetGroupName"`
- Description string `xml:"DBSubnetGroupDescription"`
- Status string `xml:"SubnetGroupStatus"`
- Subnets []Subnet `xml:"Subnets>Subnet"`
- VpcId string `xml:"VpcId"`
-}
-
-// EC2SecurityGroup a standard EC2 Security Group which can be assigned to a DB Instance
-// See http://goo.gl/AWavZ2 for more details.
-type EC2SecurityGroup struct {
- Id string `xml:"EC2SecurityGroupId"`
- Name string `xml:"EC2SecurityGroupName"`
- OwnerId string `xml:"EC2SecurityGroupOwnerId"` // The AWS ID of the owner of the EC2 security group
- Status string `xml:"Status"` // Status can be "authorizing", "authorized", "revoking", and "revoked"
-}
-
-// Endpoint encapsulates the connection endpoint for a DB Instance
-// See http://goo.gl/jefsJ4 for more details.
-type Endpoint struct {
- Address string `xml:"Address"`
- Port int `xml:"Port"`
-}
-
-// EngineDefaults describes the system parameter information for a given database engine
-// See http://goo.gl/XFy7Wv for more details.
-type EngineDefaults struct {
- DBParameterGroupFamily string `xml:"DBParameterGroupFamily"`
- Marker string `xml:"Marker"`
- Parameters []Parameter `xml:"Parameters"`
-}
-
-// Event encapsulates events related to DB instances, DB security groups, DB snapshots, and DB parameter groups
-// See http://goo.gl/6fUQow for more details.
-type Event struct {
- Date string `xml:"Date"` // Specifies the date and time of the event
- EventCategories []string `xml:"EventCategories"` // Specifies the category for the event
- Message string `xml:"Message"` // Provides the text of this event
- SourceIdentifier string `xml:"SourceIdentifier"` // Provides the identifier for the source of the event
- SourceType string `xml:"SourceType"` // Valid Values: db-instance | db-parameter-group | db-security-group | db-snapshot
-}
-
-// EventCategoriesMap encapsulates event categories for the specified source type
-// See http://goo.gl/9VY3aS for more details.
-type EventCategoriesMap struct {
- EventCategories []string `xml:"EventCategories"`
- SourceType string `xml:"SourceType"`
-}
-
-// EventSubscription describes a subscription, for a customer account, to a series of events
-// See http://goo.gl/zgNdXw for more details.
-type EventSubscription struct {
- CustSubscriptionId string `xml:"CustSubscriptionId"` // The RDS event notification subscription Id
- CustomerAwsId string `xml:"CustomerAwsId"` // The AWS customer account associated with the RDS event notification subscription
- Enabled bool `xml:"Enabled"` // True indicates the subscription is enabled
- EventCategoriesList []string `xml:"EventCategoriesList"` // A list of event categories for the RDS event notification subscription
- SnsTopicArn string `xml:"SnsTopicArn"` // The topic ARN of the RDS event notification subscription
- SourceIdsList []string `xml:"SourceIdsList"` // A list of source Ids for the RDS event notification subscription
- SourceType string `xml:"SourceType"` // The source type for the RDS event notification subscription
- Status string `xml:"Status"` // Can be one of the following: creating | modifying | deleting | active | no-permission | topic-not-exist
- SubscriptionCreationTime string `xml:"SubscriptionCreationTime"` // The time the RDS event notification subscription was created
-}
-
-// IPRange encapsulates an IP range (and its status) used by a DB Security Group
-// See http://goo.gl/VfntNm for more details.
-type IPRange struct {
- CIDRIP string `xml:"CIDRIP"`
- Status string `xml:"Status"` // Specifies the status of the IP range. Status can be "authorizing", "authorized", "revoking", and "revoked".
-}
-
-// Option describes a feature available for an RDS instance along with any settings applicable to it
-// See http://goo.gl/8DYY0J for more details.
-type Option struct {
- Name string `xml:"OptionName"`
- Description string `xml:"OptionDescription"`
- Settings []OptionSetting `xml:"OptionSettings"`
- Permanent bool `xml:"Permanent"`
- Persistent bool `xml:"Persistent"`
- Port int `xml:"Port"`
- DBSecurityGroupMemberships []DBSecurityGroupMembership `xml:"DBSecurityGroupMemberships"` // If the option requires access to a port, then this DB security group allows access to the port
- VpcSecurityGroupMemberships []VpcSecurityGroupMembership `xml:"VpcSecurityGroupMemberships"` // If the option requires access to a port, then this VPC security group allows access to the port
-}
-
-// OptionConfiguration is a list of all available options
-// See http://goo.gl/kkEzw1 for more details.
-type OptionConfiguration struct {
- OptionName string `xml:"OptionName"`
- OptionSettings []OptionSetting `xml:"OptionSettings"`
- Port int `xml:"Port"`
- DBSecurityGroupMemberships []string `xml:"DBSecurityGroupMemberships"`
- VpcSecurityGroupMemberships []string `xml:"VpcSecurityGroupMemberships"`
-}
-
-// OptionGroup represents a set of features, called options, that are available for a particular Amazon RDS DB instance
-// See http://goo.gl/NedBJl for more details.
-type OptionGroup struct {
- Name string `xml:"OptionGroupName"`
- Description string `xml:"OptionGroupDescription"`
- VpcId string `xml:"VpcId"`
- AllowsVpcAndNonVpcInstanceMemberships bool `xml:"AllowsVpcAndNonVpcInstanceMemberships"`
- EngineName string `xml:"EngineName"`
- MajorEngineVersion string `xml:"MajorEngineVersion"`
- Options []Option `xml:"Options"`
-}
-
-// OptionGroupMembership provides information on the option groups the DB instance is a member of
-// See http://goo.gl/XBW6j4 for more details.
-type OptionGroupMembership struct {
- Name string `xml:"OptionGroupName"` // The name of the option group that the instance belongs to
- Status string `xml:"Status"` // The status of the option group membership, e.g. in-sync, pending, pending-maintenance, applying
-}
-
-// OptionGroupOption represents an option within an option group
-// See http://goo.gl/jQYL0U for more details.
-type OptionGroupOption struct {
- DefaultPort int `xml:"DefaultPort"`
- Description string `xml:"Description"`
- EngineName string `xml:"EngineName"`
- MajorEngineVersion string `xml:"MajorEngineVersion"`
- MinimumRequiredMinorEngineVersion string `xml:"MinimumRequiredMinorEngineVersion"`
- Name string `xml:"Name"`
- OptionGroupOptionSettings []OptionGroupOptionSetting `xml:"OptionGroupOptionSettings"`
- OptionsDependedOn string `xml:"OptionsDependedOn"`
- Permanent bool `xml:"Permanent"`
- Persistent bool `xml:"Persistent"`
- PortRequired bool `xml:"PortRequired"`
-}
-
-// OptionGroupOptionSetting are used to display settings available for each option with their default values and other information
-// See http://goo.gl/9aIwNX for more details.
-type OptionGroupOptionSetting struct {
- AllowedValues string `xml:"AllowedValues"`
- ApplyType string `xml:"ApplyType"`
- DefaultValue string `xml:"DefaultValue"`
- IsModifiable bool `xml:"IsModifiable"`
- SettingDescription string `xml:"SettingDescription"`
- SettingName string `xml:"SettingName"`
-}
-
-// OptionSetting encapsulates modifiable settings for a particular option (a feature available for a Database Instance)
-// See http://goo.gl/VjOJmW for more details.
-type OptionSetting struct {
- Name string `xml:"Name"`
- Value string `xml:"Value"`
- Description string `xml:"Description"`
- AllowedValues string `xml:"AllowedValues"`
- ApplyType string `xml:"ApplyType"`
- DataType string `xml:"DataType"`
- DefaultValue string `xml:"DefaultValue"`
- IsCollection bool `xml:"IsCollection"`
- IsModifiable bool `xml:"IsModifiable"`
-}
-
-// OrderableDBInstanceOption contains a list of available options for a DB instance
-// See http://goo.gl/FVPeVC for more details.
-type OrderableDBInstanceOption struct {
- AvailabilityZones []AvailabilityZone `xml:"AvailabilityZones"`
- DBInstanceClass string `xml:"DBInstanceClass"`
- Engine string `xml:"Engine"`
- EngineVersion string `xml:"EngineVersion"`
- LicenseModel string `xml:"LicenseModel"`
- MultiAZCapable bool `xml:"MultiAZCapable"`
- ReadReplicaCapable bool `xml:"ReadReplicaCapable"`
- Vpc bool `xml:"Vpc"`
-}
-
-// Parameter is used as a request parameter in various actions
-// See http://goo.gl/cJmvVT for more details.
-type Parameter struct {
- AllowedValues string `xml:"AllowedValues"`
- ApplyMethod string `xml:"ApplyMethod"` // Valid Values: immediate | pending-reboot
- ApplyType string `xml:"ApplyType"`
- DataType string `xml:"DataType"`
- Description string `xml:"Description"`
- IsModifiable bool `xml:"IsModifiable"`
- MinimumEngineVersion string `xml:"MinimumEngineVersion"`
- ParameterName string `xml:"ParameterName"`
- ParameterValue string `xml:"ParameterValue"`
- Source string `xml:"Source"`
-}
-
-// PendingModifiedValues represents values modified in a ModifyDBInstance action
-// See http://goo.gl/UoXhLH for more details.
-type PendingModifiedValues struct {
- AllocatedStorage int `xml:"AllocatedStorage"`
- BackupRetentionPeriod int `xml:"BackupRetentionPeriod"`
- DBInstanceClass string `xml:"DBInstanceClass"`
- DBInstanceIdentifier string `xml:"DBInstanceIdentifier"`
- EngineVersion string `xml:"EngineVersion"`
- Iops int `xml:"Iops"`
- MasterUserPassword string `xml:"MasterUserPassword"`
- MultiAZ bool `xml:"MultiAZ"`
- Port string `xml:"Port"`
-}
-
-// RecurringCharge describes an amount that will be charged on a recurring basis with a given frequency
-// See http://goo.gl/3GDplh for more details.
-type RecurringCharge struct {
- Amount float64 `xml:"RecurringChargeAmount"`
- Frequency string `xml:"RecurringChargeFrequency"`
-}
-
-// ReservedDBInstance encapsulates a reserved Database Instance
-// See http://goo.gl/mjLhNI for more details.
-type ReservedDBInstance struct {
- CurrencyCode string `xml:"CurrencyCode"`
- DBInstanceClass string `xml:"DBInstanceClass"`
- DBInstanceCount int `xml:"DBInstanceCount"`
- Duration int `xml:"Duration"`
- FixedPrice float64 `xml:"FixedPrice"`
- MultiAZ bool `xml:"MultiAZ"`
- OfferingType string `xml:"OfferingType"`
- ProductDescription string `xml:"ProductDescription"`
- RecurringCharges []RecurringCharge `xml:"RecurringCharges"`
- ReservedDBInstanceId string `xml:"ReservedDBInstanceId"`
- ReservedDBInstancesOfferingId string `xml:"ReservedDBInstancesOfferingId"`
- StartTime string `xml:"StartTime"`
- State string `xml:"State"`
- UsagePrice float64 `xml:"UsagePrice"`
-}
-
-// ReservedDBInstancesOffering describes an available Reserved DB instance offering which can be purchased
-// See http://goo.gl/h5s8e6 for more details.
-type ReservedDBInstancesOffering struct {
- CurrencyCode string `xml:"CurrencyCode"`
- DBInstanceClass string `xml:"DBInstanceClass"`
- Duration int `xml:"Duration"`
- FixedPrice float64 `xml:"FixedPrice"`
- MultiAZ bool `xml:"MultiAZ"`
- OfferingType string `xml:"OfferingType"`
- ProductDescription string `xml:"ProductDescription"`
- RecurringCharges []RecurringCharge `xml:"RecurringCharges"`
- ReservedDBInstancesOfferingId string `xml:"ReservedDBInstancesOfferingId"`
- UsagePrice float64 `xml:"UsagePrice"`
-}
-
-// Subnet describes an EC2 subnet, along with its status and location
-// See http://goo.gl/Nc8ymd for more details.
-type Subnet struct {
- Id string `xml:"SubnetIdentifier"`
- Status string `xml:"SubnetStatus"`
- AvailabilityZone AvailabilityZone `xml:"SubnetAvailabilityZone"`
-}
-
-// Tag represents metadata assigned to an Amazon RDS resource consisting of a key-value pair
-// See http://goo.gl/YnXRrE for more details.
-type Tag struct {
- Key string `xml:"Key"`
- Value string `xml:"Value"`
-}
-
-// VpcSecurityGroupMembership describes a standard VPC Security Group which has been assigned to a DB Instance located in a VPC
-// See http://goo.gl/UIvmlS for more details.
-type VpcSecurityGroupMembership struct {
- Id string `xml:"VpcSecurityGroupId"`
- Status string `xml:"Status"`
-}
diff --git a/vendor/github.com/goamz/goamz/route53/route53.go b/vendor/github.com/goamz/goamz/route53/route53.go
deleted file mode 100644
index 0e26a6f73..000000000
--- a/vendor/github.com/goamz/goamz/route53/route53.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package route53
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "github.com/goamz/goamz/aws"
- "io"
- "net/http"
-)
-
-type Route53 struct {
- Auth aws.Auth
- Endpoint string
- Signer *aws.Route53Signer
- Service *aws.Service
-}
-
-const route53_host = "https://route53.amazonaws.com"
-
-// Factory for the route53 type
-func NewRoute53(auth aws.Auth) (*Route53, error) {
- signer := aws.NewRoute53Signer(auth)
-
- return &Route53{
- Auth: auth,
- Signer: signer,
- Endpoint: route53_host + "/2013-04-01/hostedzone",
- }, nil
-}
-
-// General Structs used in all types of requests
-type HostedZone struct {
- XMLName xml.Name `xml:"HostedZone"`
- Id string
- Name string
- CallerReference string
- Config Config
- ResourceRecordSetCount int
-}
-
-type Config struct {
- XMLName xml.Name `xml:"Config"`
- Comment string
-}
-
-// Structs for getting the existing Hosted Zones
-type ListHostedZonesResponse struct {
- XMLName xml.Name `xml:"ListHostedZonesResponse"`
- HostedZones []HostedZone `xml:"HostedZones>HostedZone"`
- Marker string
- IsTruncated bool
- NextMarker string
- MaxItems int
-}
-
-// Structs for Creating a New Host
-type CreateHostedZoneRequest struct {
- XMLName xml.Name `xml:"CreateHostedZoneRequest"`
- Xmlns string `xml:"xmlns,attr"`
- Name string
- CallerReference string
- HostedZoneConfig HostedZoneConfig
-}
-
-type ResourceRecordValue struct {
- Value string `xml:"Value"`
-}
-
-type AliasTarget struct {
- HostedZoneId string `xml:"HostedZoneId"`
- DNSName string `xml:"DNSName"`
- EvaluateTargetHealth bool `xml:"EvaluateTargetHealth"`
-}
-
-// Wrapper for all the different resource record sets
-type ResourceRecordSet interface{}
-
-// Basic Change
-type Change struct {
- Action string `xml:"Action"`
- Name string `xml:"ResourceRecordSet>Name"`
- Type string `xml:"ResourceRecordSet>Type"`
- TTL int `xml:"ResourceRecordSet>TTL,omitempty"`
- Values []ResourceRecordValue `xml:"ResourceRecordSet>ResourceRecords>ResourceRecord"`
- HealthCheckId string `xml:"ResourceRecordSet>HealthCheckId,omitempty"`
-}
-
-// Basic Resource Recod Set
-type BasicResourceRecordSet struct {
- Action string `xml:"Action"`
- Name string `xml:"ResourceRecordSet>Name"`
- Type string `xml:"ResourceRecordSet>Type"`
- TTL int `xml:"ResourceRecordSet>TTL,omitempty"`
- Values []ResourceRecordValue `xml:"ResourceRecordSet>ResourceRecords>ResourceRecord"`
- HealthCheckId string `xml:"ResourceRecordSet>HealthCheckId,omitempty"`
-}
-
-// Alias Resource Record Set
-type AliasResourceRecordSet struct {
- Action string `xml:"Action"`
- Name string `xml:"ResourceRecordSet>Name"`
- Type string `xml:"ResourceRecordSet>Type"`
- AliasTarget AliasTarget `xml:"ResourceRecordSet>AliasTarget"`
- HealthCheckId string `xml:"ResourceRecordSet>HealthCheckId,omitempty"`
-}
-
-type ChangeResourceRecordSetsRequest struct {
- XMLName xml.Name `xml:"ChangeResourceRecordSetsRequest"`
- Xmlns string `xml:"xmlns,attr"`
- Changes []ResourceRecordSet `xml:"ChangeBatch>Changes>Change"`
-}
-
-type HostedZoneConfig struct {
- XMLName xml.Name `xml:"HostedZoneConfig"`
- Comment string
-}
-
-type CreateHostedZoneResponse struct {
- XMLName xml.Name `xml:"CreateHostedZoneResponse"`
- HostedZone HostedZone
- ChangeInfo ChangeInfo
- DelegationSet DelegationSet
-}
-
-type ChangeResourceRecordSetsResponse struct {
- XMLName xml.Name `xml:"ChangeResourceRecordSetsResponse"`
- Id string `xml:"ChangeInfo>Id"`
- Status string `xml:"ChangeInfo>Status"`
- SubmittedAt string `xml:"ChangeInfo>SubmittedAt"`
-}
-
-type ChangeInfo struct {
- XMLName xml.Name `xml:"ChangeInfo"`
- Id string
- Status string
- SubmittedAt string
-}
-
-type DelegationSet struct {
- XMLName xml.Name `xml:"DelegationSet`
- NameServers NameServers
-}
-
-type NameServers struct {
- XMLName xml.Name `xml:"NameServers`
- NameServer []string
-}
-
-type GetHostedZoneResponse struct {
- XMLName xml.Name `xml:"GetHostedZoneResponse"`
- HostedZone HostedZone
- DelegationSet DelegationSet
-}
-
-type DeleteHostedZoneResponse struct {
- XMLName xml.Name `xml:"DeleteHostedZoneResponse"`
- Xmlns string `xml:"xmlns,attr"`
- ChangeInfo ChangeInfo
-}
-
-// query sends the specified HTTP request to the path and signs the request
-// with the required authentication and headers based on the Auth.
-//
-// Automatically decodes the response into the the result interface
-func (r *Route53) query(method string, path string, body io.Reader, result interface{}) error {
- var err error
-
- // Create the POST request and sign the headers
- req, err := http.NewRequest(method, path, body)
- r.Signer.Sign(req)
-
- // Send the request and capture the response
- client := &http.Client{}
- res, err := client.Do(req)
- if err != nil {
- return err
- }
-
- if method == "POST" {
- defer req.Body.Close()
- }
-
- if res.StatusCode != 201 && res.StatusCode != 200 {
- err = r.Service.BuildError(res)
- return err
- }
-
- err = xml.NewDecoder(res.Body).Decode(result)
-
- return err
-}
-
-// CreateHostedZone send a creation request to the AWS Route53 API
-func (r *Route53) CreateHostedZone(hostedZoneReq *CreateHostedZoneRequest) (*CreateHostedZoneResponse, error) {
- xmlBytes, err := xml.Marshal(hostedZoneReq)
- if err != nil {
- return nil, err
- }
-
- result := new(CreateHostedZoneResponse)
- err = r.query("POST", r.Endpoint, bytes.NewBuffer(xmlBytes), result)
-
- return result, err
-}
-
-// ChangeResourceRecordSet send a change resource record request to the AWS Route53 API
-func (r *Route53) ChangeResourceRecordSet(req *ChangeResourceRecordSetsRequest, zoneId string) (*ChangeResourceRecordSetsResponse, error) {
- xmlBytes, err := xml.Marshal(req)
- if err != nil {
- return nil, err
- }
- xmlBytes = []byte(xml.Header + string(xmlBytes))
-
- result := new(ChangeResourceRecordSetsResponse)
- path := fmt.Sprintf("%s/%s/rrset", r.Endpoint, zoneId)
- err = r.query("POST", path, bytes.NewBuffer(xmlBytes), result)
-
- return result, err
-}
-
-// ListedHostedZones fetches a collection of HostedZones through the AWS Route53 API
-func (r *Route53) ListHostedZones(marker string, maxItems int) (result *ListHostedZonesResponse, err error) {
- path := ""
-
- if marker == "" {
- path = fmt.Sprintf("%s?maxitems=%d", r.Endpoint, maxItems)
- } else {
- path = fmt.Sprintf("%s?marker=%v&maxitems=%d", r.Endpoint, marker, maxItems)
- }
-
- result = new(ListHostedZonesResponse)
- err = r.query("GET", path, nil, result)
-
- return
-}
-
-// GetHostedZone fetches a particular hostedzones DelegationSet by id
-func (r *Route53) GetHostedZone(id string) (result *GetHostedZoneResponse, err error) {
- result = new(GetHostedZoneResponse)
- err = r.query("GET", fmt.Sprintf("%s/%v", r.Endpoint, id), nil, result)
-
- return
-}
-
-// DeleteHostedZone deletes the hosted zone with the given id
-func (r *Route53) DeleteHostedZone(id string) (result *DeleteHostedZoneResponse, err error) {
- path := fmt.Sprintf("%s/%s", r.Endpoint, id)
-
- result = new(DeleteHostedZoneResponse)
- err = r.query("DELETE", path, nil, result)
-
- return
-}
diff --git a/vendor/github.com/goamz/goamz/s3/export_test.go b/vendor/github.com/goamz/goamz/s3/export_test.go
deleted file mode 100644
index 4ff913cde..000000000
--- a/vendor/github.com/goamz/goamz/s3/export_test.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package s3
-
-import (
- "github.com/goamz/goamz/aws"
-)
-
-func Sign(auth aws.Auth, method, path string, params, headers map[string][]string) {
- sign(auth, method, path, params, headers)
-}
-
-func SetListPartsMax(n int) {
- listPartsMax = n
-}
-
-func SetListMultiMax(n int) {
- listMultiMax = n
-}
diff --git a/vendor/github.com/goamz/goamz/s3/multi.go b/vendor/github.com/goamz/goamz/s3/multi.go
deleted file mode 100644
index 348ead300..000000000
--- a/vendor/github.com/goamz/goamz/s3/multi.go
+++ /dev/null
@@ -1,439 +0,0 @@
-package s3
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/base64"
- "encoding/hex"
- "encoding/xml"
- "errors"
- "io"
- "sort"
- "strconv"
-)
-
-// Multi represents an unfinished multipart upload.
-//
-// Multipart uploads allow sending big objects in smaller chunks.
-// After all parts have been sent, the upload must be explicitly
-// completed by calling Complete with the list of parts.
-//
-// See http://goo.gl/vJfTG for an overview of multipart uploads.
-type Multi struct {
- Bucket *Bucket
- Key string
- UploadId string
-}
-
-// That's the default. Here just for testing.
-var listMultiMax = 1000
-
-type listMultiResp struct {
- NextKeyMarker string
- NextUploadIdMarker string
- IsTruncated bool
- Upload []Multi
- CommonPrefixes []string `xml:"CommonPrefixes>Prefix"`
-}
-
-// ListMulti returns the list of unfinished multipart uploads in b.
-//
-// The prefix parameter limits the response to keys that begin with the
-// specified prefix. You can use prefixes to separate a bucket into different
-// groupings of keys (to get the feeling of folders, for example).
-//
-// The delim parameter causes the response to group all of the keys that
-// share a common prefix up to the next delimiter in a single entry within
-// the CommonPrefixes field. You can use delimiters to separate a bucket
-// into different groupings of keys, similar to how folders would work.
-//
-// See http://goo.gl/ePioY for details.
-func (b *Bucket) ListMulti(prefix, delim string) (multis []*Multi, prefixes []string, err error) {
- params := map[string][]string{
- "uploads": {""},
- "max-uploads": {strconv.FormatInt(int64(listMultiMax), 10)},
- "prefix": {prefix},
- "delimiter": {delim},
- }
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- req := &request{
- method: "GET",
- bucket: b.Name,
- params: params,
- }
- var resp listMultiResp
- err := b.S3.query(req, &resp)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err != nil {
- return nil, nil, err
- }
- for i := range resp.Upload {
- multi := &resp.Upload[i]
- multi.Bucket = b
- multis = append(multis, multi)
- }
- prefixes = append(prefixes, resp.CommonPrefixes...)
- if !resp.IsTruncated {
- return multis, prefixes, nil
- }
- params["key-marker"] = []string{resp.NextKeyMarker}
- params["upload-id-marker"] = []string{resp.NextUploadIdMarker}
- attempt = b.S3.AttemptStrategy.Start() // Last request worked.
- }
- panic("unreachable")
-}
-
-// Multi returns a multipart upload handler for the provided key
-// inside b. If a multipart upload exists for key, it is returned,
-// otherwise a new multipart upload is initiated with contType and perm.
-func (b *Bucket) Multi(key, contType string, perm ACL) (*Multi, error) {
- multis, _, err := b.ListMulti(key, "")
- if err != nil && !hasCode(err, "NoSuchUpload") {
- return nil, err
- }
- for _, m := range multis {
- if m.Key == key {
- return m, nil
- }
- }
- return b.InitMulti(key, contType, perm)
-}
-
-// InitMulti initializes a new multipart upload at the provided
-// key inside b and returns a value for manipulating it.
-//
-// See http://goo.gl/XP8kL for details.
-func (b *Bucket) InitMulti(key string, contType string, perm ACL) (*Multi, error) {
- headers := map[string][]string{
- "Content-Type": {contType},
- "Content-Length": {"0"},
- "x-amz-acl": {string(perm)},
- }
- params := map[string][]string{
- "uploads": {""},
- }
- req := &request{
- method: "POST",
- bucket: b.Name,
- path: key,
- headers: headers,
- params: params,
- }
- var err error
- var resp struct {
- UploadId string `xml:"UploadId"`
- }
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- err = b.S3.query(req, &resp)
- if !shouldRetry(err) {
- break
- }
- }
- if err != nil {
- return nil, err
- }
- return &Multi{Bucket: b, Key: key, UploadId: resp.UploadId}, nil
-}
-
-// PutPart sends part n of the multipart upload, reading all the content from r.
-// Each part, except for the last one, must be at least 5MB in size.
-//
-// See http://goo.gl/pqZer for details.
-func (m *Multi) PutPart(n int, r io.ReadSeeker) (Part, error) {
- partSize, _, md5b64, err := seekerInfo(r)
- if err != nil {
- return Part{}, err
- }
- return m.putPart(n, r, partSize, md5b64)
-}
-
-func (m *Multi) putPart(n int, r io.ReadSeeker, partSize int64, md5b64 string) (Part, error) {
- headers := map[string][]string{
- "Content-Length": {strconv.FormatInt(partSize, 10)},
- "Content-MD5": {md5b64},
- }
- params := map[string][]string{
- "uploadId": {m.UploadId},
- "partNumber": {strconv.FormatInt(int64(n), 10)},
- }
- for attempt := m.Bucket.S3.AttemptStrategy.Start(); attempt.Next(); {
- _, err := r.Seek(0, 0)
- if err != nil {
- return Part{}, err
- }
- req := &request{
- method: "PUT",
- bucket: m.Bucket.Name,
- path: m.Key,
- headers: headers,
- params: params,
- payload: r,
- }
- err = m.Bucket.S3.prepare(req)
- if err != nil {
- return Part{}, err
- }
- resp, err := m.Bucket.S3.run(req, nil)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err != nil {
- return Part{}, err
- }
- etag := resp.Header.Get("ETag")
- if etag == "" {
- return Part{}, errors.New("part upload succeeded with no ETag")
- }
- return Part{n, etag, partSize}, nil
- }
- panic("unreachable")
-}
-
-func seekerInfo(r io.ReadSeeker) (size int64, md5hex string, md5b64 string, err error) {
- _, err = r.Seek(0, 0)
- if err != nil {
- return 0, "", "", err
- }
- digest := md5.New()
- size, err = io.Copy(digest, r)
- if err != nil {
- return 0, "", "", err
- }
- sum := digest.Sum(nil)
- md5hex = hex.EncodeToString(sum)
- md5b64 = base64.StdEncoding.EncodeToString(sum)
- return size, md5hex, md5b64, nil
-}
-
-type Part struct {
- N int `xml:"PartNumber"`
- ETag string
- Size int64
-}
-
-type partSlice []Part
-
-func (s partSlice) Len() int { return len(s) }
-func (s partSlice) Less(i, j int) bool { return s[i].N < s[j].N }
-func (s partSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-type listPartsResp struct {
- NextPartNumberMarker string
- IsTruncated bool
- Part []Part
-}
-
-// That's the default. Here just for testing.
-var listPartsMax = 1000
-
-// ListParts returns the list of previously uploaded parts in m,
-// ordered by part number.
-//
-// See http://goo.gl/ePioY for details.
-func (m *Multi) ListParts() ([]Part, error) {
- params := map[string][]string{
- "uploadId": {m.UploadId},
- "max-parts": {strconv.FormatInt(int64(listPartsMax), 10)},
- }
- var parts partSlice
- for attempt := m.Bucket.S3.AttemptStrategy.Start(); attempt.Next(); {
- req := &request{
- method: "GET",
- bucket: m.Bucket.Name,
- path: m.Key,
- params: params,
- }
- var resp listPartsResp
- err := m.Bucket.S3.query(req, &resp)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err != nil {
- return nil, err
- }
- parts = append(parts, resp.Part...)
- if !resp.IsTruncated {
- sort.Sort(parts)
- return parts, nil
- }
- params["part-number-marker"] = []string{resp.NextPartNumberMarker}
- attempt = m.Bucket.S3.AttemptStrategy.Start() // Last request worked.
- }
- panic("unreachable")
-}
-
-type ReaderAtSeeker interface {
- io.ReaderAt
- io.ReadSeeker
-}
-
-// PutAll sends all of r via a multipart upload with parts no larger
-// than partSize bytes, which must be set to at least 5MB.
-// Parts previously uploaded are either reused if their checksum
-// and size match the new part, or otherwise overwritten with the
-// new content.
-// PutAll returns all the parts of m (reused or not).
-func (m *Multi) PutAll(r ReaderAtSeeker, partSize int64) ([]Part, error) {
- old, err := m.ListParts()
- if err != nil && !hasCode(err, "NoSuchUpload") {
- return nil, err
- }
- reuse := 0 // Index of next old part to consider reusing.
- current := 1 // Part number of latest good part handled.
- totalSize, err := r.Seek(0, 2)
- if err != nil {
- return nil, err
- }
- first := true // Must send at least one empty part if the file is empty.
- var result []Part
-NextSection:
- for offset := int64(0); offset < totalSize || first; offset += partSize {
- first = false
- if offset+partSize > totalSize {
- partSize = totalSize - offset
- }
- section := io.NewSectionReader(r, offset, partSize)
- _, md5hex, md5b64, err := seekerInfo(section)
- if err != nil {
- return nil, err
- }
- for reuse < len(old) && old[reuse].N <= current {
- // Looks like this part was already sent.
- part := &old[reuse]
- etag := `"` + md5hex + `"`
- if part.N == current && part.Size == partSize && part.ETag == etag {
- // Checksum matches. Reuse the old part.
- result = append(result, *part)
- current++
- continue NextSection
- }
- reuse++
- }
-
- // Part wasn't found or doesn't match. Send it.
- part, err := m.putPart(current, section, partSize, md5b64)
- if err != nil {
- return nil, err
- }
- result = append(result, part)
- current++
- }
- return result, nil
-}
-
-type completeUpload struct {
- XMLName xml.Name `xml:"CompleteMultipartUpload"`
- Parts completeParts `xml:"Part"`
-}
-
-type completePart struct {
- PartNumber int
- ETag string
-}
-
-type completeParts []completePart
-
-func (p completeParts) Len() int { return len(p) }
-func (p completeParts) Less(i, j int) bool { return p[i].PartNumber < p[j].PartNumber }
-func (p completeParts) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type completeResponse struct {
- // The element name: should be either CompleteMultipartUploadResult or Error.
- XMLName xml.Name
- // If the element was error, then it should have the following:
- Code string
- Message string
- RequestId string
- HostId string
-}
-
-// Complete assembles the given previously uploaded parts into the
-// final object. This operation may take several minutes.
-//
-// The complete call to AMZ may still fail after returning HTTP 200,
-// so even though it's unusued, the body of the reply must be demarshalled
-// and checked to see whether or not the complete succeeded.
-//
-// See http://goo.gl/2Z7Tw for details.
-func (m *Multi) Complete(parts []Part) error {
- params := map[string][]string{
- "uploadId": {m.UploadId},
- }
- c := completeUpload{}
- for _, p := range parts {
- c.Parts = append(c.Parts, completePart{p.N, p.ETag})
- }
- sort.Sort(c.Parts)
- data, err := xml.Marshal(&c)
- if err != nil {
- return err
- }
-
- // Setting Content-Length prevents breakage on DreamObjects
- for attempt := m.Bucket.S3.AttemptStrategy.Start(); attempt.Next(); {
- req := &request{
- method: "POST",
- bucket: m.Bucket.Name,
- path: m.Key,
- params: params,
- payload: bytes.NewReader(data),
- headers: map[string][]string{
- "Content-Length": []string{strconv.Itoa(len(data))},
- },
- }
-
- resp := &completeResponse{}
- err := m.Bucket.S3.query(req, resp)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err == nil && resp.XMLName.Local == "Error" {
- err = &Error{
- StatusCode: 200,
- Code: resp.Code,
- Message: resp.Message,
- RequestId: resp.RequestId,
- HostId: resp.HostId,
- }
- }
- return err
- }
- panic("unreachable")
-}
-
-// Abort deletes an unifinished multipart upload and any previously
-// uploaded parts for it.
-//
-// After a multipart upload is aborted, no additional parts can be
-// uploaded using it. However, if any part uploads are currently in
-// progress, those part uploads might or might not succeed. As a result,
-// it might be necessary to abort a given multipart upload multiple
-// times in order to completely free all storage consumed by all parts.
-//
-// NOTE: If the described scenario happens to you, please report back to
-// the goamz authors with details. In the future such retrying should be
-// handled internally, but it's not clear what happens precisely (Is an
-// error returned? Is the issue completely undetectable?).
-//
-// See http://goo.gl/dnyJw for details.
-func (m *Multi) Abort() error {
- params := map[string][]string{
- "uploadId": {m.UploadId},
- }
- for attempt := m.Bucket.S3.AttemptStrategy.Start(); attempt.Next(); {
- req := &request{
- method: "DELETE",
- bucket: m.Bucket.Name,
- path: m.Key,
- params: params,
- }
- err := m.Bucket.S3.query(req, nil)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- return err
- }
- panic("unreachable")
-}
diff --git a/vendor/github.com/goamz/goamz/s3/multi_test.go b/vendor/github.com/goamz/goamz/s3/multi_test.go
deleted file mode 100644
index 5c788d9cc..000000000
--- a/vendor/github.com/goamz/goamz/s3/multi_test.go
+++ /dev/null
@@ -1,373 +0,0 @@
-package s3_test
-
-import (
- "encoding/xml"
- "io"
- "io/ioutil"
- "strings"
-
- "github.com/goamz/goamz/s3"
- . "gopkg.in/check.v1"
-)
-
-func (s *S) TestInitMulti(c *C) {
- testServer.Response(200, nil, InitMultiResultDump)
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Header["Content-Type"], DeepEquals, []string{"text/plain"})
- c.Assert(req.Header["X-Amz-Acl"], DeepEquals, []string{"private"})
- c.Assert(req.Form["uploads"], DeepEquals, []string{""})
-
- c.Assert(multi.UploadId, Matches, "JNbR_[A-Za-z0-9.]+QQ--")
-}
-
-func (s *S) TestMultiNoPreviousUpload(c *C) {
- // Don't retry the NoSuchUpload error.
- s.DisableRetries()
-
- testServer.Response(404, nil, NoSuchUploadErrorDump)
- testServer.Response(200, nil, InitMultiResultDump)
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.Multi("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/")
- c.Assert(req.Form["uploads"], DeepEquals, []string{""})
- c.Assert(req.Form["prefix"], DeepEquals, []string{"multi"})
-
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["uploads"], DeepEquals, []string{""})
-
- c.Assert(multi.UploadId, Matches, "JNbR_[A-Za-z0-9.]+QQ--")
-}
-
-func (s *S) TestMultiReturnOld(c *C) {
- testServer.Response(200, nil, ListMultiResultDump)
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.Multi("multi1", "text/plain", s3.Private)
- c.Assert(err, IsNil)
- c.Assert(multi.Key, Equals, "multi1")
- c.Assert(multi.UploadId, Equals, "iUVug89pPvSswrikD")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/")
- c.Assert(req.Form["uploads"], DeepEquals, []string{""})
- c.Assert(req.Form["prefix"], DeepEquals, []string{"multi1"})
-}
-
-func (s *S) TestListParts(c *C) {
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(200, nil, ListPartsResultDump1)
- testServer.Response(404, nil, NoSuchUploadErrorDump) // :-(
- testServer.Response(200, nil, ListPartsResultDump2)
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- parts, err := multi.ListParts()
- c.Assert(err, IsNil)
- c.Assert(parts, HasLen, 3)
- c.Assert(parts[0].N, Equals, 1)
- c.Assert(parts[0].Size, Equals, int64(5))
- c.Assert(parts[0].ETag, Equals, `"ffc88b4ca90a355f8ddba6b2c3b2af5c"`)
- c.Assert(parts[1].N, Equals, 2)
- c.Assert(parts[1].Size, Equals, int64(5))
- c.Assert(parts[1].ETag, Equals, `"d067a0fa9dc61a6e7195ca99696b5a89"`)
- c.Assert(parts[2].N, Equals, 3)
- c.Assert(parts[2].Size, Equals, int64(5))
- c.Assert(parts[2].ETag, Equals, `"49dcd91231f801159e893fb5c6674985"`)
- testServer.WaitRequest()
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form.Get("uploadId"), Matches, "JNbR_[A-Za-z0-9.]+QQ--")
- c.Assert(req.Form["max-parts"], DeepEquals, []string{"1000"})
-
- testServer.WaitRequest() // The internal error.
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form.Get("uploadId"), Matches, "JNbR_[A-Za-z0-9.]+QQ--")
- c.Assert(req.Form["max-parts"], DeepEquals, []string{"1000"})
- c.Assert(req.Form["part-number-marker"], DeepEquals, []string{"2"})
-}
-
-func (s *S) TestPutPart(c *C) {
- headers := map[string]string{
- "ETag": `"26f90efd10d614f100252ff56d88dad8"`,
- }
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(200, headers, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- part, err := multi.PutPart(1, strings.NewReader("<part 1>"))
- c.Assert(err, IsNil)
- c.Assert(part.N, Equals, 1)
- c.Assert(part.Size, Equals, int64(8))
- c.Assert(part.ETag, Equals, headers["ETag"])
-
- testServer.WaitRequest()
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form.Get("uploadId"), Matches, "JNbR_[A-Za-z0-9.]+QQ--")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"1"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"8"})
- c.Assert(req.Header["Content-Md5"], DeepEquals, []string{"JvkO/RDWFPEAJS/1bYja2A=="})
-}
-
-func readAll(r io.Reader) string {
- data, err := ioutil.ReadAll(r)
- if err != nil {
- panic(err)
- }
- return string(data)
-}
-
-func (s *S) TestPutAllNoPreviousUpload(c *C) {
- // Don't retry the NoSuchUpload error.
- s.DisableRetries()
-
- etag1 := map[string]string{"ETag": `"etag1"`}
- etag2 := map[string]string{"ETag": `"etag2"`}
- etag3 := map[string]string{"ETag": `"etag3"`}
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(404, nil, NoSuchUploadErrorDump)
- testServer.Response(200, etag1, "")
- testServer.Response(200, etag2, "")
- testServer.Response(200, etag3, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- parts, err := multi.PutAll(strings.NewReader("part1part2last"), 5)
- c.Assert(parts, HasLen, 3)
- c.Assert(parts[0].ETag, Equals, `"etag1"`)
- c.Assert(parts[1].ETag, Equals, `"etag2"`)
- c.Assert(parts[2].ETag, Equals, `"etag3"`)
- c.Assert(err, IsNil)
-
- // Init
- testServer.WaitRequest()
-
- // List old parts. Won't find anything.
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
-
- // Send part 1.
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"1"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"5"})
- c.Assert(readAll(req.Body), Equals, "part1")
-
- // Send part 2.
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"2"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"5"})
- c.Assert(readAll(req.Body), Equals, "part2")
-
- // Send part 3 with shorter body.
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"3"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"4"})
- c.Assert(readAll(req.Body), Equals, "last")
-}
-
-func (s *S) TestPutAllZeroSizeFile(c *C) {
- // Don't retry the NoSuchUpload error.
- s.DisableRetries()
-
- etag1 := map[string]string{"ETag": `"etag1"`}
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(404, nil, NoSuchUploadErrorDump)
- testServer.Response(200, etag1, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- // Must send at least one part, so that completing it will work.
- parts, err := multi.PutAll(strings.NewReader(""), 5)
- c.Assert(parts, HasLen, 1)
- c.Assert(parts[0].ETag, Equals, `"etag1"`)
- c.Assert(err, IsNil)
-
- // Init
- testServer.WaitRequest()
-
- // List old parts. Won't find anything.
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
-
- // Send empty part.
- req = testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"1"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"0"})
- c.Assert(readAll(req.Body), Equals, "")
-}
-
-func (s *S) TestPutAllResume(c *C) {
- etag2 := map[string]string{"ETag": `"etag2"`}
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(200, nil, ListPartsResultDump1)
- testServer.Response(200, nil, ListPartsResultDump2)
- testServer.Response(200, etag2, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- // "part1" and "part3" match the checksums in ResultDump1.
- // The middle one is a mismatch (it refers to "part2").
- parts, err := multi.PutAll(strings.NewReader("part1partXpart3"), 5)
- c.Assert(parts, HasLen, 3)
- c.Assert(parts[0].N, Equals, 1)
- c.Assert(parts[0].Size, Equals, int64(5))
- c.Assert(parts[0].ETag, Equals, `"ffc88b4ca90a355f8ddba6b2c3b2af5c"`)
- c.Assert(parts[1].N, Equals, 2)
- c.Assert(parts[1].Size, Equals, int64(5))
- c.Assert(parts[1].ETag, Equals, `"etag2"`)
- c.Assert(parts[2].N, Equals, 3)
- c.Assert(parts[2].Size, Equals, int64(5))
- c.Assert(parts[2].ETag, Equals, `"49dcd91231f801159e893fb5c6674985"`)
- c.Assert(err, IsNil)
-
- // Init
- testServer.WaitRequest()
-
- // List old parts, broken in two requests.
- for i := 0; i < 2; i++ {
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- }
-
- // Send part 2, as it didn't match the checksum.
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form["partNumber"], DeepEquals, []string{"2"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"5"})
- c.Assert(readAll(req.Body), Equals, "partX")
-}
-
-func (s *S) TestMultiComplete(c *C) {
- testServer.Response(200, nil, InitMultiResultDump)
- // Note the 200 response. Completing will hold the connection on some
- // kind of long poll, and may return a late error even after a 200.
- testServer.Response(200, nil, InternalErrorDump)
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- err = multi.Complete([]s3.Part{{2, `"ETag2"`, 32}, {1, `"ETag1"`, 64}})
- // returns InternalErrorDump in the payload, which should manifest as
- // an error.
- c.Assert(err, NotNil)
-
- testServer.WaitRequest()
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form.Get("uploadId"), Matches, "JNbR_[A-Za-z0-9.]+QQ--")
-
- var payload struct {
- XMLName xml.Name
- Part []struct {
- PartNumber int
- ETag string
- }
- }
-
- dec := xml.NewDecoder(req.Body)
- err = dec.Decode(&payload)
- c.Assert(err, IsNil)
-
- c.Assert(payload.XMLName.Local, Equals, "CompleteMultipartUpload")
- c.Assert(len(payload.Part), Equals, 2)
- c.Assert(payload.Part[0].PartNumber, Equals, 1)
- c.Assert(payload.Part[0].ETag, Equals, `"ETag1"`)
- c.Assert(payload.Part[1].PartNumber, Equals, 2)
- c.Assert(payload.Part[1].ETag, Equals, `"ETag2"`)
-}
-
-func (s *S) TestMultiAbort(c *C) {
- testServer.Response(200, nil, InitMultiResultDump)
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("sample")
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
-
- err = multi.Abort()
- c.Assert(err, IsNil)
-
- testServer.WaitRequest()
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "DELETE")
- c.Assert(req.URL.Path, Equals, "/sample/multi")
- c.Assert(req.Form.Get("uploadId"), Matches, "JNbR_[A-Za-z0-9.]+QQ--")
-}
-
-func (s *S) TestListMulti(c *C) {
- testServer.Response(200, nil, ListMultiResultDump)
-
- b := s.s3.Bucket("sample")
-
- multis, prefixes, err := b.ListMulti("", "/")
- c.Assert(err, IsNil)
- c.Assert(prefixes, DeepEquals, []string{"a/", "b/"})
- c.Assert(multis, HasLen, 2)
- c.Assert(multis[0].Key, Equals, "multi1")
- c.Assert(multis[0].UploadId, Equals, "iUVug89pPvSswrikD")
- c.Assert(multis[1].Key, Equals, "multi2")
- c.Assert(multis[1].UploadId, Equals, "DkirwsSvPp98guVUi")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/sample/")
- c.Assert(req.Form["uploads"], DeepEquals, []string{""})
- c.Assert(req.Form["prefix"], DeepEquals, []string{""})
- c.Assert(req.Form["delimiter"], DeepEquals, []string{"/"})
- c.Assert(req.Form["max-uploads"], DeepEquals, []string{"1000"})
-}
diff --git a/vendor/github.com/goamz/goamz/s3/responses_test.go b/vendor/github.com/goamz/goamz/s3/responses_test.go
deleted file mode 100644
index 414ede0a7..000000000
--- a/vendor/github.com/goamz/goamz/s3/responses_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package s3_test
-
-var GetObjectErrorDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<Error>
- <Code>NoSuchBucket</Code>
- <Message>The specified bucket does not exist</Message>
- <BucketName>non-existent-bucket</BucketName>
- <RequestId>3F1B667FAD71C3D8</RequestId>
- <HostId>L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D</HostId>
-</Error>
-`
-
-var GetListResultDump1 = `
-<?xml version="1.0" encoding="UTF-8"?>
-<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
- <Name>quotes</Name>
- <Prefix>N</Prefix>
- <IsTruncated>false</IsTruncated>
- <Contents>
- <Key>Nelson</Key>
- <LastModified>2006-01-01T12:00:00.000Z</LastModified>
- <ETag>&quot;828ef3fdfa96f00ad9f27c383fc9ac7f&quot;</ETag>
- <Size>5</Size>
- <StorageClass>STANDARD</StorageClass>
- <Owner>
- <ID>bcaf161ca5fb16fd081034f</ID>
- <DisplayName>webfile</DisplayName>
- </Owner>
- </Contents>
- <Contents>
- <Key>Neo</Key>
- <LastModified>2006-01-01T12:00:00.000Z</LastModified>
- <ETag>&quot;828ef3fdfa96f00ad9f27c383fc9ac7f&quot;</ETag>
- <Size>4</Size>
- <StorageClass>STANDARD</StorageClass>
- <Owner>
- <ID>bcaf1ffd86a5fb16fd081034f</ID>
- <DisplayName>webfile</DisplayName>
- </Owner>
- </Contents>
-</ListBucketResult>
-`
-
-var GetListResultDump2 = `
-<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <Name>example-bucket</Name>
- <Prefix>photos/2006/</Prefix>
- <Marker>some-marker</Marker>
- <MaxKeys>1000</MaxKeys>
- <Delimiter>/</Delimiter>
- <IsTruncated>false</IsTruncated>
-
- <CommonPrefixes>
- <Prefix>photos/2006/feb/</Prefix>
- </CommonPrefixes>
- <CommonPrefixes>
- <Prefix>photos/2006/jan/</Prefix>
- </CommonPrefixes>
-</ListBucketResult>
-`
-
-var InitMultiResultDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <Bucket>sample</Bucket>
- <Key>multi</Key>
- <UploadId>JNbR_cMdwnGiD12jKAd6WK2PUkfj2VxA7i4nCwjE6t71nI9Tl3eVDPFlU0nOixhftH7I17ZPGkV3QA.l7ZD.QQ--</UploadId>
-</InitiateMultipartUploadResult>
-`
-
-var ListPartsResultDump1 = `
-<?xml version="1.0" encoding="UTF-8"?>
-<ListPartsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <Bucket>sample</Bucket>
- <Key>multi</Key>
- <UploadId>JNbR_cMdwnGiD12jKAd6WK2PUkfj2VxA7i4nCwjE6t71nI9Tl3eVDPFlU0nOixhftH7I17ZPGkV3QA.l7ZD.QQ--</UploadId>
- <Initiator>
- <ID>bb5c0f63b0b25f2d099c</ID>
- <DisplayName>joe</DisplayName>
- </Initiator>
- <Owner>
- <ID>bb5c0f63b0b25f2d099c</ID>
- <DisplayName>joe</DisplayName>
- </Owner>
- <StorageClass>STANDARD</StorageClass>
- <PartNumberMarker>0</PartNumberMarker>
- <NextPartNumberMarker>2</NextPartNumberMarker>
- <MaxParts>2</MaxParts>
- <IsTruncated>true</IsTruncated>
- <Part>
- <PartNumber>1</PartNumber>
- <LastModified>2013-01-30T13:45:51.000Z</LastModified>
- <ETag>&quot;ffc88b4ca90a355f8ddba6b2c3b2af5c&quot;</ETag>
- <Size>5</Size>
- </Part>
- <Part>
- <PartNumber>2</PartNumber>
- <LastModified>2013-01-30T13:45:52.000Z</LastModified>
- <ETag>&quot;d067a0fa9dc61a6e7195ca99696b5a89&quot;</ETag>
- <Size>5</Size>
- </Part>
-</ListPartsResult>
-`
-
-var ListPartsResultDump2 = `
-<?xml version="1.0" encoding="UTF-8"?>
-<ListPartsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <Bucket>sample</Bucket>
- <Key>multi</Key>
- <UploadId>JNbR_cMdwnGiD12jKAd6WK2PUkfj2VxA7i4nCwjE6t71nI9Tl3eVDPFlU0nOixhftH7I17ZPGkV3QA.l7ZD.QQ--</UploadId>
- <Initiator>
- <ID>bb5c0f63b0b25f2d099c</ID>
- <DisplayName>joe</DisplayName>
- </Initiator>
- <Owner>
- <ID>bb5c0f63b0b25f2d099c</ID>
- <DisplayName>joe</DisplayName>
- </Owner>
- <StorageClass>STANDARD</StorageClass>
- <PartNumberMarker>2</PartNumberMarker>
- <NextPartNumberMarker>3</NextPartNumberMarker>
- <MaxParts>2</MaxParts>
- <IsTruncated>false</IsTruncated>
- <Part>
- <PartNumber>3</PartNumber>
- <LastModified>2013-01-30T13:46:50.000Z</LastModified>
- <ETag>&quot;49dcd91231f801159e893fb5c6674985&quot;</ETag>
- <Size>5</Size>
- </Part>
-</ListPartsResult>
-`
-
-var ListMultiResultDump = `
-<?xml version="1.0"?>
-<ListMultipartUploadsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <Bucket>goamz-test-bucket-us-east-1-akiajk3wyewhctyqbf7a</Bucket>
- <KeyMarker/>
- <UploadIdMarker/>
- <NextKeyMarker>multi1</NextKeyMarker>
- <NextUploadIdMarker>iUVug89pPvSswrikD72p8uO62EzhNtpDxRmwC5WSiWDdK9SfzmDqe3xpP1kMWimyimSnz4uzFc3waVM5ufrKYQ--</NextUploadIdMarker>
- <Delimiter>/</Delimiter>
- <MaxUploads>1000</MaxUploads>
- <IsTruncated>false</IsTruncated>
- <Upload>
- <Key>multi1</Key>
- <UploadId>iUVug89pPvSswrikD</UploadId>
- <Initiator>
- <ID>bb5c0f63b0b25f2d0</ID>
- <DisplayName>gustavoniemeyer</DisplayName>
- </Initiator>
- <Owner>
- <ID>bb5c0f63b0b25f2d0</ID>
- <DisplayName>gustavoniemeyer</DisplayName>
- </Owner>
- <StorageClass>STANDARD</StorageClass>
- <Initiated>2013-01-30T18:15:47.000Z</Initiated>
- </Upload>
- <Upload>
- <Key>multi2</Key>
- <UploadId>DkirwsSvPp98guVUi</UploadId>
- <Initiator>
- <ID>bb5c0f63b0b25f2d0</ID>
- <DisplayName>joe</DisplayName>
- </Initiator>
- <Owner>
- <ID>bb5c0f63b0b25f2d0</ID>
- <DisplayName>joe</DisplayName>
- </Owner>
- <StorageClass>STANDARD</StorageClass>
- <Initiated>2013-01-30T18:15:47.000Z</Initiated>
- </Upload>
- <CommonPrefixes>
- <Prefix>a/</Prefix>
- </CommonPrefixes>
- <CommonPrefixes>
- <Prefix>b/</Prefix>
- </CommonPrefixes>
-</ListMultipartUploadsResult>
-`
-
-var NoSuchUploadErrorDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<Error>
- <Code>NoSuchUpload</Code>
- <Message>Not relevant</Message>
- <BucketName>sample</BucketName>
- <RequestId>3F1B667FAD71C3D8</RequestId>
- <HostId>kjhwqk</HostId>
-</Error>
-`
-
-var InternalErrorDump = `
-<?xml version="1.0" encoding="UTF-8"?>
-<Error>
- <Code>InternalError</Code>
- <Message>Not relevant</Message>
- <BucketName>sample</BucketName>
- <RequestId>3F1B667FAD71C3D8</RequestId>
- <HostId>kjhwqk</HostId>
-</Error>
-`
diff --git a/vendor/github.com/goamz/goamz/s3/s3.go b/vendor/github.com/goamz/goamz/s3/s3.go
deleted file mode 100644
index f27479cb4..000000000
--- a/vendor/github.com/goamz/goamz/s3/s3.go
+++ /dev/null
@@ -1,1164 +0,0 @@
-//
-// goamz - Go packages to interact with the Amazon Web Services.
-//
-// https://wiki.ubuntu.com/goamz
-//
-// Copyright (c) 2011 Canonical Ltd.
-//
-// Written by Gustavo Niemeyer <gustavo.niemeyer@canonical.com>
-//
-
-package s3
-
-import (
- "bytes"
- "crypto/hmac"
- "crypto/md5"
- "crypto/sha1"
- "encoding/base64"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-const debug = false
-
-// The S3 type encapsulates operations with an S3 region.
-type S3 struct {
- aws.Auth
- aws.Region
-
- // ConnectTimeout is the maximum time a request attempt will
- // wait for a successful connection to be made.
- //
- // A value of zero means no timeout.
- ConnectTimeout time.Duration
-
- // ReadTimeout is the maximum time a request attempt will wait
- // for an individual read to complete.
- //
- // A value of zero means no timeout.
- ReadTimeout time.Duration
-
- // WriteTimeout is the maximum time a request attempt will
- // wait for an individual write to complete.
- //
- // A value of zero means no timeout.
- WriteTimeout time.Duration
-
- // RequestTimeout is the maximum time a request attempt can
- // take before operations return a timeout error.
- //
- // This includes connection time, any redirects, and reading
- // the response body. The timer remains running after the request
- // is made so it can interrupt reading of the response data.
- //
- // A Timeout of zero means no timeout.
- RequestTimeout time.Duration
-
- // AttemptStrategy is the attempt strategy used for requests.
- aws.AttemptStrategy
-
- // Reserve the right of using private data.
- private byte
-
- // client used for requests
- client *http.Client
-}
-
-// The Bucket type encapsulates operations with an S3 bucket.
-type Bucket struct {
- *S3
- Name string
-}
-
-// The Owner type represents the owner of the object in an S3 bucket.
-type Owner struct {
- ID string
- DisplayName string
-}
-
-// Fold options into an Options struct
-//
-type Options struct {
- SSE bool
- Meta map[string][]string
- ContentEncoding string
- CacheControl string
- RedirectLocation string
- ContentMD5 string
- // What else?
- // Content-Disposition string
- //// The following become headers so they are []strings rather than strings... I think
- // x-amz-storage-class []string
-}
-
-type CopyOptions struct {
- Options
- MetadataDirective string
- ContentType string
-}
-
-// CopyObjectResult is the output from a Copy request
-type CopyObjectResult struct {
- ETag string
- LastModified string
-}
-
-// DefaultAttemptStrategy is the default AttemptStrategy used by S3 objects created by New.
-var DefaultAttemptStrategy = aws.AttemptStrategy{
- Min: 5,
- Total: 5 * time.Second,
- Delay: 200 * time.Millisecond,
-}
-
-// New creates a new S3. Optional client argument allows for custom http.clients to be used.
-func New(auth aws.Auth, region aws.Region, client ...*http.Client) *S3 {
-
- var httpclient *http.Client
-
- if len(client) > 0 {
- httpclient = client[0]
- }
-
- return &S3{Auth: auth, Region: region, AttemptStrategy: DefaultAttemptStrategy, client: httpclient}
-}
-
-// Bucket returns a Bucket with the given name.
-func (s3 *S3) Bucket(name string) *Bucket {
- if s3.Region.S3BucketEndpoint != "" || s3.Region.S3LowercaseBucket {
- name = strings.ToLower(name)
- }
- return &Bucket{s3, name}
-}
-
-var createBucketConfiguration = `<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
- <LocationConstraint>%s</LocationConstraint>
-</CreateBucketConfiguration>`
-
-// locationConstraint returns an io.Reader specifying a LocationConstraint if
-// required for the region.
-//
-// See http://goo.gl/bh9Kq for details.
-func (s3 *S3) locationConstraint() io.Reader {
- constraint := ""
- if s3.Region.S3LocationConstraint {
- constraint = fmt.Sprintf(createBucketConfiguration, s3.Region.Name)
- }
- return strings.NewReader(constraint)
-}
-
-type ACL string
-
-const (
- Private = ACL("private")
- PublicRead = ACL("public-read")
- PublicReadWrite = ACL("public-read-write")
- AuthenticatedRead = ACL("authenticated-read")
- BucketOwnerRead = ACL("bucket-owner-read")
- BucketOwnerFull = ACL("bucket-owner-full-control")
-)
-
-// PutBucket creates a new bucket.
-//
-// See http://goo.gl/ndjnR for details.
-func (b *Bucket) PutBucket(perm ACL) error {
- headers := map[string][]string{
- "x-amz-acl": {string(perm)},
- }
- req := &request{
- method: "PUT",
- bucket: b.Name,
- path: "/",
- headers: headers,
- payload: b.locationConstraint(),
- }
- return b.S3.query(req, nil)
-}
-
-// DelBucket removes an existing S3 bucket. All objects in the bucket must
-// be removed before the bucket itself can be removed.
-//
-// See http://goo.gl/GoBrY for details.
-func (b *Bucket) DelBucket() (err error) {
- req := &request{
- method: "DELETE",
- bucket: b.Name,
- path: "/",
- }
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- err = b.S3.query(req, nil)
- if !shouldRetry(err) {
- break
- }
- }
- return err
-}
-
-// Get retrieves an object from an S3 bucket.
-//
-// See http://goo.gl/isCO7 for details.
-func (b *Bucket) Get(path string) (data []byte, err error) {
- body, err := b.GetReader(path)
- defer func() {
- if body != nil {
- body.Close()
- }
- }()
- if err != nil {
- return nil, err
- }
- data, err = ioutil.ReadAll(body)
- return data, err
-}
-
-// GetReader retrieves an object from an S3 bucket,
-// returning the body of the HTTP response.
-// It is the caller's responsibility to call Close on rc when
-// finished reading.
-func (b *Bucket) GetReader(path string) (rc io.ReadCloser, err error) {
- resp, err := b.GetResponse(path)
- if resp != nil {
- return resp.Body, err
- }
- return nil, err
-}
-
-// GetResponse retrieves an object from an S3 bucket,
-// returning the HTTP response.
-// It is the caller's responsibility to call Close on rc when
-// finished reading
-func (b *Bucket) GetResponse(path string) (resp *http.Response, err error) {
- return b.GetResponseWithHeaders(path, make(http.Header))
-}
-
-// GetReaderWithHeaders retrieves an object from an S3 bucket
-// Accepts custom headers to be sent as the second parameter
-// returning the body of the HTTP response.
-// It is the caller's responsibility to call Close on rc when
-// finished reading
-func (b *Bucket) GetResponseWithHeaders(path string, headers map[string][]string) (resp *http.Response, err error) {
- req := &request{
- bucket: b.Name,
- path: path,
- headers: headers,
- }
- err = b.S3.prepare(req)
- if err != nil {
- return nil, err
- }
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- resp, err := b.S3.run(req, nil)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err != nil {
- return nil, err
- }
- return resp, nil
- }
- panic("unreachable")
-}
-
-// Exists checks whether or not an object exists on an S3 bucket using a HEAD request.
-func (b *Bucket) Exists(path string) (exists bool, err error) {
- req := &request{
- method: "HEAD",
- bucket: b.Name,
- path: path,
- }
- err = b.S3.prepare(req)
- if err != nil {
- return
- }
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- resp, err := b.S3.run(req, nil)
-
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
-
- if err != nil {
- // We can treat a 403 or 404 as non existance
- if e, ok := err.(*Error); ok && (e.StatusCode == 403 || e.StatusCode == 404) {
- return false, nil
- }
- return false, err
- }
-
- if resp.StatusCode/100 == 2 {
- exists = true
- }
- return exists, err
- }
- return false, fmt.Errorf("S3 Currently Unreachable")
-}
-
-// Head HEADs an object in the S3 bucket, returns the response with
-// no body see http://bit.ly/17K1ylI
-func (b *Bucket) Head(path string, headers map[string][]string) (*http.Response, error) {
- req := &request{
- method: "HEAD",
- bucket: b.Name,
- path: path,
- headers: headers,
- }
- err := b.S3.prepare(req)
- if err != nil {
- return nil, err
- }
-
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- resp, err := b.S3.run(req, nil)
- if shouldRetry(err) && attempt.HasNext() {
- continue
- }
- if err != nil {
- return nil, err
- }
- return resp, err
- }
- return nil, fmt.Errorf("S3 Currently Unreachable")
-}
-
-// Put inserts an object into the S3 bucket.
-//
-// See http://goo.gl/FEBPD for details.
-func (b *Bucket) Put(path string, data []byte, contType string, perm ACL, options Options) error {
- body := bytes.NewBuffer(data)
- return b.PutReader(path, body, int64(len(data)), contType, perm, options)
-}
-
-// PutCopy puts a copy of an object given by the key path into bucket b using b.Path as the target key
-func (b *Bucket) PutCopy(path string, perm ACL, options CopyOptions, source string) (result *CopyObjectResult, err error) {
- headers := map[string][]string{
- "x-amz-acl": {string(perm)},
- "x-amz-copy-source": {source},
- }
- options.addHeaders(headers)
- req := &request{
- method: "PUT",
- bucket: b.Name,
- path: path,
- headers: headers,
- }
- result = &CopyObjectResult{}
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- err = b.S3.query(req, result)
- if !shouldRetry(err) {
- break
- }
- }
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-/*
-PutHeader - like Put, inserts an object into the S3 bucket.
-Instead of Content-Type string, pass in custom headers to override defaults.
-*/
-func (b *Bucket) PutHeader(path string, data []byte, customHeaders map[string][]string, perm ACL) error {
- body := bytes.NewBuffer(data)
- return b.PutReaderHeader(path, body, int64(len(data)), customHeaders, perm)
-}
-
-// PutReader inserts an object into the S3 bucket by consuming data
-// from r until EOF.
-func (b *Bucket) PutReader(path string, r io.Reader, length int64, contType string, perm ACL, options Options) error {
- headers := map[string][]string{
- "Content-Length": {strconv.FormatInt(length, 10)},
- "Content-Type": {contType},
- "x-amz-acl": {string(perm)},
- }
- options.addHeaders(headers)
- req := &request{
- method: "PUT",
- bucket: b.Name,
- path: path,
- headers: headers,
- payload: r,
- }
- return b.S3.query(req, nil)
-}
-
-/*
-PutReaderHeader - like PutReader, inserts an object into S3 from a reader.
-Instead of Content-Type string, pass in custom headers to override defaults.
-*/
-func (b *Bucket) PutReaderHeader(path string, r io.Reader, length int64, customHeaders map[string][]string, perm ACL) error {
- // Default headers
- headers := map[string][]string{
- "Content-Length": {strconv.FormatInt(length, 10)},
- "Content-Type": {"application/text"},
- "x-amz-acl": {string(perm)},
- }
-
- // Override with custom headers
- for key, value := range customHeaders {
- headers[key] = value
- }
-
- req := &request{
- method: "PUT",
- bucket: b.Name,
- path: path,
- headers: headers,
- payload: r,
- }
- return b.S3.query(req, nil)
-}
-
-// addHeaders adds o's specified fields to headers
-func (o Options) addHeaders(headers map[string][]string) {
- if o.SSE {
- headers["x-amz-server-side-encryption"] = []string{"AES256"}
- }
- if len(o.ContentEncoding) != 0 {
- headers["Content-Encoding"] = []string{o.ContentEncoding}
- }
- if len(o.CacheControl) != 0 {
- headers["Cache-Control"] = []string{o.CacheControl}
- }
- if len(o.ContentMD5) != 0 {
- headers["Content-MD5"] = []string{o.ContentMD5}
- }
- if len(o.RedirectLocation) != 0 {
- headers["x-amz-website-redirect-location"] = []string{o.RedirectLocation}
- }
- for k, v := range o.Meta {
- headers["x-amz-meta-"+k] = v
- }
-}
-
-// addHeaders adds o's specified fields to headers
-func (o CopyOptions) addHeaders(headers map[string][]string) {
- o.Options.addHeaders(headers)
- if len(o.MetadataDirective) != 0 {
- headers["x-amz-metadata-directive"] = []string{o.MetadataDirective}
- }
- if len(o.ContentType) != 0 {
- headers["Content-Type"] = []string{o.ContentType}
- }
-}
-
-func makeXmlBuffer(doc []byte) *bytes.Buffer {
- buf := new(bytes.Buffer)
- buf.WriteString(xml.Header)
- buf.Write(doc)
- return buf
-}
-
-type RoutingRule struct {
- ConditionKeyPrefixEquals string `xml:"Condition>KeyPrefixEquals"`
- RedirectReplaceKeyPrefixWith string `xml:"Redirect>ReplaceKeyPrefixWith,omitempty"`
- RedirectReplaceKeyWith string `xml:"Redirect>ReplaceKeyWith,omitempty"`
-}
-
-type WebsiteConfiguration struct {
- XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ WebsiteConfiguration"`
- IndexDocumentSuffix string `xml:"IndexDocument>Suffix"`
- ErrorDocumentKey string `xml:"ErrorDocument>Key"`
- RoutingRules *[]RoutingRule `xml:"RoutingRules>RoutingRule,omitempty"`
-}
-
-func (b *Bucket) PutBucketWebsite(configuration WebsiteConfiguration) error {
-
- doc, err := xml.Marshal(configuration)
- if err != nil {
- return err
- }
-
- buf := makeXmlBuffer(doc)
-
- return b.PutBucketSubresource("website", buf, int64(buf.Len()))
-}
-
-func (b *Bucket) PutBucketSubresource(subresource string, r io.Reader, length int64) error {
- headers := map[string][]string{
- "Content-Length": {strconv.FormatInt(length, 10)},
- }
- req := &request{
- path: "/",
- method: "PUT",
- bucket: b.Name,
- headers: headers,
- payload: r,
- params: url.Values{subresource: {""}},
- }
-
- return b.S3.query(req, nil)
-}
-
-// Del removes an object from the S3 bucket.
-//
-// See http://goo.gl/APeTt for details.
-func (b *Bucket) Del(path string) error {
- req := &request{
- method: "DELETE",
- bucket: b.Name,
- path: path,
- }
- return b.S3.query(req, nil)
-}
-
-type Delete struct {
- Quiet bool `xml:"Quiet,omitempty"`
- Objects []Object `xml:"Object"`
-}
-
-type Object struct {
- Key string `xml:"Key"`
- VersionId string `xml:"VersionId,omitempty"`
-}
-
-// DelMulti removes up to 1000 objects from the S3 bucket.
-//
-// See http://goo.gl/jx6cWK for details.
-func (b *Bucket) DelMulti(objects Delete) error {
- doc, err := xml.Marshal(objects)
- if err != nil {
- return err
- }
-
- buf := makeXmlBuffer(doc)
- digest := md5.New()
- size, err := digest.Write(buf.Bytes())
- if err != nil {
- return err
- }
-
- headers := map[string][]string{
- "Content-Length": {strconv.FormatInt(int64(size), 10)},
- "Content-MD5": {base64.StdEncoding.EncodeToString(digest.Sum(nil))},
- "Content-Type": {"text/xml"},
- }
- req := &request{
- path: "/",
- method: "POST",
- params: url.Values{"delete": {""}},
- bucket: b.Name,
- headers: headers,
- payload: buf,
- }
-
- return b.S3.query(req, nil)
-}
-
-// The ListResp type holds the results of a List bucket operation.
-type ListResp struct {
- Name string
- Prefix string
- Delimiter string
- Marker string
- NextMarker string
- MaxKeys int
-
- // IsTruncated is true if the results have been truncated because
- // there are more keys and prefixes than can fit in MaxKeys.
- // N.B. this is the opposite sense to that documented (incorrectly) in
- // http://goo.gl/YjQTc
- IsTruncated bool
- Contents []Key
- CommonPrefixes []string `xml:">Prefix"`
-}
-
-// The Key type represents an item stored in an S3 bucket.
-type Key struct {
- Key string
- LastModified string
- Size int64
- // ETag gives the hex-encoded MD5 sum of the contents,
- // surrounded with double-quotes.
- ETag string
- StorageClass string
- Owner Owner
-}
-
-// List returns information about objects in an S3 bucket.
-//
-// The prefix parameter limits the response to keys that begin with the
-// specified prefix.
-//
-// The delim parameter causes the response to group all of the keys that
-// share a common prefix up to the next delimiter in a single entry within
-// the CommonPrefixes field. You can use delimiters to separate a bucket
-// into different groupings of keys, similar to how folders would work.
-//
-// The marker parameter specifies the key to start with when listing objects
-// in a bucket. Amazon S3 lists objects in alphabetical order and
-// will return keys alphabetically greater than the marker.
-//
-// The max parameter specifies how many keys + common prefixes to return in
-// the response. The default is 1000.
-//
-// For example, given these keys in a bucket:
-//
-// index.html
-// index2.html
-// photos/2006/January/sample.jpg
-// photos/2006/February/sample2.jpg
-// photos/2006/February/sample3.jpg
-// photos/2006/February/sample4.jpg
-//
-// Listing this bucket with delimiter set to "/" would yield the
-// following result:
-//
-// &ListResp{
-// Name: "sample-bucket",
-// MaxKeys: 1000,
-// Delimiter: "/",
-// Contents: []Key{
-// {Key: "index.html", "index2.html"},
-// },
-// CommonPrefixes: []string{
-// "photos/",
-// },
-// }
-//
-// Listing the same bucket with delimiter set to "/" and prefix set to
-// "photos/2006/" would yield the following result:
-//
-// &ListResp{
-// Name: "sample-bucket",
-// MaxKeys: 1000,
-// Delimiter: "/",
-// Prefix: "photos/2006/",
-// CommonPrefixes: []string{
-// "photos/2006/February/",
-// "photos/2006/January/",
-// },
-// }
-//
-// See http://goo.gl/YjQTc for details.
-func (b *Bucket) List(prefix, delim, marker string, max int) (result *ListResp, err error) {
- params := map[string][]string{
- "prefix": {prefix},
- "delimiter": {delim},
- "marker": {marker},
- }
- if max != 0 {
- params["max-keys"] = []string{strconv.FormatInt(int64(max), 10)}
- }
- req := &request{
- bucket: b.Name,
- params: params,
- }
- result = &ListResp{}
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- err = b.S3.query(req, result)
- if !shouldRetry(err) {
- break
- }
- }
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// The VersionsResp type holds the results of a list bucket Versions operation.
-type VersionsResp struct {
- Name string
- Prefix string
- KeyMarker string
- VersionIdMarker string
- MaxKeys int
- Delimiter string
- IsTruncated bool
- Versions []Version
- CommonPrefixes []string `xml:">Prefix"`
-}
-
-// The Version type represents an object version stored in an S3 bucket.
-type Version struct {
- Key string
- VersionId string
- IsLatest bool
- LastModified string
- // ETag gives the hex-encoded MD5 sum of the contents,
- // surrounded with double-quotes.
- ETag string
- Size int64
- Owner Owner
- StorageClass string
-}
-
-func (b *Bucket) Versions(prefix, delim, keyMarker string, versionIdMarker string, max int) (result *VersionsResp, err error) {
- params := map[string][]string{
- "versions": {""},
- "prefix": {prefix},
- "delimiter": {delim},
- }
-
- if len(versionIdMarker) != 0 {
- params["version-id-marker"] = []string{versionIdMarker}
- }
- if len(keyMarker) != 0 {
- params["key-marker"] = []string{keyMarker}
- }
-
- if max != 0 {
- params["max-keys"] = []string{strconv.FormatInt(int64(max), 10)}
- }
- req := &request{
- bucket: b.Name,
- params: params,
- }
- result = &VersionsResp{}
- for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
- err = b.S3.query(req, result)
- if !shouldRetry(err) {
- break
- }
- }
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// Returns a mapping of all key names in this bucket to Key objects
-func (b *Bucket) GetBucketContents() (*map[string]Key, error) {
- bucket_contents := map[string]Key{}
- prefix := ""
- path_separator := ""
- marker := ""
- for {
- contents, err := b.List(prefix, path_separator, marker, 1000)
- if err != nil {
- return &bucket_contents, err
- }
- for _, key := range contents.Contents {
- bucket_contents[key.Key] = key
- }
- if contents.IsTruncated {
- marker = contents.NextMarker
- } else {
- break
- }
- }
-
- return &bucket_contents, nil
-}
-
-// URL returns a non-signed URL that allows retriving the
-// object at path. It only works if the object is publicly
-// readable (see SignedURL).
-func (b *Bucket) URL(path string) string {
- req := &request{
- bucket: b.Name,
- path: path,
- }
- err := b.S3.prepare(req)
- if err != nil {
- panic(err)
- }
- u, err := req.url()
- if err != nil {
- panic(err)
- }
- u.RawQuery = ""
- return u.String()
-}
-
-// SignedURL returns a signed URL that allows anyone holding the URL
-// to retrieve the object at path. The signature is valid until expires.
-func (b *Bucket) SignedURL(path string, expires time.Time) string {
- req := &request{
- bucket: b.Name,
- path: path,
- params: url.Values{"Expires": {strconv.FormatInt(expires.Unix(), 10)}},
- }
- err := b.S3.prepare(req)
- if err != nil {
- panic(err)
- }
- u, err := req.url()
- if err != nil {
- panic(err)
- }
- if b.S3.Auth.Token() != "" {
- return u.String() + "&x-amz-security-token=" + url.QueryEscape(req.headers["X-Amz-Security-Token"][0])
- } else {
- return u.String()
- }
-}
-
-// UploadSignedURL returns a signed URL that allows anyone holding the URL
-// to upload the object at path. The signature is valid until expires.
-// contenttype is a string like image/png
-// path is the resource name in s3 terminalogy like images/ali.png [obviously exclusing the bucket name itself]
-func (b *Bucket) UploadSignedURL(path, method, content_type string, expires time.Time) string {
- expire_date := expires.Unix()
- if method != "POST" {
- method = "PUT"
- }
- stringToSign := method + "\n\n" + content_type + "\n" + strconv.FormatInt(expire_date, 10) + "\n/" + b.Name + "/" + path
- fmt.Println("String to sign:\n", stringToSign)
- a := b.S3.Auth
- secretKey := a.SecretKey
- accessId := a.AccessKey
- mac := hmac.New(sha1.New, []byte(secretKey))
- mac.Write([]byte(stringToSign))
- macsum := mac.Sum(nil)
- signature := base64.StdEncoding.EncodeToString([]byte(macsum))
- signature = strings.TrimSpace(signature)
-
- signedurl, err := url.Parse("https://" + b.Name + ".s3.amazonaws.com/")
- if err != nil {
- log.Println("ERROR sining url for S3 upload", err)
- return ""
- }
- signedurl.Path += path
- params := url.Values{}
- params.Add("AWSAccessKeyId", accessId)
- params.Add("Expires", strconv.FormatInt(expire_date, 10))
- params.Add("Signature", signature)
- if a.Token() != "" {
- params.Add("token", a.Token())
- }
-
- signedurl.RawQuery = params.Encode()
- return signedurl.String()
-}
-
-// PostFormArgs returns the action and input fields needed to allow anonymous
-// uploads to a bucket within the expiration limit
-func (b *Bucket) PostFormArgs(path string, expires time.Time, redirect string) (action string, fields map[string]string) {
- conditions := make([]string, 0)
- fields = map[string]string{
- "AWSAccessKeyId": b.Auth.AccessKey,
- "key": path,
- }
-
- conditions = append(conditions, fmt.Sprintf("{\"key\": \"%s\"}", path))
- conditions = append(conditions, fmt.Sprintf("{\"bucket\": \"%s\"}", b.Name))
- if redirect != "" {
- conditions = append(conditions, fmt.Sprintf("{\"success_action_redirect\": \"%s\"}", redirect))
- fields["success_action_redirect"] = redirect
- }
-
- vExpiration := expires.Format("2006-01-02T15:04:05Z")
- vConditions := strings.Join(conditions, ",")
- policy := fmt.Sprintf("{\"expiration\": \"%s\", \"conditions\": [%s]}", vExpiration, vConditions)
- policy64 := base64.StdEncoding.EncodeToString([]byte(policy))
- fields["policy"] = policy64
-
- signer := hmac.New(sha1.New, []byte(b.Auth.SecretKey))
- signer.Write([]byte(policy64))
- fields["signature"] = base64.StdEncoding.EncodeToString(signer.Sum(nil))
-
- action = fmt.Sprintf("%s/%s/", b.S3.Region.S3Endpoint, b.Name)
- return
-}
-
-type request struct {
- method string
- bucket string
- path string
- signpath string
- params url.Values
- headers http.Header
- baseurl string
- payload io.Reader
- prepared bool
-}
-
-func (req *request) url() (*url.URL, error) {
- u, err := url.Parse(req.baseurl)
- if err != nil {
- return nil, fmt.Errorf("bad S3 endpoint URL %q: %v", req.baseurl, err)
- }
- u.RawQuery = req.params.Encode()
- u.Path = req.path
- return u, nil
-}
-
-// query prepares and runs the req request.
-// If resp is not nil, the XML data contained in the response
-// body will be unmarshalled on it.
-func (s3 *S3) query(req *request, resp interface{}) error {
- err := s3.prepare(req)
- if err == nil {
- var httpResponse *http.Response
- httpResponse, err = s3.run(req, resp)
- if resp == nil && httpResponse != nil {
- httpResponse.Body.Close()
- }
- }
- return err
-}
-
-// prepare sets up req to be delivered to S3.
-func (s3 *S3) prepare(req *request) error {
- var signpath = req.path
-
- if !req.prepared {
- req.prepared = true
- if req.method == "" {
- req.method = "GET"
- }
- // Copy so they can be mutated without affecting on retries.
- params := make(url.Values)
- headers := make(http.Header)
- for k, v := range req.params {
- params[k] = v
- }
- for k, v := range req.headers {
- headers[k] = v
- }
- req.params = params
- req.headers = headers
- if !strings.HasPrefix(req.path, "/") {
- req.path = "/" + req.path
- }
- signpath = req.path
- if req.bucket != "" {
- req.baseurl = s3.Region.S3BucketEndpoint
- if req.baseurl == "" {
- // Use the path method to address the bucket.
- req.baseurl = s3.Region.S3Endpoint
- req.path = "/" + req.bucket + req.path
- } else {
- // Just in case, prevent injection.
- if strings.IndexAny(req.bucket, "/:@") >= 0 {
- return fmt.Errorf("bad S3 bucket: %q", req.bucket)
- }
- req.baseurl = strings.Replace(req.baseurl, "${bucket}", req.bucket, -1)
- }
- signpath = "/" + req.bucket + signpath
- }
- }
-
- // Always sign again as it's not clear how far the
- // server has handled a previous attempt.
- u, err := url.Parse(req.baseurl)
- if err != nil {
- return fmt.Errorf("bad S3 endpoint URL %q: %v", req.baseurl, err)
- }
- reqSignpathSpaceFix := (&url.URL{Path: signpath}).String()
- req.headers["Host"] = []string{u.Host}
- req.headers["Date"] = []string{time.Now().In(time.UTC).Format(time.RFC1123)}
- if s3.Auth.Token() != "" {
- req.headers["X-Amz-Security-Token"] = []string{s3.Auth.Token()}
- }
- sign(s3.Auth, req.method, reqSignpathSpaceFix, req.params, req.headers)
- return nil
-}
-
-// run sends req and returns the http response from the server.
-// If resp is not nil, the XML data contained in the response
-// body will be unmarshalled on it.
-func (s3 *S3) run(req *request, resp interface{}) (*http.Response, error) {
- if debug {
- log.Printf("Running S3 request: %#v", req)
- }
-
- u, err := req.url()
- if err != nil {
- return nil, err
- }
-
- hreq := http.Request{
- URL: u,
- Method: req.method,
- ProtoMajor: 1,
- ProtoMinor: 1,
- Close: true,
- Header: req.headers,
- }
-
- if v, ok := req.headers["Content-Length"]; ok {
- hreq.ContentLength, _ = strconv.ParseInt(v[0], 10, 64)
- delete(req.headers, "Content-Length")
- if hreq.ContentLength == 0 {
- req.payload = nil
- }
- }
- if req.payload != nil {
- hreq.Body = ioutil.NopCloser(req.payload)
- }
-
- if s3.client == nil {
- s3.client = &http.Client{
- Transport: &http.Transport{
- Dial: func(netw, addr string) (c net.Conn, err error) {
- c, err = net.DialTimeout(netw, addr, s3.ConnectTimeout)
- if err != nil {
- return
- }
-
- var deadline time.Time
- if s3.RequestTimeout > 0 {
- deadline = time.Now().Add(s3.RequestTimeout)
- c.SetDeadline(deadline)
- }
-
- if s3.ReadTimeout > 0 || s3.WriteTimeout > 0 {
- c = &ioTimeoutConn{
- TCPConn: c.(*net.TCPConn),
- readTimeout: s3.ReadTimeout,
- writeTimeout: s3.WriteTimeout,
- requestDeadline: deadline,
- }
- }
- return
- },
- },
- }
- }
-
- hresp, err := s3.client.Do(&hreq)
- if err != nil {
- return nil, err
- }
- if debug {
- dump, _ := httputil.DumpResponse(hresp, true)
- log.Printf("} -> %s\n", dump)
- }
- if hresp.StatusCode != 200 && hresp.StatusCode != 204 && hresp.StatusCode != 206 {
- defer hresp.Body.Close()
- return nil, buildError(hresp)
- }
- if resp != nil {
- err = xml.NewDecoder(hresp.Body).Decode(resp)
- hresp.Body.Close()
- if debug {
- log.Printf("goamz.s3> decoded xml into %#v", resp)
- }
- }
- return hresp, err
-}
-
-// Error represents an error in an operation with S3.
-type Error struct {
- StatusCode int // HTTP status code (200, 403, ...)
- Code string // EC2 error code ("UnsupportedOperation", ...)
- Message string // The human-oriented error message
- BucketName string
- RequestId string
- HostId string
-}
-
-func (e *Error) Error() string {
- return e.Message
-}
-
-func buildError(r *http.Response) error {
- if debug {
- log.Printf("got error (status code %v)", r.StatusCode)
- data, err := ioutil.ReadAll(r.Body)
- if err != nil {
- log.Printf("\tread error: %v", err)
- } else {
- log.Printf("\tdata:\n%s\n\n", data)
- }
- r.Body = ioutil.NopCloser(bytes.NewBuffer(data))
- }
-
- err := Error{}
- // TODO return error if Unmarshal fails?
- xml.NewDecoder(r.Body).Decode(&err)
- r.Body.Close()
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- if debug {
- log.Printf("err: %#v\n", err)
- }
- return &err
-}
-
-func shouldRetry(err error) bool {
- if err == nil {
- return false
- }
- if e, ok := err.(*url.Error); ok {
- // Transport returns this string if it detects a write on a connection which
- // has already had an error
- if e.Err.Error() == "http: can't write HTTP request on broken connection" {
- return true
- }
- err = e.Err
- }
-
- switch err {
- case io.ErrUnexpectedEOF, io.EOF:
- return true
- }
- switch e := err.(type) {
- case *net.DNSError:
- return true
- case *net.OpError:
- switch e.Op {
- case "read", "write", "WSARecv", "WSASend", "ConnectEx":
- return true
- }
- case *Error:
- switch e.Code {
- case "InternalError", "NoSuchUpload", "NoSuchBucket", "RequestTimeout":
- return true
- }
- // let's handle tls handshake timeout issues and similar temporary errors
- case net.Error:
- return e.Temporary()
- }
-
- return false
-}
-
-func hasCode(err error, code string) bool {
- s3err, ok := err.(*Error)
- return ok && s3err.Code == code
-}
-
-// ioTimeoutConn is a net.Conn which sets a deadline for each Read or Write operation
-type ioTimeoutConn struct {
- *net.TCPConn
- readTimeout time.Duration
- writeTimeout time.Duration
- requestDeadline time.Time
-}
-
-func (c *ioTimeoutConn) deadline(timeout time.Duration) time.Time {
- dl := time.Now().Add(timeout)
- if c.requestDeadline.IsZero() || dl.Before(c.requestDeadline) {
- return dl
- }
-
- return c.requestDeadline
-}
-
-func (c *ioTimeoutConn) Read(b []byte) (int, error) {
- if c.readTimeout > 0 {
- err := c.TCPConn.SetReadDeadline(c.deadline(c.readTimeout))
- if err != nil {
- return 0, err
- }
- }
- return c.TCPConn.Read(b)
-}
-
-func (c *ioTimeoutConn) Write(b []byte) (int, error) {
- if c.writeTimeout > 0 {
- err := c.TCPConn.SetWriteDeadline(c.deadline(c.writeTimeout))
- if err != nil {
- return 0, err
- }
- }
- return c.TCPConn.Write(b)
-}
diff --git a/vendor/github.com/goamz/goamz/s3/s3_test.go b/vendor/github.com/goamz/goamz/s3/s3_test.go
deleted file mode 100644
index 24d4dfcc0..000000000
--- a/vendor/github.com/goamz/goamz/s3/s3_test.go
+++ /dev/null
@@ -1,427 +0,0 @@
-package s3_test
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "testing"
- "time"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/s3"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- s3 *s3.S3
-}
-
-var _ = Suite(&S{})
-
-var testServer = testutil.NewHTTPServer()
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.s3 = s3.New(auth, aws.Region{Name: "faux-region-1", S3Endpoint: testServer.URL})
-}
-
-func (s *S) TearDownSuite(c *C) {
- s.s3.AttemptStrategy = s3.DefaultAttemptStrategy
-}
-
-func (s *S) SetUpTest(c *C) {
- s.s3.AttemptStrategy = aws.AttemptStrategy{
- Total: 300 * time.Millisecond,
- Delay: 100 * time.Millisecond,
- }
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) DisableRetries() {
- s.s3.AttemptStrategy = aws.AttemptStrategy{}
-}
-
-// PutBucket docs: http://goo.gl/kBTCu
-
-func (s *S) TestPutBucket(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/bucket/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-}
-
-// Head docs: http://bit.ly/17K1ylI
-
-func (s *S) TestHead(c *C) {
- testServer.Response(200, nil, "content")
-
- b := s.s3.Bucket("bucket")
- resp, err := b.Head("name", nil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "HEAD")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(err, IsNil)
- c.Assert(resp.ContentLength, FitsTypeOf, int64(0))
- c.Assert(resp, FitsTypeOf, &http.Response{})
-}
-
-// DeleteBucket docs: http://goo.gl/GoBrY
-
-func (s *S) TestDelBucket(c *C) {
- testServer.Response(204, nil, "")
-
- b := s.s3.Bucket("bucket")
- err := b.DelBucket()
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "DELETE")
- c.Assert(req.URL.Path, Equals, "/bucket/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-}
-
-// GetObject docs: http://goo.gl/isCO7
-
-func (s *S) TestGet(c *C) {
- testServer.Response(200, nil, "content")
-
- b := s.s3.Bucket("bucket")
- data, err := b.Get("name")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "content")
-}
-
-func (s *S) TestURL(c *C) {
- testServer.Response(200, nil, "content")
-
- b := s.s3.Bucket("bucket")
- url := b.URL("name")
- r, err := http.Get(url)
- c.Assert(err, IsNil)
- data, err := ioutil.ReadAll(r.Body)
- r.Body.Close()
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "content")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
-}
-
-func (s *S) TestGetReader(c *C) {
- testServer.Response(200, nil, "content")
-
- b := s.s3.Bucket("bucket")
- rc, err := b.GetReader("name")
- c.Assert(err, IsNil)
- data, err := ioutil.ReadAll(rc)
- rc.Close()
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "content")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(Equals), "")
-}
-
-func (s *S) TestGetNotFound(c *C) {
- for i := 0; i < 10; i++ {
- testServer.Response(404, nil, GetObjectErrorDump)
- }
-
- b := s.s3.Bucket("non-existent-bucket")
- data, err := b.Get("non-existent")
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/non-existent-bucket/non-existent")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- s3err, _ := err.(*s3.Error)
- c.Assert(s3err, NotNil)
- c.Assert(s3err.StatusCode, Equals, 404)
- c.Assert(s3err.BucketName, Equals, "non-existent-bucket")
- c.Assert(s3err.RequestId, Equals, "3F1B667FAD71C3D8")
- c.Assert(s3err.HostId, Equals, "L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D")
- c.Assert(s3err.Code, Equals, "NoSuchBucket")
- c.Assert(s3err.Message, Equals, "The specified bucket does not exist")
- c.Assert(s3err.Error(), Equals, "The specified bucket does not exist")
- c.Assert(data, IsNil)
-}
-
-// PutObject docs: http://goo.gl/FEBPD
-
-func (s *S) TestPutObject(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- err := b.Put("name", []byte("content"), "content-type", s3.Private, s3.Options{})
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(DeepEquals), []string{""})
- c.Assert(req.Header["Content-Type"], DeepEquals, []string{"content-type"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"7"})
- //c.Assert(req.Header["Content-MD5"], DeepEquals, "...")
- c.Assert(req.Header["X-Amz-Acl"], DeepEquals, []string{"private"})
-}
-
-func (s *S) TestPutObjectReadTimeout(c *C) {
- s.s3.ReadTimeout = 50 * time.Millisecond
- defer func() {
- s.s3.ReadTimeout = 0
- }()
-
- b := s.s3.Bucket("bucket")
- err := b.Put("name", []byte("content"), "content-type", s3.Private, s3.Options{})
-
- // Make sure that we get a timeout error.
- c.Assert(err, NotNil)
-
- // Set the response after the request times out so that the next request will work.
- testServer.Response(200, nil, "")
-
- // This time set the response within our timeout period so that we expect the call
- // to return successfully.
- go func() {
- time.Sleep(25 * time.Millisecond)
- testServer.Response(200, nil, "")
- }()
- err = b.Put("name", []byte("content"), "content-type", s3.Private, s3.Options{})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestPutObjectHeader(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- err := b.PutHeader(
- "name",
- []byte("content"),
- map[string][]string{"Content-Type": {"content-type"}},
- s3.Private,
- )
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(DeepEquals), []string{""})
- c.Assert(req.Header["Content-Type"], DeepEquals, []string{"content-type"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"7"})
- //c.Assert(req.Header["Content-MD5"], DeepEquals, "...")
- c.Assert(req.Header["X-Amz-Acl"], DeepEquals, []string{"private"})
-}
-
-func (s *S) TestPutReader(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- buf := bytes.NewBufferString("content")
- err := b.PutReader("name", buf, int64(buf.Len()), "content-type", s3.Private, s3.Options{})
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(DeepEquals), []string{""})
- c.Assert(req.Header["Content-Type"], DeepEquals, []string{"content-type"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"7"})
- //c.Assert(req.Header["Content-MD5"], Equals, "...")
- c.Assert(req.Header["X-Amz-Acl"], DeepEquals, []string{"private"})
-}
-
-func (s *S) TestPutReaderHeader(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- buf := bytes.NewBufferString("content")
- err := b.PutReaderHeader(
- "name",
- buf,
- int64(buf.Len()),
- map[string][]string{"Content-Type": {"content-type"}},
- s3.Private,
- )
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "PUT")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(DeepEquals), []string{""})
- c.Assert(req.Header["Content-Type"], DeepEquals, []string{"content-type"})
- c.Assert(req.Header["Content-Length"], DeepEquals, []string{"7"})
- //c.Assert(req.Header["Content-MD5"], Equals, "...")
- c.Assert(req.Header["X-Amz-Acl"], DeepEquals, []string{"private"})
-}
-
-// DelObject docs: http://goo.gl/APeTt
-
-func (s *S) TestDelObject(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- err := b.Del("name")
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "DELETE")
- c.Assert(req.URL.Path, Equals, "/bucket/name")
- c.Assert(req.Header["Date"], Not(Equals), "")
-}
-
-func (s *S) TestDelMultiObjects(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- objects := []s3.Object{s3.Object{Key: "test"}}
- err := b.DelMulti(s3.Delete{
- Quiet: false,
- Objects: objects,
- })
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "POST")
- c.Assert(req.URL.RawQuery, Equals, "delete=")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Header["Content-MD5"], Not(Equals), "")
- c.Assert(req.Header["Content-Type"], Not(Equals), "")
- c.Assert(req.ContentLength, Not(Equals), "")
-}
-
-// Bucket List Objects docs: http://goo.gl/YjQTc
-
-func (s *S) TestList(c *C) {
- testServer.Response(200, nil, GetListResultDump1)
-
- b := s.s3.Bucket("quotes")
-
- data, err := b.List("N", "", "", 0)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/quotes/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Form["prefix"], DeepEquals, []string{"N"})
- c.Assert(req.Form["delimiter"], DeepEquals, []string{""})
- c.Assert(req.Form["marker"], DeepEquals, []string{""})
- c.Assert(req.Form["max-keys"], DeepEquals, []string(nil))
-
- c.Assert(data.Name, Equals, "quotes")
- c.Assert(data.Prefix, Equals, "N")
- c.Assert(data.IsTruncated, Equals, false)
- c.Assert(len(data.Contents), Equals, 2)
-
- c.Assert(data.Contents[0].Key, Equals, "Nelson")
- c.Assert(data.Contents[0].LastModified, Equals, "2006-01-01T12:00:00.000Z")
- c.Assert(data.Contents[0].ETag, Equals, `"828ef3fdfa96f00ad9f27c383fc9ac7f"`)
- c.Assert(data.Contents[0].Size, Equals, int64(5))
- c.Assert(data.Contents[0].StorageClass, Equals, "STANDARD")
- c.Assert(data.Contents[0].Owner.ID, Equals, "bcaf161ca5fb16fd081034f")
- c.Assert(data.Contents[0].Owner.DisplayName, Equals, "webfile")
-
- c.Assert(data.Contents[1].Key, Equals, "Neo")
- c.Assert(data.Contents[1].LastModified, Equals, "2006-01-01T12:00:00.000Z")
- c.Assert(data.Contents[1].ETag, Equals, `"828ef3fdfa96f00ad9f27c383fc9ac7f"`)
- c.Assert(data.Contents[1].Size, Equals, int64(4))
- c.Assert(data.Contents[1].StorageClass, Equals, "STANDARD")
- c.Assert(data.Contents[1].Owner.ID, Equals, "bcaf1ffd86a5fb16fd081034f")
- c.Assert(data.Contents[1].Owner.DisplayName, Equals, "webfile")
-}
-
-func (s *S) TestListWithDelimiter(c *C) {
- testServer.Response(200, nil, GetListResultDump2)
-
- b := s.s3.Bucket("quotes")
-
- data, err := b.List("photos/2006/", "/", "some-marker", 1000)
- c.Assert(err, IsNil)
-
- req := testServer.WaitRequest()
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/quotes/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- c.Assert(req.Form["prefix"], DeepEquals, []string{"photos/2006/"})
- c.Assert(req.Form["delimiter"], DeepEquals, []string{"/"})
- c.Assert(req.Form["marker"], DeepEquals, []string{"some-marker"})
- c.Assert(req.Form["max-keys"], DeepEquals, []string{"1000"})
-
- c.Assert(data.Name, Equals, "example-bucket")
- c.Assert(data.Prefix, Equals, "photos/2006/")
- c.Assert(data.Delimiter, Equals, "/")
- c.Assert(data.Marker, Equals, "some-marker")
- c.Assert(data.IsTruncated, Equals, false)
- c.Assert(len(data.Contents), Equals, 0)
- c.Assert(data.CommonPrefixes, DeepEquals, []string{"photos/2006/feb/", "photos/2006/jan/"})
-}
-
-func (s *S) TestExists(c *C) {
- testServer.Response(200, nil, "")
-
- b := s.s3.Bucket("bucket")
- result, err := b.Exists("name")
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "HEAD")
-
- c.Assert(err, IsNil)
- c.Assert(result, Equals, true)
-}
-
-func (s *S) TestExistsNotFound404(c *C) {
- testServer.Response(404, nil, "")
-
- b := s.s3.Bucket("bucket")
- result, err := b.Exists("name")
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "HEAD")
-
- c.Assert(err, IsNil)
- c.Assert(result, Equals, false)
-}
-
-func (s *S) TestExistsNotFound403(c *C) {
- testServer.Response(403, nil, "")
-
- b := s.s3.Bucket("bucket")
- result, err := b.Exists("name")
-
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "HEAD")
-
- c.Assert(err, IsNil)
- c.Assert(result, Equals, false)
-}
diff --git a/vendor/github.com/goamz/goamz/s3/s3i_test.go b/vendor/github.com/goamz/goamz/s3/s3i_test.go
deleted file mode 100644
index 1b898efc4..000000000
--- a/vendor/github.com/goamz/goamz/s3/s3i_test.go
+++ /dev/null
@@ -1,590 +0,0 @@
-package s3_test
-
-import (
- "bytes"
- "crypto/md5"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
- "sort"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/s3"
- "github.com/goamz/goamz/testutil"
- . "gopkg.in/check.v1"
-)
-
-// AmazonServer represents an Amazon S3 server.
-type AmazonServer struct {
- auth aws.Auth
-}
-
-func (s *AmazonServer) SetUp(c *C) {
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err.Error())
- }
- s.auth = auth
-}
-
-var _ = Suite(&AmazonClientSuite{Region: aws.USEast})
-var _ = Suite(&AmazonClientSuite{Region: aws.EUWest})
-var _ = Suite(&AmazonDomainClientSuite{Region: aws.USEast})
-
-// AmazonClientSuite tests the client against a live S3 server.
-type AmazonClientSuite struct {
- aws.Region
- srv AmazonServer
- ClientTests
-}
-
-func (s *AmazonClientSuite) SetUpSuite(c *C) {
- if !testutil.Amazon {
- c.Skip("live tests against AWS disabled (no -amazon)")
- }
- s.srv.SetUp(c)
- s.s3 = s3.New(s.srv.auth, s.Region)
- // In case tests were interrupted in the middle before.
- s.ClientTests.Cleanup()
-}
-
-func (s *AmazonClientSuite) TearDownTest(c *C) {
- s.ClientTests.Cleanup()
-}
-
-// AmazonDomainClientSuite tests the client against a live S3
-// server using bucket names in the endpoint domain name rather
-// than the request path.
-type AmazonDomainClientSuite struct {
- aws.Region
- srv AmazonServer
- ClientTests
-}
-
-func (s *AmazonDomainClientSuite) SetUpSuite(c *C) {
- if !testutil.Amazon {
- c.Skip("live tests against AWS disabled (no -amazon)")
- }
- s.srv.SetUp(c)
- region := s.Region
- region.S3BucketEndpoint = "https://${bucket}.s3.amazonaws.com"
- s.s3 = s3.New(s.srv.auth, region)
- s.ClientTests.Cleanup()
-}
-
-func (s *AmazonDomainClientSuite) TearDownTest(c *C) {
- s.ClientTests.Cleanup()
-}
-
-// ClientTests defines integration tests designed to test the client.
-// It is not used as a test suite in itself, but embedded within
-// another type.
-type ClientTests struct {
- s3 *s3.S3
- authIsBroken bool
-}
-
-func (s *ClientTests) Cleanup() {
- killBucket(testBucket(s.s3))
-}
-
-func testBucket(s *s3.S3) *s3.Bucket {
- // Watch out! If this function is corrupted and made to match with something
- // people own, killBucket will happily remove *everything* inside the bucket.
- key := s.Auth.AccessKey
- if len(key) >= 8 {
- key = s.Auth.AccessKey[:8]
- }
- return s.Bucket(fmt.Sprintf("goamz-%s-%s", s.Region.Name, key))
-}
-
-var attempts = aws.AttemptStrategy{
- Min: 5,
- Total: 20 * time.Second,
- Delay: 100 * time.Millisecond,
-}
-
-func killBucket(b *s3.Bucket) {
- var err error
- for attempt := attempts.Start(); attempt.Next(); {
- err = b.DelBucket()
- if err == nil {
- return
- }
- if _, ok := err.(*net.DNSError); ok {
- return
- }
- e, ok := err.(*s3.Error)
- if ok && e.Code == "NoSuchBucket" {
- return
- }
- if ok && e.Code == "BucketNotEmpty" {
- // Errors are ignored here. Just retry.
- resp, err := b.List("", "", "", 1000)
- if err == nil {
- for _, key := range resp.Contents {
- _ = b.Del(key.Key)
- }
- }
- multis, _, _ := b.ListMulti("", "")
- for _, m := range multis {
- _ = m.Abort()
- }
- }
- }
- message := "cannot delete test bucket"
- if err != nil {
- message += ": " + err.Error()
- }
- panic(message)
-}
-
-func get(url string) ([]byte, error) {
- for attempt := attempts.Start(); attempt.Next(); {
- resp, err := http.Get(url)
- if err != nil {
- if attempt.HasNext() {
- continue
- }
- return nil, err
- }
- data, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- if attempt.HasNext() {
- continue
- }
- return nil, err
- }
- return data, err
- }
- panic("unreachable")
-}
-
-func (s *ClientTests) TestBasicFunctionality(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.PublicRead)
- c.Assert(err, IsNil)
-
- err = b.Put("name", []byte("yo!"), "text/plain", s3.PublicRead, s3.Options{})
- c.Assert(err, IsNil)
- defer b.Del("name")
-
- data, err := b.Get("name")
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "yo!")
-
- data, err = get(b.URL("name"))
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "yo!")
-
- buf := bytes.NewBufferString("hey!")
- err = b.PutReader("name2", buf, int64(buf.Len()), "text/plain", s3.Private, s3.Options{})
- c.Assert(err, IsNil)
- defer b.Del("name2")
-
- rc, err := b.GetReader("name2")
- c.Assert(err, IsNil)
- data, err = ioutil.ReadAll(rc)
- c.Check(err, IsNil)
- c.Check(string(data), Equals, "hey!")
- rc.Close()
-
- data, err = get(b.SignedURL("name2", time.Now().Add(time.Hour)))
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, "hey!")
-
- if !s.authIsBroken {
- data, err = get(b.SignedURL("name2", time.Now().Add(-time.Hour)))
- c.Assert(err, IsNil)
- c.Assert(string(data), Matches, "(?s).*AccessDenied.*")
- }
-
- err = b.DelBucket()
- c.Assert(err, NotNil)
-
- s3err, ok := err.(*s3.Error)
- c.Assert(ok, Equals, true)
- c.Assert(s3err.Code, Equals, "BucketNotEmpty")
- c.Assert(s3err.BucketName, Equals, b.Name)
- c.Assert(s3err.Message, Equals, "The bucket you tried to delete is not empty")
-
- err = b.Del("name")
- c.Assert(err, IsNil)
- err = b.Del("name2")
- c.Assert(err, IsNil)
-
- err = b.DelBucket()
- c.Assert(err, IsNil)
-}
-
-func (s *ClientTests) TestGetNotFound(c *C) {
- b := s.s3.Bucket("goamz-" + s.s3.Auth.AccessKey)
- data, err := b.Get("non-existent")
-
- s3err, _ := err.(*s3.Error)
- c.Assert(s3err, NotNil)
- c.Assert(s3err.StatusCode, Equals, 404)
- c.Assert(s3err.Code, Equals, "NoSuchBucket")
- c.Assert(s3err.Message, Equals, "The specified bucket does not exist")
- c.Assert(data, IsNil)
-}
-
-// Communicate with all endpoints to see if they are alive.
-func (s *ClientTests) TestRegions(c *C) {
- errs := make(chan error, len(aws.Regions))
- for _, region := range aws.Regions {
- go func(r aws.Region) {
- s := s3.New(s.s3.Auth, r)
- b := s.Bucket("goamz-" + s.Auth.AccessKey)
- _, err := b.Get("non-existent")
- errs <- err
- }(region)
- }
- for _ = range aws.Regions {
- err := <-errs
- if err != nil {
- s3_err, ok := err.(*s3.Error)
- if ok {
- c.Check(s3_err.Code, Matches, "NoSuchBucket")
- } else if _, ok = err.(*net.DNSError); ok {
- // Okay as well.
- } else {
- c.Errorf("Non-S3 error: %s", err)
- }
- } else {
- c.Errorf("Test should have errored but it seems to have succeeded")
- }
- }
-}
-
-var objectNames = []string{
- "index.html",
- "index2.html",
- "photos/2006/February/sample2.jpg",
- "photos/2006/February/sample3.jpg",
- "photos/2006/February/sample4.jpg",
- "photos/2006/January/sample.jpg",
- "test/bar",
- "test/foo",
-}
-
-func keys(names ...string) []s3.Key {
- ks := make([]s3.Key, len(names))
- for i, name := range names {
- ks[i].Key = name
- }
- return ks
-}
-
-// As the ListResp specifies all the parameters to the
-// request too, we use it to specify request parameters
-// and expected results. The Contents field is
-// used only for the key names inside it.
-var listTests = []s3.ListResp{
- // normal list.
- {
- Contents: keys(objectNames...),
- }, {
- Marker: objectNames[0],
- Contents: keys(objectNames[1:]...),
- }, {
- Marker: objectNames[0] + "a",
- Contents: keys(objectNames[1:]...),
- }, {
- Marker: "z",
- },
-
- // limited results.
- {
- MaxKeys: 2,
- Contents: keys(objectNames[0:2]...),
- IsTruncated: true,
- }, {
- MaxKeys: 2,
- Marker: objectNames[0],
- Contents: keys(objectNames[1:3]...),
- IsTruncated: true,
- }, {
- MaxKeys: 2,
- Marker: objectNames[len(objectNames)-2],
- Contents: keys(objectNames[len(objectNames)-1:]...),
- },
-
- // with delimiter
- {
- Delimiter: "/",
- CommonPrefixes: []string{"photos/", "test/"},
- Contents: keys("index.html", "index2.html"),
- }, {
- Delimiter: "/",
- Prefix: "photos/2006/",
- CommonPrefixes: []string{"photos/2006/February/", "photos/2006/January/"},
- }, {
- Delimiter: "/",
- Prefix: "t",
- CommonPrefixes: []string{"test/"},
- }, {
- Delimiter: "/",
- MaxKeys: 1,
- Contents: keys("index.html"),
- IsTruncated: true,
- }, {
- Delimiter: "/",
- MaxKeys: 1,
- Marker: "index2.html",
- CommonPrefixes: []string{"photos/"},
- IsTruncated: true,
- }, {
- Delimiter: "/",
- MaxKeys: 1,
- Marker: "photos/",
- CommonPrefixes: []string{"test/"},
- IsTruncated: false,
- }, {
- Delimiter: "Feb",
- CommonPrefixes: []string{"photos/2006/Feb"},
- Contents: keys("index.html", "index2.html", "photos/2006/January/sample.jpg", "test/bar", "test/foo"),
- },
-}
-
-func (s *ClientTests) TestDoublePutBucket(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.PublicRead)
- c.Assert(err, IsNil)
-
- err = b.PutBucket(s3.PublicRead)
- if err != nil {
- c.Assert(err, FitsTypeOf, new(s3.Error))
- c.Assert(err.(*s3.Error).Code, Equals, "BucketAlreadyOwnedByYou")
- }
-}
-
-func (s *ClientTests) TestBucketList(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- objData := make(map[string][]byte)
- for i, path := range objectNames {
- data := []byte(strings.Repeat("a", i))
- err := b.Put(path, data, "text/plain", s3.Private, s3.Options{})
- c.Assert(err, IsNil)
- defer b.Del(path)
- objData[path] = data
- }
-
- for i, t := range listTests {
- c.Logf("test %d", i)
- resp, err := b.List(t.Prefix, t.Delimiter, t.Marker, t.MaxKeys)
- c.Assert(err, IsNil)
- c.Check(resp.Name, Equals, b.Name)
- c.Check(resp.Delimiter, Equals, t.Delimiter)
- c.Check(resp.IsTruncated, Equals, t.IsTruncated)
- c.Check(resp.CommonPrefixes, DeepEquals, t.CommonPrefixes)
- checkContents(c, resp.Contents, objData, t.Contents)
- }
-}
-
-func etag(data []byte) string {
- sum := md5.New()
- sum.Write(data)
- return fmt.Sprintf(`"%x"`, sum.Sum(nil))
-}
-
-func checkContents(c *C, contents []s3.Key, data map[string][]byte, expected []s3.Key) {
- c.Assert(contents, HasLen, len(expected))
- for i, k := range contents {
- c.Check(k.Key, Equals, expected[i].Key)
- // TODO mtime
- c.Check(k.Size, Equals, int64(len(data[k.Key])))
- c.Check(k.ETag, Equals, etag(data[k.Key]))
- }
-}
-
-func (s *ClientTests) TestMultiInitPutList(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
- c.Assert(multi.UploadId, Matches, ".+")
- defer multi.Abort()
-
- var sent []s3.Part
-
- for i := 0; i < 5; i++ {
- p, err := multi.PutPart(i+1, strings.NewReader(fmt.Sprintf("<part %d>", i+1)))
- c.Assert(err, IsNil)
- c.Assert(p.N, Equals, i+1)
- c.Assert(p.Size, Equals, int64(8))
- c.Assert(p.ETag, Matches, ".+")
- sent = append(sent, p)
- }
-
- s3.SetListPartsMax(2)
-
- parts, err := multi.ListParts()
- c.Assert(err, IsNil)
- c.Assert(parts, HasLen, len(sent))
- for i := range parts {
- c.Assert(parts[i].N, Equals, sent[i].N)
- c.Assert(parts[i].Size, Equals, sent[i].Size)
- c.Assert(parts[i].ETag, Equals, sent[i].ETag)
- }
-
- err = multi.Complete(parts)
- s3err, failed := err.(*s3.Error)
- c.Assert(failed, Equals, true)
- c.Assert(s3err.Code, Equals, "EntityTooSmall")
-
- err = multi.Abort()
- c.Assert(err, IsNil)
- _, err = multi.ListParts()
- s3err, ok := err.(*s3.Error)
- c.Assert(ok, Equals, true)
- c.Assert(s3err.Code, Equals, "NoSuchUpload")
-}
-
-// This may take a minute or more due to the minimum size accepted S3
-// on multipart upload parts.
-func (s *ClientTests) TestMultiComplete(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
- c.Assert(multi.UploadId, Matches, ".+")
- defer multi.Abort()
-
- // Minimum size S3 accepts for all but the last part is 5MB.
- data1 := make([]byte, 5*1024*1024)
- data2 := []byte("<part 2>")
-
- part1, err := multi.PutPart(1, bytes.NewReader(data1))
- c.Assert(err, IsNil)
- part2, err := multi.PutPart(2, bytes.NewReader(data2))
- c.Assert(err, IsNil)
-
- // Purposefully reversed. The order requirement must be handled.
- err = multi.Complete([]s3.Part{part2, part1})
- c.Assert(err, IsNil)
-
- data, err := b.Get("multi")
- c.Assert(err, IsNil)
-
- c.Assert(len(data), Equals, len(data1)+len(data2))
- for i := range data1 {
- if data[i] != data1[i] {
- c.Fatalf("uploaded object at byte %d: want %d, got %d", data1[i], data[i])
- }
- }
- c.Assert(string(data[len(data1):]), Equals, string(data2))
-}
-
-type multiList []*s3.Multi
-
-func (l multiList) Len() int { return len(l) }
-func (l multiList) Less(i, j int) bool { return l[i].Key < l[j].Key }
-func (l multiList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
-
-func (s *ClientTests) TestListMulti(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- // Ensure an empty state before testing its behavior.
- multis, _, err := b.ListMulti("", "")
- for _, m := range multis {
- err := m.Abort()
- c.Assert(err, IsNil)
- }
-
- keys := []string{
- "a/multi2",
- "a/multi3",
- "b/multi4",
- "multi1",
- }
- for _, key := range keys {
- m, err := b.InitMulti(key, "", s3.Private)
- c.Assert(err, IsNil)
- defer m.Abort()
- }
-
- // Amazon's implementation of the multiple-request listing for
- // multipart uploads in progress seems broken in multiple ways.
- // (next tokens are not provided, etc).
- //s3.SetListMultiMax(2)
-
- multis, prefixes, err := b.ListMulti("", "")
- c.Assert(err, IsNil)
- for attempt := attempts.Start(); attempt.Next() && len(multis) < len(keys); {
- multis, prefixes, err = b.ListMulti("", "")
- c.Assert(err, IsNil)
- }
- sort.Sort(multiList(multis))
- c.Assert(prefixes, IsNil)
- var gotKeys []string
- for _, m := range multis {
- gotKeys = append(gotKeys, m.Key)
- }
- c.Assert(gotKeys, DeepEquals, keys)
- for _, m := range multis {
- c.Assert(m.Bucket, Equals, b)
- c.Assert(m.UploadId, Matches, ".+")
- }
-
- multis, prefixes, err = b.ListMulti("", "/")
- for attempt := attempts.Start(); attempt.Next() && len(prefixes) < 2; {
- multis, prefixes, err = b.ListMulti("", "")
- c.Assert(err, IsNil)
- }
- c.Assert(err, IsNil)
- c.Assert(prefixes, DeepEquals, []string{"a/", "b/"})
- c.Assert(multis, HasLen, 1)
- c.Assert(multis[0].Bucket, Equals, b)
- c.Assert(multis[0].Key, Equals, "multi1")
- c.Assert(multis[0].UploadId, Matches, ".+")
-
- for attempt := attempts.Start(); attempt.Next() && len(multis) < 2; {
- multis, prefixes, err = b.ListMulti("", "")
- c.Assert(err, IsNil)
- }
- multis, prefixes, err = b.ListMulti("a/", "/")
- c.Assert(err, IsNil)
- c.Assert(prefixes, IsNil)
- c.Assert(multis, HasLen, 2)
- c.Assert(multis[0].Bucket, Equals, b)
- c.Assert(multis[0].Key, Equals, "a/multi2")
- c.Assert(multis[0].UploadId, Matches, ".+")
- c.Assert(multis[1].Bucket, Equals, b)
- c.Assert(multis[1].Key, Equals, "a/multi3")
- c.Assert(multis[1].UploadId, Matches, ".+")
-}
-
-func (s *ClientTests) TestMultiPutAllZeroLength(c *C) {
- b := testBucket(s.s3)
- err := b.PutBucket(s3.Private)
- c.Assert(err, IsNil)
-
- multi, err := b.InitMulti("multi", "text/plain", s3.Private)
- c.Assert(err, IsNil)
- defer multi.Abort()
-
- // This tests an edge case. Amazon requires at least one
- // part for multiprat uploads to work, even the part is empty.
- parts, err := multi.PutAll(strings.NewReader(""), 5*1024*1024)
- c.Assert(err, IsNil)
- c.Assert(parts, HasLen, 1)
- c.Assert(parts[0].Size, Equals, int64(0))
- c.Assert(parts[0].ETag, Equals, `"d41d8cd98f00b204e9800998ecf8427e"`)
-
- err = multi.Complete(parts)
- c.Assert(err, IsNil)
-}
diff --git a/vendor/github.com/goamz/goamz/s3/s3t_test.go b/vendor/github.com/goamz/goamz/s3/s3t_test.go
deleted file mode 100644
index 4e6f61fdb..000000000
--- a/vendor/github.com/goamz/goamz/s3/s3t_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package s3_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/s3"
- "github.com/goamz/goamz/s3/s3test"
- . "gopkg.in/check.v1"
-)
-
-type LocalServer struct {
- auth aws.Auth
- region aws.Region
- srv *s3test.Server
- config *s3test.Config
-}
-
-func (s *LocalServer) SetUp(c *C) {
- srv, err := s3test.NewServer(s.config)
- c.Assert(err, IsNil)
- c.Assert(srv, NotNil)
-
- s.srv = srv
- s.region = aws.Region{
- Name: "faux-region-1",
- S3Endpoint: srv.URL(),
- S3LocationConstraint: true, // s3test server requires a LocationConstraint
- }
-}
-
-// LocalServerSuite defines tests that will run
-// against the local s3test server. It includes
-// selected tests from ClientTests;
-// when the s3test functionality is sufficient, it should
-// include all of them, and ClientTests can be simply embedded.
-type LocalServerSuite struct {
- srv LocalServer
- clientTests ClientTests
-}
-
-var (
- // run tests twice, once in us-east-1 mode, once not.
- _ = Suite(&LocalServerSuite{
- srv: LocalServer{
- config: &s3test.Config{},
- },
- })
- _ = Suite(&LocalServerSuite{
- srv: LocalServer{
- config: &s3test.Config{
- Send409Conflict: true,
- },
- },
- })
-)
-
-func (s *LocalServerSuite) SetUpSuite(c *C) {
- s.srv.SetUp(c)
- s.clientTests.s3 = s3.New(s.srv.auth, s.srv.region)
-
- // TODO Sadly the fake server ignores auth completely right now. :-(
- s.clientTests.authIsBroken = true
- s.clientTests.Cleanup()
-}
-
-func (s *LocalServerSuite) TearDownTest(c *C) {
- s.clientTests.Cleanup()
-}
-
-func (s *LocalServerSuite) TestBasicFunctionality(c *C) {
- s.clientTests.TestBasicFunctionality(c)
-}
-
-func (s *LocalServerSuite) TestGetNotFound(c *C) {
- s.clientTests.TestGetNotFound(c)
-}
-
-func (s *LocalServerSuite) TestBucketList(c *C) {
- s.clientTests.TestBucketList(c)
-}
-
-func (s *LocalServerSuite) TestDoublePutBucket(c *C) {
- s.clientTests.TestDoublePutBucket(c)
-}
diff --git a/vendor/github.com/goamz/goamz/s3/s3test/server.go b/vendor/github.com/goamz/goamz/s3/s3test/server.go
deleted file mode 100644
index 04808d3ad..000000000
--- a/vendor/github.com/goamz/goamz/s3/s3test/server.go
+++ /dev/null
@@ -1,642 +0,0 @@
-package s3test
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/base64"
- "encoding/hex"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "net/url"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/goamz/goamz/s3"
-)
-
-const debug = false
-
-type s3Error struct {
- statusCode int
- XMLName struct{} `xml:"Error"`
- Code string
- Message string
- BucketName string
- RequestId string
- HostId string
-}
-
-type action struct {
- srv *Server
- w http.ResponseWriter
- req *http.Request
- reqId string
-}
-
-// Config controls the internal behaviour of the Server. A nil config is the default
-// and behaves as if all configurations assume their default behaviour. Once passed
-// to NewServer, the configuration must not be modified.
-type Config struct {
- // Send409Conflict controls how the Server will respond to calls to PUT on a
- // previously existing bucket. The default is false, and corresponds to the
- // us-east-1 s3 enpoint. Setting this value to true emulates the behaviour of
- // all other regions.
- // http://docs.amazonwebservices.com/AmazonS3/latest/API/ErrorResponses.html
- Send409Conflict bool
- // Set the host string on which to serve s3test server.
- Host string
-}
-
-func (c *Config) send409Conflict() bool {
- if c != nil {
- return c.Send409Conflict
- }
- return false
-}
-
-// Server is a fake S3 server for testing purposes.
-// All of the data for the server is kept in memory.
-type Server struct {
- url string
- reqId int
- listener net.Listener
- mu sync.Mutex
- buckets map[string]*bucket
- config *Config
-}
-
-type bucket struct {
- name string
- acl s3.ACL
- ctime time.Time
- objects map[string]*object
-}
-
-type object struct {
- name string
- mtime time.Time
- meta http.Header // metadata to return with requests.
- checksum []byte // also held as Content-MD5 in meta.
- data []byte
-}
-
-// A resource encapsulates the subject of an HTTP request.
-// The resource referred to may or may not exist
-// when the request is made.
-type resource interface {
- put(a *action) interface{}
- get(a *action) interface{}
- post(a *action) interface{}
- delete(a *action) interface{}
-}
-
-func NewServer(config *Config) (*Server, error) {
- if config.Host == "" {
- config.Host = "localhost:0"
- }
-
- l, err := net.Listen("tcp", config.Host)
- if err != nil {
- return nil, fmt.Errorf("cannot listen on localhost: %v", err)
- }
- srv := &Server{
- listener: l,
- url: "http://" + l.Addr().String(),
- buckets: make(map[string]*bucket),
- config: config,
- }
- go http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- srv.serveHTTP(w, req)
- }))
- return srv, nil
-}
-
-// Quit closes down the server.
-func (srv *Server) Quit() {
- srv.listener.Close()
-}
-
-// URL returns a URL for the server.
-func (srv *Server) URL() string {
- return srv.url
-}
-
-func fatalf(code int, codeStr string, errf string, a ...interface{}) {
- panic(&s3Error{
- statusCode: code,
- Code: codeStr,
- Message: fmt.Sprintf(errf, a...),
- })
-}
-
-// serveHTTP serves the S3 protocol.
-func (srv *Server) serveHTTP(w http.ResponseWriter, req *http.Request) {
- // ignore error from ParseForm as it's usually spurious.
- req.ParseForm()
-
- srv.mu.Lock()
- defer srv.mu.Unlock()
-
- if debug {
- log.Printf("s3test %q %q", req.Method, req.URL)
- }
- a := &action{
- srv: srv,
- w: w,
- req: req,
- reqId: fmt.Sprintf("%09X", srv.reqId),
- }
- srv.reqId++
-
- var r resource
- defer func() {
- switch err := recover().(type) {
- case *s3Error:
- switch r := r.(type) {
- case objectResource:
- err.BucketName = r.bucket.name
- case bucketResource:
- err.BucketName = r.name
- }
- err.RequestId = a.reqId
- // TODO HostId
- w.Header().Set("Content-Type", `xml version="1.0" encoding="UTF-8"`)
- w.WriteHeader(err.statusCode)
- xmlMarshal(w, err)
- case nil:
- default:
- panic(err)
- }
- }()
-
- r = srv.resourceForURL(req.URL)
-
- var resp interface{}
- switch req.Method {
- case "PUT":
- resp = r.put(a)
- case "GET", "HEAD":
- resp = r.get(a)
- case "DELETE":
- resp = r.delete(a)
- case "POST":
- resp = r.post(a)
- default:
- fatalf(400, "MethodNotAllowed", "unknown http request method %q", req.Method)
- }
- if resp != nil && req.Method != "HEAD" {
- xmlMarshal(w, resp)
- }
-}
-
-// xmlMarshal is the same as xml.Marshal except that
-// it panics on error. The marshalling should not fail,
-// but we want to know if it does.
-func xmlMarshal(w io.Writer, x interface{}) {
- if err := xml.NewEncoder(w).Encode(x); err != nil {
- panic(fmt.Errorf("error marshalling %#v: %v", x, err))
- }
-}
-
-// In a fully implemented test server, each of these would have
-// its own resource type.
-var unimplementedBucketResourceNames = map[string]bool{
- "acl": true,
- "lifecycle": true,
- "policy": true,
- "location": true,
- "logging": true,
- "notification": true,
- "versions": true,
- "requestPayment": true,
- "versioning": true,
- "website": true,
- "uploads": true,
-}
-
-var unimplementedObjectResourceNames = map[string]bool{
- "uploadId": true,
- "acl": true,
- "torrent": true,
- "uploads": true,
-}
-
-var pathRegexp = regexp.MustCompile("/(([^/]+)(/(.*))?)?")
-
-// resourceForURL returns a resource object for the given URL.
-func (srv *Server) resourceForURL(u *url.URL) (r resource) {
- m := pathRegexp.FindStringSubmatch(u.Path)
- if m == nil {
- fatalf(404, "InvalidURI", "Couldn't parse the specified URI")
- }
- bucketName := m[2]
- objectName := m[4]
- if bucketName == "" {
- return nullResource{} // root
- }
- b := bucketResource{
- name: bucketName,
- bucket: srv.buckets[bucketName],
- }
- q := u.Query()
- if objectName == "" {
- for name := range q {
- if unimplementedBucketResourceNames[name] {
- return nullResource{}
- }
- }
- return b
-
- }
- if b.bucket == nil {
- fatalf(404, "NoSuchBucket", "The specified bucket does not exist")
- }
- objr := objectResource{
- name: objectName,
- version: q.Get("versionId"),
- bucket: b.bucket,
- }
- for name := range q {
- if unimplementedObjectResourceNames[name] {
- return nullResource{}
- }
- }
- if obj := objr.bucket.objects[objr.name]; obj != nil {
- objr.object = obj
- }
- return objr
-}
-
-// nullResource has error stubs for all resource methods.
-type nullResource struct{}
-
-func notAllowed() interface{} {
- fatalf(400, "MethodNotAllowed", "The specified method is not allowed against this resource")
- return nil
-}
-
-func (nullResource) put(a *action) interface{} { return notAllowed() }
-func (nullResource) get(a *action) interface{} { return notAllowed() }
-func (nullResource) post(a *action) interface{} { return notAllowed() }
-func (nullResource) delete(a *action) interface{} { return notAllowed() }
-
-const timeFormat = "2006-01-02T15:04:05.000Z07:00"
-
-type bucketResource struct {
- name string
- bucket *bucket // non-nil if the bucket already exists.
-}
-
-// GET on a bucket lists the objects in the bucket.
-// http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html
-func (r bucketResource) get(a *action) interface{} {
- if r.bucket == nil {
- fatalf(404, "NoSuchBucket", "The specified bucket does not exist")
- }
- delimiter := a.req.Form.Get("delimiter")
- marker := a.req.Form.Get("marker")
- maxKeys := -1
- if s := a.req.Form.Get("max-keys"); s != "" {
- i, err := strconv.Atoi(s)
- if err != nil || i < 0 {
- fatalf(400, "invalid value for max-keys: %q", s)
- }
- maxKeys = i
- }
- prefix := a.req.Form.Get("prefix")
- a.w.Header().Set("Content-Type", "application/xml")
-
- if a.req.Method == "HEAD" {
- return nil
- }
-
- var objs orderedObjects
-
- // first get all matching objects and arrange them in alphabetical order.
- for name, obj := range r.bucket.objects {
- if strings.HasPrefix(name, prefix) {
- objs = append(objs, obj)
- }
- }
- sort.Sort(objs)
-
- if maxKeys <= 0 {
- maxKeys = 1000
- }
- resp := &s3.ListResp{
- Name: r.bucket.name,
- Prefix: prefix,
- Delimiter: delimiter,
- Marker: marker,
- MaxKeys: maxKeys,
- }
-
- var prefixes []string
- for _, obj := range objs {
- if !strings.HasPrefix(obj.name, prefix) {
- continue
- }
- name := obj.name
- isPrefix := false
- if delimiter != "" {
- if i := strings.Index(obj.name[len(prefix):], delimiter); i >= 0 {
- name = obj.name[:len(prefix)+i+len(delimiter)]
- if prefixes != nil && prefixes[len(prefixes)-1] == name {
- continue
- }
- isPrefix = true
- }
- }
- if name <= marker {
- continue
- }
- if len(resp.Contents)+len(prefixes) >= maxKeys {
- resp.IsTruncated = true
- break
- }
- if isPrefix {
- prefixes = append(prefixes, name)
- } else {
- // Contents contains only keys not found in CommonPrefixes
- resp.Contents = append(resp.Contents, obj.s3Key())
- }
- }
- resp.CommonPrefixes = prefixes
- return resp
-}
-
-// orderedObjects holds a slice of objects that can be sorted
-// by name.
-type orderedObjects []*object
-
-func (s orderedObjects) Len() int {
- return len(s)
-}
-func (s orderedObjects) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-func (s orderedObjects) Less(i, j int) bool {
- return s[i].name < s[j].name
-}
-
-func (obj *object) s3Key() s3.Key {
- return s3.Key{
- Key: obj.name,
- LastModified: obj.mtime.Format(timeFormat),
- Size: int64(len(obj.data)),
- ETag: fmt.Sprintf(`"%x"`, obj.checksum),
- // TODO StorageClass
- // TODO Owner
- }
-}
-
-// DELETE on a bucket deletes the bucket if it's not empty.
-func (r bucketResource) delete(a *action) interface{} {
- b := r.bucket
- if b == nil {
- fatalf(404, "NoSuchBucket", "The specified bucket does not exist")
- }
- if len(b.objects) > 0 {
- fatalf(400, "BucketNotEmpty", "The bucket you tried to delete is not empty")
- }
- delete(a.srv.buckets, b.name)
- return nil
-}
-
-// PUT on a bucket creates the bucket.
-// http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
-func (r bucketResource) put(a *action) interface{} {
- var created bool
- if r.bucket == nil {
- if !validBucketName(r.name) {
- fatalf(400, "InvalidBucketName", "The specified bucket is not valid")
- }
- if loc := locationConstraint(a); loc == "" {
- fatalf(400, "InvalidRequets", "The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.")
- }
- // TODO validate acl
- r.bucket = &bucket{
- name: r.name,
- // TODO default acl
- objects: make(map[string]*object),
- }
- a.srv.buckets[r.name] = r.bucket
- created = true
- }
- if !created && a.srv.config.send409Conflict() {
- fatalf(409, "BucketAlreadyOwnedByYou", "Your previous request to create the named bucket succeeded and you already own it.")
- }
- r.bucket.acl = s3.ACL(a.req.Header.Get("x-amz-acl"))
- return nil
-}
-
-func (bucketResource) post(a *action) interface{} {
- fatalf(400, "Method", "bucket POST method not available")
- return nil
-}
-
-// validBucketName returns whether name is a valid bucket name.
-// Here are the rules, from:
-// http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/BucketRestrictions.html
-//
-// Can contain lowercase letters, numbers, periods (.), underscores (_),
-// and dashes (-). You can use uppercase letters for buckets only in the
-// US Standard region.
-//
-// Must start with a number or letter
-//
-// Must be between 3 and 255 characters long
-//
-// There's one extra rule (Must not be formatted as an IP address (e.g., 192.168.5.4)
-// but the real S3 server does not seem to check that rule, so we will not
-// check it either.
-//
-func validBucketName(name string) bool {
- if len(name) < 3 || len(name) > 255 {
- return false
- }
- r := name[0]
- if !(r >= '0' && r <= '9' || r >= 'a' && r <= 'z') {
- return false
- }
- for _, r := range name {
- switch {
- case r >= '0' && r <= '9':
- case r >= 'a' && r <= 'z':
- case r == '_' || r == '-':
- case r == '.':
- default:
- return false
- }
- }
- return true
-}
-
-var responseParams = map[string]bool{
- "content-type": true,
- "content-language": true,
- "expires": true,
- "cache-control": true,
- "content-disposition": true,
- "content-encoding": true,
-}
-
-type objectResource struct {
- name string
- version string
- bucket *bucket // always non-nil.
- object *object // may be nil.
-}
-
-const awsTimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT"
-
-// GET on an object gets the contents of the object.
-// http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGET.html
-func (objr objectResource) get(a *action) interface{} {
- obj := objr.object
- if obj == nil {
- fatalf(404, "NoSuchKey", "The specified key does not exist.")
- }
- h := a.w.Header()
- // add metadata
- for name, d := range obj.meta {
- h[name] = d
- }
- // override header values in response to request parameters.
- for name, vals := range a.req.Form {
- if strings.HasPrefix(name, "response-") {
- name = name[len("response-"):]
- if !responseParams[name] {
- continue
- }
- h.Set(name, vals[0])
- }
- }
- if r := a.req.Header.Get("Range"); r != "" {
- fatalf(400, "NotImplemented", "range unimplemented")
- }
- // TODO Last-Modified-Since
- // TODO If-Modified-Since
- // TODO If-Unmodified-Since
- // TODO If-Match
- // TODO If-None-Match
- // TODO Connection: close ??
- // TODO x-amz-request-id
- h.Set("Content-Length", fmt.Sprint(len(obj.data)))
- h.Set("ETag", hex.EncodeToString(obj.checksum))
- h.Set("Last-Modified", obj.mtime.Format(awsTimeFormat))
- if a.req.Method == "HEAD" {
- return nil
- }
- // TODO avoid holding the lock when writing data.
- _, err := a.w.Write(obj.data)
- if err != nil {
- // we can't do much except just log the fact.
- log.Printf("error writing data: %v", err)
- }
- return nil
-}
-
-var metaHeaders = map[string]bool{
- "Content-MD5": true,
- "x-amz-acl": true,
- "Content-Type": true,
- "Content-Encoding": true,
- "Content-Disposition": true,
-}
-
-// PUT on an object creates the object.
-func (objr objectResource) put(a *action) interface{} {
- // TODO Cache-Control header
- // TODO Expires header
- // TODO x-amz-server-side-encryption
- // TODO x-amz-storage-class
-
- // TODO is this correct, or should we erase all previous metadata?
- obj := objr.object
- if obj == nil {
- obj = &object{
- name: objr.name,
- meta: make(http.Header),
- }
- }
-
- var expectHash []byte
- if c := a.req.Header.Get("Content-MD5"); c != "" {
- var err error
- expectHash, err = base64.StdEncoding.DecodeString(c)
- if err != nil || len(expectHash) != md5.Size {
- fatalf(400, "InvalidDigest", "The Content-MD5 you specified was invalid")
- }
- }
- sum := md5.New()
- // TODO avoid holding lock while reading data.
- data, err := ioutil.ReadAll(io.TeeReader(a.req.Body, sum))
- if err != nil {
- fatalf(400, "TODO", "read error")
- }
- gotHash := sum.Sum(nil)
- if expectHash != nil && bytes.Compare(gotHash, expectHash) != 0 {
- fatalf(400, "BadDigest", "The Content-MD5 you specified did not match what we received")
- }
- if a.req.ContentLength >= 0 && int64(len(data)) != a.req.ContentLength {
- fatalf(400, "IncompleteBody", "You did not provide the number of bytes specified by the Content-Length HTTP header")
- }
-
- // PUT request has been successful - save data and metadata
- for key, values := range a.req.Header {
- key = http.CanonicalHeaderKey(key)
- if metaHeaders[key] || strings.HasPrefix(key, "X-Amz-Meta-") {
- obj.meta[key] = values
- }
- }
- obj.data = data
- obj.checksum = gotHash
- obj.mtime = time.Now()
- objr.bucket.objects[objr.name] = obj
-
- h := a.w.Header()
- h.Set("ETag", fmt.Sprintf(`"%s"`, hex.EncodeToString(obj.checksum)))
-
- return nil
-}
-
-func (objr objectResource) delete(a *action) interface{} {
- delete(objr.bucket.objects, objr.name)
- return nil
-}
-
-func (objr objectResource) post(a *action) interface{} {
- fatalf(400, "MethodNotAllowed", "The specified method is not allowed against this resource")
- return nil
-}
-
-type CreateBucketConfiguration struct {
- LocationConstraint string
-}
-
-// locationConstraint parses the <CreateBucketConfiguration /> request body (if present).
-// If there is no body, an empty string will be returned.
-func locationConstraint(a *action) string {
- var body bytes.Buffer
- if _, err := io.Copy(&body, a.req.Body); err != nil {
- fatalf(400, "InvalidRequest", err.Error())
- }
- if body.Len() == 0 {
- return ""
- }
- var loc CreateBucketConfiguration
- if err := xml.NewDecoder(&body).Decode(&loc); err != nil {
- fatalf(400, "InvalidRequest", err.Error())
- }
- return loc.LocationConstraint
-}
diff --git a/vendor/github.com/goamz/goamz/s3/sign.go b/vendor/github.com/goamz/goamz/s3/sign.go
deleted file mode 100644
index 722d97d29..000000000
--- a/vendor/github.com/goamz/goamz/s3/sign.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package s3
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "log"
- "sort"
- "strings"
-)
-
-var b64 = base64.StdEncoding
-
-// ----------------------------------------------------------------------------
-// S3 signing (http://goo.gl/G1LrK)
-
-var s3ParamsToSign = map[string]bool{
- "acl": true,
- "location": true,
- "logging": true,
- "notification": true,
- "partNumber": true,
- "policy": true,
- "requestPayment": true,
- "torrent": true,
- "uploadId": true,
- "uploads": true,
- "versionId": true,
- "versioning": true,
- "versions": true,
- "response-content-type": true,
- "response-content-language": true,
- "response-expires": true,
- "response-cache-control": true,
- "response-content-disposition": true,
- "response-content-encoding": true,
- "website": true,
- "delete": true,
-}
-
-type keySortableTupleList []keySortableTuple
-
-type keySortableTuple struct {
- Key string
- TupleString string
-}
-
-func (l keySortableTupleList) StringSlice() []string {
- slice := make([]string, len(l))
- for i, v := range l {
- slice[i] = v.TupleString
- }
- return slice
-}
-
-func (l keySortableTupleList) Len() int {
- return len(l)
-}
-
-func (l keySortableTupleList) Less(i, j int) bool {
- return l[i].Key < l[j].Key
-}
-
-func (l keySortableTupleList) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-func sign(auth aws.Auth, method, canonicalPath string, params, headers map[string][]string) {
- var md5, ctype, date, xamz string
- var xamzDate bool
- var sarray keySortableTupleList
- for k, v := range headers {
- k = strings.ToLower(k)
- switch k {
- case "content-md5":
- md5 = v[0]
- case "content-type":
- ctype = v[0]
- case "date":
- if !xamzDate {
- date = v[0]
- }
- default:
- if strings.HasPrefix(k, "x-amz-") {
- vall := strings.Join(v, ",")
- sarray = append(sarray, keySortableTuple{k, k + ":" + vall})
- if k == "x-amz-date" {
- xamzDate = true
- date = ""
- }
- }
- }
- }
- if len(sarray) > 0 {
- sort.Sort(sarray)
- xamz = strings.Join(sarray.StringSlice(), "\n") + "\n"
- }
-
- expires := false
- if v, ok := params["Expires"]; ok {
- // Query string request authentication alternative.
- expires = true
- date = v[0]
- params["AWSAccessKeyId"] = []string{auth.AccessKey}
- }
-
- sarray = sarray[0:0]
- for k, v := range params {
- if s3ParamsToSign[k] {
- for _, vi := range v {
- if vi == "" {
- sarray = append(sarray, keySortableTuple{k, k})
- } else {
- // "When signing you do not encode these values."
- sarray = append(sarray, keySortableTuple{k, k + "=" + vi})
- }
- }
- }
- }
- if len(sarray) > 0 {
- sort.Sort(sarray)
- canonicalPath = canonicalPath + "?" + strings.Join(sarray.StringSlice(), "&")
- }
-
- payload := method + "\n" + md5 + "\n" + ctype + "\n" + date + "\n" + xamz + canonicalPath
- hash := hmac.New(sha1.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- if expires {
- params["Signature"] = []string{string(signature)}
- } else {
- headers["Authorization"] = []string{"AWS " + auth.AccessKey + ":" + string(signature)}
- }
- if debug {
- log.Printf("Signature payload: %q", payload)
- log.Printf("Signature: %q", signature)
- }
-}
diff --git a/vendor/github.com/goamz/goamz/s3/sign_test.go b/vendor/github.com/goamz/goamz/s3/sign_test.go
deleted file mode 100644
index 112e1ca3e..000000000
--- a/vendor/github.com/goamz/goamz/s3/sign_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-package s3_test
-
-import (
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/s3"
- . "gopkg.in/check.v1"
-)
-
-// S3 ReST authentication docs: http://goo.gl/G1LrK
-
-var testAuth = aws.Auth{AccessKey: "0PN5J17HBGZHT7JJ3X82", SecretKey: "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o"}
-
-func (s *S) TestSignExampleObjectGet(c *C) {
- method := "GET"
- path := "/johnsmith/photos/puppy.jpg"
- headers := map[string][]string{
- "Host": {"johnsmith.s3.amazonaws.com"},
- "Date": {"Tue, 27 Mar 2007 19:36:42 +0000"},
- }
- s3.Sign(testAuth, method, path, nil, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:xXjDGYUmKxnwqr5KXNPGldn5LbA="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleObjectPut(c *C) {
- method := "PUT"
- path := "/johnsmith/photos/puppy.jpg"
- headers := map[string][]string{
- "Host": {"johnsmith.s3.amazonaws.com"},
- "Date": {"Tue, 27 Mar 2007 21:15:45 +0000"},
- "Content-Type": {"image/jpeg"},
- "Content-Length": {"94328"},
- }
- s3.Sign(testAuth, method, path, nil, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:hcicpDDvL9SsO6AkvxqmIWkmOuQ="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleList(c *C) {
- method := "GET"
- path := "/johnsmith/"
- params := map[string][]string{
- "prefix": {"photos"},
- "max-keys": {"50"},
- "marker": {"puppy"},
- }
- headers := map[string][]string{
- "Host": {"johnsmith.s3.amazonaws.com"},
- "Date": {"Tue, 27 Mar 2007 19:42:41 +0000"},
- "User-Agent": {"Mozilla/5.0"},
- }
- s3.Sign(testAuth, method, path, params, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:jsRt/rhG+Vtp88HrYL706QhE4w4="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleFetch(c *C) {
- method := "GET"
- path := "/johnsmith/"
- params := map[string][]string{
- "acl": {""},
- }
- headers := map[string][]string{
- "Host": {"johnsmith.s3.amazonaws.com"},
- "Date": {"Tue, 27 Mar 2007 19:44:46 +0000"},
- }
- s3.Sign(testAuth, method, path, params, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:thdUi9VAkzhkniLj96JIrOPGi0g="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleDelete(c *C) {
- method := "DELETE"
- path := "/johnsmith/photos/puppy.jpg"
- params := map[string][]string{}
- headers := map[string][]string{
- "Host": {"s3.amazonaws.com"},
- "Date": {"Tue, 27 Mar 2007 21:20:27 +0000"},
- "User-Agent": {"dotnet"},
- "x-amz-date": {"Tue, 27 Mar 2007 21:20:26 +0000"},
- }
- s3.Sign(testAuth, method, path, params, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:k3nL7gH3+PadhTEVn5Ip83xlYzk="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleUpload(c *C) {
- method := "PUT"
- path := "/static.johnsmith.net/db-backup.dat.gz"
- params := map[string][]string{}
- headers := map[string][]string{
- "Host": {"static.johnsmith.net:8080"},
- "Date": {"Tue, 27 Mar 2007 21:06:08 +0000"},
- "User-Agent": {"curl/7.15.5"},
- "x-amz-acl": {"public-read"},
- "content-type": {"application/x-download"},
- "Content-MD5": {"4gJE4saaMU4BqNR0kLY+lw=="},
- "X-Amz-Meta-ReviewedBy": {"joe@johnsmith.net,jane@johnsmith.net"},
- "X-Amz-Meta-FileChecksum": {"0x02661779"},
- "X-Amz-Meta-ChecksumAlgorithm": {"crc32"},
- "Content-Disposition": {"attachment; filename=database.dat"},
- "Content-Encoding": {"gzip"},
- "Content-Length": {"5913339"},
- }
- s3.Sign(testAuth, method, path, params, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:C0FlOtU8Ylb9KDTpZqYkZPX91iI="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleListAllMyBuckets(c *C) {
- method := "GET"
- path := "/"
- headers := map[string][]string{
- "Host": {"s3.amazonaws.com"},
- "Date": {"Wed, 28 Mar 2007 01:29:59 +0000"},
- }
- s3.Sign(testAuth, method, path, nil, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:Db+gepJSUbZKwpx1FR0DLtEYoZA="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
-
-func (s *S) TestSignExampleUnicodeKeys(c *C) {
- method := "GET"
- path := "/dictionary/fran%C3%A7ais/pr%c3%a9f%c3%a8re"
- headers := map[string][]string{
- "Host": {"s3.amazonaws.com"},
- "Date": {"Wed, 28 Mar 2007 01:49:49 +0000"},
- }
- s3.Sign(testAuth, method, path, nil, headers)
- expected := "AWS 0PN5J17HBGZHT7JJ3X82:dxhSBHoI6eVSPcXJqEghlUzZMnY="
- c.Assert(headers["Authorization"], DeepEquals, []string{expected})
-}
diff --git a/vendor/github.com/goamz/goamz/sqs/Makefile b/vendor/github.com/goamz/goamz/sqs/Makefile
deleted file mode 100644
index 1219acfb9..000000000
--- a/vendor/github.com/goamz/goamz/sqs/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=launchpad.net/goamz/sqs
-
-GOFILES=\
- sqs.go\
-
-include $(GOROOT)/src/Make.pkg
-
-GOFMT=gofmt
-BADFMT=$(shell $(GOFMT) -l $(GOFILES) 2> /dev/null)
-
-gofmt: $(BADFMT)
- @for F in $(BADFMT); do $(GOFMT) -w $$F && echo $$F; done
-
-ifneq ($(BADFMT),)
-ifneq ($(MAKECMDGOALS), gofmt)
-#$(warning WARNING: make gofmt: $(BADFMT))
-endif
-endif
diff --git a/vendor/github.com/goamz/goamz/sqs/README.md b/vendor/github.com/goamz/goamz/sqs/README.md
deleted file mode 100644
index a283a4eec..000000000
--- a/vendor/github.com/goamz/goamz/sqs/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-Amazon Simple Queue Service API Client Written in Golang.
-=========================================================
-
-Merged from https://github.com/Mistobaan/sqs
-
-Installation
-------------
-
- go get github.com/goamz/goamz/sqs
-
-Documentation
--------------
-
-http://godoc.org/github.com/goamz/goamz/sqs
-
-
-Sample Usage
-------------
-
- var auth = aws.Auth{
- AccessKey: os.Getenv("AWS_ACCESS_KEY_ID"),
- SecretKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),
- }
-
- conn := sqs.New(auth, aws.USEast)
-
- q, err := conn.CreateQueue(queueName)
- if err != nil {
- log.Fatalf(err.Error())
- }
-
- q.SendMessage(batch)
-
-
-Testing
--------
-
- go test .
diff --git a/vendor/github.com/goamz/goamz/sqs/responses_test.go b/vendor/github.com/goamz/goamz/sqs/responses_test.go
deleted file mode 100644
index 857fb9104..000000000
--- a/vendor/github.com/goamz/goamz/sqs/responses_test.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package sqs
-
-var TestCreateQueueXmlOK = `
-<CreateQueueResponse>
- <CreateQueueResult>
- <QueueUrl>http://sqs.us-east-1.amazonaws.com/123456789012/testQueue</QueueUrl>
- </CreateQueueResult>
- <ResponseMetadata>
- <RequestId>7a62c49f-347e-4fc4-9331-6e8e7a96aa73</RequestId>
- </ResponseMetadata>
-</CreateQueueResponse>
-`
-
-var TestListQueuesXmlOK = `
-<ListQueuesResponse>
- <ListQueuesResult>
- <QueueUrl>http://sqs.us-east-1.amazonaws.com/123456789012/testQueue</QueueUrl>
- </ListQueuesResult>
- <ResponseMetadata>
- <RequestId>725275ae-0b9b-4762-b238-436d7c65a1ac</RequestId>
- </ResponseMetadata>
-</ListQueuesResponse>
-`
-
-var TestDeleteQueueXmlOK = `
-<DeleteQueueResponse>
- <ResponseMetadata>
- <RequestId>6fde8d1e-52cd-4581-8cd9-c512f4c64223</RequestId>
- </ResponseMetadata>
-</DeleteQueueResponse>
-`
-
-var TestPurgeQueueXmlOK = `
-<PurgeQueueResponse>
- <ResponseMetadata>
- <RequestId>6fde8d1e-52cd-4581-8cd9-c512f4c64223</RequestId>
- </ResponseMetadata>
-</PurgeQueueResponse>
-`
-
-var TestSendMessageXmlOK = `
-<SendMessageResponse>
- <SendMessageResult>
- <MD5OfMessageBody>fafb00f5732ab283681e124bf8747ed1</MD5OfMessageBody>
- <MessageId>5fea7756-0ea4-451a-a703-a558b933e274</MessageId>
- <MD5OfMessageAttributes>ba056227cfd9533dba1f72ad9816d233</MD5OfMessageAttributes>
- </SendMessageResult>
- <ResponseMetadata>
- <RequestId>27daac76-34dd-47df-bd01-1f6e873584a0</RequestId>
- </ResponseMetadata>
-</SendMessageResponse>
-`
-
-var TestSendMessageBatchXmlOk = `
-<SendMessageBatchResponse>
-<SendMessageBatchResult>
- <SendMessageBatchResultEntry>
- <Id>test_msg_001</Id>
- <MessageId>0a5231c7-8bff-4955-be2e-8dc7c50a25fa</MessageId>
- <MD5OfMessageBody>0e024d309850c78cba5eabbeff7cae71</MD5OfMessageBody>
- </SendMessageBatchResultEntry>
- <SendMessageBatchResultEntry>
- <Id>test_msg_002</Id>
- <MessageId>15ee1ed3-87e7-40c1-bdaa-2e49968ea7e9</MessageId>
- <MD5OfMessageBody>7fb8146a82f95e0af155278f406862c2</MD5OfMessageBody>
- </SendMessageBatchResultEntry>
-</SendMessageBatchResult>
-<ResponseMetadata>
- <RequestId>ca1ad5d0-8271-408b-8d0f-1351bf547e74</RequestId>
-</ResponseMetadata>
-</SendMessageBatchResponse>
-`
-
-var TestReceiveMessageXmlOK = `
-<ReceiveMessageResponse>
- <ReceiveMessageResult>
- <Message>
- <MessageId>5fea7756-0ea4-451a-a703-a558b933e274</MessageId>
- <ReceiptHandle>MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+CwLj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QEauMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0=</ReceiptHandle>
- <MD5OfBody>fafb00f5732ab283681e124bf8747ed1</MD5OfBody>
- <Body>This is a test message</Body>
- <Attribute>
- <Name>SenderId</Name>
- <Value>195004372649</Value>
- </Attribute>
- <Attribute>
- <Name>SentTimestamp</Name>
- <Value>1238099229000</Value>
- </Attribute>
- <Attribute>
- <Name>ApproximateReceiveCount</Name>
- <Value>5</Value>
- </Attribute>
- <Attribute>
- <Name>ApproximateFirstReceiveTimestamp</Name>
- <Value>1250700979248</Value>
- </Attribute>
- <MessageAttribute>
- <Name>CustomAttribute</Name>
- <Value>
- <DataType>String</DataType>
- <StringValue>Testing, testing, 1, 2, 3</StringValue>
- </Value>
- </MessageAttribute>
- <MessageAttribute>
- <Name>BinaryCustomAttribute</Name>
- <Value>
- <DataType>Binary</DataType>
- <BinaryValue>iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABA0lEQVQ4T72UrQ4CMRCEewhyiiBPopBgcfAUSIICB88CDhRB8hTgsCBRyJMEdUFwZJpMs/3LHQlhVdPufJ1ut03UjyKJcR5zVc4umbW87eeqvVFBjTdJwP54D+4xGXVUCGiBxoOsJOCd9IKgRnnV8wAezrnRmwGcpKtCJ8UgJBNWLFNzVAOimyqIhElXGkQ3LmQ6fKrdqaW1cixhdKVBcEOBLEwViBugVv8B1elVuLYcoTea624drcl5LW4KTRsFhQpLtVzzQKGCh2DuHI8FvdVH7vGQKEPerHRjgegKMESsXgAgWBtu5D1a9BQWCXSrzx9BvjPPkRQR6IJcQNTRV/cvkj93DqUTWzVDIQAAAABJRU5ErkJggg==</BinaryValue>
- </Value>
- </MessageAttribute>
- </Message>
- </ReceiveMessageResult>
-<ResponseMetadata>
- <RequestId>b6633655-283d-45b4-aee4-4e84e0ae6afa</RequestId>
-</ResponseMetadata>
-</ReceiveMessageResponse>
-`
-
-var TestChangeMessageVisibilityXmlOK = `
-<ChangeMessageVisibilityResponse>
- <ResponseMetadata>
- <RequestId>6a7a282a-d013-4a59-aba9-335b0fa48bed</RequestId>
- </ResponseMetadata>
-</ChangeMessageVisibilityResponse>
-`
-
-var TestDeleteMessageBatchXmlOK = `
-<DeleteMessageBatchResponse>
- <DeleteMessageBatchResult>
- <DeleteMessageBatchResultEntry>
- <Id>msg1</Id>
- </DeleteMessageBatchResultEntry>
- <DeleteMessageBatchResultEntry>
- <Id>msg2</Id>
- </DeleteMessageBatchResultEntry>
- </DeleteMessageBatchResult>
- <ResponseMetadata>
- <RequestId>d6f86b7a-74d1-4439-b43f-196a1e29cd85</RequestId>
- </ResponseMetadata>
-</DeleteMessageBatchResponse>
-`
-
-var TestDeleteMessageUsingReceiptXmlOK = `
-<DeleteMessageResponse>
- <ResponseMetadata>
- <RequestId>d6d86b7a-74d1-4439-b43f-196a1e29cd85</RequestId>
- </ResponseMetadata>
-</DeleteMessageResponse>
-`
-
-var TestGetQueueAttributesXmlOK = `
-<GetQueueAttributesResponse>
- <GetQueueAttributesResult>
- <Attribute>
- <Name>ReceiveMessageWaitTimeSeconds</Name>
- <Value>2</Value>
- </Attribute>
- <Attribute>
- <Name>VisibilityTimeout</Name>
- <Value>30</Value>
- </Attribute>
- <Attribute>
- <Name>ApproximateNumberOfMessages</Name>
- <Value>0</Value>
- </Attribute>
- <Attribute>
- <Name>ApproximateNumberOfMessagesNotVisible</Name>
- <Value>0</Value>
- </Attribute>
- <Attribute>
- <Name>CreatedTimestamp</Name>
- <Value>1286771522</Value>
- </Attribute>
- <Attribute>
- <Name>LastModifiedTimestamp</Name>
- <Value>1286771522</Value>
- </Attribute>
- <Attribute>
- <Name>QueueArn</Name>
- <Value>arn:aws:sqs:us-east-1:123456789012:qfoo</Value>
- </Attribute>
- <Attribute>
- <Name>MaximumMessageSize</Name>
- <Value>8192</Value>
- </Attribute>
- <Attribute>
- <Name>MessageRetentionPeriod</Name>
- <Value>345600</Value>
- </Attribute>
- </GetQueueAttributesResult>
- <ResponseMetadata>
- <RequestId>1ea71be5-b5a2-4f9d-b85a-945d8d08cd0b</RequestId>
- </ResponseMetadata>
-</GetQueueAttributesResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/sqs/sqs.go b/vendor/github.com/goamz/goamz/sqs/sqs.go
deleted file mode 100644
index 23f1951ab..000000000
--- a/vendor/github.com/goamz/goamz/sqs/sqs.go
+++ /dev/null
@@ -1,583 +0,0 @@
-//
-// gosqs - Go packages to interact with the Amazon SQS Web Services.
-//
-// depends on https://wiki.ubuntu.com/goamz
-//
-//
-// Written by Prudhvi Krishna Surapaneni <me@prudhvi.net>
-// Extended by Fabrizio Milo <mistobaan@gmail.com>
-//
-package sqs
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-const API_VERSION = "2012-11-05"
-
-const debug = false
-
-// The SQS type encapsulates operation with an SQS region.
-type SQS struct {
- aws.Auth
- aws.Region
- private byte // Reserve the right of using private data.
- transport *http.Transport
-}
-
-// NewFrom Create A new SQS Client given an access and secret Key
-// region must be one of "us.east, us.west, eu.west"
-func NewFrom(accessKey, secretKey, region string) (*SQS, error) {
-
- auth := aws.Auth{AccessKey: accessKey, SecretKey: secretKey}
- aws_region := aws.USEast
-
- switch region {
- case "us.east", "us.east.1":
- aws_region = aws.USEast
- case "us.west", "us.west.1":
- aws_region = aws.USWest
- case "us.west.2":
- aws_region = aws.USWest2
- case "eu.west":
- aws_region = aws.EUWest
- case "ap.southeast", "ap.southeast.1":
- aws_region = aws.APSoutheast
- case "ap.southeast.2":
- aws_region = aws.APSoutheast2
- case "ap.northeast", "ap.northeast.1":
- aws_region = aws.APNortheast
- case "ap.northeast.2":
- aws_region = aws.APNortheast2
- case "sa.east", "sa.east.1":
- aws_region = aws.SAEast
- case "cn.north", "cn.north.1":
- aws_region = aws.CNNorth
- default:
- return nil, errors.New(fmt.Sprintf("Unknown/Unsupported region %s", region))
- }
-
- aws_sqs := New(auth, aws_region)
- return aws_sqs, nil
-}
-
-// NewFrom Create A new SQS Client from an exisisting aws.Auth
-func New(auth aws.Auth, region aws.Region) *SQS {
- return &SQS{auth, region, 0, nil}
-}
-
-// NewFromTransport Create A new SQS Client that uses a given &http.Transport
-func NewFromTransport(auth aws.Auth, region aws.Region, transport *http.Transport) *SQS {
- return &SQS{auth, region, 0, transport}
-}
-
-// Queue Reference to a Queue
-type Queue struct {
- *SQS
- Url string
-}
-
-type CreateQueueResponse struct {
- QueueUrl string `xml:"CreateQueueResult>QueueUrl"`
- ResponseMetadata ResponseMetadata
-}
-
-type GetQueueUrlResponse struct {
- QueueUrl string `xml:"GetQueueUrlResult>QueueUrl"`
- ResponseMetadata ResponseMetadata
-}
-
-type ListQueuesResponse struct {
- QueueUrl []string `xml:"ListQueuesResult>QueueUrl"`
- ResponseMetadata ResponseMetadata
-}
-
-type DeleteMessageResponse struct {
- ResponseMetadata ResponseMetadata
-}
-
-type DeleteQueueResponse struct {
- ResponseMetadata ResponseMetadata
-}
-
-type PurgeQueueResponse struct {
- ResponseMetadata ResponseMetadata
-}
-
-type SendMessageResponse struct {
- MD5 string `xml:"SendMessageResult>MD5OfMessageBody"`
- MD5OfMessageAttributes string `xml:"SendMessageResult>MD5OfMessageAttributes"`
- Id string `xml:"SendMessageResult>MessageId"`
- ResponseMetadata ResponseMetadata
-}
-
-type ReceiveMessageResponse struct {
- Messages []Message `xml:"ReceiveMessageResult>Message"`
- ResponseMetadata ResponseMetadata
-}
-
-type Message struct {
- MessageId string `xml:"MessageId"`
- Body string `xml:"Body"`
- MD5OfBody string `xml:"MD5OfBody"`
- ReceiptHandle string `xml:"ReceiptHandle"`
- Attribute []Attribute `xml:"Attribute"`
- MessageAttribute []MessageAttribute `xml:"MessageAttribute"`
- MD5OfMessageAttributes string `xml:"MD5OfMessageAttributes"`
-}
-
-type Attribute struct {
- Name string `xml:"Name"`
- Value string `xml:"Value"`
-}
-
-type MessageAttribute struct {
- Name string `xml:"Name"`
- Value MessageAttributeValue `xml:"Value"`
-}
-
-type MessageAttributeValue struct {
- DataType string `xml:"DataType"`
- BinaryValue []byte `xml:"BinaryValue"`
- StringValue string `xml:"StringValue"`
-
- // Not yet implemented (Reserved for future use)
- BinaryListValues [][]byte `xml:"BinaryListValues"`
- StringListValues []string `xml:"StringListValues"`
-}
-
-type ChangeMessageVisibilityResponse struct {
- ResponseMetadata ResponseMetadata
-}
-
-type GetQueueAttributesResponse struct {
- Attributes []Attribute `xml:"GetQueueAttributesResult>Attribute"`
- ResponseMetadata ResponseMetadata
-}
-
-type ResponseMetadata struct {
- RequestId string
- BoxUsage float64
-}
-
-type Error struct {
- StatusCode int
- Code string
- Message string
- RequestId string
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-func (err *Error) String() string {
- return err.Message
-}
-
-type xmlErrors struct {
- RequestId string
- Errors []Error `xml:"Errors>Error"`
- Error Error
-}
-
-// CreateQueue create a queue with a specific name
-func (s *SQS) CreateQueue(queueName string) (*Queue, error) {
- return s.CreateQueueWithTimeout(queueName, 30)
-}
-
-// CreateQueue create a queue with a specific name and a timeout
-func (s *SQS) CreateQueueWithTimeout(queueName string, timeout int) (*Queue, error) {
- params := map[string]string{
- "VisibilityTimeout": strconv.Itoa(timeout),
- }
- return s.CreateQueueWithAttributes(queueName, params)
-}
-
-func (s *SQS) CreateQueueWithAttributes(queueName string, attrs map[string]string) (q *Queue, err error) {
- resp, err := s.newQueue(queueName, attrs)
- if err != nil {
- return nil, err
- }
- q = &Queue{s, resp.QueueUrl}
- return
-}
-
-// GetQueue get a reference to the given quename
-func (s *SQS) GetQueue(queueName string) (*Queue, error) {
- var q *Queue
- resp, err := s.getQueueUrl(queueName)
- if err != nil {
- return q, err
- }
- q = &Queue{s, resp.QueueUrl}
- return q, nil
-}
-
-func (s *SQS) QueueFromArn(queueUrl string) (q *Queue) {
- q = &Queue{s, queueUrl}
- return
-}
-
-func (s *SQS) getQueueUrl(queueName string) (resp *GetQueueUrlResponse, err error) {
- resp = &GetQueueUrlResponse{}
- params := makeParams("GetQueueUrl")
- params["QueueName"] = queueName
- err = s.query("", params, resp)
- return resp, err
-}
-
-func (s *SQS) newQueue(queueName string, attrs map[string]string) (resp *CreateQueueResponse, err error) {
- resp = &CreateQueueResponse{}
- params := makeParams("CreateQueue")
- params["QueueName"] = queueName
-
- i := 1
- for k, v := range attrs {
- nameParam := fmt.Sprintf("Attribute.%d.Name", i)
- valParam := fmt.Sprintf("Attribute.%d.Value", i)
- params[nameParam] = k
- params[valParam] = v
- i++
- }
-
- err = s.query("", params, resp)
- return
-}
-
-func (s *SQS) ListQueues(QueueNamePrefix string) (resp *ListQueuesResponse, err error) {
- resp = &ListQueuesResponse{}
- params := makeParams("ListQueues")
-
- if QueueNamePrefix != "" {
- params["QueueNamePrefix"] = QueueNamePrefix
- }
-
- err = s.query("", params, resp)
- return
-}
-
-func (q *Queue) Delete() (resp *DeleteQueueResponse, err error) {
- resp = &DeleteQueueResponse{}
- params := makeParams("DeleteQueue")
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) Purge() (resp *PurgeQueueResponse, err error) {
- resp = &PurgeQueueResponse{}
- params := makeParams("PurgeQueue")
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) SendMessageWithDelay(MessageBody string, DelaySeconds int64) (resp *SendMessageResponse, err error) {
- resp = &SendMessageResponse{}
- params := makeParams("SendMessage")
-
- params["MessageBody"] = MessageBody
- params["DelaySeconds"] = strconv.Itoa(int(DelaySeconds))
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) SendMessage(MessageBody string) (resp *SendMessageResponse, err error) {
- resp = &SendMessageResponse{}
- params := makeParams("SendMessage")
-
- params["MessageBody"] = MessageBody
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) SendMessageWithAttributes(MessageBody string, attrs map[string]string) (resp *SendMessageResponse, err error) {
- resp = &SendMessageResponse{}
- params := makeParams("SendMessage")
-
- params["MessageBody"] = MessageBody
-
- i := 1
- for k, v := range attrs {
- nameParam := fmt.Sprintf("MessageAttribute.%d.Name", i)
- valParam := fmt.Sprintf("MessageAttribute.%d.Value.StringValue", i)
- typeParam := fmt.Sprintf("MessageAttribute.%d.Value.DataType", i)
- params[nameParam] = k
- params[valParam] = v
- params[typeParam] = "String"
- i++
- }
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-// ReceiveMessageWithVisibilityTimeout
-func (q *Queue) ReceiveMessageWithVisibilityTimeout(MaxNumberOfMessages, VisibilityTimeoutSec int) (*ReceiveMessageResponse, error) {
- params := map[string]string{
- "MaxNumberOfMessages": strconv.Itoa(MaxNumberOfMessages),
- "VisibilityTimeout": strconv.Itoa(VisibilityTimeoutSec),
- }
- return q.ReceiveMessageWithParameters(params)
-}
-
-// ReceiveMessage
-func (q *Queue) ReceiveMessage(MaxNumberOfMessages int) (*ReceiveMessageResponse, error) {
- params := map[string]string{
- "MaxNumberOfMessages": strconv.Itoa(MaxNumberOfMessages),
- }
- return q.ReceiveMessageWithParameters(params)
-}
-
-func (q *Queue) ReceiveMessageWithParameters(p map[string]string) (resp *ReceiveMessageResponse, err error) {
- resp = &ReceiveMessageResponse{}
- params := makeParams("ReceiveMessage")
- params["AttributeName"] = "All"
- params["MessageAttributeNames"] = "All"
-
- for k, v := range p {
- params[k] = v
- }
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) ChangeMessageVisibility(M *Message, VisibilityTimeout int) (resp *ChangeMessageVisibilityResponse, err error) {
- resp = &ChangeMessageVisibilityResponse{}
- params := makeParams("ChangeMessageVisibility")
- params["VisibilityTimeout"] = strconv.Itoa(VisibilityTimeout)
- params["ReceiptHandle"] = M.ReceiptHandle
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) GetQueueAttributes(A string) (resp *GetQueueAttributesResponse, err error) {
- resp = &GetQueueAttributesResponse{}
- params := makeParams("GetQueueAttributes")
- params["AttributeName"] = A
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-func (q *Queue) DeleteMessage(M *Message) (resp *DeleteMessageResponse, err error) {
- return q.DeleteMessageUsingReceiptHandle(M.ReceiptHandle)
-}
-
-func (q *Queue) DeleteMessageUsingReceiptHandle(receiptHandle string) (resp *DeleteMessageResponse, err error) {
- resp = &DeleteMessageResponse{}
- params := makeParams("DeleteMessage")
- params["ReceiptHandle"] = receiptHandle
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-type SendMessageBatchResultEntry struct {
- Id string `xml:"Id"`
- MessageId string `xml:"MessageId"`
- MD5OfMessageBody string `xml:"MD5OfMessageBody"`
-}
-
-type SendMessageBatchResponse struct {
- SendMessageBatchResult []SendMessageBatchResultEntry `xml:"SendMessageBatchResult>SendMessageBatchResultEntry"`
- ResponseMetadata ResponseMetadata
-}
-
-/* SendMessageBatch
- */
-func (q *Queue) SendMessageBatch(msgList []Message) (resp *SendMessageBatchResponse, err error) {
- resp = &SendMessageBatchResponse{}
- params := makeParams("SendMessageBatch")
-
- for idx, msg := range msgList {
- count := idx + 1
- params[fmt.Sprintf("SendMessageBatchRequestEntry.%d.Id", count)] = fmt.Sprintf("msg-%d", count)
- params[fmt.Sprintf("SendMessageBatchRequestEntry.%d.MessageBody", count)] = msg.Body
- }
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-/* SendMessageBatchString
- */
-func (q *Queue) SendMessageBatchString(msgList []string) (resp *SendMessageBatchResponse, err error) {
- resp = &SendMessageBatchResponse{}
- params := makeParams("SendMessageBatch")
-
- for idx, msg := range msgList {
- count := idx + 1
- params[fmt.Sprintf("SendMessageBatchRequestEntry.%d.Id", count)] = fmt.Sprintf("msg-%d", count)
- params[fmt.Sprintf("SendMessageBatchRequestEntry.%d.MessageBody", count)] = msg
- }
-
- err = q.SQS.query(q.Url, params, resp)
- return
-}
-
-type DeleteMessageBatchResponse struct {
- DeleteMessageBatchResult []struct {
- Id string
- SenderFault bool
- Code string
- Message string
- } `xml:"DeleteMessageBatchResult>DeleteMessageBatchResultEntry"`
- ResponseMetadata ResponseMetadata
-}
-
-/* DeleteMessageBatch */
-func (q *Queue) DeleteMessageBatch(msgList []Message) (resp *DeleteMessageBatchResponse, err error) {
- resp = &DeleteMessageBatchResponse{}
- params := makeParams("DeleteMessageBatch")
-
- lutMsg := make(map[string]Message)
-
- for idx := range msgList {
- params[fmt.Sprintf("DeleteMessageBatchRequestEntry.%d.Id", idx+1)] = msgList[idx].MessageId
- params[fmt.Sprintf("DeleteMessageBatchRequestEntry.%d.ReceiptHandle", idx+1)] = msgList[idx].ReceiptHandle
-
- lutMsg[string(msgList[idx].MessageId)] = msgList[idx]
- }
-
- err = q.SQS.query(q.Url, params, resp)
-
- messageWithErrors := make([]Message, 0, len(msgList))
-
- for idx := range resp.DeleteMessageBatchResult {
- if resp.DeleteMessageBatchResult[idx].SenderFault {
- msg, ok := lutMsg[resp.DeleteMessageBatchResult[idx].Id]
- if ok {
- messageWithErrors = append(messageWithErrors, msg)
- }
- }
- }
-
- if len(messageWithErrors) > 0 {
- log.Printf("%d Message have not been sent", len(messageWithErrors))
- }
-
- return
-}
-
-func (s *SQS) query(queueUrl string, params map[string]string, resp interface{}) (err error) {
- params["Version"] = API_VERSION
- params["Timestamp"] = time.Now().In(time.UTC).Format(time.RFC3339)
- var url_ *url.URL
-
- switch {
- // fully qualified queueUrl
- case strings.HasPrefix(queueUrl, "http"):
- url_, err = url.Parse(queueUrl)
- // relative queueUrl
- case strings.HasPrefix(queueUrl, "/"):
- url_, err = url.Parse(s.Region.SQSEndpoint + queueUrl)
- // zero-value for queueUrl
- default:
- url_, err = url.Parse(s.Region.SQSEndpoint)
- }
-
- if err != nil {
- return err
- }
-
- if s.Auth.Token() != "" {
- params["SecurityToken"] = s.Auth.Token()
- }
-
- var r *http.Response
-
- var sarray []string
- for k, v := range params {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(v))
- }
-
- req, err := http.NewRequest("GET", fmt.Sprintf("%s?%s", url_, strings.Join(sarray, "&")), nil)
- if err != nil {
- return err
- }
- signer := aws.NewV4Signer(s.Auth, "sqs", s.Region)
- signer.Sign(req)
- var client http.Client
- if s.transport == nil {
- client = http.Client{}
- } else {
- client = http.Client{Transport: s.transport}
- }
- r, err = client.Do(req)
-
- if debug {
- log.Printf("GET %s\n", url_.String())
- }
-
- if err != nil {
- return err
- }
-
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("DUMP:%s\n", string(dump))
- }
-
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- io.Copy(ioutil.Discard, r.Body)
-
- return err
-}
-
-func buildError(r *http.Response) error {
- errors := xmlErrors{}
- xml.NewDecoder(r.Body).Decode(&errors)
- var err Error
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- } else {
- err = errors.Error
- }
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
diff --git a/vendor/github.com/goamz/goamz/sqs/sqs_test.go b/vendor/github.com/goamz/goamz/sqs/sqs_test.go
deleted file mode 100644
index a06433535..000000000
--- a/vendor/github.com/goamz/goamz/sqs/sqs_test.go
+++ /dev/null
@@ -1,414 +0,0 @@
-package sqs
-
-import (
- "crypto/md5"
- "encoding/binary"
- "fmt"
- "hash"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-var _ = Suite(&S{})
-
-type S struct {
- HTTPSuite
- sqs *SQS
-}
-
-func (s *S) SetUpSuite(c *C) {
- s.HTTPSuite.SetUpSuite(c)
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.sqs = New(auth, aws.Region{SQSEndpoint: testServer.URL})
-}
-
-func (s *S) TestCreateQueue(c *C) {
- testServer.PrepareResponse(200, nil, TestCreateQueueXmlOK)
-
- resp, err := s.sqs.CreateQueue("testQueue")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
- fmt.Printf("%+v\n", req)
- c.Assert(req.Form["Action"], DeepEquals, []string{"CreateQueue"})
- c.Assert(req.Form["Attribute.1.Name"], DeepEquals, []string{"VisibilityTimeout"})
- c.Assert(req.Form["Attribute.1.Value"], DeepEquals, []string{"30"})
-
- c.Assert(resp.Url, Equals, "http://sqs.us-east-1.amazonaws.com/123456789012/testQueue")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCreateQueueWithTimeout(c *C) {
- testServer.PrepareResponse(200, nil, TestCreateQueueXmlOK)
-
- s.sqs.CreateQueueWithTimeout("testQueue", 180)
- req := testServer.WaitRequest()
-
- // TestCreateQueue() tests the core functionality, just check the timeout in this test
- c.Assert(req.Form["Attribute.1.Name"], DeepEquals, []string{"VisibilityTimeout"})
- c.Assert(req.Form["Attribute.1.Value"], DeepEquals, []string{"180"})
-}
-
-func (s *S) TestCreateQueueWithAttributes(c *C) {
- testServer.PrepareResponse(200, nil, TestCreateQueueXmlOK)
-
- s.sqs.CreateQueueWithAttributes("testQueue", map[string]string{
- "ReceiveMessageWaitTimeSeconds": "20",
- "VisibilityTimeout": "240",
- })
- req := testServer.WaitRequest()
-
- // TestCreateQueue() tests the core functionality, just check the timeout in this test
- var receiveMessageWaitSet bool
- var visibilityTimeoutSet bool
-
- for i := 1; i <= 2; i++ {
- prefix := fmt.Sprintf("Attribute.%d.", i)
- attr := req.FormValue(prefix + "Name")
- value := req.FormValue(prefix + "Value")
- switch attr {
- case "ReceiveMessageWaitTimeSeconds":
- c.Assert(value, DeepEquals, "20")
- receiveMessageWaitSet = true
- case "VisibilityTimeout":
- c.Assert(value, DeepEquals, "240")
- visibilityTimeoutSet = true
- }
- }
- c.Assert(receiveMessageWaitSet, Equals, true)
- c.Assert(visibilityTimeoutSet, Equals, true)
-}
-
-func (s *S) TestListQueues(c *C) {
- testServer.PrepareResponse(200, nil, TestListQueuesXmlOK)
-
- resp, err := s.sqs.ListQueues("")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.QueueUrl), Not(Equals), 0)
- c.Assert(resp.QueueUrl[0], Equals, "http://sqs.us-east-1.amazonaws.com/123456789012/testQueue")
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "725275ae-0b9b-4762-b238-436d7c65a1ac")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestDeleteQueue(c *C) {
- testServer.PrepareResponse(200, nil, TestDeleteQueueXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
- resp, err := q.Delete()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "6fde8d1e-52cd-4581-8cd9-c512f4c64223")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestPurgeQueue(c *C) {
- testServer.PrepareResponse(200, nil, TestPurgeQueueXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
- resp, err := q.Purge()
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "6fde8d1e-52cd-4581-8cd9-c512f4c64223")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSendMessage(c *C) {
- testServer.PrepareResponse(200, nil, TestSendMessageXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
- resp, err := q.SendMessage("This is a test message")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- msg := "This is a test message"
- var h hash.Hash = md5.New()
- h.Write([]byte(msg))
- c.Assert(resp.MD5, Equals, fmt.Sprintf("%x", h.Sum(nil)))
- c.Assert(resp.Id, Equals, "5fea7756-0ea4-451a-a703-a558b933e274")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSendMessageRelativePath(c *C) {
- testServer.PrepareResponse(200, nil, TestSendMessageXmlOK)
-
- q := &Queue{s.sqs, "/123456789012/testQueue/"}
- resp, err := q.SendMessage("This is a test message")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- msg := "This is a test message"
- var h hash.Hash = md5.New()
- h.Write([]byte(msg))
- c.Assert(resp.MD5, Equals, fmt.Sprintf("%x", h.Sum(nil)))
- c.Assert(resp.Id, Equals, "5fea7756-0ea4-451a-a703-a558b933e274")
- c.Assert(err, IsNil)
-}
-
-func encodeMessageAttribute(str string) []byte {
- bstr := []byte(str)
- bs := make([]byte, 4+len(bstr))
- binary.BigEndian.PutUint32(bs, uint32(len(bstr)))
- copy(bs[4:len(bs)], bstr)
- return bs
-}
-
-func (s *S) TestSendMessageWithAttributes(c *C) {
- testServer.PrepareResponse(200, nil, TestSendMessageXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
- attrs := map[string]string{
- "test_attribute_name_1": "test_attribute_value_1",
- }
- resp, err := q.SendMessageWithAttributes("This is a test message", attrs)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- var attrsHash = md5.New()
- attrsHash.Write(encodeMessageAttribute("test_attribute_name_1"))
- attrsHash.Write(encodeMessageAttribute("String"))
- attrsHash.Write([]byte{1})
- attrsHash.Write(encodeMessageAttribute("test_attribute_value_1"))
- c.Assert(resp.MD5OfMessageAttributes, Equals, fmt.Sprintf("%x", attrsHash.Sum(nil)))
-
- msg := "This is a test message"
- var h hash.Hash = md5.New()
- h.Write([]byte(msg))
- c.Assert(resp.MD5, Equals, fmt.Sprintf("%x", h.Sum(nil)))
- c.Assert(resp.Id, Equals, "5fea7756-0ea4-451a-a703-a558b933e274")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestSendMessageBatch(c *C) {
- testServer.PrepareResponse(200, nil, TestSendMessageBatchXmlOk)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
-
- msgList := []string{"test message body 1", "test message body 2"}
- resp, err := q.SendMessageBatchString(msgList)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- for idx, msg := range msgList {
- var h hash.Hash = md5.New()
- h.Write([]byte(msg))
- c.Assert(resp.SendMessageBatchResult[idx].MD5OfMessageBody, Equals, fmt.Sprintf("%x", h.Sum(nil)))
- c.Assert(err, IsNil)
- }
-}
-
-func (s *S) TestDeleteMessageBatch(c *C) {
- testServer.PrepareResponse(200, nil, TestDeleteMessageBatchXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
-
- msgList := []Message{*(&Message{ReceiptHandle: "gfk0T0R0waama4fVFffkjPQrrvzMrOg0fTFk2LxT33EuB8wR0ZCFgKWyXGWFoqqpCIiprQUEhir%2F5LeGPpYTLzjqLQxyQYaQALeSNHb0us3uE84uujxpBhsDkZUQkjFFkNqBXn48xlMcVhTcI3YLH%2Bd%2BIqetIOHgBCZAPx6r%2B09dWaBXei6nbK5Ygih21DCDdAwFV68Jo8DXhb3ErEfoDqx7vyvC5nCpdwqv%2BJhU%2FTNGjNN8t51v5c%2FAXvQsAzyZVNapxUrHIt4NxRhKJ72uICcxruyE8eRXlxIVNgeNP8ZEDcw7zZU1Zw%3D%3D"}),
- *(&Message{ReceiptHandle: "gfk0T0R0waama4fVFffkjKzmhMCymjQvfTFk2LxT33G4ms5subrE0deLKWSscPU1oD3J9zgeS4PQQ3U30qOumIE6AdAv3w%2F%2Fa1IXW6AqaWhGsEPaLm3Vf6IiWqdM8u5imB%2BNTwj3tQRzOWdTOePjOjPcTpRxBtXix%2BEvwJOZUma9wabv%2BSw6ZHjwmNcVDx8dZXJhVp16Bksiox%2FGrUvrVTCJRTWTLc59oHLLF8sEkKzRmGNzTDGTiV%2BYjHfQj60FD3rVaXmzTsoNxRhKJ72uIHVMGVQiAGgB%2BqAbSqfKHDQtVOmJJgkHug%3D%3D"}),
- }
-
- resp, err := q.DeleteMessageBatch(msgList)
- c.Assert(err, IsNil)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- for idx, _ := range msgList {
- c.Assert(resp.DeleteMessageBatchResult[idx].Id, Equals, fmt.Sprintf("msg%d", idx+1))
- }
-}
-
-func (s *S) TestDeleteMessageUsingReceiptHandle(c *C) {
- testServer.PrepareResponse(200, nil, TestDeleteMessageUsingReceiptXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
-
- msg := &Message{ReceiptHandle: "gfk0T0R0waama4fVFffkjRQrrvzMrOg0fTFk2LxT33EuB8wR0ZCFgKWyXGWFoqqpCIiprQUEhir%2F5LeGPpYTLzjqLQxyQYaQALeSNHb0us3uE84uujxpBhsDkZUQkjFFkNqBXn48xlMcVhTcI3YLH%2Bd%2BIqetIOHgBCZAPx6r%2B09dWaBXei6nbK5Ygih21DCDdAwFV68Jo8DXhb3ErEfoDqx7vyvC5nCpdwqv%2BJhU%2FTNGjNN8t51v5c%2FAXvQsAzyZVNapxUrHIt4NxRhKJ72uICcxruyE8eRXlxIVNgeNP8ZEDcw7zZU1Zw%3D%3D"}
-
- resp, err := q.DeleteMessageUsingReceiptHandle(msg.ReceiptHandle)
- c.Assert(err, IsNil)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "d6d86b7a-74d1-4439-b43f-196a1e29cd85")
-}
-
-func (s *S) TestReceiveMessage(c *C) {
- testServer.PrepareResponse(200, nil, TestReceiveMessageXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
- resp, err := q.ReceiveMessage(5)
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(len(resp.Messages), Not(Equals), 0)
- c.Assert(resp.Messages[0].MessageId, Equals, "5fea7756-0ea4-451a-a703-a558b933e274")
- c.Assert(resp.Messages[0].MD5OfBody, Equals, "fafb00f5732ab283681e124bf8747ed1")
- c.Assert(resp.Messages[0].ReceiptHandle, Equals, "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+CwLj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QEauMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0=")
- c.Assert(resp.Messages[0].Body, Equals, "This is a test message")
-
- c.Assert(len(resp.Messages[0].Attribute), Not(Equals), 0)
-
- expectedAttributeResults := []struct {
- Name string
- Value string
- }{
- {Name: "SenderId", Value: "195004372649"},
- {Name: "SentTimestamp", Value: "1238099229000"},
- {Name: "ApproximateReceiveCount", Value: "5"},
- {Name: "ApproximateFirstReceiveTimestamp", Value: "1250700979248"},
- }
-
- for i, expected := range expectedAttributeResults {
- c.Assert(resp.Messages[0].Attribute[i].Name, Equals, expected.Name)
- c.Assert(resp.Messages[0].Attribute[i].Value, Equals, expected.Value)
- }
-
- c.Assert(len(resp.Messages[0].MessageAttribute), Not(Equals), 0)
-
- expectedMessageAttributeResults := []struct {
- Name string
- Value struct {
- DataType string
- BinaryValue []byte
- StringValue string
-
- // Not yet implemented (Reserved for future use)
- BinaryListValues [][]byte
- StringListValues []string
- }
- }{
- {
- Name: "CustomAttribute",
- Value: struct {
- DataType string
- BinaryValue []byte
- StringValue string
-
- // Not yet implemented (Reserved for future use)
- BinaryListValues [][]byte
- StringListValues []string
- }{
- DataType: "String",
- StringValue: "Testing, testing, 1, 2, 3",
- },
- },
- {
- Name: "BinaryCustomAttribute",
- Value: struct {
- DataType string
- BinaryValue []byte
- StringValue string
-
- // Not yet implemented (Reserved for future use)
- BinaryListValues [][]byte
- StringListValues []string
- }{
- DataType: "Binary",
- BinaryValue: []byte("iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABA0lEQVQ4T72UrQ4CMRCEewhyiiBPopBgcfAUSIICB88CDhRB8hTgsCBRyJMEdUFwZJpMs/3LHQlhVdPufJ1ut03UjyKJcR5zVc4umbW87eeqvVFBjTdJwP54D+4xGXVUCGiBxoOsJOCd9IKgRnnV8wAezrnRmwGcpKtCJ8UgJBNWLFNzVAOimyqIhElXGkQ3LmQ6fKrdqaW1cixhdKVBcEOBLEwViBugVv8B1elVuLYcoTea624drcl5LW4KTRsFhQpLtVzzQKGCh2DuHI8FvdVH7vGQKEPerHRjgegKMESsXgAgWBtu5D1a9BQWCXSrzx9BvjPPkRQR6IJcQNTRV/cvkj93DqUTWzVDIQAAAABJRU5ErkJggg=="),
- },
- },
- }
-
- for i, expected := range expectedMessageAttributeResults {
- c.Assert(resp.Messages[0].MessageAttribute[i].Name, Equals, expected.Name)
- c.Assert(resp.Messages[0].MessageAttribute[i].Value.DataType, Equals, expected.Value.DataType)
- c.Assert(string(resp.Messages[0].MessageAttribute[i].Value.BinaryValue), Equals, string(expected.Value.BinaryValue))
- c.Assert(resp.Messages[0].MessageAttribute[i].Value.StringValue, Equals, expected.Value.StringValue)
- }
-
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestChangeMessageVisibility(c *C) {
- testServer.PrepareResponse(200, nil, TestReceiveMessageXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
-
- resp1, err := q.ReceiveMessage(1)
- req := testServer.WaitRequest()
-
- testServer.PrepareResponse(200, nil, TestChangeMessageVisibilityXmlOK)
-
- resp, err := q.ChangeMessageVisibility(&resp1.Messages[0], 50)
- req = testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
- c.Assert(req.Header["Date"], Not(Equals), "")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "6a7a282a-d013-4a59-aba9-335b0fa48bed")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGetQueueAttributes(c *C) {
- testServer.PrepareResponse(200, nil, TestGetQueueAttributesXmlOK)
-
- q := &Queue{s.sqs, testServer.URL + "/123456789012/testQueue/"}
-
- resp, err := q.GetQueueAttributes("All")
- req := testServer.WaitRequest()
-
- c.Assert(req.Method, Equals, "GET")
- c.Assert(req.URL.Path, Equals, "/123456789012/testQueue/")
-
- c.Assert(resp.ResponseMetadata.RequestId, Equals, "1ea71be5-b5a2-4f9d-b85a-945d8d08cd0b")
-
- c.Assert(len(resp.Attributes), Equals, 9)
-
- expectedResults := []struct {
- Name string
- Value string
- }{
- {Name: "ReceiveMessageWaitTimeSeconds", Value: "2"},
- {Name: "VisibilityTimeout", Value: "30"},
- {Name: "ApproximateNumberOfMessages", Value: "0"},
- {Name: "ApproximateNumberOfMessagesNotVisible", Value: "0"},
- {Name: "CreatedTimestamp", Value: "1286771522"},
- {Name: "LastModifiedTimestamp", Value: "1286771522"},
- {Name: "QueueArn", Value: "arn:aws:sqs:us-east-1:123456789012:qfoo"},
- {Name: "MaximumMessageSize", Value: "8192"},
- {Name: "MessageRetentionPeriod", Value: "345600"},
- }
-
- for i, expected := range expectedResults {
- c.Assert(resp.Attributes[i].Name, Equals, expected.Name)
- c.Assert(resp.Attributes[i].Value, Equals, expected.Value)
- }
-
- c.Assert(err, IsNil)
-}
diff --git a/vendor/github.com/goamz/goamz/sqs/suite_test.go b/vendor/github.com/goamz/goamz/sqs/suite_test.go
deleted file mode 100644
index 8de1bc04f..000000000
--- a/vendor/github.com/goamz/goamz/sqs/suite_test.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package sqs
-
-import (
- "flag"
- "fmt"
- "net/http"
- "net/url"
- "os"
- "testing"
- "time"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var integration = flag.Bool("i", false, "Enable integration tests")
-
-type SuiteI struct {
- auth aws.Auth
-}
-
-func (s *SuiteI) SetUpSuite(c *C) {
- if !*integration {
- c.Skip("Integration tests not enabled (-i flag)")
- }
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err.Error())
- }
- s.auth = auth
-}
-
-type HTTPSuite struct{}
-
-var testServer = NewTestHTTPServer("http://localhost:4455", 5e9)
-
-func (s *HTTPSuite) SetUpSuite(c *C) {
- testServer.Start()
-}
-
-func (s *HTTPSuite) TearDownTest(c *C) {
- testServer.FlushRequests()
-}
-
-type TestHTTPServer struct {
- URL string
- Timeout time.Duration
- started bool
- request chan *http.Request
- response chan *testResponse
- pending chan bool
-}
-
-type testResponse struct {
- Status int
- Headers map[string]string
- Body string
-}
-
-func NewTestHTTPServer(url string, timeout time.Duration) *TestHTTPServer {
- return &TestHTTPServer{URL: url, Timeout: timeout}
-}
-
-func (s *TestHTTPServer) Start() {
- if s.started {
- return
- }
- s.started = true
-
- s.request = make(chan *http.Request, 64)
- s.response = make(chan *testResponse, 64)
- s.pending = make(chan bool, 64)
-
- url, _ := url.Parse(s.URL)
- go func() {
- err := http.ListenAndServe(url.Host, s)
- if err != nil {
- panic(err)
- }
- }()
-
- s.PrepareResponse(202, nil, "Nothing.")
- for {
- // Wait for it to be up.
- resp, err := http.Get(s.URL)
- if err == nil && resp.StatusCode == 202 {
- break
- }
- fmt.Fprintf(os.Stderr, "\nWaiting for fake server to be up... ")
- time.Sleep(1e8)
- }
- fmt.Fprintf(os.Stderr, "done\n\n")
- s.WaitRequest() // Consume dummy request.
-}
-
-// FlushRequests discards requests which were not yet consumed by WaitRequest.
-func (s *TestHTTPServer) FlushRequests() {
- for {
- select {
- case <-s.request:
- default:
- return
- }
- }
-}
-
-func (s *TestHTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- s.request <- req
- var resp *testResponse
- select {
- case resp = <-s.response:
- case <-time.After(s.Timeout):
- fmt.Fprintf(os.Stderr, "ERROR: Timeout waiting for test to provide response\n")
- resp = &testResponse{500, nil, ""}
- }
- if resp.Headers != nil {
- h := w.Header()
- for k, v := range resp.Headers {
- h.Set(k, v)
- }
- }
- if resp.Status != 0 {
- w.WriteHeader(resp.Status)
- }
- w.Write([]byte(resp.Body))
-}
-
-func (s *TestHTTPServer) WaitRequest() *http.Request {
- select {
- case req := <-s.request:
- req.ParseForm()
- return req
- case <-time.After(s.Timeout):
- panic("Timeout waiting for goamz request")
- }
- panic("unreached")
-}
-
-func (s *TestHTTPServer) PrepareResponse(status int, headers map[string]string, body string) {
- s.response <- &testResponse{status, headers, body}
-}
diff --git a/vendor/github.com/goamz/goamz/sts/responses_test.go b/vendor/github.com/goamz/goamz/sts/responses_test.go
deleted file mode 100644
index b25f495e2..000000000
--- a/vendor/github.com/goamz/goamz/sts/responses_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package sts_test
-
-var AssumeRoleResponse = `
-<AssumeRoleResponse xmlns="https://sts.amazonaws.com/doc/
-2011-06-15/">
- <AssumeRoleResult>
- <Credentials>
- <SessionToken>
- AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQW
- LWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGd
- QrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU
- 9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz
- +scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==
- </SessionToken>
- <SecretAccessKey>
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- </SecretAccessKey>
- <Expiration>2011-07-15T23:28:33.359Z</Expiration>
- <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>
- </Credentials>
- <AssumedRoleUser>
- <Arn>arn:aws:sts::123456789012:assumed-role/demo/Bob</Arn>
- <AssumedRoleId>ARO123EXAMPLE123:Bob</AssumedRoleId>
- </AssumedRoleUser>
- <PackedPolicySize>6</PackedPolicySize>
- </AssumeRoleResult>
- <ResponseMetadata>
- <RequestId>c6104cbe-af31-11e0-8154-cbc7ccf896c7</RequestId>
- </ResponseMetadata>
-</AssumeRoleResponse>
-`
-
-var GetFederationTokenResponse = `
-<GetFederationTokenResponse xmlns="https://sts.amazonaws.com/doc/
-2011-06-15/">
- <GetFederationTokenResult>
- <Credentials>
- <SessionToken>
- AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQW
- LWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGd
- QrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU
- 9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz
- +scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==
- </SessionToken>
- <SecretAccessKey>
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- </SecretAccessKey>
- <Expiration>2011-07-15T23:28:33.359Z</Expiration>
- <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>
- </Credentials>
- <FederatedUser>
- <Arn>arn:aws:sts::123456789012:federated-user/Bob</Arn>
- <FederatedUserId>123456789012:Bob</FederatedUserId>
- </FederatedUser>
- <PackedPolicySize>6</PackedPolicySize>
- </GetFederationTokenResult>
- <ResponseMetadata>
- <RequestId>c6104cbe-af31-11e0-8154-cbc7ccf896c7</RequestId>
- </ResponseMetadata>
-</GetFederationTokenResponse>
-`
-
-var GetSessionTokenResponse = `
-<GetSessionTokenResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
- <GetSessionTokenResult>
- <Credentials>
- <SessionToken>
- AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh3c/L
- To6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4IgRmpRV3z
- rkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15fjrBs2+cTQtp
- Z3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE
- </SessionToken>
- <SecretAccessKey>
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- </SecretAccessKey>
- <Expiration>2011-07-11T19:55:29.611Z</Expiration>
- <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>
- </Credentials>
- </GetSessionTokenResult>
- <ResponseMetadata>
- <RequestId>58c5dbae-abef-11e0-8cfe-09039844ac7d</RequestId>
- </ResponseMetadata>
-</GetSessionTokenResponse>
-`
diff --git a/vendor/github.com/goamz/goamz/sts/sts.go b/vendor/github.com/goamz/goamz/sts/sts.go
deleted file mode 100644
index 973969223..000000000
--- a/vendor/github.com/goamz/goamz/sts/sts.go
+++ /dev/null
@@ -1,273 +0,0 @@
-//
-// sts: This package provides types and functions to interact with the AWS STS API
-//
-// Depends on https://github.com/goamz/goamz
-//
-
-package sts
-
-import (
- "encoding/xml"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/goamz/goamz/aws"
-)
-
-// The STS type encapsulates operations within a specific EC2 region.
-type STS struct {
- aws.Auth
- aws.Region
- private byte // Reserve the right of using private data.
-}
-
-// New creates a new STS Client.
-// We can only use us-east for region because AWS..
-func New(auth aws.Auth, region aws.Region) *STS {
- // Make sure we can run the package tests
- if region.Name == "" {
- return &STS{auth, region, 0}
- }
- return &STS{auth, aws.Regions["us-east-1"], 0}
-}
-
-const debug = false
-
-// ----------------------------------------------------------------------------
-// Request dispatching logic.
-
-// Error encapsulates an error returned by the AWS STS API.
-//
-// See http://goo.gl/zDZbuQ for more details.
-type Error struct {
- // HTTP status code (200, 403, ...)
- StatusCode int
- // STS error code
- Code string
- // The human-oriented error message
- Message string
- RequestId string `xml:"RequestID"`
-}
-
-func (err *Error) Error() string {
- if err.Code == "" {
- return err.Message
- }
-
- return fmt.Sprintf("%s (%s)", err.Message, err.Code)
-}
-
-type xmlErrors struct {
- RequestId string `xml:"RequestId"`
- Errors []Error `xml:"Error"`
-}
-
-func (sts *STS) query(params map[string]string, resp interface{}) error {
- params["Version"] = "2011-06-15"
-
- data := strings.NewReader(multimap(params).Encode())
-
- hreq, err := http.NewRequest("POST", sts.Region.STSEndpoint+"/", data)
- if err != nil {
- return err
- }
-
- hreq.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
-
- token := sts.Auth.Token()
- if token != "" {
- hreq.Header.Set("X-Amz-Security-Token", token)
- }
-
- signer := aws.NewV4Signer(sts.Auth, "sts", sts.Region)
- signer.Sign(hreq)
-
- if debug {
- log.Printf("%v -> {\n", hreq)
- }
- r, err := http.DefaultClient.Do(hreq)
-
- if err != nil {
- log.Printf("Error calling Amazon")
- return err
- }
-
- defer r.Body.Close()
-
- if debug {
- dump, _ := httputil.DumpResponse(r, true)
- log.Printf("response:\n")
- log.Printf("%v\n}\n", string(dump))
- }
- if r.StatusCode != 200 {
- return buildError(r)
- }
- err = xml.NewDecoder(r.Body).Decode(resp)
- return err
-}
-
-func buildError(r *http.Response) error {
- var (
- err Error
- errors xmlErrors
- )
- xml.NewDecoder(r.Body).Decode(&errors)
- if len(errors.Errors) > 0 {
- err = errors.Errors[0]
- }
-
- err.RequestId = errors.RequestId
- err.StatusCode = r.StatusCode
- if err.Message == "" {
- err.Message = r.Status
- }
- return &err
-}
-
-func makeParams(action string) map[string]string {
- params := make(map[string]string)
- params["Action"] = action
- return params
-}
-
-func multimap(p map[string]string) url.Values {
- q := make(url.Values, len(p))
- for k, v := range p {
- q[k] = []string{v}
- }
- return q
-}
-
-// options for the AssumeRole function
-//
-// See http://goo.gl/Ld6Dbk for details
-type AssumeRoleParams struct {
- DurationSeconds int
- ExternalId string
- Policy string
- RoleArn string
- RoleSessionName string
-}
-
-type AssumedRoleUser struct {
- Arn string `xml:"Arn"`
- AssumedRoleId string `xml:"AssumedRoleId"`
-}
-
-type Credentials struct {
- AccessKeyId string `xml:"AccessKeyId"`
- Expiration time.Time `xml:"Expiration"`
- SecretAccessKey string `xml:"SecretAccessKey"`
- SessionToken string `xml:"SessionToken"`
-}
-
-type AssumeRoleResult struct {
- AssumedRoleUser AssumedRoleUser `xml:"AssumeRoleResult>AssumedRoleUser"`
- Credentials Credentials `xml:"AssumeRoleResult>Credentials"`
- PackedPolicySize int `xml:"AssumeRoleResult>PackedPolicySize"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// AssumeRole assumes the specified role
-//
-// See http://goo.gl/zDZbuQ for more details.
-func (sts *STS) AssumeRole(options *AssumeRoleParams) (resp *AssumeRoleResult, err error) {
- params := makeParams("AssumeRole")
-
- params["RoleArn"] = options.RoleArn
- params["RoleSessionName"] = options.RoleSessionName
-
- if options.DurationSeconds != 0 {
- params["DurationSeconds"] = strconv.Itoa(options.DurationSeconds)
- }
- if options.ExternalId != "" {
- params["ExternalId"] = options.ExternalId
- }
- if options.Policy != "" {
- params["Policy"] = options.Policy
- }
-
- resp = new(AssumeRoleResult)
- if err := sts.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// FederatedUser presents dentifiers for the federated user that is associated with the credentials.
-//
-// See http://goo.gl/uPtr7V for more details
-type FederatedUser struct {
- Arn string `xml:"Arn"`
- FederatedUserId string `xml:"FederatedUserId"`
-}
-
-// GetFederationToken wraps GetFederationToken response
-//
-// See http://goo.gl/Iujjeg for more details
-type GetFederationTokenResult struct {
- Credentials Credentials `xml:"GetFederationTokenResult>Credentials"`
- FederatedUser FederatedUser `xml:"GetFederationTokenResult>FederatedUser"`
- PackedPolicySize int `xml:"GetFederationTokenResult>PackedPolicySize"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// GetFederationToken returns a set of temporary credentials for an AWS account or IAM user
-//
-// See http://goo.gl/Iujjeg for more details
-func (sts *STS) GetFederationToken(name, policy string, durationSeconds int) (
- resp *GetFederationTokenResult, err error) {
- params := makeParams("GetFederationToken")
- params["Name"] = name
-
- if durationSeconds != 0 {
- params["DurationSeconds"] = strconv.Itoa(durationSeconds)
- }
- if policy != "" {
- params["Policy"] = policy
- }
-
- resp = new(GetFederationTokenResult)
- if err := sts.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-// GetSessionToken wraps GetSessionToken response
-//
-// See http://goo.gl/v8s5Y for more details
-type GetSessionTokenResult struct {
- Credentials Credentials `xml:"GetSessionTokenResult>Credentials"`
- RequestId string `xml:"ResponseMetadata>RequestId"`
-}
-
-// GetSessionToken returns a set of temporary credentials for an AWS account or IAM user
-//
-// See http://goo.gl/v8s5Y for more details
-func (sts *STS) GetSessionToken(durationSeconds int, serialnNumber, tokenCode string) (
- resp *GetSessionTokenResult, err error) {
- params := makeParams("GetSessionToken")
-
- if durationSeconds != 0 {
- params["DurationSeconds"] = strconv.Itoa(durationSeconds)
- }
- if serialnNumber != "" {
- params["SerialNumber"] = serialnNumber
- }
- if tokenCode != "" {
- params["TokenCode"] = tokenCode
- }
-
- resp = new(GetSessionTokenResult)
- if err := sts.query(params, resp); err != nil {
- return nil, err
- }
- return resp, nil
-}
diff --git a/vendor/github.com/goamz/goamz/sts/sts_test.go b/vendor/github.com/goamz/goamz/sts/sts_test.go
deleted file mode 100644
index 354c6272f..000000000
--- a/vendor/github.com/goamz/goamz/sts/sts_test.go
+++ /dev/null
@@ -1,151 +0,0 @@
-package sts_test
-
-import (
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/sts"
- "github.com/goamz/goamz/testutil"
-)
-
-func Test(t *testing.T) {
- TestingT(t)
-}
-
-var _ = Suite(&S{})
-
-type S struct {
- sts *sts.STS
-}
-
-var testServer = testutil.NewHTTPServer()
-
-var mockTest bool
-
-func (s *S) SetUpSuite(c *C) {
- testServer.Start()
- auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
- s.sts = sts.New(auth, aws.Region{STSEndpoint: testServer.URL})
-}
-
-func (s *S) TearDownTest(c *C) {
- testServer.Flush()
-}
-
-func (s *S) TestAssumeRole(c *C) {
- testServer.Response(200, nil, AssumeRoleResponse)
- request := &sts.AssumeRoleParams{
- DurationSeconds: 3600,
- ExternalId: "123ABC",
- Policy: `{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:*","Resource":"*"}]}`,
- RoleArn: "arn:aws:iam::123456789012:role/demo",
- RoleSessionName: "Bob",
- }
- resp, err := s.sts.AssumeRole(request)
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2011-06-15")
- c.Assert(values.Get("Action"), Equals, "AssumeRole")
- c.Assert(values.Get("DurationSeconds"), Equals, "3600")
- c.Assert(values.Get("ExternalId"), Equals, "123ABC")
- c.Assert(values.Get("Policy"), Equals, `{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:*","Resource":"*"}]}`)
- c.Assert(values.Get("RoleArn"), Equals, "arn:aws:iam::123456789012:role/demo")
- c.Assert(values.Get("RoleSessionName"), Equals, "Bob")
- // Response test
- exp, _ := time.Parse(time.RFC3339, "2011-07-15T23:28:33.359Z")
- c.Assert(resp.RequestId, Equals, "c6104cbe-af31-11e0-8154-cbc7ccf896c7")
- c.Assert(resp.PackedPolicySize, Equals, 6)
- c.Assert(resp.AssumedRoleUser, DeepEquals, sts.AssumedRoleUser{
- Arn: "arn:aws:sts::123456789012:assumed-role/demo/Bob",
- AssumedRoleId: "ARO123EXAMPLE123:Bob",
- })
- c.Assert(resp.Credentials, DeepEquals, sts.Credentials{
- SessionToken: `
- AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQW
- LWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGd
- QrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU
- 9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz
- +scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==
- `,
- SecretAccessKey: `
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- `,
- AccessKeyId: "AKIAIOSFODNN7EXAMPLE",
- Expiration: exp,
- })
-
-}
-
-func (s *S) TestGetFederationToken(c *C) {
- testServer.Response(200, nil, GetFederationTokenResponse)
- resp, err := s.sts.GetFederationToken(
- "Bob",
- `{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:*","Resource":"*"}]}`,
- 3600,
- )
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2011-06-15")
- c.Assert(values.Get("Action"), Equals, "GetFederationToken")
- c.Assert(values.Get("DurationSeconds"), Equals, "3600")
- c.Assert(values.Get("Policy"), Equals, `{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:*","Resource":"*"}]}`)
- c.Assert(values.Get("Name"), Equals, "Bob")
- // Response test
- exp, _ := time.Parse(time.RFC3339, "2011-07-15T23:28:33.359Z")
- c.Assert(resp.RequestId, Equals, "c6104cbe-af31-11e0-8154-cbc7ccf896c7")
- c.Assert(resp.PackedPolicySize, Equals, 6)
- c.Assert(resp.FederatedUser, DeepEquals, sts.FederatedUser{
- Arn: "arn:aws:sts::123456789012:federated-user/Bob",
- FederatedUserId: "123456789012:Bob",
- })
- c.Assert(resp.Credentials, DeepEquals, sts.Credentials{
- SessionToken: `
- AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQW
- LWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGd
- QrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU
- 9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz
- +scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==
- `,
- SecretAccessKey: `
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- `,
- AccessKeyId: "AKIAIOSFODNN7EXAMPLE",
- Expiration: exp,
- })
-
-}
-
-func (s *S) TestGetSessionToken(c *C) {
- testServer.Response(200, nil, GetSessionTokenResponse)
- resp, err := s.sts.GetSessionToken(3600, "YourMFADeviceSerialNumber", "123456")
- c.Assert(err, IsNil)
- values := testServer.WaitRequest().PostForm
- // Post request test
- c.Assert(values.Get("Version"), Equals, "2011-06-15")
- c.Assert(values.Get("Action"), Equals, "GetSessionToken")
- c.Assert(values.Get("DurationSeconds"), Equals, "3600")
- c.Assert(values.Get("SerialNumber"), Equals, "YourMFADeviceSerialNumber")
- c.Assert(values.Get("TokenCode"), Equals, "123456")
- // Response test
- exp, _ := time.Parse(time.RFC3339, "2011-07-11T19:55:29.611Z")
- c.Assert(resp.RequestId, Equals, "58c5dbae-abef-11e0-8cfe-09039844ac7d")
- c.Assert(resp.Credentials, DeepEquals, sts.Credentials{
- SessionToken: `
- AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh3c/L
- To6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4IgRmpRV3z
- rkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15fjrBs2+cTQtp
- Z3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE
- `,
- SecretAccessKey: `
- wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
- `,
- AccessKeyId: "AKIAIOSFODNN7EXAMPLE",
- Expiration: exp,
- })
-
-}
diff --git a/vendor/github.com/goamz/goamz/testutil/http.go b/vendor/github.com/goamz/goamz/testutil/http.go
deleted file mode 100644
index ccc570cdd..000000000
--- a/vendor/github.com/goamz/goamz/testutil/http.go
+++ /dev/null
@@ -1,180 +0,0 @@
-package testutil
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
- "net/url"
- "os"
- "time"
-)
-
-type HTTPServer struct {
- URL string
- Timeout time.Duration
- started bool
- request chan *http.Request
- response chan ResponseFunc
-}
-
-type Response struct {
- Status int
- Headers map[string]string
- Body string
-}
-
-var DefaultClient = &http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- },
-}
-
-func NewHTTPServer() *HTTPServer {
- return &HTTPServer{URL: "http://localhost:4444", Timeout: 5 * time.Second}
-}
-
-type ResponseFunc func(path string) Response
-
-func (s *HTTPServer) Start() {
- if s.started {
- return
- }
- s.started = true
- s.request = make(chan *http.Request, 1024)
- s.response = make(chan ResponseFunc, 1024)
- u, err := url.Parse(s.URL)
- if err != nil {
- panic(err)
- }
- l, err := net.Listen("tcp", u.Host)
- if err != nil {
- panic(err)
- }
- go http.Serve(l, s)
-
- s.Response(203, nil, "")
- for {
- // Wait for it to be up.
- resp, err := http.Get(s.URL)
- if err == nil && resp.StatusCode == 203 {
- break
- }
- time.Sleep(1e8)
- }
- s.WaitRequest() // Consume dummy request.
-}
-
-// Flush discards all pending requests and responses.
-func (s *HTTPServer) Flush() {
- for {
- select {
- case <-s.request:
- case <-s.response:
- default:
- return
- }
- }
-}
-
-func body(req *http.Request) string {
- data, err := ioutil.ReadAll(req.Body)
- if err != nil {
- panic(err)
- }
- return string(data)
-}
-
-func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- req.ParseMultipartForm(1e6)
- data, err := ioutil.ReadAll(req.Body)
- if err != nil {
- panic(err)
- }
- req.Body = ioutil.NopCloser(bytes.NewBuffer(data))
- s.request <- req
- var resp Response
- select {
- case respFunc := <-s.response:
- resp = respFunc(req.URL.Path)
- case <-time.After(s.Timeout):
- const msg = "ERROR: Timeout waiting for test to prepare a response\n"
- fmt.Fprintf(os.Stderr, msg)
- resp = Response{500, nil, msg}
- }
- if resp.Headers != nil {
- h := w.Header()
- for k, v := range resp.Headers {
- h.Set(k, v)
- }
- }
- if resp.Status != 0 {
- w.WriteHeader(resp.Status)
- }
- w.Write([]byte(resp.Body))
-}
-
-// WaitRequests returns the next n requests made to the http server from
-// the queue. If not enough requests were previously made, it waits until
-// the timeout value for them to be made.
-func (s *HTTPServer) WaitRequests(n int) []*http.Request {
- reqs := make([]*http.Request, 0, n)
- for i := 0; i < n; i++ {
- select {
- case req := <-s.request:
- reqs = append(reqs, req)
- case <-time.After(s.Timeout):
- panic("Timeout waiting for request")
- }
- }
- return reqs
-}
-
-// WaitRequest returns the next request made to the http server from
-// the queue. If no requests were previously made, it waits until the
-// timeout value for one to be made.
-func (s *HTTPServer) WaitRequest() *http.Request {
- return s.WaitRequests(1)[0]
-}
-
-// ResponseFunc prepares the test server to respond the following n
-// requests using f to build each response.
-func (s *HTTPServer) ResponseFunc(n int, f ResponseFunc) {
- for i := 0; i < n; i++ {
- s.response <- f
- }
-}
-
-// ResponseMap maps request paths to responses.
-type ResponseMap map[string]Response
-
-// ResponseMap prepares the test server to respond the following n
-// requests using the m to obtain the responses.
-func (s *HTTPServer) ResponseMap(n int, m ResponseMap) {
- f := func(path string) Response {
- for rpath, resp := range m {
- if rpath == path {
- return resp
- }
- }
- body := "Path not found in response map: " + path
- return Response{Status: 500, Body: body}
- }
- s.ResponseFunc(n, f)
-}
-
-// Responses prepares the test server to respond the following n requests
-// using the provided response parameters.
-func (s *HTTPServer) Responses(n int, status int, headers map[string]string, body string) {
- f := func(path string) Response {
- return Response{status, headers, body}
- }
- s.ResponseFunc(n, f)
-}
-
-// Response prepares the test server to respond the following request
-// using the provided response parameters.
-func (s *HTTPServer) Response(status int, headers map[string]string, body string) {
- s.Responses(1, status, headers, body)
-}
diff --git a/vendor/github.com/goamz/goamz/testutil/suite.go b/vendor/github.com/goamz/goamz/testutil/suite.go
deleted file mode 100644
index f4519aa4e..000000000
--- a/vendor/github.com/goamz/goamz/testutil/suite.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package testutil
-
-import (
- "flag"
-
- "github.com/goamz/goamz/aws"
- . "gopkg.in/check.v1"
-)
-
-// Amazon must be used by all tested packages to determine whether to
-// run functional tests against the real AWS servers.
-var Amazon bool
-
-func init() {
- flag.BoolVar(&Amazon, "amazon", false, "Enable tests against amazon server")
-}
-
-type LiveSuite struct {
- auth aws.Auth
-}
-
-func (s *LiveSuite) SetUpSuite(c *C) {
- if !Amazon {
- c.Skip("amazon tests not enabled (-amazon flag)")
- }
- auth, err := aws.EnvAuth()
- if err != nil {
- c.Fatal(err.Error())
- }
- s.auth = auth
-}
diff --git a/vendor/github.com/golang/protobuf/descriptor/descriptor.go b/vendor/github.com/golang/protobuf/descriptor/descriptor.go
index 83607ff6c..ac7e51bfb 100644
--- a/vendor/github.com/golang/protobuf/descriptor/descriptor.go
+++ b/vendor/github.com/golang/protobuf/descriptor/descriptor.go
@@ -43,7 +43,7 @@ import (
"io/ioutil"
"github.com/golang/protobuf/proto"
- protobuf "google.golang.org/genproto/protobuf"
+ protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
)
// extractFile extracts a FileDescriptorProto from a gzip'd buffer.
diff --git a/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go b/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go
index 282a1e3a7..27b0729cb 100644
--- a/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go
+++ b/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go
@@ -6,7 +6,7 @@ import (
"github.com/golang/protobuf/descriptor"
tpb "github.com/golang/protobuf/proto/testdata"
- protobuf "google.golang.org/genproto/protobuf"
+ protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
)
func TestMessage(t *testing.T) {
diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile
index b1ac45c77..a0bf9fefd 100644
--- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile
+++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile
@@ -45,9 +45,9 @@ my_test/test.pb.go: my_test/test.proto
golden:
make -B my_test/test.pb.go
- sed -i '/return.*fileDescriptor/d' my_test/test.pb.go
- sed -i '/^var fileDescriptor/,/^}/d' my_test/test.pb.go
- sed -i '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go
+ sed -i -e '/return.*fileDescriptor/d' my_test/test.pb.go
+ sed -i -e '/^var fileDescriptor/,/^}/d' my_test/test.pb.go
+ sed -i -e '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go
gofmt -w my_test/test.pb.go
diff -w my_test/test.pb.go my_test/test.pb.go.golden
diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
index 9ec3e1292..d8717d57d 100644
--- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
+++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
@@ -319,7 +319,7 @@ func (m *Reply) GetCompactKeys() []int32 {
type Reply_Entry struct {
KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"`
Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"`
- XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=myFieldName2" json:"_my_field_name_2,omitempty"`
+ XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
@@ -389,6 +389,7 @@ var E_ReplyExtensions_Time = &proto.ExtensionDesc{
Field: 101,
Name: "my.test.ReplyExtensions.time",
Tag: "fixed64,101,opt,name=time",
+ Filename: "my_test/test.proto",
}
var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
@@ -397,6 +398,7 @@ var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
Field: 105,
Name: "my.test.ReplyExtensions.carrot",
Tag: "bytes,105,opt,name=carrot",
+ Filename: "my_test/test.proto",
}
var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
@@ -405,6 +407,7 @@ var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
Field: 101,
Name: "my.test.ReplyExtensions.donut",
Tag: "bytes,101,opt,name=donut",
+ Filename: "my_test/test.proto",
}
type OtherReplyExtensions struct {
@@ -832,6 +835,7 @@ var E_Tag = &proto.ExtensionDesc{
Field: 103,
Name: "my.test.tag",
Tag: "bytes,103,opt,name=tag",
+ Filename: "my_test/test.proto",
}
var E_Donut = &proto.ExtensionDesc{
@@ -840,6 +844,7 @@ var E_Donut = &proto.ExtensionDesc{
Field: 106,
Name: "my.test.donut",
Tag: "bytes,106,opt,name=donut",
+ Filename: "my_test/test.proto",
}
func init() {
diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden
index 9ec3e1292..d8717d57d 100644
--- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden
+++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden
@@ -319,7 +319,7 @@ func (m *Reply) GetCompactKeys() []int32 {
type Reply_Entry struct {
KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"`
Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"`
- XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=myFieldName2" json:"_my_field_name_2,omitempty"`
+ XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
@@ -389,6 +389,7 @@ var E_ReplyExtensions_Time = &proto.ExtensionDesc{
Field: 101,
Name: "my.test.ReplyExtensions.time",
Tag: "fixed64,101,opt,name=time",
+ Filename: "my_test/test.proto",
}
var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
@@ -397,6 +398,7 @@ var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
Field: 105,
Name: "my.test.ReplyExtensions.carrot",
Tag: "bytes,105,opt,name=carrot",
+ Filename: "my_test/test.proto",
}
var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
@@ -405,6 +407,7 @@ var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
Field: 101,
Name: "my.test.ReplyExtensions.donut",
Tag: "bytes,101,opt,name=donut",
+ Filename: "my_test/test.proto",
}
type OtherReplyExtensions struct {
@@ -832,6 +835,7 @@ var E_Tag = &proto.ExtensionDesc{
Field: 103,
Name: "my.test.tag",
Tag: "bytes,103,opt,name=tag",
+ Filename: "my_test/test.proto",
}
var E_Donut = &proto.ExtensionDesc{
@@ -840,6 +844,7 @@ var E_Donut = &proto.ExtensionDesc{
Field: 106,
Name: "my.test.donut",
Tag: "bytes,106,opt,name=donut",
+ Filename: "my_test/test.proto",
}
func init() {
diff --git a/vendor/github.com/jaytaylor/html2text/.gitignore b/vendor/github.com/jaytaylor/html2text/.gitignore
new file mode 100644
index 000000000..daf913b1b
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/.gitignore
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
diff --git a/vendor/github.com/jaytaylor/html2text/.travis.yml b/vendor/github.com/jaytaylor/html2text/.travis.yml
new file mode 100644
index 000000000..6c7f48efd
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/.travis.yml
@@ -0,0 +1,14 @@
+language: go
+go:
+ - tip
+ - 1.8
+ - 1.7
+ - 1.6
+ - 1.5
+ - 1.4
+ - 1.3
+ - 1.2
+notifications:
+ email:
+ on_success: change
+ on_failure: always
diff --git a/vendor/github.com/jaytaylor/html2text/LICENSE b/vendor/github.com/jaytaylor/html2text/LICENSE
new file mode 100644
index 000000000..24dc4abec
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Jay Taylor
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/vendor/github.com/jaytaylor/html2text/README.md b/vendor/github.com/jaytaylor/html2text/README.md
new file mode 100644
index 000000000..ac1124739
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/README.md
@@ -0,0 +1,116 @@
+# html2text
+
+[![Documentation](https://godoc.org/github.com/jaytaylor/html2text?status.svg)](https://godoc.org/github.com/jaytaylor/html2text)
+[![Build Status](https://travis-ci.org/jaytaylor/html2text.svg?branch=master)](https://travis-ci.org/jaytaylor/html2text)
+[![Report Card](https://goreportcard.com/badge/github.com/jaytaylor/html2text)](https://goreportcard.com/report/github.com/jaytaylor/html2text)
+
+### Converts HTML into text
+
+
+## Introduction
+
+Ensure your emails are readable by all!
+
+Turns HTML into raw text, useful for sending fancy HTML emails with a equivalently nicely formatted TXT document as a fallback (e.g. for people who don't allow HTML emails or have other display issues).
+
+html2text is a simple golang package for rendering HTML into plaintext.
+
+There are still lots of improvements to be had, but FWIW this has worked fine for my [basic] HTML-2-text needs.
+
+It requires go 1.x or newer ;)
+
+
+## Download the package
+
+```bash
+go get github.com/jaytaylor/html2text
+```
+
+## Example usage
+
+```go
+package main
+
+import (
+ "fmt"
+
+ "github.com/jaytaylor/html2text"
+)
+
+func main() {
+ inputHtml := `
+ <html>
+ <head>
+ <title>My Mega Service</title>
+ <link rel=\"stylesheet\" href=\"main.css\">
+ <style type=\"text/css\">body { color: #fff; }</style>
+ </head>
+
+ <body>
+ <div class="logo">
+ <a href="http://mymegaservice.com/"><img src="/logo-image.jpg" alt="Mega Service"/></a>
+ </div>
+
+ <h1>Welcome to your new account on my service!</h1>
+
+ <p>
+ Here is some more information:
+
+ <ul>
+ <li>Link 1: <a href="https://example.com">Example.com</a></li>
+ <li>Link 2: <a href="https://example2.com">Example2.com</a></li>
+ <li>Something else</li>
+ </ul>
+ </p>
+ </body>
+ </html>
+ `
+
+ text, err := html2text.FromString(inputHtml)
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println(text)
+}
+```
+
+Output:
+```
+Mega Service ( http://mymegaservice.com/ )
+
+******************************************
+Welcome to your new account on my service!
+******************************************
+
+Here is some more information:
+
+* Link 1: Example.com ( https://example.com )
+* Link 2: Example2.com ( https://example2.com )
+* Something else
+```
+
+
+## Unit-tests
+
+Running the unit-tests is straightforward and standard:
+
+```bash
+go test
+```
+
+
+# License
+
+Permissive MIT license.
+
+
+## Contact
+
+You are more than welcome to open issues and send pull requests if you find a bug or want a new feature.
+
+If you appreciate this library please feel free to drop me a line and tell me! It's always nice to hear from people who have benefitted from my work.
+
+Email: jay at (my github username).com
+
+Twitter: [@jtaylor](https://twitter.com/jtaylor)
+
diff --git a/vendor/github.com/jaytaylor/html2text/html2text.go b/vendor/github.com/jaytaylor/html2text/html2text.go
new file mode 100644
index 000000000..2a013a039
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/html2text.go
@@ -0,0 +1,312 @@
+package html2text
+
+import (
+ "bytes"
+ "io"
+ "regexp"
+ "strings"
+ "unicode"
+
+ "github.com/ssor/bom"
+
+ "golang.org/x/net/html"
+ "golang.org/x/net/html/atom"
+)
+
+var (
+ spacingRe = regexp.MustCompile(`[ \r\n\t]+`)
+ newlineRe = regexp.MustCompile(`\n\n+`)
+)
+
+type textifyTraverseCtx struct {
+ Buf bytes.Buffer
+
+ prefix string
+ blockquoteLevel int
+ lineLength int
+ endsWithSpace bool
+ endsWithNewline bool
+ justClosedDiv bool
+}
+
+func (ctx *textifyTraverseCtx) traverse(node *html.Node) error {
+ switch node.Type {
+ default:
+ return ctx.traverseChildren(node)
+
+ case html.TextNode:
+ data := strings.Trim(spacingRe.ReplaceAllString(node.Data, " "), " ")
+ return ctx.emit(data)
+
+ case html.ElementNode:
+ return ctx.handleElementNode(node)
+ }
+}
+
+func (ctx *textifyTraverseCtx) handleElementNode(node *html.Node) error {
+ ctx.justClosedDiv = false
+ switch node.DataAtom {
+ case atom.Br:
+ return ctx.emit("\n")
+
+ case atom.H1, atom.H2, atom.H3:
+ subCtx := textifyTraverseCtx{}
+ if err := subCtx.traverseChildren(node); err != nil {
+ return err
+ }
+
+ str := subCtx.Buf.String()
+ dividerLen := 0
+ for _, line := range strings.Split(str, "\n") {
+ if lineLen := len([]rune(line)); lineLen-1 > dividerLen {
+ dividerLen = lineLen - 1
+ }
+ }
+ divider := ""
+ if node.DataAtom == atom.H1 {
+ divider = strings.Repeat("*", dividerLen)
+ } else {
+ divider = strings.Repeat("-", dividerLen)
+ }
+
+ if node.DataAtom == atom.H3 {
+ return ctx.emit("\n\n" + str + "\n" + divider + "\n\n")
+ }
+ return ctx.emit("\n\n" + divider + "\n" + str + "\n" + divider + "\n\n")
+
+ case atom.Blockquote:
+ ctx.blockquoteLevel++
+ ctx.prefix = strings.Repeat(">", ctx.blockquoteLevel) + " "
+ if err := ctx.emit("\n"); err != nil {
+ return err
+ }
+ if ctx.blockquoteLevel == 1 {
+ if err := ctx.emit("\n"); err != nil {
+ return err
+ }
+ }
+ if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+ ctx.blockquoteLevel--
+ ctx.prefix = strings.Repeat(">", ctx.blockquoteLevel)
+ if ctx.blockquoteLevel > 0 {
+ ctx.prefix += " "
+ }
+ return ctx.emit("\n\n")
+
+ case atom.Div:
+ if ctx.lineLength > 0 {
+ if err := ctx.emit("\n"); err != nil {
+ return err
+ }
+ }
+ if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+ var err error
+ if ctx.justClosedDiv == false {
+ err = ctx.emit("\n")
+ }
+ ctx.justClosedDiv = true
+ return err
+
+ case atom.Li:
+ if err := ctx.emit("* "); err != nil {
+ return err
+ }
+
+ if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+
+ return ctx.emit("\n")
+
+ case atom.B, atom.Strong:
+ subCtx := textifyTraverseCtx{}
+ subCtx.endsWithSpace = true
+ if err := subCtx.traverseChildren(node); err != nil {
+ return err
+ }
+ str := subCtx.Buf.String()
+ return ctx.emit("*" + str + "*")
+
+ case atom.A:
+ // If image is the only child, take its alt text as the link text
+ if img := node.FirstChild; img != nil && node.LastChild == img && img.DataAtom == atom.Img {
+ if altText := getAttrVal(img, "alt"); altText != "" {
+ ctx.emit(altText)
+ }
+ } else if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+
+ hrefLink := ""
+ if attrVal := getAttrVal(node, "href"); attrVal != "" {
+ attrVal = ctx.normalizeHrefLink(attrVal)
+ if attrVal != "" {
+ hrefLink = "( " + attrVal + " )"
+ }
+ }
+
+ return ctx.emit(hrefLink)
+
+ case atom.P, atom.Ul, atom.Table:
+ if err := ctx.emit("\n\n"); err != nil {
+ return err
+ }
+
+ if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+
+ return ctx.emit("\n\n")
+
+ case atom.Tr:
+ if err := ctx.traverseChildren(node); err != nil {
+ return err
+ }
+
+ return ctx.emit("\n")
+
+ case atom.Style, atom.Script, atom.Head:
+ // Ignore the subtree
+ return nil
+
+ default:
+ return ctx.traverseChildren(node)
+ }
+}
+func (ctx *textifyTraverseCtx) traverseChildren(node *html.Node) error {
+ for c := node.FirstChild; c != nil; c = c.NextSibling {
+ if err := ctx.traverse(c); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func (ctx *textifyTraverseCtx) emit(data string) error {
+ if len(data) == 0 {
+ return nil
+ }
+ lines := ctx.breakLongLines(data)
+ var err error
+ for _, line := range lines {
+ runes := []rune(line)
+ startsWithSpace := unicode.IsSpace(runes[0])
+ if !startsWithSpace && !ctx.endsWithSpace {
+ ctx.Buf.WriteByte(' ')
+ ctx.lineLength++
+ }
+ ctx.endsWithSpace = unicode.IsSpace(runes[len(runes)-1])
+ for _, c := range line {
+ _, err = ctx.Buf.WriteString(string(c))
+ if err != nil {
+ return err
+ }
+ ctx.lineLength++
+ if c == '\n' {
+ ctx.lineLength = 0
+ if ctx.prefix != "" {
+ _, err = ctx.Buf.WriteString(ctx.prefix)
+ if err != nil {
+ return err
+ }
+ }
+ }
+ }
+ }
+ return nil
+}
+
+func (ctx *textifyTraverseCtx) breakLongLines(data string) []string {
+ // only break lines when we are in blockquotes
+ if ctx.blockquoteLevel == 0 {
+ return []string{data}
+ }
+ var ret []string
+ runes := []rune(data)
+ l := len(runes)
+ existing := ctx.lineLength
+ if existing >= 74 {
+ ret = append(ret, "\n")
+ existing = 0
+ }
+ for l+existing > 74 {
+ i := 74 - existing
+ for i >= 0 && !unicode.IsSpace(runes[i]) {
+ i--
+ }
+ if i == -1 {
+ // no spaces, so go the other way
+ i = 74 - existing
+ for i < l && !unicode.IsSpace(runes[i]) {
+ i++
+ }
+ }
+ ret = append(ret, string(runes[:i])+"\n")
+ for i < l && unicode.IsSpace(runes[i]) {
+ i++
+ }
+ runes = runes[i:]
+ l = len(runes)
+ existing = 0
+ }
+ if len(runes) > 0 {
+ ret = append(ret, string(runes))
+ }
+ return ret
+}
+
+func (ctx *textifyTraverseCtx) normalizeHrefLink(link string) string {
+ link = strings.TrimSpace(link)
+ link = strings.TrimPrefix(link, "mailto:")
+ return link
+}
+
+func getAttrVal(node *html.Node, attrName string) string {
+ for _, attr := range node.Attr {
+ if attr.Key == attrName {
+ return attr.Val
+ }
+ }
+
+ return ""
+}
+
+func FromHtmlNode(doc *html.Node) (string, error) {
+ ctx := textifyTraverseCtx{
+ Buf: bytes.Buffer{},
+ }
+ if err := ctx.traverse(doc); err != nil {
+ return "", err
+ }
+
+ text := strings.TrimSpace(newlineRe.ReplaceAllString(
+ strings.Replace(ctx.Buf.String(), "\n ", "\n", -1), "\n\n"))
+ return text, nil
+
+}
+
+func FromReader(reader io.Reader) (string, error) {
+ newReader, err := bom.NewReaderWithoutBom(reader)
+ if err != nil {
+ return "", err
+ }
+ doc, err := html.Parse(newReader)
+ if err != nil {
+ return "", err
+ }
+ return FromHtmlNode(doc)
+}
+
+func FromString(input string) (string, error) {
+ bs := bom.CleanBom([]byte(input))
+ text, err := FromReader(bytes.NewReader(bs))
+ if err != nil {
+ return "", err
+ }
+ return text, nil
+}
diff --git a/vendor/github.com/jaytaylor/html2text/html2text_test.go b/vendor/github.com/jaytaylor/html2text/html2text_test.go
new file mode 100644
index 000000000..b30d68ac9
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/html2text_test.go
@@ -0,0 +1,674 @@
+package html2text
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "path"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+const (
+ destPath = "testdata"
+)
+
+func TestParseUTF8(t *testing.T) {
+ htmlFiles := []struct {
+ file string
+ keywordShouldNotExist string
+ keywordShouldExist string
+ }{
+ {
+ "utf8.html",
+ "学习之道:美国公认学习第一书title",
+ "次世界冠军赛上,我几近疯狂",
+ },
+ {
+ "utf8_with_bom.xhtml",
+ "1892年波兰文版序言title",
+ "种新的波兰文本已成为必要",
+ },
+ }
+
+ for _, htmlFile := range htmlFiles {
+ bs, err := ioutil.ReadFile(path.Join(destPath, htmlFile.file))
+ if err != nil {
+ t.Fatal(err)
+ }
+ text, err := FromReader(bytes.NewReader(bs))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(text, htmlFile.keywordShouldExist) {
+ t.Fatalf("keyword %s should exists in file %s", htmlFile.keywordShouldExist, htmlFile.file)
+ }
+ if strings.Contains(text, htmlFile.keywordShouldNotExist) {
+ t.Fatalf("keyword %s should not exists in file %s", htmlFile.keywordShouldNotExist, htmlFile.file)
+ }
+ }
+}
+
+func TestStrippingWhitespace(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "test text",
+ "test text",
+ },
+ {
+ " \ttext\ntext\n",
+ "text text",
+ },
+ {
+ " \na \n\t \n \n a \t",
+ "a a",
+ },
+ {
+ "test text",
+ "test text",
+ },
+ {
+ "test&nbsp;&nbsp;&nbsp; text&nbsp;",
+ "test    text",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestParagraphsAndBreaks(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "Test text",
+ "Test text",
+ },
+ {
+ "Test text<br>",
+ "Test text",
+ },
+ {
+ "Test text<br>Test",
+ "Test text\nTest",
+ },
+ {
+ "<p>Test text</p>",
+ "Test text",
+ },
+ {
+ "<p>Test text</p><p>Test text</p>",
+ "Test text\n\nTest text",
+ },
+ {
+ "\n<p>Test text</p>\n\n\n\t<p>Test text</p>\n",
+ "Test text\n\nTest text",
+ },
+ {
+ "\n<p>Test text<br/>Test text</p>\n",
+ "Test text\nTest text",
+ },
+ {
+ "\n<p>Test text<br> \tTest text<br></p>\n",
+ "Test text\nTest text",
+ },
+ {
+ "Test text<br><BR />Test text",
+ "Test text\n\nTest text",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestTables(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<table><tr><td></td><td></td></tr></table>",
+ "",
+ },
+ {
+ "<table><tr><td>cell1</td><td>cell2</td></tr></table>",
+ "cell1 cell2",
+ },
+ {
+ "<table><tr><td>row1</td></tr><tr><td>row2</td></tr></table>",
+ "row1\nrow2",
+ },
+ {
+ `<table>
+ <tr><td>cell1-1</td><td>cell1-2</td></tr>
+ <tr><td>cell2-1</td><td>cell2-2</td></tr>
+ </table>`,
+ "cell1-1 cell1-2\ncell2-1 cell2-2",
+ },
+ {
+ "_<table><tr><td>cell</td></tr></table>_",
+ "_\n\ncell\n\n_",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestStrippingLists(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<ul></ul>",
+ "",
+ },
+ {
+ "<ul><li>item</li></ul>_",
+ "* item\n\n_",
+ },
+ {
+ "<li class='123'>item 1</li> <li>item 2</li>\n_",
+ "* item 1\n* item 2\n_",
+ },
+ {
+ "<li>item 1</li> \t\n <li>item 2</li> <li> item 3</li>\n_",
+ "* item 1\n* item 2\n* item 3\n_",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestLinks(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ `<a></a>`,
+ ``,
+ },
+ {
+ `<a href=""></a>`,
+ ``,
+ },
+ {
+ `<a href="http://example.com/"></a>`,
+ `( http://example.com/ )`,
+ },
+ {
+ `<a href="">Link</a>`,
+ `Link`,
+ },
+ {
+ `<a href="http://example.com/">Link</a>`,
+ `Link ( http://example.com/ )`,
+ },
+ {
+ `<a href="http://example.com/"><span class="a">Link</span></a>`,
+ `Link ( http://example.com/ )`,
+ },
+ {
+ "<a href='http://example.com/'>\n\t<span class='a'>Link</span>\n\t</a>",
+ `Link ( http://example.com/ )`,
+ },
+ {
+ "<a href='mailto:contact@example.org'>Contact Us</a>",
+ `Contact Us ( contact@example.org )`,
+ },
+ {
+ "<a href=\"http://example.com:80/~user?aaa=bb&amp;c=d,e,f#foo\">Link</a>",
+ `Link ( http://example.com:80/~user?aaa=bb&c=d,e,f#foo )`,
+ },
+ {
+ "<a title='title' href=\"http://example.com/\">Link</a>",
+ `Link ( http://example.com/ )`,
+ },
+ {
+ "<a href=\" http://example.com/ \"> Link </a>",
+ `Link ( http://example.com/ )`,
+ },
+ {
+ "<a href=\"http://example.com/a/\">Link A</a> <a href=\"http://example.com/b/\">Link B</a>",
+ `Link A ( http://example.com/a/ ) Link B ( http://example.com/b/ )`,
+ },
+ {
+ "<a href=\"%%LINK%%\">Link</a>",
+ `Link ( %%LINK%% )`,
+ },
+ {
+ "<a href=\"[LINK]\">Link</a>",
+ `Link ( [LINK] )`,
+ },
+ {
+ "<a href=\"{LINK}\">Link</a>",
+ `Link ( {LINK} )`,
+ },
+ {
+ "<a href=\"[[!unsubscribe]]\">Link</a>",
+ `Link ( [[!unsubscribe]] )`,
+ },
+ {
+ "<p>This is <a href=\"http://www.google.com\" >link1</a> and <a href=\"http://www.google.com\" >link2 </a> is next.</p>",
+ `This is link1 ( http://www.google.com ) and link2 ( http://www.google.com ) is next.`,
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestImageAltTags(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ `<img />`,
+ ``,
+ },
+ {
+ `<img src="http://example.ru/hello.jpg" />`,
+ ``,
+ },
+ {
+ `<img alt="Example"/>`,
+ ``,
+ },
+ {
+ `<img src="http://example.ru/hello.jpg" alt="Example"/>`,
+ ``,
+ },
+ // Images do matter if they are in a link
+ {
+ `<a href="http://example.com/"><img src="http://example.ru/hello.jpg" alt="Example"/></a>`,
+ `Example ( http://example.com/ )`,
+ },
+ {
+ `<a href="http://example.com/"><img src="http://example.ru/hello.jpg" alt="Example"></a>`,
+ `Example ( http://example.com/ )`,
+ },
+ {
+ `<a href='http://example.com/'><img src='http://example.ru/hello.jpg' alt='Example'/></a>`,
+ `Example ( http://example.com/ )`,
+ },
+ {
+ `<a href='http://example.com/'><img src='http://example.ru/hello.jpg' alt='Example'></a>`,
+ `Example ( http://example.com/ )`,
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestHeadings(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<h1>Test</h1>",
+ "****\nTest\n****",
+ },
+ {
+ "\t<h1>\nTest</h1> ",
+ "****\nTest\n****",
+ },
+ {
+ "\t<h1>\nTest line 1<br>Test 2</h1> ",
+ "***********\nTest line 1\nTest 2\n***********",
+ },
+ {
+ "<h1>Test</h1> <h1>Test</h1>",
+ "****\nTest\n****\n\n****\nTest\n****",
+ },
+ {
+ "<h2>Test</h2>",
+ "----\nTest\n----",
+ },
+ {
+ "<h1><a href='http://example.com/'>Test</a></h1>",
+ "****************************\nTest ( http://example.com/ )\n****************************",
+ },
+ {
+ "<h3> <span class='a'>Test </span></h3>",
+ "Test\n----",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+
+}
+
+func TestBold(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<b>Test</b>",
+ "*Test*",
+ },
+ {
+ "\t<b>Test</b> ",
+ "*Test*",
+ },
+ {
+ "\t<b>Test line 1<br>Test 2</b> ",
+ "*Test line 1\nTest 2*",
+ },
+ {
+ "<b>Test</b> <b>Test</b>",
+ "*Test* *Test*",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+
+}
+
+func TestDiv(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<div>Test</div>",
+ "Test",
+ },
+ {
+ "\t<div>Test</div> ",
+ "Test",
+ },
+ {
+ "<div>Test line 1<div>Test 2</div></div>",
+ "Test line 1\nTest 2",
+ },
+ {
+ "Test 1<div>Test 2</div> <div>Test 3</div>Test 4",
+ "Test 1\nTest 2\nTest 3\nTest 4",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+
+}
+
+func TestBlockquotes(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<div>level 0<blockquote>level 1<br><blockquote>level 2</blockquote>level 1</blockquote><div>level 0</div></div>",
+ "level 0\n> \n> level 1\n> \n>> level 2\n> \n> level 1\n\nlevel 0",
+ },
+ {
+ "<blockquote>Test</blockquote>Test",
+ "> \n> Test\n\nTest",
+ },
+ {
+ "\t<blockquote> \nTest<br></blockquote> ",
+ "> \n> Test\n>",
+ },
+ {
+ "\t<blockquote> \nTest line 1<br>Test 2</blockquote> ",
+ "> \n> Test line 1\n> Test 2",
+ },
+ {
+ "<blockquote>Test</blockquote> <blockquote>Test</blockquote> Other Test",
+ "> \n> Test\n\n> \n> Test\n\nOther Test",
+ },
+ {
+ "<blockquote>Lorem ipsum Commodo id consectetur pariatur ea occaecat minim aliqua ad sit consequat quis ex commodo Duis incididunt eu mollit consectetur fugiat voluptate dolore in pariatur in commodo occaecat Ut occaecat velit esse labore aute quis commodo non sit dolore officia Excepteur cillum amet cupidatat culpa velit labore ullamco dolore mollit elit in aliqua dolor irure do</blockquote>",
+ "> \n> Lorem ipsum Commodo id consectetur pariatur ea occaecat minim aliqua ad\n> sit consequat quis ex commodo Duis incididunt eu mollit consectetur fugiat\n> voluptate dolore in pariatur in commodo occaecat Ut occaecat velit esse\n> labore aute quis commodo non sit dolore officia Excepteur cillum amet\n> cupidatat culpa velit labore ullamco dolore mollit elit in aliqua dolor\n> irure do",
+ },
+ {
+ "<blockquote>Lorem<b>ipsum</b><b>Commodo</b><b>id</b><b>consectetur</b><b>pariatur</b><b>ea</b><b>occaecat</b><b>minim</b><b>aliqua</b><b>ad</b><b>sit</b><b>consequat</b><b>quis</b><b>ex</b><b>commodo</b><b>Duis</b><b>incididunt</b><b>eu</b><b>mollit</b><b>consectetur</b><b>fugiat</b><b>voluptate</b><b>dolore</b><b>in</b><b>pariatur</b><b>in</b><b>commodo</b><b>occaecat</b><b>Ut</b><b>occaecat</b><b>velit</b><b>esse</b><b>labore</b><b>aute</b><b>quis</b><b>commodo</b><b>non</b><b>sit</b><b>dolore</b><b>officia</b><b>Excepteur</b><b>cillum</b><b>amet</b><b>cupidatat</b><b>culpa</b><b>velit</b><b>labore</b><b>ullamco</b><b>dolore</b><b>mollit</b><b>elit</b><b>in</b><b>aliqua</b><b>dolor</b><b>irure</b><b>do</b></blockquote>",
+ "> \n> Lorem *ipsum* *Commodo* *id* *consectetur* *pariatur* *ea* *occaecat* *minim*\n> *aliqua* *ad* *sit* *consequat* *quis* *ex* *commodo* *Duis* *incididunt* *eu*\n> *mollit* *consectetur* *fugiat* *voluptate* *dolore* *in* *pariatur* *in* *commodo*\n> *occaecat* *Ut* *occaecat* *velit* *esse* *labore* *aute* *quis* *commodo*\n> *non* *sit* *dolore* *officia* *Excepteur* *cillum* *amet* *cupidatat* *culpa*\n> *velit* *labore* *ullamco* *dolore* *mollit* *elit* *in* *aliqua* *dolor* *irure*\n> *do*",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+
+}
+
+func TestIgnoreStylesScriptsHead(t *testing.T) {
+ testCases := []struct {
+ input string
+ output string
+ }{
+ {
+ "<style>Test</style>",
+ "",
+ },
+ {
+ "<style type=\"text/css\">body { color: #fff; }</style>",
+ "",
+ },
+ {
+ "<link rel=\"stylesheet\" href=\"main.css\">",
+ "",
+ },
+ {
+ "<script>Test</script>",
+ "",
+ },
+ {
+ "<script src=\"main.js\"></script>",
+ "",
+ },
+ {
+ "<script type=\"text/javascript\" src=\"main.js\"></script>",
+ "",
+ },
+ {
+ "<script type=\"text/javascript\">Test</script>",
+ "",
+ },
+ {
+ "<script type=\"text/ng-template\" id=\"template.html\"><a href=\"http://google.com\">Google</a></script>",
+ "",
+ },
+ {
+ "<script type=\"bla-bla-bla\" id=\"template.html\">Test</script>",
+ "",
+ },
+ {
+ `<html><head><title>Title</title></head><body></body></html>`,
+ "",
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertString(t, testCase.input, testCase.output)
+ }
+}
+
+func TestText(t *testing.T) {
+ testCases := []struct {
+ input string
+ expr string
+ }{
+ {
+ `<li>
+ <a href="/new" data-ga-click="Header, create new repository, icon:repo"><span class="octicon octicon-repo"></span> New repository</a>
+ </li>`,
+ `\* New repository \( /new \)`,
+ },
+ {
+ `hi
+
+ <br>
+
+ hello <a href="https://google.com">google</a>
+ <br><br>
+ test<p>List:</p>
+
+ <ul>
+ <li><a href="foo">Foo</a></li>
+ <li><a href="http://www.microshwhat.com/bar/soapy">Barsoap</a></li>
+ <li>Baz</li>
+ </ul>
+`,
+ `hi
+hello google \( https://google.com \)
+
+test
+
+List:
+
+\* Foo \( foo \)
+\* Barsoap \( http://www.microshwhat.com/bar/soapy \)
+\* Baz`,
+ },
+ // Malformed input html.
+ {
+ `hi
+
+ hello <a href="https://google.com">google</a>
+
+ test<p>List:</p>
+
+ <ul>
+ <li><a href="foo">Foo</a>
+ <li><a href="/
+ bar/baz">Bar</a>
+ <li>Baz</li>
+ </ul>
+ `,
+ `hi hello google \( https://google.com \) test
+
+List:
+
+\* Foo \( foo \)
+\* Bar \( /\n[ \t]+bar/baz \)
+\* Baz`,
+ },
+ }
+
+ for _, testCase := range testCases {
+ assertRegexp(t, testCase.input, testCase.expr)
+ }
+}
+
+type StringMatcher interface {
+ MatchString(string) bool
+ String() string
+}
+
+type RegexpStringMatcher string
+
+func (m RegexpStringMatcher) MatchString(str string) bool {
+ return regexp.MustCompile(string(m)).MatchString(str)
+}
+func (m RegexpStringMatcher) String() string {
+ return string(m)
+}
+
+type ExactStringMatcher string
+
+func (m ExactStringMatcher) MatchString(str string) bool {
+ return string(m) == str
+}
+func (m ExactStringMatcher) String() string {
+ return string(m)
+}
+
+func assertRegexp(t *testing.T, input string, outputRE string) {
+ assertPlaintext(t, input, RegexpStringMatcher(outputRE))
+}
+
+func assertString(t *testing.T, input string, output string) {
+ assertPlaintext(t, input, ExactStringMatcher(output))
+}
+
+func assertPlaintext(t *testing.T, input string, matcher StringMatcher) {
+ text, err := FromString(input)
+ if err != nil {
+ t.Error(err)
+ }
+ if !matcher.MatchString(text) {
+ t.Errorf("Input did not match expression\n"+
+ "Input:\n>>>>\n%s\n<<<<\n\n"+
+ "Output:\n>>>>\n%s\n<<<<\n\n"+
+ "Expected output:\n>>>>\n%s\n<<<<\n\n",
+ input, text, matcher.String())
+ } else {
+ t.Logf("input:\n\n%s\n\n\n\noutput:\n\n%s\n", input, text)
+ }
+}
+
+func Example() {
+ inputHtml := `
+ <html>
+ <head>
+ <title>My Mega Service</title>
+ <link rel=\"stylesheet\" href=\"main.css\">
+ <style type=\"text/css\">body { color: #fff; }</style>
+ </head>
+
+ <body>
+ <div class="logo">
+ <a href="http://mymegaservice.com/"><img src="/logo-image.jpg" alt="Mega Service"/></a>
+ </div>
+
+ <h1>Welcome to your new account on my service!</h1>
+
+ <p>
+ Here is some more information:
+
+ <ul>
+ <li>Link 1: <a href="https://example.com">Example.com</a></li>
+ <li>Link 2: <a href="https://example2.com">Example2.com</a></li>
+ <li>Something else</li>
+ </ul>
+ </p>
+ </body>
+ </html>
+ `
+
+ text, err := FromString(inputHtml)
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println(text)
+
+ // Output:
+ // Mega Service ( http://mymegaservice.com/ )
+ //
+ // ******************************************
+ // Welcome to your new account on my service!
+ // ******************************************
+ //
+ // Here is some more information:
+ //
+ // * Link 1: Example.com ( https://example.com )
+ // * Link 2: Example2.com ( https://example2.com )
+ // * Something else
+}
diff --git a/vendor/github.com/jaytaylor/html2text/testdata/utf8.html b/vendor/github.com/jaytaylor/html2text/testdata/utf8.html
new file mode 100755
index 000000000..53d401ce9
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/testdata/utf8.html
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='utf-8'?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>学习之道:美国公认学习第一书title</title>
+ <link href="stylesheet.css" rel="stylesheet" type="text/css" />
+ <link href="page_styles.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body class="calibre">
+ <p id="filepos9452" class="calibre_"><span class="calibre6"><span class="bold">写在前面的话</span></span>
+ </p>
+ <p class="calibre_12">在台湾的那次世界冠军赛上,我几近疯狂,直至两年后的今天,我仍沉浸在这次的经历中。这是我生平第一次如此深入地审视我自己,甚至是第一次尝试审视自己。这个过程令人很是兴奋,同时也有点感觉怪异。我重新认识了自我,看到了自己的另外一面,自己从未发觉的另外一面。为了生存,为了取胜,我成了一名角斗士,彻头彻尾,简单纯粹。我并没有意识到这一角色早已在我的心中生根发芽,呼之欲出。也许,他的出现已是不可避免。</p>
+ <p class="calibre_7">而我这全新的一面,与我一直熟识的那个乔希,那个曾经害怕黑暗的孩子,那个象棋手,那个狂热于雨水、反复诵读杰克·克鲁亚克作品的年轻人之间,又有什么样的联系呢?这些都是我正在努力弄清楚的问题。</p>
+ <p class="calibre_7">自台湾赛事之后,我急切非常,一心想要回到训练中去,摆脱自己已经达到巅峰的想法。在过去的两年中,我已经重新开始。这是一个新的起点。前方的路还很长,有待进一步的探索。</p>
+ <p class="calibre_7">这本书的创作耗费了相当多的时间和精力。在成长的过程中,我在我的小房间里从未想过等待我的会是这样的战斗。在创作中,我的思想逐渐成熟;爱恋从分崩离析,到失而复得,世界冠军头衔从失之交臂,到囊中取物。如果说在我人生的第一个二十九年中,我学到了什么,那就是,我们永远无法预测结局,无论是重要的比赛、冒险,还是轰轰烈烈的爱情。我们唯一可以肯定的只有,出乎意料。不管我们做了多么万全的准备,在生活的真实场景中,我们总是会处于陌生的境地。我们也许会无法冷静,失去理智,感觉似乎整个世界都在针对我们。在这个时候,我们所要做的是要付出加倍的努力,要表现得比预想得更好。我认为,关键在于准备好随机应变,准备好在所能想象的高压下发挥出创造力。</p>
+ <p class="calibre_7">读者朋友们,我非常希望你们在读过这本书后,可以得到启发,甚至会得到触动,从而能够根据各自的天赋与特长,去实现自己的梦想。这就是我写作此书的目的。我在字里行间所传达的理念曾经使我受益匪浅,我很希望它们可以为大家提供一个基本的框架和方向。如果我的方法言之有理,那么就请接受它,琢磨它,并加之自己的见解。忘记我的那些数字。真正的掌握需要通过自己发现一些最能够引起共鸣的信息,并将其彻底地融合进来,直至成为一体,这样我们才能随心所欲地驾驭它。</p>
+ <div class="mbp_pagebreak" id="calibre_pb_4"></div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/vendor/github.com/jaytaylor/html2text/testdata/utf8_with_bom.xhtml b/vendor/github.com/jaytaylor/html2text/testdata/utf8_with_bom.xhtml
new file mode 100755
index 000000000..68f0ee707
--- /dev/null
+++ b/vendor/github.com/jaytaylor/html2text/testdata/utf8_with_bom.xhtml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN">
+
+<head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+ <title>1892年波兰文版序言title</title>
+ <link rel="stylesheet" href="css/stylesheet.css" type="text/css" />
+</head>
+
+<body>
+ <div id="page30" />
+ <h2 id="CHP2-6">1892年波兰文版序言<a id="wzyy_18_30" href="#wz_18_30"><sup>[18]</sup></a></h2>
+ <p>出版共产主义宣言的一种新的波兰文本已成为必要,这一事实,引起了许多感想。</p>
+ <p>首先值得注意的是,近来宣言在一定程度上已成为欧洲大陆大工业发展的一种尺度。一个国家的大工业越发展,该国工人中想认清自己作为工人阶级在有产阶级面前所处地位的要求就越增加,他们中间的社会主义运动也越扩大,因而对宣言的需求也越增长。这样,根据宣言用某国文字销行的份数,不仅能够相当确切地断定该国工人运动的状况,而且还能够相当确切地断定该国大工业发展的程度。</p>
+ <p>因此,波兰文的新版本标志着波兰工业的决定性进步。从十年前发表的上一个版本以来确实有了这种进步,对此丝毫不容置疑。俄国的波兰,会议的波兰<a id="wzyy_19_30" href="#wz_19_30"><sup>[19]</sup></a>,成了俄罗斯帝国巨大的工业区。俄国大工业是零星分散的,一部分在芬兰湾沿岸,一部分在中央区(莫斯科和弗拉基米尔),第三部分在黑海和亚速海沿岸,还有另一些散布在别处;而波兰工业则紧缩于相对狭小的地区,享受到由这种积聚引起的长处与短处。这种长处是竞争着的俄罗斯工厂主所承认的,他们要求实行保护关税以对付波兰,尽管他们渴望使波兰人俄罗斯化。这种短处,对波兰工厂主与俄罗斯政府来说,表现在社会主义思想在波兰工人中间的迅速传播和对宣言需求的增长。</p>
+ <p>但是,波兰工业的迅速发展——它超过了俄国工业——本身<a id="page31" />是波兰人民的坚强生命力的一个新证明,是波兰人民临近的民族复兴的一个新保证。而一个独立强盛的波兰的复兴,不只是一件同波兰人有关、而且是同我们大家有关的事情。只有当每个民族在自己内部完全自主时,欧洲各民族间真诚的国际合作才是可能的。1848年革命在无产阶级旗帜下,使无产阶级的战士最终只作了资产阶级的工作,这次革命通过自己遗嘱的执行者路易·波拿巴和俾斯麦也实现了意大利、德国和匈牙利的独立。然而波兰,它从1792年以来为革命做的比所有这三个国家总共做的还要多,而当它1863年失败于强大十倍的俄军的时候,人们却把它抛弃不顾了。贵族既未能保持住、也未能重新争得波兰的独立;今天波兰的独立对资产阶级至少是无所谓的。然而波兰的独立对于欧洲各民族和谐的合作是必需的。这种独立只有年轻的波兰无产阶级才能争得,而且在它的手中会很好地保持住。因为欧洲所有其余的工人都象波兰工人自己一样也需要波兰的独立。</p>
+ <p>弗·恩格斯</p>
+ <p>1892年2月10日于伦敦</p>
+ <div id="page74" />
+ <div><a id="wz_18_30" href="#wzyy_18_30">[18]</a> 恩格斯用德文为《宣言》新的波兰文本写了这篇序言。1892年由波兰社会主义者在伦敦办的《黎明》杂志社出版。序言寄出后,恩格斯写信给门德尔森(1892年2月11日),信中说,他很愿意学会波兰文,并且深入研究波兰工人运动的发展,以便能够为《宣言》的下一版写一篇更详细的序言。——第20页</div>
+ <div><a id="wz_19_30" href="#wzyy_19_30">[19]</a> 指维也纳会议的波兰,即根据1814—1815年维也纳会议的决定,以波兰王国的正式名义割给俄国的那部分波兰土地。——第20页</div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.md
index 5eb9e1445..7670fc87a 100644
--- a/vendor/github.com/lib/pq/README.md
+++ b/vendor/github.com/lib/pq/README.md
@@ -1,6 +1,6 @@
# pq - A pure Go postgres driver for Go's database/sql package
-[![Build Status](https://travis-ci.org/lib/pq.png?branch=master)](https://travis-ci.org/lib/pq)
+[![Build Status](https://travis-ci.org/lib/pq.svg?branch=master)](https://travis-ci.org/lib/pq)
## Install
diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go
index 3c8f77cb6..4b2fb4462 100644
--- a/vendor/github.com/lib/pq/conn.go
+++ b/vendor/github.com/lib/pq/conn.go
@@ -133,7 +133,7 @@ type conn struct {
// Handle driver-side settings in parsed connection string.
func (c *conn) handleDriverSettings(o values) (err error) {
boolSetting := func(key string, val *bool) error {
- if value := o.Get(key); value != "" {
+ if value, ok := o[key]; ok {
if value == "yes" {
*val = true
} else if value == "no" {
@@ -158,8 +158,7 @@ func (c *conn) handleDriverSettings(o values) (err error) {
func (c *conn) handlePgpass(o values) {
// if a password was supplied, do not process .pgpass
- _, ok := o["password"]
- if ok {
+ if _, ok := o["password"]; ok {
return
}
filename := os.Getenv("PGPASSFILE")
@@ -187,11 +186,11 @@ func (c *conn) handlePgpass(o values) {
}
defer file.Close()
scanner := bufio.NewScanner(io.Reader(file))
- hostname := o.Get("host")
+ hostname := o["host"]
ntw, _ := network(o)
- port := o.Get("port")
- db := o.Get("dbname")
- username := o.Get("user")
+ port := o["port"]
+ db := o["dbname"]
+ username := o["user"]
// From: https://github.com/tg/pgpass/blob/master/reader.go
getFields := func(s string) []string {
fs := make([]string, 0, 5)
@@ -256,13 +255,13 @@ func DialOpen(d Dialer, name string) (_ driver.Conn, err error) {
// * Very low precedence defaults applied in every situation
// * Environment variables
// * Explicitly passed connection information
- o.Set("host", "localhost")
- o.Set("port", "5432")
+ o["host"] = "localhost"
+ o["port"] = "5432"
// N.B.: Extra float digits should be set to 3, but that breaks
// Postgres 8.4 and older, where the max is 2.
- o.Set("extra_float_digits", "2")
+ o["extra_float_digits"] = "2"
for k, v := range parseEnviron(os.Environ()) {
- o.Set(k, v)
+ o[k] = v
}
if strings.HasPrefix(name, "postgres://") || strings.HasPrefix(name, "postgresql://") {
@@ -277,9 +276,9 @@ func DialOpen(d Dialer, name string) (_ driver.Conn, err error) {
}
// Use the "fallback" application name if necessary
- if fallback := o.Get("fallback_application_name"); fallback != "" {
- if !o.Isset("application_name") {
- o.Set("application_name", fallback)
+ if fallback, ok := o["fallback_application_name"]; ok {
+ if _, ok := o["application_name"]; !ok {
+ o["application_name"] = fallback
}
}
@@ -290,29 +289,29 @@ func DialOpen(d Dialer, name string) (_ driver.Conn, err error) {
// parsing its value is not worth it. Instead, we always explicitly send
// client_encoding as a separate run-time parameter, which should override
// anything set in options.
- if enc := o.Get("client_encoding"); enc != "" && !isUTF8(enc) {
+ if enc, ok := o["client_encoding"]; ok && !isUTF8(enc) {
return nil, errors.New("client_encoding must be absent or 'UTF8'")
}
- o.Set("client_encoding", "UTF8")
+ o["client_encoding"] = "UTF8"
// DateStyle needs a similar treatment.
- if datestyle := o.Get("datestyle"); datestyle != "" {
+ if datestyle, ok := o["datestyle"]; ok {
if datestyle != "ISO, MDY" {
panic(fmt.Sprintf("setting datestyle must be absent or %v; got %v",
"ISO, MDY", datestyle))
}
} else {
- o.Set("datestyle", "ISO, MDY")
+ o["datestyle"] = "ISO, MDY"
}
// If a user is not provided by any other means, the last
// resort is to use the current operating system provided user
// name.
- if o.Get("user") == "" {
+ if _, ok := o["user"]; !ok {
u, err := userCurrent()
if err != nil {
return nil, err
} else {
- o.Set("user", u)
+ o["user"] = u
}
}
@@ -335,7 +334,7 @@ func DialOpen(d Dialer, name string) (_ driver.Conn, err error) {
cn.startup(o)
// reset the deadline, in case one was set (see dial)
- if timeout := o.Get("connect_timeout"); timeout != "" && timeout != "0" {
+ if timeout, ok := o["connect_timeout"]; ok && timeout != "0" {
err = cn.c.SetDeadline(time.Time{})
}
return cn, err
@@ -349,7 +348,7 @@ func dial(d Dialer, o values) (net.Conn, error) {
}
// Zero or not specified means wait indefinitely.
- if timeout := o.Get("connect_timeout"); timeout != "" && timeout != "0" {
+ if timeout, ok := o["connect_timeout"]; ok && timeout != "0" {
seconds, err := strconv.ParseInt(timeout, 10, 0)
if err != nil {
return nil, fmt.Errorf("invalid value for parameter connect_timeout: %s", err)
@@ -371,31 +370,18 @@ func dial(d Dialer, o values) (net.Conn, error) {
}
func network(o values) (string, string) {
- host := o.Get("host")
+ host := o["host"]
if strings.HasPrefix(host, "/") {
- sockPath := path.Join(host, ".s.PGSQL."+o.Get("port"))
+ sockPath := path.Join(host, ".s.PGSQL."+o["port"])
return "unix", sockPath
}
- return "tcp", net.JoinHostPort(host, o.Get("port"))
+ return "tcp", net.JoinHostPort(host, o["port"])
}
type values map[string]string
-func (vs values) Set(k, v string) {
- vs[k] = v
-}
-
-func (vs values) Get(k string) (v string) {
- return vs[k]
-}
-
-func (vs values) Isset(k string) bool {
- _, ok := vs[k]
- return ok
-}
-
// scanner implements a tokenizer for libpq-style option strings.
type scanner struct {
s []rune
@@ -466,7 +452,7 @@ func parseOpts(name string, o values) error {
// Skip any whitespace after the =
if r, ok = s.SkipSpaces(); !ok {
// If we reach the end here, the last value is just an empty string as per libpq.
- o.Set(string(keyRunes), "")
+ o[string(keyRunes)] = ""
break
}
@@ -501,7 +487,7 @@ func parseOpts(name string, o values) error {
}
}
- o.Set(string(keyRunes), string(valRunes))
+ o[string(keyRunes)] = string(valRunes)
}
return nil
@@ -665,6 +651,12 @@ func (cn *conn) simpleQuery(q string) (res *rows, err error) {
cn: cn,
}
}
+ // Set the result and tag to the last command complete if there wasn't a
+ // query already run. Although queries usually return from here and cede
+ // control to Next, a query with zero results does not.
+ if t == 'C' && res.colNames == nil {
+ res.result, res.tag = cn.parseComplete(r.string())
+ }
res.done = true
case 'Z':
cn.processReadyForQuery(r)
@@ -1119,7 +1111,7 @@ func (cn *conn) auth(r *readBuf, o values) {
// OK
case 3:
w := cn.writeBuf('p')
- w.string(o.Get("password"))
+ w.string(o["password"])
cn.send(w)
t, r := cn.recv()
@@ -1133,7 +1125,7 @@ func (cn *conn) auth(r *readBuf, o values) {
case 5:
s := string(r.next(4))
w := cn.writeBuf('p')
- w.string("md5" + md5s(md5s(o.Get("password")+o.Get("user"))+s))
+ w.string("md5" + md5s(md5s(o["password"]+o["user"])+s))
cn.send(w)
t, r := cn.recv()
@@ -1333,6 +1325,8 @@ type rows struct {
colFmts []format
done bool
rb readBuf
+ result driver.Result
+ tag string
}
func (rs *rows) Close() error {
@@ -1356,6 +1350,17 @@ func (rs *rows) Columns() []string {
return rs.colNames
}
+func (rs *rows) Result() driver.Result {
+ if rs.result == nil {
+ return emptyRows
+ }
+ return rs.result
+}
+
+func (rs *rows) Tag() string {
+ return rs.tag
+}
+
func (rs *rows) Next(dest []driver.Value) (err error) {
if rs.done {
return io.EOF
@@ -1373,6 +1378,9 @@ func (rs *rows) Next(dest []driver.Value) (err error) {
case 'E':
err = parseError(&rs.rb)
case 'C', 'I':
+ if t == 'C' {
+ rs.result, rs.tag = conn.parseComplete(rs.rb.string())
+ }
continue
case 'Z':
conn.processReadyForQuery(&rs.rb)
diff --git a/vendor/github.com/lib/pq/conn_go18.go b/vendor/github.com/lib/pq/conn_go18.go
index 0aca1d002..43cc35f7b 100644
--- a/vendor/github.com/lib/pq/conn_go18.go
+++ b/vendor/github.com/lib/pq/conn_go18.go
@@ -14,10 +14,7 @@ func (cn *conn) QueryContext(ctx context.Context, query string, args []driver.Na
for i, nv := range args {
list[i] = nv.Value
}
- var closed chan<- struct{}
- if ctx.Done() != nil {
- closed = watchCancel(ctx, cn.cancel)
- }
+ closed := cn.watchCancel(ctx)
r, err := cn.query(query, list)
if err != nil {
return nil, err
@@ -33,8 +30,7 @@ func (cn *conn) ExecContext(ctx context.Context, query string, args []driver.Nam
list[i] = nv.Value
}
- if ctx.Done() != nil {
- closed := watchCancel(ctx, cn.cancel)
+ if closed := cn.watchCancel(ctx); closed != nil {
defer close(closed)
}
@@ -53,22 +49,23 @@ func (cn *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx,
if err != nil {
return nil, err
}
- if ctx.Done() != nil {
- cn.txnClosed = watchCancel(ctx, cn.cancel)
- }
+ cn.txnClosed = cn.watchCancel(ctx)
return tx, nil
}
-func watchCancel(ctx context.Context, cancel func()) chan<- struct{} {
- closed := make(chan struct{})
- go func() {
- select {
- case <-ctx.Done():
- cancel()
- case <-closed:
- }
- }()
- return closed
+func (cn *conn) watchCancel(ctx context.Context) chan<- struct{} {
+ if done := ctx.Done(); done != nil {
+ closed := make(chan struct{})
+ go func() {
+ select {
+ case <-done:
+ cn.cancel()
+ case <-closed:
+ }
+ }()
+ return closed
+ }
+ return nil
}
func (cn *conn) cancel() {
diff --git a/vendor/github.com/lib/pq/conn_test.go b/vendor/github.com/lib/pq/conn_test.go
index 183e6dcd6..c9135b727 100644
--- a/vendor/github.com/lib/pq/conn_test.go
+++ b/vendor/github.com/lib/pq/conn_test.go
@@ -191,7 +191,7 @@ localhost:*:*:*:pass_C
pgpass.Close()
assertPassword := func(extra values, expected string) {
- o := &values{
+ o := values{
"host": "localhost",
"sslmode": "disable",
"connect_timeout": "20",
@@ -203,11 +203,11 @@ localhost:*:*:*:pass_C
"datestyle": "ISO, MDY",
}
for k, v := range extra {
- (*o)[k] = v
+ o[k] = v
}
- (&conn{}).handlePgpass(*o)
- if o.Get("password") != expected {
- t.Fatalf("For %v expected %s got %s", extra, expected, o.Get("password"))
+ (&conn{}).handlePgpass(o)
+ if pw := o["password"]; pw != expected {
+ t.Fatalf("For %v expected %s got %s", extra, expected, pw)
}
}
// wrong permissions for the pgpass file means it should be ignored
@@ -686,17 +686,28 @@ func TestCloseBadConn(t *testing.T) {
if err := cn.Close(); err != nil {
t.Fatal(err)
}
+
+ // During the Go 1.9 cycle, https://github.com/golang/go/commit/3792db5
+ // changed this error from
+ //
+ // net.errClosing = errors.New("use of closed network connection")
+ //
+ // to
+ //
+ // internal/poll.ErrClosing = errors.New("use of closed file or network connection")
+ const errClosing = "use of closed"
+
// Verify write after closing fails.
if _, err := nc.Write(nil); err == nil {
t.Fatal("expected error")
- } else if !strings.Contains(err.Error(), "use of closed network connection") {
- t.Fatalf("expected use of closed network connection error, got %s", err)
+ } else if !strings.Contains(err.Error(), errClosing) {
+ t.Fatalf("expected %s error, got %s", errClosing, err)
}
// Verify second close fails.
if err := cn.Close(); err == nil {
t.Fatal("expected error")
- } else if !strings.Contains(err.Error(), "use of closed network connection") {
- t.Fatalf("expected use of closed network connection error, got %s", err)
+ } else if !strings.Contains(err.Error(), errClosing) {
+ t.Fatalf("expected %s error, got %s", errClosing, err)
}
}
@@ -1493,3 +1504,82 @@ func TestQuoteIdentifier(t *testing.T) {
}
}
}
+
+func TestRowsResultTag(t *testing.T) {
+ type ResultTag interface {
+ Result() driver.Result
+ Tag() string
+ }
+
+ tests := []struct {
+ query string
+ tag string
+ ra int64
+ }{
+ {
+ query: "CREATE TEMP TABLE temp (a int)",
+ tag: "CREATE TABLE",
+ },
+ {
+ query: "INSERT INTO temp VALUES (1), (2)",
+ tag: "INSERT",
+ ra: 2,
+ },
+ {
+ query: "SELECT 1",
+ },
+ // A SELECT anywhere should take precedent.
+ {
+ query: "SELECT 1; INSERT INTO temp VALUES (1), (2)",
+ },
+ {
+ query: "INSERT INTO temp VALUES (1), (2); SELECT 1",
+ },
+ // Multiple statements that don't return rows should return the last tag.
+ {
+ query: "CREATE TEMP TABLE t (a int); DROP TABLE t",
+ tag: "DROP TABLE",
+ },
+ // Ensure a rows-returning query in any position among various tags-returing
+ // statements will prefer the rows.
+ {
+ query: "SELECT 1; CREATE TEMP TABLE t (a int); DROP TABLE t",
+ },
+ {
+ query: "CREATE TEMP TABLE t (a int); SELECT 1; DROP TABLE t",
+ },
+ {
+ query: "CREATE TEMP TABLE t (a int); DROP TABLE t; SELECT 1",
+ },
+ // Verify that an no-results query doesn't set the tag.
+ {
+ query: "CREATE TEMP TABLE t (a int); SELECT 1 WHERE FALSE; DROP TABLE t;",
+ },
+ }
+
+ // If this is the only test run, this will correct the connection string.
+ openTestConn(t).Close()
+
+ conn, err := Open("")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer conn.Close()
+ q := conn.(driver.Queryer)
+
+ for _, test := range tests {
+ if rows, err := q.Query(test.query, nil); err != nil {
+ t.Fatalf("%s: %s", test.query, err)
+ } else {
+ r := rows.(ResultTag)
+ if tag := r.Tag(); tag != test.tag {
+ t.Fatalf("%s: unexpected tag %q", test.query, tag)
+ }
+ res := r.Result()
+ if ra, _ := res.RowsAffected(); ra != test.ra {
+ t.Fatalf("%s: unexpected rows affected: %d", test.query, ra)
+ }
+ rows.Close()
+ }
+ }
+}
diff --git a/vendor/github.com/lib/pq/go18_test.go b/vendor/github.com/lib/pq/go18_test.go
index 15546d865..5d17e4d92 100644
--- a/vendor/github.com/lib/pq/go18_test.go
+++ b/vendor/github.com/lib/pq/go18_test.go
@@ -79,10 +79,7 @@ func TestContextCancelExec(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
// Delay execution for just a bit until db.ExecContext has begun.
- go func() {
- time.Sleep(time.Millisecond * 10)
- cancel()
- }()
+ defer time.AfterFunc(time.Millisecond*10, cancel).Stop()
// Not canceled until after the exec has started.
if _, err := db.ExecContext(ctx, "select pg_sleep(1)"); err == nil {
@@ -106,10 +103,7 @@ func TestContextCancelQuery(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
// Delay execution for just a bit until db.QueryContext has begun.
- go func() {
- time.Sleep(time.Millisecond * 10)
- cancel()
- }()
+ defer time.AfterFunc(time.Millisecond*10, cancel).Stop()
// Not canceled until after the exec has started.
if _, err := db.QueryContext(ctx, "select pg_sleep(1)"); err == nil {
@@ -137,10 +131,7 @@ func TestContextCancelBegin(t *testing.T) {
}
// Delay execution for just a bit until tx.Exec has begun.
- go func() {
- time.Sleep(time.Millisecond * 10)
- cancel()
- }()
+ defer time.AfterFunc(time.Millisecond*10, cancel).Stop()
// Not canceled until after the exec has started.
if _, err := tx.Exec("select pg_sleep(1)"); err == nil {
diff --git a/vendor/github.com/lib/pq/listen_example/doc.go b/vendor/github.com/lib/pq/listen_example/doc.go
index 5bc99f5c1..80f0a9b97 100644
--- a/vendor/github.com/lib/pq/listen_example/doc.go
+++ b/vendor/github.com/lib/pq/listen_example/doc.go
@@ -51,21 +51,15 @@ mechanism to avoid polling the database while waiting for more work to arrive.
}
func waitForNotification(l *pq.Listener) {
- for {
- select {
- case <-l.Notify:
- fmt.Println("received notification, new work available")
- return
- case <-time.After(90 * time.Second):
- go func() {
- l.Ping()
- }()
- // Check if there's more work available, just in case it takes
- // a while for the Listener to notice connection loss and
- // reconnect.
- fmt.Println("received no work for 90 seconds, checking for new work")
- return
- }
+ select {
+ case <-l.Notify:
+ fmt.Println("received notification, new work available")
+ case <-time.After(90 * time.Second):
+ go l.Ping()
+ // Check if there's more work available, just in case it takes
+ // a while for the Listener to notice connection loss and
+ // reconnect.
+ fmt.Println("received no work for 90 seconds, checking for new work")
}
}
diff --git a/vendor/github.com/lib/pq/notify_test.go b/vendor/github.com/lib/pq/notify_test.go
index fe8941a4e..82a77e1eb 100644
--- a/vendor/github.com/lib/pq/notify_test.go
+++ b/vendor/github.com/lib/pq/notify_test.go
@@ -7,7 +7,6 @@ import (
"os"
"runtime"
"sync"
- "sync/atomic"
"testing"
"time"
)
@@ -235,15 +234,10 @@ func TestConnExecDeadlock(t *testing.T) {
// calls Close on the net.Conn; equivalent to a network failure
l.Close()
- var done int32 = 0
- go func() {
- time.Sleep(10 * time.Second)
- if atomic.LoadInt32(&done) != 1 {
- panic("timed out")
- }
- }()
+ defer time.AfterFunc(10*time.Second, func() {
+ panic("timed out")
+ }).Stop()
wg.Wait()
- atomic.StoreInt32(&done, 1)
}
// Test for ListenerConn being closed while a slow query is executing
@@ -271,15 +265,11 @@ func TestListenerConnCloseWhileQueryIsExecuting(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- var done int32 = 0
- go func() {
- time.Sleep(10 * time.Second)
- if atomic.LoadInt32(&done) != 1 {
- panic("timed out")
- }
- }()
+
+ defer time.AfterFunc(10*time.Second, func() {
+ panic("timed out")
+ }).Stop()
wg.Wait()
- atomic.StoreInt32(&done, 1)
}
func TestNotifyExtra(t *testing.T) {
diff --git a/vendor/github.com/lib/pq/oid/types.go b/vendor/github.com/lib/pq/oid/types.go
index 03df05a61..a3390c23a 100644
--- a/vendor/github.com/lib/pq/oid/types.go
+++ b/vendor/github.com/lib/pq/oid/types.go
@@ -18,6 +18,7 @@ const (
T_xid Oid = 28
T_cid Oid = 29
T_oidvector Oid = 30
+ T_pg_ddl_command Oid = 32
T_pg_type Oid = 71
T_pg_attribute Oid = 75
T_pg_proc Oid = 81
@@ -28,6 +29,7 @@ const (
T_pg_node_tree Oid = 194
T__json Oid = 199
T_smgr Oid = 210
+ T_index_am_handler Oid = 325
T_point Oid = 600
T_lseg Oid = 601
T_path Oid = 602
@@ -133,6 +135,9 @@ const (
T__uuid Oid = 2951
T_txid_snapshot Oid = 2970
T_fdw_handler Oid = 3115
+ T_pg_lsn Oid = 3220
+ T__pg_lsn Oid = 3221
+ T_tsm_handler Oid = 3310
T_anyenum Oid = 3500
T_tsvector Oid = 3614
T_tsquery Oid = 3615
@@ -144,6 +149,8 @@ const (
T__regconfig Oid = 3735
T_regdictionary Oid = 3769
T__regdictionary Oid = 3770
+ T_jsonb Oid = 3802
+ T__jsonb Oid = 3807
T_anyrange Oid = 3831
T_event_trigger Oid = 3838
T_int4range Oid = 3904
@@ -158,4 +165,9 @@ const (
T__daterange Oid = 3913
T_int8range Oid = 3926
T__int8range Oid = 3927
+ T_pg_shseclabel Oid = 4066
+ T_regnamespace Oid = 4089
+ T__regnamespace Oid = 4090
+ T_regrole Oid = 4096
+ T__regrole Oid = 4097
)
diff --git a/vendor/github.com/lib/pq/ssl.go b/vendor/github.com/lib/pq/ssl.go
index b282ebd92..7deb30436 100644
--- a/vendor/github.com/lib/pq/ssl.go
+++ b/vendor/github.com/lib/pq/ssl.go
@@ -15,7 +15,7 @@ import (
func ssl(o values) func(net.Conn) net.Conn {
verifyCaOnly := false
tlsConf := tls.Config{}
- switch mode := o.Get("sslmode"); mode {
+ switch mode := o["sslmode"]; mode {
// "require" is the default.
case "", "require":
// We must skip TLS's own verification since it requires full
@@ -23,15 +23,19 @@ func ssl(o values) func(net.Conn) net.Conn {
tlsConf.InsecureSkipVerify = true
// From http://www.postgresql.org/docs/current/static/libpq-ssl.html:
- // Note: For backwards compatibility with earlier versions of PostgreSQL, if a
- // root CA file exists, the behavior of sslmode=require will be the same as
- // that of verify-ca, meaning the server certificate is validated against the
- // CA. Relying on this behavior is discouraged, and applications that need
- // certificate validation should always use verify-ca or verify-full.
- if _, err := os.Stat(o.Get("sslrootcert")); err == nil {
- verifyCaOnly = true
- } else {
- o.Set("sslrootcert", "")
+ //
+ // Note: For backwards compatibility with earlier versions of
+ // PostgreSQL, if a root CA file exists, the behavior of
+ // sslmode=require will be the same as that of verify-ca, meaning the
+ // server certificate is validated against the CA. Relying on this
+ // behavior is discouraged, and applications that need certificate
+ // validation should always use verify-ca or verify-full.
+ if sslrootcert, ok := o["sslrootcert"]; ok {
+ if _, err := os.Stat(sslrootcert); err == nil {
+ verifyCaOnly = true
+ } else {
+ delete(o, "sslrootcert")
+ }
}
case "verify-ca":
// We must skip TLS's own verification since it requires full
@@ -39,7 +43,7 @@ func ssl(o values) func(net.Conn) net.Conn {
tlsConf.InsecureSkipVerify = true
verifyCaOnly = true
case "verify-full":
- tlsConf.ServerName = o.Get("host")
+ tlsConf.ServerName = o["host"]
case "disable":
return nil
default:
@@ -64,38 +68,43 @@ func ssl(o values) func(net.Conn) net.Conn {
// in the user's home directory. The configured files must exist and have
// the correct permissions.
func sslClientCertificates(tlsConf *tls.Config, o values) {
- sslkey := o.Get("sslkey")
- sslcert := o.Get("sslcert")
-
- var cinfo, kinfo os.FileInfo
- var err error
+ // user.Current() might fail when cross-compiling. We have to ignore the
+ // error and continue without home directory defaults, since we wouldn't
+ // know from where to load them.
+ user, _ := user.Current()
+
+ // In libpq, the client certificate is only loaded if the setting is not blank.
+ //
+ // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1036-L1037
+ sslcert := o["sslcert"]
+ if len(sslcert) == 0 && user != nil {
+ sslcert = filepath.Join(user.HomeDir, ".postgresql", "postgresql.crt")
+ }
+ // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1045
+ if len(sslcert) == 0 {
+ return
+ }
+ // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1050:L1054
+ if _, err := os.Stat(sslcert); os.IsNotExist(err) {
+ return
+ } else if err != nil {
+ panic(err)
+ }
- if sslcert != "" && sslkey != "" {
- // Check that both files exist. Note that we don't do any more extensive
- // checks than this (such as checking that the paths aren't directories);
- // LoadX509KeyPair() will take care of the rest.
- cinfo, err = os.Stat(sslcert)
- if err != nil {
- panic(err)
- }
+ // In libpq, the ssl key is only loaded if the setting is not blank.
+ //
+ // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1123-L1222
+ sslkey := o["sslkey"]
+ if len(sslkey) == 0 && user != nil {
+ sslkey = filepath.Join(user.HomeDir, ".postgresql", "postgresql.key")
+ }
- kinfo, err = os.Stat(sslkey)
- if err != nil {
+ if len(sslkey) > 0 {
+ if err := sslKeyPermissions(sslkey); err != nil {
panic(err)
}
- } else {
- // Automatically find certificates from ~/.postgresql
- sslcert, sslkey, cinfo, kinfo = sslHomeCertificates()
-
- if cinfo == nil || kinfo == nil {
- // No certificates to load
- return
- }
}
- // The files must also have the correct permissions
- sslCertificatePermissions(cinfo, kinfo)
-
cert, err := tls.LoadX509KeyPair(sslcert, sslkey)
if err != nil {
panic(err)
@@ -105,7 +114,10 @@ func sslClientCertificates(tlsConf *tls.Config, o values) {
// sslCertificateAuthority adds the RootCA specified in the "sslrootcert" setting.
func sslCertificateAuthority(tlsConf *tls.Config, o values) {
- if sslrootcert := o.Get("sslrootcert"); sslrootcert != "" {
+ // In libpq, the root certificate is only loaded if the setting is not blank.
+ //
+ // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L950-L951
+ if sslrootcert := o["sslrootcert"]; len(sslrootcert) > 0 {
tlsConf.RootCAs = x509.NewCertPool()
cert, err := ioutil.ReadFile(sslrootcert)
@@ -113,41 +125,12 @@ func sslCertificateAuthority(tlsConf *tls.Config, o values) {
panic(err)
}
- ok := tlsConf.RootCAs.AppendCertsFromPEM(cert)
- if !ok {
+ if !tlsConf.RootCAs.AppendCertsFromPEM(cert) {
errorf("couldn't parse pem in sslrootcert")
}
}
}
-// sslHomeCertificates returns the path and stats of certificates in the current
-// user's home directory.
-func sslHomeCertificates() (cert, key string, cinfo, kinfo os.FileInfo) {
- user, err := user.Current()
-
- if err != nil {
- // user.Current() might fail when cross-compiling. We have to ignore the
- // error and continue without client certificates, since we wouldn't know
- // from where to load them.
- return
- }
-
- cert = filepath.Join(user.HomeDir, ".postgresql", "postgresql.crt")
- key = filepath.Join(user.HomeDir, ".postgresql", "postgresql.key")
-
- cinfo, err = os.Stat(cert)
- if err != nil {
- cinfo = nil
- }
-
- kinfo, err = os.Stat(key)
- if err != nil {
- kinfo = nil
- }
-
- return
-}
-
// sslVerifyCertificateAuthority carries out a TLS handshake to the server and
// verifies the presented certificate against the CA, i.e. the one specified in
// sslrootcert or the system CA if sslrootcert was not specified.
diff --git a/vendor/github.com/lib/pq/ssl_permissions.go b/vendor/github.com/lib/pq/ssl_permissions.go
index 33076a8da..3b7c3a2a3 100644
--- a/vendor/github.com/lib/pq/ssl_permissions.go
+++ b/vendor/github.com/lib/pq/ssl_permissions.go
@@ -4,13 +4,17 @@ package pq
import "os"
-// sslCertificatePermissions checks the permissions on user-supplied certificate
-// files. The key file should have very little access.
+// sslKeyPermissions checks the permissions on user-supplied ssl key files.
+// The key file should have very little access.
//
// libpq does not check key file permissions on Windows.
-func sslCertificatePermissions(cert, key os.FileInfo) {
- kmode := key.Mode()
- if kmode != kmode&0600 {
- panic(ErrSSLKeyHasWorldPermissions)
+func sslKeyPermissions(sslkey string) error {
+ info, err := os.Stat(sslkey)
+ if err != nil {
+ return err
}
+ if info.Mode().Perm()&0077 != 0 {
+ return ErrSSLKeyHasWorldPermissions
+ }
+ return nil
}
diff --git a/vendor/github.com/lib/pq/ssl_test.go b/vendor/github.com/lib/pq/ssl_test.go
index f70a5fd57..3eafbfd20 100644
--- a/vendor/github.com/lib/pq/ssl_test.go
+++ b/vendor/github.com/lib/pq/ssl_test.go
@@ -6,7 +6,6 @@ import (
_ "crypto/sha256"
"crypto/x509"
"database/sql"
- "fmt"
"os"
"path/filepath"
"testing"
@@ -42,10 +41,13 @@ func openSSLConn(t *testing.T, conninfo string) (*sql.DB, error) {
}
func checkSSLSetup(t *testing.T, conninfo string) {
- db, err := openSSLConn(t, conninfo)
- if err == nil {
- db.Close()
- t.Fatalf("expected error with conninfo=%q", conninfo)
+ _, err := openSSLConn(t, conninfo)
+ if pge, ok := err.(*Error); ok {
+ if pge.Code.Name() != "invalid_authorization_specification" {
+ t.Fatalf("unexpected error code '%s'", pge.Code.Name())
+ }
+ } else {
+ t.Fatalf("expected %T, got %v", (*Error)(nil), err)
}
}
@@ -150,120 +152,128 @@ func TestSSLVerifyCA(t *testing.T) {
checkSSLSetup(t, "sslmode=disable user=pqgossltest")
// Not OK according to the system CA
- _, err := openSSLConn(t, "host=postgres sslmode=verify-ca user=pqgossltest")
- if err == nil {
- t.Fatal("expected error")
+ {
+ _, err := openSSLConn(t, "host=postgres sslmode=verify-ca user=pqgossltest")
+ if _, ok := err.(x509.UnknownAuthorityError); !ok {
+ t.Fatalf("expected %T, got %#+v", x509.UnknownAuthorityError{}, err)
+ }
}
- _, ok := err.(x509.UnknownAuthorityError)
- if !ok {
- t.Fatalf("expected x509.UnknownAuthorityError, got %#+v", err)
+
+ // Still not OK according to the system CA; empty sslrootcert is treated as unspecified.
+ {
+ _, err := openSSLConn(t, "host=postgres sslmode=verify-ca user=pqgossltest sslrootcert=''")
+ if _, ok := err.(x509.UnknownAuthorityError); !ok {
+ t.Fatalf("expected %T, got %#+v", x509.UnknownAuthorityError{}, err)
+ }
}
rootCertPath := filepath.Join(os.Getenv("PQSSLCERTTEST_PATH"), "root.crt")
rootCert := "sslrootcert=" + rootCertPath + " "
// No match on Common Name, but that's OK
- _, err = openSSLConn(t, rootCert+"host=127.0.0.1 sslmode=verify-ca user=pqgossltest")
- if err != nil {
+ if _, err := openSSLConn(t, rootCert+"host=127.0.0.1 sslmode=verify-ca user=pqgossltest"); err != nil {
t.Fatal(err)
}
// Everything OK
- _, err = openSSLConn(t, rootCert+"host=postgres sslmode=verify-ca user=pqgossltest")
- if err != nil {
+ if _, err := openSSLConn(t, rootCert+"host=postgres sslmode=verify-ca user=pqgossltest"); err != nil {
t.Fatal(err)
}
}
-func getCertConninfo(t *testing.T, source string) string {
- var sslkey string
- var sslcert string
-
- certpath := os.Getenv("PQSSLCERTTEST_PATH")
-
- switch source {
- case "missingkey":
- sslkey = "/tmp/filedoesnotexist"
- sslcert = filepath.Join(certpath, "postgresql.crt")
- case "missingcert":
- sslkey = filepath.Join(certpath, "postgresql.key")
- sslcert = "/tmp/filedoesnotexist"
- case "certtwice":
- sslkey = filepath.Join(certpath, "postgresql.crt")
- sslcert = filepath.Join(certpath, "postgresql.crt")
- case "valid":
- sslkey = filepath.Join(certpath, "postgresql.key")
- sslcert = filepath.Join(certpath, "postgresql.crt")
- default:
- t.Fatalf("invalid source %q", source)
- }
- return fmt.Sprintf("sslmode=require user=pqgosslcert sslkey=%s sslcert=%s", sslkey, sslcert)
-}
-
// Authenticate over SSL using client certificates
func TestSSLClientCertificates(t *testing.T) {
maybeSkipSSLTests(t)
// Environment sanity check: should fail without SSL
checkSSLSetup(t, "sslmode=disable user=pqgossltest")
- // Should also fail without a valid certificate
- db, err := openSSLConn(t, "sslmode=require user=pqgosslcert")
- if err == nil {
- db.Close()
- t.Fatal("expected error")
- }
- pge, ok := err.(*Error)
- if !ok {
- t.Fatal("expected pq.Error")
+ const baseinfo = "sslmode=require user=pqgosslcert"
+
+ // Certificate not specified, should fail
+ {
+ _, err := openSSLConn(t, baseinfo)
+ if pge, ok := err.(*Error); ok {
+ if pge.Code.Name() != "invalid_authorization_specification" {
+ t.Fatalf("unexpected error code '%s'", pge.Code.Name())
+ }
+ } else {
+ t.Fatalf("expected %T, got %v", (*Error)(nil), err)
+ }
}
- if pge.Code.Name() != "invalid_authorization_specification" {
- t.Fatalf("unexpected error code %q", pge.Code.Name())
+
+ // Empty certificate specified, should fail
+ {
+ _, err := openSSLConn(t, baseinfo+" sslcert=''")
+ if pge, ok := err.(*Error); ok {
+ if pge.Code.Name() != "invalid_authorization_specification" {
+ t.Fatalf("unexpected error code '%s'", pge.Code.Name())
+ }
+ } else {
+ t.Fatalf("expected %T, got %v", (*Error)(nil), err)
+ }
}
- // Should work
- db, err = openSSLConn(t, getCertConninfo(t, "valid"))
- if err != nil {
- t.Fatal(err)
+ // Non-existent certificate specified, should fail
+ {
+ _, err := openSSLConn(t, baseinfo+" sslcert=/tmp/filedoesnotexist")
+ if pge, ok := err.(*Error); ok {
+ if pge.Code.Name() != "invalid_authorization_specification" {
+ t.Fatalf("unexpected error code '%s'", pge.Code.Name())
+ }
+ } else {
+ t.Fatalf("expected %T, got %v", (*Error)(nil), err)
+ }
}
- rows, err := db.Query("SELECT 1")
- if err != nil {
- t.Fatal(err)
+
+ certpath, ok := os.LookupEnv("PQSSLCERTTEST_PATH")
+ if !ok {
+ t.Fatalf("PQSSLCERTTEST_PATH not present in environment")
}
- rows.Close()
-}
-// Test errors with ssl certificates
-func TestSSLClientCertificatesMissingFiles(t *testing.T) {
- maybeSkipSSLTests(t)
- // Environment sanity check: should fail without SSL
- checkSSLSetup(t, "sslmode=disable user=pqgossltest")
+ sslcert := filepath.Join(certpath, "postgresql.crt")
- // Key missing, should fail
- _, err := openSSLConn(t, getCertConninfo(t, "missingkey"))
- if err == nil {
- t.Fatal("expected error")
- }
- // should be a PathError
- _, ok := err.(*os.PathError)
- if !ok {
- t.Fatalf("expected PathError, got %#+v", err)
+ // Cert present, key not specified, should fail
+ {
+ _, err := openSSLConn(t, baseinfo+" sslcert="+sslcert)
+ if _, ok := err.(*os.PathError); !ok {
+ t.Fatalf("expected %T, got %#+v", (*os.PathError)(nil), err)
+ }
}
- // Cert missing, should fail
- _, err = openSSLConn(t, getCertConninfo(t, "missingcert"))
- if err == nil {
- t.Fatal("expected error")
+ // Cert present, empty key specified, should fail
+ {
+ _, err := openSSLConn(t, baseinfo+" sslcert="+sslcert+" sslkey=''")
+ if _, ok := err.(*os.PathError); !ok {
+ t.Fatalf("expected %T, got %#+v", (*os.PathError)(nil), err)
+ }
}
- // should be a PathError
- _, ok = err.(*os.PathError)
- if !ok {
- t.Fatalf("expected PathError, got %#+v", err)
+
+ // Cert present, non-existent key, should fail
+ {
+ _, err := openSSLConn(t, baseinfo+" sslcert="+sslcert+" sslkey=/tmp/filedoesnotexist")
+ if _, ok := err.(*os.PathError); !ok {
+ t.Fatalf("expected %T, got %#+v", (*os.PathError)(nil), err)
+ }
}
- // Key has wrong permissions, should fail
- _, err = openSSLConn(t, getCertConninfo(t, "certtwice"))
- if err == nil {
- t.Fatal("expected error")
+ // Key has wrong permissions (passing the cert as the key), should fail
+ if _, err := openSSLConn(t, baseinfo+" sslcert="+sslcert+" sslkey="+sslcert); err != ErrSSLKeyHasWorldPermissions {
+ t.Fatalf("expected %s, got %#+v", ErrSSLKeyHasWorldPermissions, err)
}
- if err != ErrSSLKeyHasWorldPermissions {
- t.Fatalf("expected ErrSSLKeyHasWorldPermissions, got %#+v", err)
+
+ sslkey := filepath.Join(certpath, "postgresql.key")
+
+ // Should work
+ if db, err := openSSLConn(t, baseinfo+" sslcert="+sslcert+" sslkey="+sslkey); err != nil {
+ t.Fatal(err)
+ } else {
+ rows, err := db.Query("SELECT 1")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := rows.Close(); err != nil {
+ t.Fatal(err)
+ }
+ if err := db.Close(); err != nil {
+ t.Fatal(err)
+ }
}
}
diff --git a/vendor/github.com/lib/pq/ssl_windows.go b/vendor/github.com/lib/pq/ssl_windows.go
index 529daed22..5d2c763ce 100644
--- a/vendor/github.com/lib/pq/ssl_windows.go
+++ b/vendor/github.com/lib/pq/ssl_windows.go
@@ -2,8 +2,8 @@
package pq
-import "os"
-
-// sslCertificatePermissions checks the permissions on user-supplied certificate
-// files. In libpq, this is a no-op on Windows.
-func sslCertificatePermissions(cert, key os.FileInfo) {}
+// sslKeyPermissions checks the permissions on user-supplied ssl key files.
+// The key file should have very little access.
+//
+// libpq does not check key file permissions on Windows.
+func sslKeyPermissions(string) error { return nil }
diff --git a/vendor/github.com/miekg/dns/README.md b/vendor/github.com/miekg/dns/README.md
index 0c1f1b6a9..2acc7f1ff 100644
--- a/vendor/github.com/miekg/dns/README.md
+++ b/vendor/github.com/miekg/dns/README.md
@@ -25,6 +25,7 @@ two versions of Go, currently: 1.6 and 1.7.
A not-so-up-to-date-list-that-may-be-actually-current:
+* https://github.com/coredns/coredns
* https://cloudflare.com
* https://github.com/abh/geodns
* http://www.statdns.com/
@@ -54,6 +55,8 @@ A not-so-up-to-date-list-that-may-be-actually-current:
* https://github.com/mehrdadrad/mylg
* https://github.com/bamarni/dockness
* https://github.com/fffaraz/microdns
+* http://quilt.io
+* https://github.com/ipdcode/hades (JD.COM)
Send pull request if you want to be listed here.
@@ -142,6 +145,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
* 6975 - Algorithm Understanding in DNSSEC
* 7043 - EUI48/EUI64 records
* 7314 - DNS (EDNS) EXPIRE Option
+* 7828 - edns-tcp-keepalive EDNS0 Option
* 7553 - URI record
* 7858 - DNS over TLS: Initiation and Performance Considerations (draft)
* 7873 - Domain Name System (DNS) Cookies (draft-ietf-dnsop-cookies)
diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go
index 0db7f7bf6..d54d6422e 100644
--- a/vendor/github.com/miekg/dns/client.go
+++ b/vendor/github.com/miekg/dns/client.go
@@ -121,12 +121,12 @@ func (c *Client) Exchange(m *Msg, a string) (r *Msg, rtt time.Duration, err erro
r, rtt, err, shared := c.group.Do(m.Question[0].Name+t+cl, func() (*Msg, time.Duration, error) {
return c.exchange(m, a)
})
+ if r != nil && shared {
+ r = r.Copy()
+ }
if err != nil {
return r, rtt, err
}
- if shared {
- return r.Copy(), rtt, nil
- }
return r, rtt, nil
}
@@ -300,6 +300,18 @@ func tcpMsgLen(t io.Reader) (int, error) {
if err != nil {
return 0, err
}
+
+ // As seen with my local router/switch, retursn 1 byte on the above read,
+ // resulting a a ShortRead. Just write it out (instead of loop) and read the
+ // other byte.
+ if n == 1 {
+ n1, err := t.Read(p[1:])
+ if err != nil {
+ return 0, err
+ }
+ n += n1
+ }
+
if n != 2 {
return 0, ErrShortRead
}
@@ -400,7 +412,7 @@ func (co *Conn) Write(p []byte) (n int, err error) {
n, err := io.Copy(w, bytes.NewReader(p))
return int(n), err
}
- n, err = co.Conn.(*net.UDPConn).Write(p)
+ n, err = co.Conn.Write(p)
return n, err
}
diff --git a/vendor/github.com/miekg/dns/client_test.go b/vendor/github.com/miekg/dns/client_test.go
index 850bcfcda..dee585f36 100644
--- a/vendor/github.com/miekg/dns/client_test.go
+++ b/vendor/github.com/miekg/dns/client_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"strconv"
+ "sync"
"testing"
"time"
)
@@ -77,8 +78,8 @@ func TestClientTLSSync(t *testing.T) {
}
}
-func TestClientSyncBadId(t *testing.T) {
- HandleFunc("miek.nl.", HelloServerBadId)
+func TestClientSyncBadID(t *testing.T) {
+ HandleFunc("miek.nl.", HelloServerBadID)
defer HandleRemove("miek.nl.")
s, addrstr, err := RunLocalUDPServer("127.0.0.1:0")
@@ -450,3 +451,61 @@ func TestTimeout(t *testing.T) {
t.Errorf("exchange took longer (%v) than specified Timeout (%v)", length, timeout)
}
}
+
+// Check that responses from deduplicated requests aren't shared between callers
+func TestConcurrentExchanges(t *testing.T) {
+ cases := make([]*Msg, 2)
+ cases[0] = new(Msg)
+ cases[1] = new(Msg)
+ cases[1].Truncated = true
+ for _, m := range cases {
+ block := make(chan struct{})
+ waiting := make(chan struct{})
+
+ handler := func(w ResponseWriter, req *Msg) {
+ r := m.Copy()
+ r.SetReply(req)
+
+ waiting <- struct{}{}
+ <-block
+ w.WriteMsg(r)
+ }
+
+ HandleFunc("miek.nl.", handler)
+ defer HandleRemove("miek.nl.")
+
+ s, addrstr, err := RunLocalUDPServer("127.0.0.1:0")
+ if err != nil {
+ t.Fatalf("unable to run test server: %s", err)
+ }
+ defer s.Shutdown()
+
+ m := new(Msg)
+ m.SetQuestion("miek.nl.", TypeSRV)
+ c := &Client{
+ SingleInflight: true,
+ }
+ r := make([]*Msg, 2)
+
+ var wg sync.WaitGroup
+ wg.Add(len(r))
+ for i := 0; i < len(r); i++ {
+ go func(i int) {
+ r[i], _, _ = c.Exchange(m.Copy(), addrstr)
+ wg.Done()
+ }(i)
+ }
+ select {
+ case <-waiting:
+ case <-time.After(time.Second):
+ t.FailNow()
+ }
+ close(block)
+ wg.Wait()
+
+ if r[0] == r[1] {
+ t.Log("Got same response object, expected non-shared responses")
+ t.Fail()
+ }
+ }
+}
diff --git a/vendor/github.com/miekg/dns/clientconfig.go b/vendor/github.com/miekg/dns/clientconfig.go
index cfa9ad0b2..0a1f5a92c 100644
--- a/vendor/github.com/miekg/dns/clientconfig.go
+++ b/vendor/github.com/miekg/dns/clientconfig.go
@@ -97,3 +97,35 @@ func ClientConfigFromFile(resolvconf string) (*ClientConfig, error) {
}
return c, nil
}
+
+// NameList returns all of the names that should be queried based on the
+// config. It is based off of go's net/dns name building, but it does not
+// check the length of the resulting names.
+func (c *ClientConfig) NameList(name string) []string {
+ // if this domain is already fully qualified, no append needed.
+ if IsFqdn(name) {
+ return []string{name}
+ }
+
+ // Check to see if the name has more labels than Ndots. Do this before making
+ // the domain fully qualified.
+ hasNdots := CountLabel(name) > c.Ndots
+ // Make the domain fully qualified.
+ name = Fqdn(name)
+
+ // Make a list of names based off search.
+ names := []string{}
+
+ // If name has enough dots, try that first.
+ if hasNdots {
+ names = append(names, name)
+ }
+ for _, s := range c.Search {
+ names = append(names, Fqdn(name+s))
+ }
+ // If we didn't have enough dots, try after suffixes.
+ if !hasNdots {
+ names = append(names, name)
+ }
+ return names
+}
diff --git a/vendor/github.com/miekg/dns/clientconfig_test.go b/vendor/github.com/miekg/dns/clientconfig_test.go
index 63bc5c814..7755a8a6f 100644
--- a/vendor/github.com/miekg/dns/clientconfig_test.go
+++ b/vendor/github.com/miekg/dns/clientconfig_test.go
@@ -48,3 +48,40 @@ func testConfig(t *testing.T, data string) {
func TestNameserver(t *testing.T) { testConfig(t, normal) }
func TestMissingFinalNewLine(t *testing.T) { testConfig(t, missingNewline) }
+
+func TestNameList(t *testing.T) {
+ cfg := ClientConfig{
+ Ndots: 1,
+ }
+ // fqdn should be only result returned
+ names := cfg.NameList("miek.nl.")
+ if len(names) != 1 {
+ t.Errorf("NameList returned != 1 names: %v", names)
+ } else if names[0] != "miek.nl." {
+ t.Errorf("NameList didn't return sent fqdn domain: %v", names[0])
+ }
+
+ cfg.Search = []string{
+ "test",
+ }
+ // Sent domain has NDots and search
+ names = cfg.NameList("miek.nl")
+ if len(names) != 2 {
+ t.Errorf("NameList returned != 2 names: %v", names)
+ } else if names[0] != "miek.nl." {
+ t.Errorf("NameList didn't return sent domain first: %v", names[0])
+ } else if names[1] != "miek.nl.test." {
+ t.Errorf("NameList didn't return search last: %v", names[1])
+ }
+
+ cfg.Ndots = 2
+ // Sent domain has less than NDots and search
+ names = cfg.NameList("miek.nl")
+ if len(names) != 2 {
+ t.Errorf("NameList returned != 2 names: %v", names)
+ } else if names[0] != "miek.nl.test." {
+ t.Errorf("NameList didn't return search first: %v", names[0])
+ } else if names[1] != "miek.nl." {
+ t.Errorf("NameList didn't return sent domain last: %v", names[1])
+ }
+}
diff --git a/vendor/github.com/miekg/dns/compress_generate.go b/vendor/github.com/miekg/dns/compress_generate.go
new file mode 100644
index 000000000..1a301e9f3
--- /dev/null
+++ b/vendor/github.com/miekg/dns/compress_generate.go
@@ -0,0 +1,184 @@
+//+build ignore
+
+// compression_generate.go is meant to run with go generate. It will use
+// go/{importer,types} to track down all the RR struct types. Then for each type
+// it will look to see if there are (compressible) names, if so it will add that
+// type to compressionLenHelperType and comressionLenSearchType which "fake" the
+// compression so that Len() is fast.
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "go/format"
+ "go/importer"
+ "go/types"
+ "log"
+ "os"
+)
+
+var packageHdr = `
+// *** DO NOT MODIFY ***
+// AUTOGENERATED BY go generate from compress_generate.go
+
+package dns
+
+`
+
+// getTypeStruct will take a type and the package scope, and return the
+// (innermost) struct if the type is considered a RR type (currently defined as
+// those structs beginning with a RR_Header, could be redefined as implementing
+// the RR interface). The bool return value indicates if embedded structs were
+// resolved.
+func getTypeStruct(t types.Type, scope *types.Scope) (*types.Struct, bool) {
+ st, ok := t.Underlying().(*types.Struct)
+ if !ok {
+ return nil, false
+ }
+ if st.Field(0).Type() == scope.Lookup("RR_Header").Type() {
+ return st, false
+ }
+ if st.Field(0).Anonymous() {
+ st, _ := getTypeStruct(st.Field(0).Type(), scope)
+ return st, true
+ }
+ return nil, false
+}
+
+func main() {
+ // Import and type-check the package
+ pkg, err := importer.Default().Import("github.com/miekg/dns")
+ fatalIfErr(err)
+ scope := pkg.Scope()
+
+ domainTypes := map[string]bool{} // Types that have a domain name in them (either comressible or not).
+ cdomainTypes := map[string]bool{} // Types that have a compressible domain name in them (subset of domainType)
+ for _, name := range scope.Names() {
+ o := scope.Lookup(name)
+ if o == nil || !o.Exported() {
+ continue
+ }
+ st, _ := getTypeStruct(o.Type(), scope)
+ if st == nil {
+ continue
+ }
+ if name == "PrivateRR" {
+ continue
+ }
+
+ if scope.Lookup("Type"+o.Name()) == nil && o.Name() != "RFC3597" {
+ log.Fatalf("Constant Type%s does not exist.", o.Name())
+ }
+
+ for i := 1; i < st.NumFields(); i++ {
+ if _, ok := st.Field(i).Type().(*types.Slice); ok {
+ if st.Tag(i) == `dns:"domain-name"` {
+ domainTypes[o.Name()] = true
+ }
+ if st.Tag(i) == `dns:"cdomain-name"` {
+ cdomainTypes[o.Name()] = true
+ domainTypes[o.Name()] = true
+ }
+ continue
+ }
+
+ switch {
+ case st.Tag(i) == `dns:"domain-name"`:
+ domainTypes[o.Name()] = true
+ case st.Tag(i) == `dns:"cdomain-name"`:
+ cdomainTypes[o.Name()] = true
+ domainTypes[o.Name()] = true
+ }
+ }
+ }
+
+ b := &bytes.Buffer{}
+ b.WriteString(packageHdr)
+
+ // compressionLenHelperType - all types that have domain-name/cdomain-name can be used for compressing names
+
+ fmt.Fprint(b, "func compressionLenHelperType(c map[string]int, r RR) {\n")
+ fmt.Fprint(b, "switch x := r.(type) {\n")
+ for name, _ := range domainTypes {
+ o := scope.Lookup(name)
+ st, _ := getTypeStruct(o.Type(), scope)
+
+ fmt.Fprintf(b, "case *%s:\n", name)
+ for i := 1; i < st.NumFields(); i++ {
+ out := func(s string) { fmt.Fprintf(b, "compressionLenHelper(c, x.%s)\n", st.Field(i).Name()) }
+
+ if _, ok := st.Field(i).Type().(*types.Slice); ok {
+ switch st.Tag(i) {
+ case `dns:"domain-name"`:
+ fallthrough
+ case `dns:"cdomain-name"`:
+ // For HIP we need to slice over the elements in this slice.
+ fmt.Fprintf(b, `for i := range x.%s {
+ compressionLenHelper(c, x.%s[i])
+ }
+`, st.Field(i).Name(), st.Field(i).Name())
+ }
+ continue
+ }
+
+ switch {
+ case st.Tag(i) == `dns:"cdomain-name"`:
+ fallthrough
+ case st.Tag(i) == `dns:"domain-name"`:
+ out(st.Field(i).Name())
+ }
+ }
+ }
+ fmt.Fprintln(b, "}\n}\n\n")
+
+ // compressionLenSearchType - search cdomain-tags types for compressible names.
+
+ fmt.Fprint(b, "func compressionLenSearchType(c map[string]int, r RR) (int, bool) {\n")
+ fmt.Fprint(b, "switch x := r.(type) {\n")
+ for name, _ := range cdomainTypes {
+ o := scope.Lookup(name)
+ st, _ := getTypeStruct(o.Type(), scope)
+
+ fmt.Fprintf(b, "case *%s:\n", name)
+ j := 1
+ for i := 1; i < st.NumFields(); i++ {
+ out := func(s string, j int) {
+ fmt.Fprintf(b, "k%d, ok%d := compressionLenSearch(c, x.%s)\n", j, j, st.Field(i).Name())
+ }
+
+ // There are no slice types with names that can be compressed.
+
+ switch {
+ case st.Tag(i) == `dns:"cdomain-name"`:
+ out(st.Field(i).Name(), j)
+ j++
+ }
+ }
+ k := "k1"
+ ok := "ok1"
+ for i := 2; i < j; i++ {
+ k += fmt.Sprintf(" + k%d", i)
+ ok += fmt.Sprintf(" && ok%d", i)
+ }
+ fmt.Fprintf(b, "return %s, %s\n", k, ok)
+ }
+ fmt.Fprintln(b, "}\nreturn 0, false\n}\n\n")
+
+ // gofmt
+ res, err := format.Source(b.Bytes())
+ if err != nil {
+ b.WriteTo(os.Stderr)
+ log.Fatal(err)
+ }
+
+ f, err := os.Create("zcompress.go")
+ fatalIfErr(err)
+ defer f.Close()
+ f.Write(res)
+}
+
+func fatalIfErr(err error) {
+ if err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/vendor/github.com/miekg/dns/dane.go b/vendor/github.com/miekg/dns/dane.go
index cdaa833ff..8c4a14ef1 100644
--- a/vendor/github.com/miekg/dns/dane.go
+++ b/vendor/github.com/miekg/dns/dane.go
@@ -6,7 +6,6 @@ import (
"crypto/x509"
"encoding/hex"
"errors"
- "io"
)
// CertificateToDANE converts a certificate to a hex string as used in the TLSA or SMIMEA records.
@@ -23,20 +22,20 @@ func CertificateToDANE(selector, matchingType uint8, cert *x509.Certificate) (st
h := sha256.New()
switch selector {
case 0:
- io.WriteString(h, string(cert.Raw))
+ h.Write(cert.Raw)
return hex.EncodeToString(h.Sum(nil)), nil
case 1:
- io.WriteString(h, string(cert.RawSubjectPublicKeyInfo))
+ h.Write(cert.RawSubjectPublicKeyInfo)
return hex.EncodeToString(h.Sum(nil)), nil
}
case 2:
h := sha512.New()
switch selector {
case 0:
- io.WriteString(h, string(cert.Raw))
+ h.Write(cert.Raw)
return hex.EncodeToString(h.Sum(nil)), nil
case 1:
- io.WriteString(h, string(cert.RawSubjectPublicKeyInfo))
+ h.Write(cert.RawSubjectPublicKeyInfo)
return hex.EncodeToString(h.Sum(nil)), nil
}
}
diff --git a/vendor/github.com/miekg/dns/dns_test.go b/vendor/github.com/miekg/dns/dns_test.go
index ad68533fd..dbfe25328 100644
--- a/vendor/github.com/miekg/dns/dns_test.go
+++ b/vendor/github.com/miekg/dns/dns_test.go
@@ -310,6 +310,23 @@ func TestMsgLengthCompressionMalformed(t *testing.T) {
m.Len() // Should not crash.
}
+func TestMsgCompressLength2(t *testing.T) {
+ msg := new(Msg)
+ msg.Compress = true
+ msg.SetQuestion(Fqdn("bliep."), TypeANY)
+ msg.Answer = append(msg.Answer, &SRV{Hdr: RR_Header{Name: "blaat.", Rrtype: 0x21, Class: 0x1, Ttl: 0x3c}, Port: 0x4c57, Target: "foo.bar."})
+ msg.Extra = append(msg.Extra, &A{Hdr: RR_Header{Name: "foo.bar.", Rrtype: 0x1, Class: 0x1, Ttl: 0x3c}, A: net.IP{0xac, 0x11, 0x0, 0x3}})
+ predicted := msg.Len()
+ buf, err := msg.Pack()
+ if err != nil {
+ t.Error(err)
+ }
+ if predicted != len(buf) {
+ t.Errorf("predicted compressed length is wrong: predicted %s (len=%d) %d, actual %d",
+ msg.Question[0].Name, len(msg.Answer), predicted, len(buf))
+ }
+}
+
func TestToRFC3597(t *testing.T) {
a, _ := NewRR("miek.nl. IN A 10.0.1.1")
x := new(RFC3597)
diff --git a/vendor/github.com/miekg/dns/dnssec.go b/vendor/github.com/miekg/dns/dnssec.go
index f5f3fbdd8..07262011e 100644
--- a/vendor/github.com/miekg/dns/dnssec.go
+++ b/vendor/github.com/miekg/dns/dnssec.go
@@ -43,7 +43,7 @@ const (
PRIVATEOID uint8 = 254
)
-// Map for algorithm names.
+// AlgorithmToString is a map of algorithm IDs to algorithm names.
var AlgorithmToString = map[uint8]string{
RSAMD5: "RSAMD5",
DH: "DH",
@@ -61,10 +61,10 @@ var AlgorithmToString = map[uint8]string{
PRIVATEOID: "PRIVATEOID",
}
-// Map of algorithm strings.
+// StringToAlgorithm is the reverse of AlgorithmToString.
var StringToAlgorithm = reverseInt8(AlgorithmToString)
-// Map of algorithm crypto hashes.
+// AlgorithmToHash is a map of algorithm crypto hash IDs to crypto.Hash's.
var AlgorithmToHash = map[uint8]crypto.Hash{
RSAMD5: crypto.MD5, // Deprecated in RFC 6725
RSASHA1: crypto.SHA1,
@@ -85,7 +85,7 @@ const (
SHA512 // Experimental
)
-// Map for hash names.
+// HashToString is a map of hash IDs to names.
var HashToString = map[uint8]string{
SHA1: "SHA1",
SHA256: "SHA256",
@@ -94,7 +94,7 @@ var HashToString = map[uint8]string{
SHA512: "SHA512",
}
-// Map of hash strings.
+// StringToHash is a map of names to hash IDs.
var StringToHash = reverseInt8(HashToString)
// DNSKEY flag values.
@@ -208,9 +208,6 @@ func (k *DNSKEY) ToDS(h uint8) *DS {
// "|" denotes concatenation
// DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key.
- // digest buffer
- digest := append(owner, wire...) // another copy
-
var hash crypto.Hash
switch h {
case SHA1:
@@ -226,7 +223,8 @@ func (k *DNSKEY) ToDS(h uint8) *DS {
}
s := hash.New()
- s.Write(digest)
+ s.Write(owner)
+ s.Write(wire)
ds.Digest = hex.EncodeToString(s.Sum(nil))
return ds
}
@@ -297,7 +295,6 @@ func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error {
if err != nil {
return err
}
- signdata = append(signdata, wire...)
hash, ok := AlgorithmToHash[rr.Algorithm]
if !ok {
@@ -306,6 +303,7 @@ func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error {
h := hash.New()
h.Write(signdata)
+ h.Write(wire)
signature, err := sign(k, h.Sum(nil), hash, rr.Algorithm)
if err != nil {
@@ -415,7 +413,6 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
if err != nil {
return err
}
- signeddata = append(signeddata, wire...)
sigbuf := rr.sigBuf() // Get the binary signature data
if rr.Algorithm == PRIVATEDNS { // PRIVATEOID
@@ -438,6 +435,7 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
h := hash.New()
h.Write(signeddata)
+ h.Write(wire)
return rsa.VerifyPKCS1v15(pubkey, hash, h.Sum(nil), sigbuf)
case ECDSAP256SHA256, ECDSAP384SHA384:
@@ -452,6 +450,7 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
h := hash.New()
h.Write(signeddata)
+ h.Write(wire)
if ecdsa.Verify(pubkey, h.Sum(nil), r, s) {
return nil
}
diff --git a/vendor/github.com/miekg/dns/dnssec_keygen.go b/vendor/github.com/miekg/dns/dnssec_keygen.go
index 229a07937..5e4b7741a 100644
--- a/vendor/github.com/miekg/dns/dnssec_keygen.go
+++ b/vendor/github.com/miekg/dns/dnssec_keygen.go
@@ -121,17 +121,17 @@ func (k *DNSKEY) setPublicKeyDSA(_Q, _P, _G, _Y *big.Int) bool {
// RFC 3110: Section 2. RSA Public KEY Resource Records
func exponentToBuf(_E int) []byte {
var buf []byte
- i := big.NewInt(int64(_E))
- if len(i.Bytes()) < 256 {
- buf = make([]byte, 1)
- buf[0] = uint8(len(i.Bytes()))
+ i := big.NewInt(int64(_E)).Bytes()
+ if len(i) < 256 {
+ buf = make([]byte, 1, 1+len(i))
+ buf[0] = uint8(len(i))
} else {
- buf = make([]byte, 3)
+ buf = make([]byte, 3, 3+len(i))
buf[0] = 0
- buf[1] = uint8(len(i.Bytes()) >> 8)
- buf[2] = uint8(len(i.Bytes()))
+ buf[1] = uint8(len(i) >> 8)
+ buf[2] = uint8(len(i))
}
- buf = append(buf, i.Bytes()...)
+ buf = append(buf, i...)
return buf
}
diff --git a/vendor/github.com/miekg/dns/dnssec_keyscan.go b/vendor/github.com/miekg/dns/dnssec_keyscan.go
index 9ff3a617e..4f8d830b8 100644
--- a/vendor/github.com/miekg/dns/dnssec_keyscan.go
+++ b/vendor/github.com/miekg/dns/dnssec_keyscan.go
@@ -36,7 +36,7 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, er
return nil, ErrPrivKey
}
// TODO(mg): check if the pubkey matches the private key
- algo, err := strconv.Atoi(strings.SplitN(m["algorithm"], " ", 2)[0])
+ algo, err := strconv.ParseUint(strings.SplitN(m["algorithm"], " ", 2)[0], 10, 8)
if err != nil {
return nil, ErrPrivKey
}
diff --git a/vendor/github.com/miekg/dns/edns.go b/vendor/github.com/miekg/dns/edns.go
index 465b85f37..dbff3714c 100644
--- a/vendor/github.com/miekg/dns/edns.go
+++ b/vendor/github.com/miekg/dns/edns.go
@@ -157,7 +157,7 @@ type EDNS0 interface {
String() string
}
-// The nsid EDNS0 option is used to retrieve a nameserver
+// EDNS0_NSID option is used to retrieve a nameserver
// identifier. When sending a request Nsid must be set to the empty string
// The identifier is an opaque string encoded as hex.
// Basic use pattern for creating an nsid option:
@@ -197,7 +197,7 @@ func (e *EDNS0_NSID) String() string { return string(e.Nsid) }
// e := new(dns.EDNS0_SUBNET)
// e.Code = dns.EDNS0SUBNET
// e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
-// e.SourceNetMask = 32 // 32 for IPV4, 128 for IPv6
+// e.SourceNetmask = 32 // 32 for IPV4, 128 for IPv6
// e.SourceScope = 0
// e.Address = net.ParseIP("127.0.0.1").To4() // for IPv4
// // e.Address = net.ParseIP("2001:7b8:32a::2") // for IPV6
@@ -301,7 +301,7 @@ func (e *EDNS0_SUBNET) String() (s string) {
return
}
-// The Cookie EDNS0 option
+// The EDNS0_COOKIE option is used to add a DNS Cookie to a message.
//
// o := new(dns.OPT)
// o.Hdr.Name = "."
@@ -543,15 +543,15 @@ func (e *EDNS0_LOCAL) unpack(b []byte) error {
return nil
}
+// EDNS0_TCP_KEEPALIVE is an EDNS0 option that instructs the server to keep
+// the TCP connection alive. See RFC 7828.
type EDNS0_TCP_KEEPALIVE struct {
Code uint16 // Always EDNSTCPKEEPALIVE
Length uint16 // the value 0 if the TIMEOUT is omitted, the value 2 if it is present;
Timeout uint16 // an idle timeout value for the TCP connection, specified in units of 100 milliseconds, encoded in network byte order.
}
-func (e *EDNS0_TCP_KEEPALIVE) Option() uint16 {
- return EDNS0TCPKEEPALIVE
-}
+func (e *EDNS0_TCP_KEEPALIVE) Option() uint16 { return EDNS0TCPKEEPALIVE }
func (e *EDNS0_TCP_KEEPALIVE) pack() ([]byte, error) {
if e.Timeout != 0 && e.Length != 2 {
diff --git a/vendor/github.com/miekg/dns/idn/punycode.go b/vendor/github.com/miekg/dns/idn/punycode.go
index 7e5c263fc..1d03bf6ae 100644
--- a/vendor/github.com/miekg/dns/idn/punycode.go
+++ b/vendor/github.com/miekg/dns/idn/punycode.go
@@ -242,11 +242,8 @@ func encode(input []byte) []byte {
t, k, cp rune // weight and codepoint calculation
)
- s := &bytes.Buffer{}
for h := basiclen; h < fulllen; n, delta = n+1, delta+1 {
nextltr = next(b, n)
- s.Truncate(0)
- s.WriteRune(nextltr)
delta, n = delta+(nextltr-n)*rune(h+1), nextltr
for _, ltr = range b {
diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go
index 0d8cc6fb3..b5c074f05 100644
--- a/vendor/github.com/miekg/dns/msg.go
+++ b/vendor/github.com/miekg/dns/msg.go
@@ -9,6 +9,7 @@
package dns
//go:generate go run msg_generate.go
+//go:generate go run compress_generate.go
import (
crand "crypto/rand"
@@ -16,22 +17,9 @@ import (
"math/big"
"math/rand"
"strconv"
+ "sync"
)
-func init() {
- // Initialize default math/rand source using crypto/rand to provide better
- // security without the performance trade-off.
- buf := make([]byte, 8)
- _, err := crand.Read(buf)
- if err != nil {
- // Failed to read from cryptographic source, fallback to default initial
- // seed (1) by returning early
- return
- }
- seed := binary.BigEndian.Uint64(buf)
- rand.Seed(int64(seed))
-}
-
const maxCompressionOffset = 2 << 13 // We have 14 bits for the compression pointer
var (
@@ -66,11 +54,45 @@ var (
// dns.Id = func() uint16 { return 3 }
var Id func() uint16 = id
+var (
+ idLock sync.Mutex
+ idRand *rand.Rand
+)
+
// id returns a 16 bits random number to be used as a
// message id. The random provided should be good enough.
func id() uint16 {
- id32 := rand.Uint32()
- return uint16(id32)
+ idLock.Lock()
+
+ if idRand == nil {
+ // This (partially) works around
+ // https://github.com/golang/go/issues/11833 by only
+ // seeding idRand upon the first call to id.
+
+ var seed int64
+ var buf [8]byte
+
+ if _, err := crand.Read(buf[:]); err == nil {
+ seed = int64(binary.LittleEndian.Uint64(buf[:]))
+ } else {
+ seed = rand.Int63()
+ }
+
+ idRand = rand.New(rand.NewSource(seed))
+ }
+
+ // The call to idRand.Uint32 must be within the
+ // mutex lock because *rand.Rand is not safe for
+ // concurrent use.
+ //
+ // There is no added performance overhead to calling
+ // idRand.Uint32 inside a mutex lock over just
+ // calling rand.Uint32 as the global math/rand rng
+ // is internally protected by a sync.Mutex.
+ id := uint16(idRand.Uint32())
+
+ idLock.Unlock()
+ return id
}
// MsgHdr is a a manually-unpacked version of (id, bits).
@@ -241,7 +263,9 @@ func packDomainName(s string, msg []byte, off int, compression map[string]int, c
bsFresh = true
}
// Don't try to compress '.'
- if compress && roBs[begin:] != "." {
+ // We should only compress when compress it true, but we should also still pick
+ // up names that can be used for *future* compression(s).
+ if compression != nil && roBs[begin:] != "." {
if p, ok := compression[roBs[begin:]]; !ok {
// Only offsets smaller than this can be used.
if offset < maxCompressionOffset {
@@ -303,6 +327,7 @@ End:
// UnpackDomainName unpacks a domain name into a string.
func UnpackDomainName(msg []byte, off int) (string, int, error) {
s := make([]byte, 0, 64)
+ labels := 0
off1 := 0
lenmsg := len(msg)
ptr := 0 // number of pointers followed
@@ -345,6 +370,15 @@ Loop:
}
}
}
+ // never exceed the allowed label count lenght (63)
+ if labels >= 63 {
+ return "", lenmsg, &Error{err: "name exceeds 63 labels"}
+ }
+ labels += 1
+ // never exceed the allowed doman name length (255 octets)
+ if len(s) >= 255 {
+ return "", lenmsg, &Error{err: "name exceeded allowed 255 octets"}
+ }
s = append(s, '.')
off += c
case 0xC0:
@@ -364,6 +398,9 @@ Loop:
if ptr++; ptr > 10 {
return "", lenmsg, &Error{err: "too many compression pointers"}
}
+ // pointer should guarantee that it advances and points forwards at least
+ // but the condition on previous three lines guarantees that it's
+ // at least loop-free
off = (c^0xC0)<<8 | int(c1)
default:
// 0x80 and 0x40 are reserved
@@ -710,12 +747,10 @@ func (dns *Msg) PackBuffer(buf []byte) (msg []byte, err error) {
// We need the uncompressed length here, because we first pack it and then compress it.
msg = buf
- compress := dns.Compress
- dns.Compress = false
- if packLen := dns.Len() + 1; len(msg) < packLen {
+ uncompressedLen := compressedLen(dns, false)
+ if packLen := uncompressedLen + 1; len(msg) < packLen {
msg = make([]byte, packLen)
}
- dns.Compress = compress
// Pack it in: header and then the pieces.
off := 0
@@ -868,16 +903,18 @@ func (dns *Msg) String() string {
// If dns.Compress is true compression it is taken into account. Len()
// is provided to be a faster way to get the size of the resulting packet,
// than packing it, measuring the size and discarding the buffer.
-func (dns *Msg) Len() int {
+func (dns *Msg) Len() int { return compressedLen(dns, dns.Compress) }
+
+// compressedLen returns the message length when in compressed wire format
+// when compress is true, otherwise the uncompressed length is returned.
+func compressedLen(dns *Msg, compress bool) int {
// We always return one more than needed.
l := 12 // Message header is always 12 bytes
- var compression map[string]int
- if dns.Compress {
- compression = make(map[string]int)
- }
+ compression := map[string]int{}
+
for i := 0; i < len(dns.Question); i++ {
l += dns.Question[i].len()
- if dns.Compress {
+ if compress {
compressionLenHelper(compression, dns.Question[i].Name)
}
}
@@ -886,7 +923,7 @@ func (dns *Msg) Len() int {
continue
}
l += dns.Answer[i].len()
- if dns.Compress {
+ if compress {
k, ok := compressionLenSearch(compression, dns.Answer[i].Header().Name)
if ok {
l += 1 - k
@@ -904,7 +941,7 @@ func (dns *Msg) Len() int {
continue
}
l += dns.Ns[i].len()
- if dns.Compress {
+ if compress {
k, ok := compressionLenSearch(compression, dns.Ns[i].Header().Name)
if ok {
l += 1 - k
@@ -922,7 +959,7 @@ func (dns *Msg) Len() int {
continue
}
l += dns.Extra[i].len()
- if dns.Compress {
+ if compress {
k, ok := compressionLenSearch(compression, dns.Extra[i].Header().Name)
if ok {
l += 1 - k
@@ -970,97 +1007,6 @@ func compressionLenSearch(c map[string]int, s string) (int, bool) {
return 0, false
}
-// TODO(miek): should add all types, because the all can be *used* for compression. Autogenerate from msg_generate and put in zmsg.go
-func compressionLenHelperType(c map[string]int, r RR) {
- switch x := r.(type) {
- case *NS:
- compressionLenHelper(c, x.Ns)
- case *MX:
- compressionLenHelper(c, x.Mx)
- case *CNAME:
- compressionLenHelper(c, x.Target)
- case *PTR:
- compressionLenHelper(c, x.Ptr)
- case *SOA:
- compressionLenHelper(c, x.Ns)
- compressionLenHelper(c, x.Mbox)
- case *MB:
- compressionLenHelper(c, x.Mb)
- case *MG:
- compressionLenHelper(c, x.Mg)
- case *MR:
- compressionLenHelper(c, x.Mr)
- case *MF:
- compressionLenHelper(c, x.Mf)
- case *MD:
- compressionLenHelper(c, x.Md)
- case *RT:
- compressionLenHelper(c, x.Host)
- case *RP:
- compressionLenHelper(c, x.Mbox)
- compressionLenHelper(c, x.Txt)
- case *MINFO:
- compressionLenHelper(c, x.Rmail)
- compressionLenHelper(c, x.Email)
- case *AFSDB:
- compressionLenHelper(c, x.Hostname)
- case *SRV:
- compressionLenHelper(c, x.Target)
- case *NAPTR:
- compressionLenHelper(c, x.Replacement)
- case *RRSIG:
- compressionLenHelper(c, x.SignerName)
- case *NSEC:
- compressionLenHelper(c, x.NextDomain)
- // HIP?
- }
-}
-
-// Only search on compressing these types.
-func compressionLenSearchType(c map[string]int, r RR) (int, bool) {
- switch x := r.(type) {
- case *NS:
- return compressionLenSearch(c, x.Ns)
- case *MX:
- return compressionLenSearch(c, x.Mx)
- case *CNAME:
- return compressionLenSearch(c, x.Target)
- case *DNAME:
- return compressionLenSearch(c, x.Target)
- case *PTR:
- return compressionLenSearch(c, x.Ptr)
- case *SOA:
- k, ok := compressionLenSearch(c, x.Ns)
- k1, ok1 := compressionLenSearch(c, x.Mbox)
- if !ok && !ok1 {
- return 0, false
- }
- return k + k1, true
- case *MB:
- return compressionLenSearch(c, x.Mb)
- case *MG:
- return compressionLenSearch(c, x.Mg)
- case *MR:
- return compressionLenSearch(c, x.Mr)
- case *MF:
- return compressionLenSearch(c, x.Mf)
- case *MD:
- return compressionLenSearch(c, x.Md)
- case *RT:
- return compressionLenSearch(c, x.Host)
- case *MINFO:
- k, ok := compressionLenSearch(c, x.Rmail)
- k1, ok1 := compressionLenSearch(c, x.Email)
- if !ok && !ok1 {
- return 0, false
- }
- return k + k1, true
- case *AFSDB:
- return compressionLenSearch(c, x.Hostname)
- }
- return 0, false
-}
-
// Copy returns a new RR which is a deep-copy of r.
func Copy(r RR) RR { r1 := r.copy(); return r1 }
diff --git a/vendor/github.com/miekg/dns/nsecx.go b/vendor/github.com/miekg/dns/nsecx.go
index 6f10f3e65..51ce7f8b1 100644
--- a/vendor/github.com/miekg/dns/nsecx.go
+++ b/vendor/github.com/miekg/dns/nsecx.go
@@ -3,7 +3,6 @@ package dns
import (
"crypto/sha1"
"hash"
- "io"
"strings"
)
@@ -36,15 +35,15 @@ func HashName(label string, ha uint8, iter uint16, salt string) string {
}
// k = 0
- name = append(name, wire...)
- io.WriteString(s, string(name))
+ s.Write(name)
+ s.Write(wire)
nsec3 := s.Sum(nil)
// k > 0
for k := uint16(0); k < iter; k++ {
s.Reset()
- nsec3 = append(nsec3, wire...)
- io.WriteString(s, string(nsec3))
- nsec3 = s.Sum(nil)
+ s.Write(nsec3)
+ s.Write(wire)
+ nsec3 = s.Sum(nsec3[:0])
}
return toBase32(nsec3)
}
diff --git a/vendor/github.com/miekg/dns/parse_test.go b/vendor/github.com/miekg/dns/parse_test.go
index dc18b59ce..c727c1301 100644
--- a/vendor/github.com/miekg/dns/parse_test.go
+++ b/vendor/github.com/miekg/dns/parse_test.go
@@ -836,11 +836,7 @@ func TestSRVPacking(t *testing.T) {
if err != nil {
continue
}
- port := 8484
- tmp, err := strconv.Atoi(p)
- if err == nil {
- port = tmp
- }
+ port, _ := strconv.ParseUint(p, 10, 16)
rr := &SRV{
Hdr: RR_Header{Name: "somename.",
diff --git a/vendor/github.com/miekg/dns/reverse.go b/vendor/github.com/miekg/dns/reverse.go
index 099dac948..f6e7a47a6 100644
--- a/vendor/github.com/miekg/dns/reverse.go
+++ b/vendor/github.com/miekg/dns/reverse.go
@@ -6,10 +6,10 @@ var StringToType = reverseInt16(TypeToString)
// StringToClass is the reverse of ClassToString, needed for string parsing.
var StringToClass = reverseInt16(ClassToString)
-// Map of opcodes strings.
+// StringToOpcode is a map of opcodes to strings.
var StringToOpcode = reverseInt(OpcodeToString)
-// Map of rcodes strings.
+// StringToRcode is a map of rcodes to strings.
var StringToRcode = reverseInt(RcodeToString)
// Reverse a map
diff --git a/vendor/github.com/miekg/dns/scan.go b/vendor/github.com/miekg/dns/scan.go
index d34597ba3..de0db32f8 100644
--- a/vendor/github.com/miekg/dns/scan.go
+++ b/vendor/github.com/miekg/dns/scan.go
@@ -819,8 +819,8 @@ func classToInt(token string) (uint16, bool) {
if len(token) < offset+1 {
return 0, false
}
- class, ok := strconv.Atoi(token[offset:])
- if ok != nil || class > maxUint16 {
+ class, err := strconv.ParseUint(token[offset:], 10, 16)
+ if err != nil {
return 0, false
}
return uint16(class), true
@@ -832,8 +832,8 @@ func typeToInt(token string) (uint16, bool) {
if len(token) < offset+1 {
return 0, false
}
- typ, ok := strconv.Atoi(token[offset:])
- if ok != nil || typ > maxUint16 {
+ typ, err := strconv.ParseUint(token[offset:], 10, 16)
+ if err != nil {
return 0, false
}
return uint16(typ), true
diff --git a/vendor/github.com/miekg/dns/scan_rr.go b/vendor/github.com/miekg/dns/scan_rr.go
index 8d6a1bf24..f4c0d3767 100644
--- a/vendor/github.com/miekg/dns/scan_rr.go
+++ b/vendor/github.com/miekg/dns/scan_rr.go
@@ -447,7 +447,7 @@ func setMX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad MX Pref", l}, ""
}
@@ -476,7 +476,7 @@ func setRT(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil {
return nil, &ParseError{f, "bad RT Preference", l}, ""
}
@@ -506,7 +506,7 @@ func setAFSDB(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad AFSDB Subtype", l}, ""
}
@@ -551,7 +551,7 @@ func setKX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad KX Pref", l}, ""
}
@@ -665,7 +665,7 @@ func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.err {
return nil, &ParseError{f, "bad SOA zone parameter", l}, ""
}
- if j, e := strconv.Atoi(l.token); e != nil {
+ if j, e := strconv.ParseUint(l.token, 10, 32); e != nil {
if i == 0 {
// Serial should be a number
return nil, &ParseError{f, "bad SOA zone parameter", l}, ""
@@ -705,21 +705,21 @@ func setSRV(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad SRV Priority", l}, ""
}
rr.Priority = uint16(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad SRV Weight", l}, ""
}
rr.Weight = uint16(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad SRV Port", l}, ""
}
@@ -749,14 +749,14 @@ func setNAPTR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad NAPTR Order", l}, ""
}
rr.Order = uint16(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad NAPTR Preference", l}, ""
}
@@ -885,7 +885,7 @@ func setLOC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return nil, &ParseError{f, "bad LOC Latitude", l}, ""
}
@@ -897,7 +897,7 @@ func setLOC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok {
goto East
}
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return nil, &ParseError{f, "bad LOC Latitude minutes", l}, ""
}
@@ -923,7 +923,7 @@ East:
// East
<-c // zBlank
l = <-c
- if i, e := strconv.Atoi(l.token); e != nil || l.err {
+ if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
return nil, &ParseError{f, "bad LOC Longitude", l}, ""
} else {
rr.Longitude = 1000 * 60 * 60 * uint32(i)
@@ -934,7 +934,7 @@ East:
if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok {
goto Altitude
}
- if i, e := strconv.Atoi(l.token); e != nil || l.err {
+ if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
return nil, &ParseError{f, "bad LOC Longitude minutes", l}, ""
} else {
rr.Longitude += 1000 * 60 * uint32(i)
@@ -1016,7 +1016,7 @@ func setHIP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad HIP PublicKeyAlgorithm", l}, ""
}
@@ -1077,14 +1077,14 @@ func setCERT(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
}
if v, ok := StringToCertType[l.token]; ok {
rr.Type = v
- } else if i, e := strconv.Atoi(l.token); e != nil {
+ } else if i, e := strconv.ParseUint(l.token, 10, 16); e != nil {
return nil, &ParseError{f, "bad CERT Type", l}, ""
} else {
rr.Type = uint16(i)
}
<-c // zBlank
l = <-c // zString
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad CERT KeyTag", l}, ""
}
@@ -1093,7 +1093,7 @@ func setCERT(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
l = <-c // zString
if v, ok := StringToAlgorithm[l.token]; ok {
rr.Algorithm = v
- } else if i, e := strconv.Atoi(l.token); e != nil {
+ } else if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
return nil, &ParseError{f, "bad CERT Algorithm", l}, ""
} else {
rr.Algorithm = uint8(i)
@@ -1148,21 +1148,21 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
}
<-c // zBlank
l = <-c
- i, err := strconv.Atoi(l.token)
+ i, err := strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return nil, &ParseError{f, "bad RRSIG Algorithm", l}, ""
}
rr.Algorithm = uint8(i)
<-c // zBlank
l = <-c
- i, err = strconv.Atoi(l.token)
+ i, err = strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return nil, &ParseError{f, "bad RRSIG Labels", l}, ""
}
rr.Labels = uint8(i)
<-c // zBlank
l = <-c
- i, err = strconv.Atoi(l.token)
+ i, err = strconv.ParseUint(l.token, 10, 32)
if err != nil || l.err {
return nil, &ParseError{f, "bad RRSIG OrigTtl", l}, ""
}
@@ -1193,7 +1193,7 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
}
<-c // zBlank
l = <-c
- i, err = strconv.Atoi(l.token)
+ i, err = strconv.ParseUint(l.token, 10, 16)
if err != nil || l.err {
return nil, &ParseError{f, "bad RRSIG KeyTag", l}, ""
}
@@ -1274,21 +1274,21 @@ func setNSEC3(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3 Hash", l}, ""
}
rr.Hash = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3 Flags", l}, ""
}
rr.Flags = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3 Iterations", l}, ""
}
@@ -1342,21 +1342,21 @@ func setNSEC3PARAM(h RR_Header, c chan lex, o, f string) (RR, *ParseError, strin
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3PARAM Hash", l}, ""
}
rr.Hash = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3PARAM Flags", l}, ""
}
rr.Flags = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad NSEC3PARAM Iterations", l}, ""
}
@@ -1440,14 +1440,14 @@ func setSSHFP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad SSHFP Algorithm", l}, ""
}
rr.Algorithm = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad SSHFP Type", l}, ""
}
@@ -1469,21 +1469,21 @@ func setDNSKEYs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, str
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad " + typ + " Flags", l}, ""
}
rr.Flags = uint16(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad " + typ + " Protocol", l}, ""
}
rr.Protocol = uint8(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad " + typ + " Algorithm", l}, ""
}
@@ -1525,21 +1525,21 @@ func setRKEY(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad RKEY Flags", l}, ""
}
rr.Flags = uint16(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad RKEY Protocol", l}, ""
}
rr.Protocol = uint8(i)
<-c // zBlank
l = <-c // zString
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad RKEY Algorithm", l}, ""
}
@@ -1610,14 +1610,14 @@ func setDSs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, string)
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad " + typ + " KeyTag", l}, ""
}
rr.KeyTag = uint16(i)
<-c // zBlank
l = <-c
- if i, e := strconv.Atoi(l.token); e != nil {
+ if i, e = strconv.ParseUint(l.token, 10, 8); e != nil {
i, ok := StringToAlgorithm[l.tokenUpper]
if !ok || l.err {
return nil, &ParseError{f, "bad " + typ + " Algorithm", l}, ""
@@ -1628,7 +1628,7 @@ func setDSs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, string)
}
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad " + typ + " DigestType", l}, ""
}
@@ -1669,14 +1669,14 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad TA KeyTag", l}, ""
}
rr.KeyTag = uint16(i)
<-c // zBlank
l = <-c
- if i, e := strconv.Atoi(l.token); e != nil {
+ if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
i, ok := StringToAlgorithm[l.tokenUpper]
if !ok || l.err {
return nil, &ParseError{f, "bad TA Algorithm", l}, ""
@@ -1687,7 +1687,7 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
}
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad TA DigestType", l}, ""
}
@@ -1707,21 +1707,21 @@ func setTLSA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad TLSA Usage", l}, ""
}
rr.Usage = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad TLSA Selector", l}, ""
}
rr.Selector = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad TLSA MatchingType", l}, ""
}
@@ -1742,21 +1742,21 @@ func setSMIMEA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad SMIMEA Usage", l}, ""
}
rr.Usage = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad SMIMEA Selector", l}, ""
}
rr.Selector = uint8(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return nil, &ParseError{f, "bad SMIMEA MatchingType", l}, ""
}
@@ -1842,14 +1842,14 @@ func setURI(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad URI Priority", l}, ""
}
rr.Priority = uint16(i)
<-c // zBlank
l = <-c
- i, e = strconv.Atoi(l.token)
+ i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad URI Weight", l}, ""
}
@@ -1888,7 +1888,7 @@ func setNID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad NID Preference", l}, ""
}
@@ -1911,7 +1911,7 @@ func setL32(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad L32 Preference", l}, ""
}
@@ -1933,7 +1933,7 @@ func setLP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad LP Preference", l}, ""
}
@@ -1966,7 +1966,7 @@ func setL64(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad L64 Preference", l}, ""
}
@@ -1988,7 +1988,7 @@ func setUID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return nil, &ParseError{f, "bad UID Uid", l}, ""
}
@@ -2003,7 +2003,7 @@ func setGID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return nil, &ParseError{f, "bad GID Gid", l}, ""
}
@@ -2033,7 +2033,7 @@ func setPX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, ""
}
- i, e := strconv.Atoi(l.token)
+ i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return nil, &ParseError{f, "bad PX Preference", l}, ""
}
@@ -2079,7 +2079,7 @@ func setCAA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
if l.length == 0 {
return rr, nil, l.comment
}
- i, err := strconv.Atoi(l.token)
+ i, err := strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return nil, &ParseError{f, "bad CAA Flag", l}, ""
}
diff --git a/vendor/github.com/miekg/dns/server_test.go b/vendor/github.com/miekg/dns/server_test.go
index 098be2ebe..f17a2f90f 100644
--- a/vendor/github.com/miekg/dns/server_test.go
+++ b/vendor/github.com/miekg/dns/server_test.go
@@ -20,7 +20,7 @@ func HelloServer(w ResponseWriter, req *Msg) {
w.WriteMsg(m)
}
-func HelloServerBadId(w ResponseWriter, req *Msg) {
+func HelloServerBadID(w ResponseWriter, req *Msg) {
m := new(Msg)
m.SetReply(req)
m.Id++
@@ -548,7 +548,7 @@ func TestHandlerCloseTCP(t *testing.T) {
return
}
time.Sleep(time.Second / 10)
- tries += 1
+ tries++
goto exchange
}
}()
diff --git a/vendor/github.com/miekg/dns/sig0.go b/vendor/github.com/miekg/dns/sig0.go
index 2dce06af8..f31e9e684 100644
--- a/vendor/github.com/miekg/dns/sig0.go
+++ b/vendor/github.com/miekg/dns/sig0.go
@@ -60,16 +60,15 @@ func (rr *SIG) Sign(k crypto.Signer, m *Msg) ([]byte, error) {
}
rr.Signature = toBase64(signature)
- sig := string(signature)
- buf = append(buf, sig...)
+ buf = append(buf, signature...)
if len(buf) > int(^uint16(0)) {
return nil, ErrBuf
}
// Adjust sig data length
rdoff := len(mbuf) + 1 + 2 + 2 + 4
rdlen := binary.BigEndian.Uint16(buf[rdoff:])
- rdlen += uint16(len(sig))
+ rdlen += uint16(len(signature))
binary.BigEndian.PutUint16(buf[rdoff:], rdlen)
// Adjust additional count
adc := binary.BigEndian.Uint16(buf[10:])
diff --git a/vendor/github.com/miekg/dns/smimea.go b/vendor/github.com/miekg/dns/smimea.go
index 3a4bb5700..4e7ded4b3 100644
--- a/vendor/github.com/miekg/dns/smimea.go
+++ b/vendor/github.com/miekg/dns/smimea.go
@@ -33,15 +33,15 @@ func (r *SMIMEA) Verify(cert *x509.Certificate) error {
return ErrSig // ErrSig, really?
}
-// SIMEAName returns the ownername of a SMIMEA resource record as per the
+// SMIMEAName returns the ownername of a SMIMEA resource record as per the
// format specified in RFC 'draft-ietf-dane-smime-12' Section 2 and 3
-func SMIMEAName(email_address string, domain_name string) (string, error) {
+func SMIMEAName(email, domain string) (string, error) {
hasher := sha256.New()
- hasher.Write([]byte(email_address))
+ hasher.Write([]byte(email))
// RFC Section 3: "The local-part is hashed using the SHA2-256
// algorithm with the hash truncated to 28 octets and
// represented in its hexadecimal representation to become the
// left-most label in the prepared domain name"
- return hex.EncodeToString(hasher.Sum(nil)[:28]) + "." + "_smimecert." + domain_name, nil
+ return hex.EncodeToString(hasher.Sum(nil)[:28]) + "." + "_smimecert." + domain, nil
}
diff --git a/vendor/github.com/miekg/dns/tsig.go b/vendor/github.com/miekg/dns/tsig.go
index 78365e1c5..24013096b 100644
--- a/vendor/github.com/miekg/dns/tsig.go
+++ b/vendor/github.com/miekg/dns/tsig.go
@@ -9,7 +9,6 @@ import (
"encoding/binary"
"encoding/hex"
"hash"
- "io"
"strconv"
"strings"
"time"
@@ -124,7 +123,7 @@ func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, s
default:
return nil, "", ErrKeyAlg
}
- io.WriteString(h, string(buf))
+ h.Write(buf)
t.MAC = hex.EncodeToString(h.Sum(nil))
t.MACSize = uint16(len(t.MAC) / 2) // Size is half!
diff --git a/vendor/github.com/miekg/dns/types.go b/vendor/github.com/miekg/dns/types.go
index c8b3191e5..c17251cb6 100644
--- a/vendor/github.com/miekg/dns/types.go
+++ b/vendor/github.com/miekg/dns/types.go
@@ -144,7 +144,7 @@ const (
OpcodeUpdate = 5
)
-// Headers is the wire format for the DNS packet header.
+// Header is the wire format for the DNS packet header.
type Header struct {
Id uint16
Bits uint16
diff --git a/vendor/github.com/miekg/dns/types_generate.go b/vendor/github.com/miekg/dns/types_generate.go
index bf80da329..dd1310942 100644
--- a/vendor/github.com/miekg/dns/types_generate.go
+++ b/vendor/github.com/miekg/dns/types_generate.go
@@ -197,7 +197,7 @@ func main() {
case st.Tag(i) == "":
switch st.Field(i).Type().(*types.Basic).Kind() {
case types.Uint8:
- o("l += 1 // %s\n")
+ o("l++ // %s\n")
case types.Uint16:
o("l += 2 // %s\n")
case types.Uint32:
diff --git a/vendor/github.com/miekg/dns/udp.go b/vendor/github.com/miekg/dns/udp.go
index c79c6c883..af111b9a8 100644
--- a/vendor/github.com/miekg/dns/udp.go
+++ b/vendor/github.com/miekg/dns/udp.go
@@ -1,10 +1,9 @@
-// +build !windows,!plan9
+// +build !windows
package dns
import (
"net"
- "syscall"
)
// SessionUDP holds the remote address and the associated
@@ -17,29 +16,6 @@ type SessionUDP struct {
// RemoteAddr returns the remote network address.
func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
-// setUDPSocketOptions sets the UDP socket options.
-// This function is implemented on a per platform basis. See udp_*.go for more details
-func setUDPSocketOptions(conn *net.UDPConn) error {
- sa, err := getUDPSocketName(conn)
- if err != nil {
- return err
- }
- switch sa.(type) {
- case *syscall.SockaddrInet6:
- v6only, err := getUDPSocketOptions6Only(conn)
- if err != nil {
- return err
- }
- setUDPSocketOptions6(conn)
- if !v6only {
- setUDPSocketOptions4(conn)
- }
- case *syscall.SockaddrInet4:
- setUDPSocketOptions4(conn)
- }
- return nil
-}
-
// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
// net.UDPAddr.
func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
diff --git a/vendor/github.com/miekg/dns/udp_linux.go b/vendor/github.com/miekg/dns/udp_linux.go
index 142a80073..033df4239 100644
--- a/vendor/github.com/miekg/dns/udp_linux.go
+++ b/vendor/github.com/miekg/dns/udp_linux.go
@@ -1,4 +1,4 @@
-// +build linux
+// +build linux,!appengine
package dns
@@ -15,6 +15,29 @@ import (
"syscall"
)
+// setUDPSocketOptions sets the UDP socket options.
+// This function is implemented on a per platform basis. See udp_*.go for more details
+func setUDPSocketOptions(conn *net.UDPConn) error {
+ sa, err := getUDPSocketName(conn)
+ if err != nil {
+ return err
+ }
+ switch sa.(type) {
+ case *syscall.SockaddrInet6:
+ v6only, err := getUDPSocketOptions6Only(conn)
+ if err != nil {
+ return err
+ }
+ setUDPSocketOptions6(conn)
+ if !v6only {
+ setUDPSocketOptions4(conn)
+ }
+ case *syscall.SockaddrInet4:
+ setUDPSocketOptions4(conn)
+ }
+ return nil
+}
+
// setUDPSocketOptions4 prepares the v4 socket for sessions.
func setUDPSocketOptions4(conn *net.UDPConn) error {
file, err := conn.File()
diff --git a/vendor/github.com/miekg/dns/udp_other.go b/vendor/github.com/miekg/dns/udp_other.go
index d40732441..488a282b2 100644
--- a/vendor/github.com/miekg/dns/udp_other.go
+++ b/vendor/github.com/miekg/dns/udp_other.go
@@ -1,17 +1,15 @@
-// +build !linux,!plan9
+// +build !linux appengine
package dns
import (
"net"
- "syscall"
)
// These do nothing. See udp_linux.go for an example of how to implement this.
// We tried to adhire to some kind of naming scheme.
-
+func setUDPSocketOptions(conn *net.UDPConn) error { return nil }
func setUDPSocketOptions4(conn *net.UDPConn) error { return nil }
func setUDPSocketOptions6(conn *net.UDPConn) error { return nil }
func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) { return false, nil }
-func getUDPSocketName(conn *net.UDPConn) (syscall.Sockaddr, error) { return nil, nil }
diff --git a/vendor/github.com/miekg/dns/udp_plan9.go b/vendor/github.com/miekg/dns/udp_plan9.go
deleted file mode 100644
index b794deeba..000000000
--- a/vendor/github.com/miekg/dns/udp_plan9.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package dns
-
-import (
- "net"
-)
-
-func setUDPSocketOptions(conn *net.UDPConn) error { return nil }
-
-// SessionUDP holds the remote address and the associated
-// out-of-band data.
-type SessionUDP struct {
- raddr *net.UDPAddr
- context []byte
-}
-
-// RemoteAddr returns the remote network address.
-func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
-
-// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
-// net.UDPAddr.
-func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
- oob := make([]byte, 40)
- n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob)
- if err != nil {
- return n, nil, err
- }
- return n, &SessionUDP{raddr, oob[:oobn]}, err
-}
-
-// WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr.
-func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) {
- n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr)
- return n, err
-}
diff --git a/vendor/github.com/miekg/dns/udp_windows.go b/vendor/github.com/miekg/dns/udp_windows.go
index 2ce4b3300..51e532ac2 100644
--- a/vendor/github.com/miekg/dns/udp_windows.go
+++ b/vendor/github.com/miekg/dns/udp_windows.go
@@ -8,6 +8,8 @@ type SessionUDP struct {
raddr *net.UDPAddr
}
+func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
+
// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
// net.UDPAddr.
func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
@@ -25,10 +27,3 @@ func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, e
return n, err
}
-func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
-
-// setUDPSocketOptions sets the UDP socket options.
-// This function is implemented on a per platform basis. See udp_*.go for more details
-func setUDPSocketOptions(conn *net.UDPConn) error {
- return nil
-}
diff --git a/vendor/github.com/miekg/dns/update_test.go b/vendor/github.com/miekg/dns/update_test.go
index 56602dfe9..12760a1ee 100644
--- a/vendor/github.com/miekg/dns/update_test.go
+++ b/vendor/github.com/miekg/dns/update_test.go
@@ -92,28 +92,28 @@ func TestPreReqAndRemovals(t *testing.T) {
m.Id = 1234
// Use a full set of RRs each time, so we are sure the rdata is stripped.
- rr_name1, _ := NewRR("name_used. 3600 IN A 127.0.0.1")
- rr_name2, _ := NewRR("name_not_used. 3600 IN A 127.0.0.1")
- rr_remove1, _ := NewRR("remove1. 3600 IN A 127.0.0.1")
- rr_remove2, _ := NewRR("remove2. 3600 IN A 127.0.0.1")
- rr_remove3, _ := NewRR("remove3. 3600 IN A 127.0.0.1")
- rr_insert, _ := NewRR("insert. 3600 IN A 127.0.0.1")
- rr_rrset1, _ := NewRR("rrset_used1. 3600 IN A 127.0.0.1")
- rr_rrset2, _ := NewRR("rrset_used2. 3600 IN A 127.0.0.1")
- rr_rrset3, _ := NewRR("rrset_not_used. 3600 IN A 127.0.0.1")
+ rrName1, _ := NewRR("name_used. 3600 IN A 127.0.0.1")
+ rrName2, _ := NewRR("name_not_used. 3600 IN A 127.0.0.1")
+ rrRemove1, _ := NewRR("remove1. 3600 IN A 127.0.0.1")
+ rrRemove2, _ := NewRR("remove2. 3600 IN A 127.0.0.1")
+ rrRemove3, _ := NewRR("remove3. 3600 IN A 127.0.0.1")
+ rrInsert, _ := NewRR("insert. 3600 IN A 127.0.0.1")
+ rrRrset1, _ := NewRR("rrset_used1. 3600 IN A 127.0.0.1")
+ rrRrset2, _ := NewRR("rrset_used2. 3600 IN A 127.0.0.1")
+ rrRrset3, _ := NewRR("rrset_not_used. 3600 IN A 127.0.0.1")
// Handle the prereqs.
- m.NameUsed([]RR{rr_name1})
- m.NameNotUsed([]RR{rr_name2})
- m.RRsetUsed([]RR{rr_rrset1})
- m.Used([]RR{rr_rrset2})
- m.RRsetNotUsed([]RR{rr_rrset3})
+ m.NameUsed([]RR{rrName1})
+ m.NameNotUsed([]RR{rrName2})
+ m.RRsetUsed([]RR{rrRrset1})
+ m.Used([]RR{rrRrset2})
+ m.RRsetNotUsed([]RR{rrRrset3})
// and now the updates.
- m.RemoveName([]RR{rr_remove1})
- m.RemoveRRset([]RR{rr_remove2})
- m.Remove([]RR{rr_remove3})
- m.Insert([]RR{rr_insert})
+ m.RemoveName([]RR{rrRemove1})
+ m.RemoveRRset([]RR{rrRemove2})
+ m.Remove([]RR{rrRemove3})
+ m.Insert([]RR{rrInsert})
// This test function isn't a Example function because we print these RR with tabs at the
// end and the Example function trim these, thus they never match.
diff --git a/vendor/github.com/miekg/dns/zcompress.go b/vendor/github.com/miekg/dns/zcompress.go
new file mode 100644
index 000000000..86a31a916
--- /dev/null
+++ b/vendor/github.com/miekg/dns/zcompress.go
@@ -0,0 +1,119 @@
+// *** DO NOT MODIFY ***
+// AUTOGENERATED BY go generate from compress_generate.go
+
+package dns
+
+func compressionLenHelperType(c map[string]int, r RR) {
+ switch x := r.(type) {
+ case *KX:
+ compressionLenHelper(c, x.Exchanger)
+ case *MX:
+ compressionLenHelper(c, x.Mx)
+ case *NSEC:
+ compressionLenHelper(c, x.NextDomain)
+ case *DNAME:
+ compressionLenHelper(c, x.Target)
+ case *HIP:
+ for i := range x.RendezvousServers {
+ compressionLenHelper(c, x.RendezvousServers[i])
+ }
+ case *CNAME:
+ compressionLenHelper(c, x.Target)
+ case *MR:
+ compressionLenHelper(c, x.Mr)
+ case *PX:
+ compressionLenHelper(c, x.Map822)
+ compressionLenHelper(c, x.Mapx400)
+ case *SIG:
+ compressionLenHelper(c, x.SignerName)
+ case *SRV:
+ compressionLenHelper(c, x.Target)
+ case *TALINK:
+ compressionLenHelper(c, x.PreviousName)
+ compressionLenHelper(c, x.NextName)
+ case *LP:
+ compressionLenHelper(c, x.Fqdn)
+ case *NAPTR:
+ compressionLenHelper(c, x.Replacement)
+ case *NS:
+ compressionLenHelper(c, x.Ns)
+ case *RP:
+ compressionLenHelper(c, x.Mbox)
+ compressionLenHelper(c, x.Txt)
+ case *RRSIG:
+ compressionLenHelper(c, x.SignerName)
+ case *TKEY:
+ compressionLenHelper(c, x.Algorithm)
+ case *TSIG:
+ compressionLenHelper(c, x.Algorithm)
+ case *AFSDB:
+ compressionLenHelper(c, x.Hostname)
+ case *MF:
+ compressionLenHelper(c, x.Mf)
+ case *RT:
+ compressionLenHelper(c, x.Host)
+ case *MINFO:
+ compressionLenHelper(c, x.Rmail)
+ compressionLenHelper(c, x.Email)
+ case *PTR:
+ compressionLenHelper(c, x.Ptr)
+ case *SOA:
+ compressionLenHelper(c, x.Ns)
+ compressionLenHelper(c, x.Mbox)
+ case *MD:
+ compressionLenHelper(c, x.Md)
+ case *NSAPPTR:
+ compressionLenHelper(c, x.Ptr)
+ case *MG:
+ compressionLenHelper(c, x.Mg)
+ case *MB:
+ compressionLenHelper(c, x.Mb)
+ }
+}
+
+func compressionLenSearchType(c map[string]int, r RR) (int, bool) {
+ switch x := r.(type) {
+ case *MF:
+ k1, ok1 := compressionLenSearch(c, x.Mf)
+ return k1, ok1
+ case *MG:
+ k1, ok1 := compressionLenSearch(c, x.Mg)
+ return k1, ok1
+ case *MINFO:
+ k1, ok1 := compressionLenSearch(c, x.Rmail)
+ k2, ok2 := compressionLenSearch(c, x.Email)
+ return k1 + k2, ok1 && ok2
+ case *MR:
+ k1, ok1 := compressionLenSearch(c, x.Mr)
+ return k1, ok1
+ case *PTR:
+ k1, ok1 := compressionLenSearch(c, x.Ptr)
+ return k1, ok1
+ case *AFSDB:
+ k1, ok1 := compressionLenSearch(c, x.Hostname)
+ return k1, ok1
+ case *CNAME:
+ k1, ok1 := compressionLenSearch(c, x.Target)
+ return k1, ok1
+ case *MD:
+ k1, ok1 := compressionLenSearch(c, x.Md)
+ return k1, ok1
+ case *RT:
+ k1, ok1 := compressionLenSearch(c, x.Host)
+ return k1, ok1
+ case *SOA:
+ k1, ok1 := compressionLenSearch(c, x.Ns)
+ k2, ok2 := compressionLenSearch(c, x.Mbox)
+ return k1 + k2, ok1 && ok2
+ case *MB:
+ k1, ok1 := compressionLenSearch(c, x.Mb)
+ return k1, ok1
+ case *MX:
+ k1, ok1 := compressionLenSearch(c, x.Mx)
+ return k1, ok1
+ case *NS:
+ k1, ok1 := compressionLenSearch(c, x.Ns)
+ return k1, ok1
+ }
+ return 0, false
+}
diff --git a/vendor/github.com/miekg/dns/ztypes.go b/vendor/github.com/miekg/dns/ztypes.go
index 3c052773e..311b8243b 100644
--- a/vendor/github.com/miekg/dns/ztypes.go
+++ b/vendor/github.com/miekg/dns/ztypes.go
@@ -254,7 +254,7 @@ func (rr *ANY) len() int {
}
func (rr *CAA) len() int {
l := rr.Hdr.len()
- l += 1 // Flag
+ l++ // Flag
l += len(rr.Tag) + 1
l += len(rr.Value)
return l
@@ -263,7 +263,7 @@ func (rr *CERT) len() int {
l := rr.Hdr.len()
l += 2 // Type
l += 2 // KeyTag
- l += 1 // Algorithm
+ l++ // Algorithm
l += base64.StdEncoding.DecodedLen(len(rr.Certificate))
return l
}
@@ -285,16 +285,16 @@ func (rr *DNAME) len() int {
func (rr *DNSKEY) len() int {
l := rr.Hdr.len()
l += 2 // Flags
- l += 1 // Protocol
- l += 1 // Algorithm
+ l++ // Protocol
+ l++ // Algorithm
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
return l
}
func (rr *DS) len() int {
l := rr.Hdr.len()
l += 2 // KeyTag
- l += 1 // Algorithm
- l += 1 // DigestType
+ l++ // Algorithm
+ l++ // DigestType
l += len(rr.Digest)/2 + 1
return l
}
@@ -333,8 +333,8 @@ func (rr *HINFO) len() int {
}
func (rr *HIP) len() int {
l := rr.Hdr.len()
- l += 1 // HitLength
- l += 1 // PublicKeyAlgorithm
+ l++ // HitLength
+ l++ // PublicKeyAlgorithm
l += 2 // PublicKeyLength
l += len(rr.Hit)/2 + 1
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
@@ -363,10 +363,10 @@ func (rr *L64) len() int {
}
func (rr *LOC) len() int {
l := rr.Hdr.len()
- l += 1 // Version
- l += 1 // Size
- l += 1 // HorizPre
- l += 1 // VertPre
+ l++ // Version
+ l++ // Size
+ l++ // HorizPre
+ l++ // VertPre
l += 4 // Latitude
l += 4 // Longitude
l += 4 // Altitude
@@ -455,10 +455,10 @@ func (rr *NSAPPTR) len() int {
}
func (rr *NSEC3PARAM) len() int {
l := rr.Hdr.len()
- l += 1 // Hash
- l += 1 // Flags
+ l++ // Hash
+ l++ // Flags
l += 2 // Iterations
- l += 1 // SaltLength
+ l++ // SaltLength
l += len(rr.Salt)/2 + 1
return l
}
@@ -487,8 +487,8 @@ func (rr *RFC3597) len() int {
func (rr *RKEY) len() int {
l := rr.Hdr.len()
l += 2 // Flags
- l += 1 // Protocol
- l += 1 // Algorithm
+ l++ // Protocol
+ l++ // Algorithm
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
return l
}
@@ -501,8 +501,8 @@ func (rr *RP) len() int {
func (rr *RRSIG) len() int {
l := rr.Hdr.len()
l += 2 // TypeCovered
- l += 1 // Algorithm
- l += 1 // Labels
+ l++ // Algorithm
+ l++ // Labels
l += 4 // OrigTtl
l += 4 // Expiration
l += 4 // Inception
@@ -519,9 +519,9 @@ func (rr *RT) len() int {
}
func (rr *SMIMEA) len() int {
l := rr.Hdr.len()
- l += 1 // Usage
- l += 1 // Selector
- l += 1 // MatchingType
+ l++ // Usage
+ l++ // Selector
+ l++ // MatchingType
l += len(rr.Certificate)/2 + 1
return l
}
@@ -553,16 +553,16 @@ func (rr *SRV) len() int {
}
func (rr *SSHFP) len() int {
l := rr.Hdr.len()
- l += 1 // Algorithm
- l += 1 // Type
+ l++ // Algorithm
+ l++ // Type
l += len(rr.FingerPrint)/2 + 1
return l
}
func (rr *TA) len() int {
l := rr.Hdr.len()
l += 2 // KeyTag
- l += 1 // Algorithm
- l += 1 // DigestType
+ l++ // Algorithm
+ l++ // DigestType
l += len(rr.Digest)/2 + 1
return l
}
@@ -587,9 +587,9 @@ func (rr *TKEY) len() int {
}
func (rr *TLSA) len() int {
l := rr.Hdr.len()
- l += 1 // Usage
- l += 1 // Selector
- l += 1 // MatchingType
+ l++ // Usage
+ l++ // Selector
+ l++ // MatchingType
l += len(rr.Certificate)/2 + 1
return l
}
diff --git a/vendor/github.com/prometheus/client_model/AUTHORS.md b/vendor/github.com/prometheus/client_model/AUTHORS.md
deleted file mode 100644
index e8b3efa6a..000000000
--- a/vendor/github.com/prometheus/client_model/AUTHORS.md
+++ /dev/null
@@ -1,13 +0,0 @@
-The Prometheus project was started by Matt T. Proud (emeritus) and
-Julius Volz in 2012.
-
-Maintainers of this repository:
-
-* Björn Rabenstein <beorn@soundcloud.com>
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Björn Rabenstein <beorn@soundcloud.com>
-* Matt T. Proud <matt.proud@gmail.com>
-* Tobias Schmidt <ts@soundcloud.com>
diff --git a/vendor/github.com/prometheus/client_model/CONTRIBUTING.md b/vendor/github.com/prometheus/client_model/CONTRIBUTING.md
index 573d58741..40503edbf 100644
--- a/vendor/github.com/prometheus/client_model/CONTRIBUTING.md
+++ b/vendor/github.com/prometheus/client_model/CONTRIBUTING.md
@@ -2,16 +2,16 @@
Prometheus uses GitHub to manage reviews of pull requests.
-* If you have a trivial fix or improvement, go ahead and create a pull
- request, addressing (with `@...`) one or more of the maintainers
- (see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
+* If you have a trivial fix or improvement, go ahead and create a pull request,
+ addressing (with `@...`) the maintainer of this repository (see
+ [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
* If you plan to do something more involved, first discuss your ideas
on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
This will avoid unnecessary work and surely give you and us a good deal
of inspiration.
-* Relevant coding style guidelines for the Go parts are the [Go Code Review
+* Relevant coding style guidelines are the [Go Code Review
Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
and the _Formatting and style_ section of Peter Bourgon's [Go: Best
Practices for Production
diff --git a/vendor/github.com/prometheus/client_model/MAINTAINERS.md b/vendor/github.com/prometheus/client_model/MAINTAINERS.md
new file mode 100644
index 000000000..3ede55fe1
--- /dev/null
+++ b/vendor/github.com/prometheus/client_model/MAINTAINERS.md
@@ -0,0 +1 @@
+* Björn Rabenstein <beorn@soundcloud.com>
diff --git a/vendor/github.com/prometheus/common/AUTHORS.md b/vendor/github.com/prometheus/common/AUTHORS.md
deleted file mode 100644
index c63f4d395..000000000
--- a/vendor/github.com/prometheus/common/AUTHORS.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Maintainers of this repository:
-
-* Fabian Reinartz <fabian@soundcloud.com>
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Björn Rabenstein <beorn@soundcloud.com>
-* Fabian Reinartz <fabian@soundcloud.com>
-* Julius Volz <julius.volz@gmail.com>
-* Miguel Molina <hi@mvader.me>
diff --git a/vendor/github.com/prometheus/common/CONTRIBUTING.md b/vendor/github.com/prometheus/common/CONTRIBUTING.md
index 5705f0fbe..40503edbf 100644
--- a/vendor/github.com/prometheus/common/CONTRIBUTING.md
+++ b/vendor/github.com/prometheus/common/CONTRIBUTING.md
@@ -2,9 +2,9 @@
Prometheus uses GitHub to manage reviews of pull requests.
-* If you have a trivial fix or improvement, go ahead and create a pull
- request, addressing (with `@...`) one or more of the maintainers
- (see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
+* If you have a trivial fix or improvement, go ahead and create a pull request,
+ addressing (with `@...`) the maintainer of this repository (see
+ [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
* If you plan to do something more involved, first discuss your ideas
on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
diff --git a/vendor/github.com/prometheus/common/MAINTAINERS.md b/vendor/github.com/prometheus/common/MAINTAINERS.md
new file mode 100644
index 000000000..1b3152161
--- /dev/null
+++ b/vendor/github.com/prometheus/common/MAINTAINERS.md
@@ -0,0 +1 @@
+* Fabian Reinartz <fabian.reinartz@coreos.com>
diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go
index 7728abaee..c9ed3ffd8 100644
--- a/vendor/github.com/prometheus/common/model/value.go
+++ b/vendor/github.com/prometheus/common/model/value.go
@@ -129,11 +129,8 @@ func (s *Sample) Equal(o *Sample) bool {
if !s.Timestamp.Equal(o.Timestamp) {
return false
}
- if s.Value.Equal(o.Value) {
- return false
- }
- return true
+ return s.Value.Equal(o.Value)
}
func (s Sample) String() string {
diff --git a/vendor/github.com/prometheus/common/model/value_test.go b/vendor/github.com/prometheus/common/model/value_test.go
index 8d2b69ea1..b97dcf84c 100644
--- a/vendor/github.com/prometheus/common/model/value_test.go
+++ b/vendor/github.com/prometheus/common/model/value_test.go
@@ -21,7 +21,7 @@ import (
"testing"
)
-func TestEqual(t *testing.T) {
+func TestEqualValues(t *testing.T) {
tests := map[string]struct {
in1, in2 SampleValue
want bool
@@ -76,6 +76,57 @@ func TestEqual(t *testing.T) {
}
}
+func TestEqualSamples(t *testing.T) {
+ testSample := &Sample{}
+
+ tests := map[string]struct {
+ in1, in2 *Sample
+ want bool
+ }{
+ "equal pointers": {
+ in1: testSample,
+ in2: testSample,
+ want: true,
+ },
+ "different metrics": {
+ in1: &Sample{Metric: Metric{"foo": "bar"}},
+ in2: &Sample{Metric: Metric{"foo": "biz"}},
+ want: false,
+ },
+ "different timestamp": {
+ in1: &Sample{Timestamp: 0},
+ in2: &Sample{Timestamp: 1},
+ want: false,
+ },
+ "different value": {
+ in1: &Sample{Value: 0},
+ in2: &Sample{Value: 1},
+ want: false,
+ },
+ "equal samples": {
+ in1: &Sample{
+ Metric: Metric{"foo": "bar"},
+ Timestamp: 0,
+ Value: 1,
+ },
+ in2: &Sample{
+ Metric: Metric{"foo": "bar"},
+ Timestamp: 0,
+ Value: 1,
+ },
+ want: true,
+ },
+ }
+
+ for name, test := range tests {
+ got := test.in1.Equal(test.in2)
+ if got != test.want {
+ t.Errorf("Comparing %s, %v and %v: got %t, want %t", name, test.in1, test.in2, got, test.want)
+ }
+ }
+
+}
+
func TestSamplePairJSON(t *testing.T) {
input := []struct {
plain string
diff --git a/vendor/github.com/prometheus/procfs/AUTHORS.md b/vendor/github.com/prometheus/procfs/AUTHORS.md
deleted file mode 100644
index d55863560..000000000
--- a/vendor/github.com/prometheus/procfs/AUTHORS.md
+++ /dev/null
@@ -1,21 +0,0 @@
-The Prometheus project was started by Matt T. Proud (emeritus) and
-Julius Volz in 2012.
-
-Maintainers of this repository:
-
-* Tobias Schmidt <ts@soundcloud.com>
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Armen Baghumian <abaghumian@noggin.com.au>
-* Bjoern Rabenstein <beorn@soundcloud.com>
-* David Cournapeau <cournape@gmail.com>
-* Ji-Hoon, Seol <jihoon.seol@gmail.com>
-* Jonas Große Sundrup <cherti@letopolis.de>
-* Julius Volz <julius.volz@gmail.com>
-* Matt Layher <mdlayher@gmail.com>
-* Matthias Rampke <mr@soundcloud.com>
-* Nicky Gerritsen <nicky@streamone.nl>
-* Rémi Audebert <contact@halfr.net>
-* Tobias Schmidt <tobidt@gmail.com>
diff --git a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
index 5705f0fbe..40503edbf 100644
--- a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
+++ b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
@@ -2,9 +2,9 @@
Prometheus uses GitHub to manage reviews of pull requests.
-* If you have a trivial fix or improvement, go ahead and create a pull
- request, addressing (with `@...`) one or more of the maintainers
- (see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
+* If you have a trivial fix or improvement, go ahead and create a pull request,
+ addressing (with `@...`) the maintainer of this repository (see
+ [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
* If you plan to do something more involved, first discuss your ideas
on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md
new file mode 100644
index 000000000..35993c41c
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/MAINTAINERS.md
@@ -0,0 +1 @@
+* Tobias Schmidt <tobidt@gmail.com>
diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md
index 6e7ee6b8b..209549471 100644
--- a/vendor/github.com/prometheus/procfs/README.md
+++ b/vendor/github.com/prometheus/procfs/README.md
@@ -8,3 +8,4 @@ backwards-incompatible ways without warnings. Use it at your own risk.
[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs)
[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs)
+[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs)
diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go
new file mode 100644
index 000000000..680a9842a
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/buddyinfo.go
@@ -0,0 +1,95 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package procfs
+
+import (
+ "bufio"
+ "fmt"
+ "io"
+ "os"
+ "strconv"
+ "strings"
+)
+
+// A BuddyInfo is the details parsed from /proc/buddyinfo.
+// The data is comprised of an array of free fragments of each size.
+// The sizes are 2^n*PAGE_SIZE, where n is the array index.
+type BuddyInfo struct {
+ Node string
+ Zone string
+ Sizes []float64
+}
+
+// NewBuddyInfo reads the buddyinfo statistics.
+func NewBuddyInfo() ([]BuddyInfo, error) {
+ fs, err := NewFS(DefaultMountPoint)
+ if err != nil {
+ return nil, err
+ }
+
+ return fs.NewBuddyInfo()
+}
+
+// NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem.
+func (fs FS) NewBuddyInfo() ([]BuddyInfo, error) {
+ file, err := os.Open(fs.Path("buddyinfo"))
+ if err != nil {
+ return nil, err
+ }
+ defer file.Close()
+
+ return parseBuddyInfo(file)
+}
+
+func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) {
+ var (
+ buddyInfo = []BuddyInfo{}
+ scanner = bufio.NewScanner(r)
+ bucketCount = -1
+ )
+
+ for scanner.Scan() {
+ var err error
+ line := scanner.Text()
+ parts := strings.Fields(string(line))
+
+ if len(parts) < 4 {
+ return nil, fmt.Errorf("invalid number of fields when parsing buddyinfo")
+ }
+
+ node := strings.TrimRight(parts[1], ",")
+ zone := strings.TrimRight(parts[3], ",")
+ arraySize := len(parts[4:])
+
+ if bucketCount == -1 {
+ bucketCount = arraySize
+ } else {
+ if bucketCount != arraySize {
+ return nil, fmt.Errorf("mismatch in number of buddyinfo buckets, previous count %d, new count %d", bucketCount, arraySize)
+ }
+ }
+
+ sizes := make([]float64, arraySize)
+ for i := 0; i < arraySize; i++ {
+ sizes[i], err = strconv.ParseFloat(parts[i+4], 64)
+ if err != nil {
+ return nil, fmt.Errorf("invalid value in buddyinfo: %s", err)
+ }
+ }
+
+ buddyInfo = append(buddyInfo, BuddyInfo{node, zone, sizes})
+ }
+
+ return buddyInfo, scanner.Err()
+}
diff --git a/vendor/github.com/prometheus/procfs/buddyinfo_test.go b/vendor/github.com/prometheus/procfs/buddyinfo_test.go
new file mode 100644
index 000000000..bcf9355ca
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/buddyinfo_test.go
@@ -0,0 +1,64 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package procfs
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestBuddyInfo(t *testing.T) {
+ buddyInfo, err := FS("fixtures/buddyinfo/valid").NewBuddyInfo()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := "DMA", buddyInfo[0].Zone; want != got {
+ t.Errorf("want Node 0, Zone %s, got %s", want, got)
+ }
+
+ if want, got := "Normal", buddyInfo[2].Zone; want != got {
+ t.Errorf("want Node 0, Zone %s, got %s", want, got)
+ }
+
+ if want, got := 4381.0, buddyInfo[2].Sizes[0]; want != got {
+ t.Errorf("want Node 0, Zone Normal %f, got %f", want, got)
+ }
+
+ if want, got := 572.0, buddyInfo[1].Sizes[1]; want != got {
+ t.Errorf("want Node 0, Zone DMA32 %f, got %f", want, got)
+ }
+}
+
+func TestBuddyInfoShort(t *testing.T) {
+ _, err := FS("fixtures/buddyinfo/short").NewBuddyInfo()
+ if err == nil {
+ t.Errorf("expected error, but none occurred")
+ }
+
+ if want, got := "invalid number of fields when parsing buddyinfo", err.Error(); want != got {
+ t.Errorf("wrong error returned, wanted %q, got %q", want, got)
+ }
+}
+
+func TestBuddyInfoSizeMismatch(t *testing.T) {
+ _, err := FS("fixtures/buddyinfo/sizemismatch").NewBuddyInfo()
+ if err == nil {
+ t.Errorf("expected error, but none occurred")
+ }
+
+ if want, got := "mismatch in number of buddyinfo buckets", err.Error(); !strings.HasPrefix(got, want) {
+ t.Errorf("wrong error returned, wanted prefix %q, got %q", want, got)
+ }
+}
diff --git a/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/short/buddyinfo b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/short/buddyinfo
new file mode 100644
index 000000000..40e71ca35
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/short/buddyinfo
@@ -0,0 +1,3 @@
+Node 0, zone
+Node 0, zone
+Node 0, zone
diff --git a/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/sizemismatch/buddyinfo b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/sizemismatch/buddyinfo
new file mode 100644
index 000000000..945636182
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/sizemismatch/buddyinfo
@@ -0,0 +1,3 @@
+Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3
+Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 0
+Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0
diff --git a/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/valid/buddyinfo b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/valid/buddyinfo
new file mode 100644
index 000000000..f90594a81
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/fixtures/buddyinfo/valid/buddyinfo
@@ -0,0 +1,3 @@
+Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3
+Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0
+Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0
diff --git a/vendor/github.com/prometheus/procfs/fixtures/fs/xfs/stat b/vendor/github.com/prometheus/procfs/fixtures/fs/xfs/stat
new file mode 100644
index 000000000..f7ca7f940
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/fixtures/fs/xfs/stat
@@ -0,0 +1,23 @@
+extent_alloc 92447 97589 92448 93751
+abt 0 0 0 0
+blk_map 1767055 188820 184891 92447 92448 2140766 0
+bmbt 0 0 0 0
+dir 185039 92447 92444 136422
+trans 706 944304 0
+ig 185045 58807 0 126238 0 33637 22
+log 2883 113448 9 17360 739
+push_ail 945014 0 134260 15483 0 3940 464 159985 0 40
+xstrat 92447 0
+rw 107739 94045
+attr 4 0 0 0
+icluster 8677 7849 135802
+vnodes 92601 0 0 0 92444 92444 92444 0
+buf 2666287 7122 2659202 3599 2 7085 0 10297 7085
+abtb2 184941 1277345 13257 13278 0 0 0 0 0 0 0 0 0 0 2746147
+abtc2 345295 2416764 172637 172658 0 0 0 0 0 0 0 0 0 0 21406023
+bmbt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ibt2 343004 1358467 0 0 0 0 0 0 0 0 0 0 0 0 0
+fibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+qm 0 0 0 0 0 0 0 0
+xpc 399724544 92823103 86219234
+debug 0
diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go
index 49aaab050..17546756b 100644
--- a/vendor/github.com/prometheus/procfs/fs.go
+++ b/vendor/github.com/prometheus/procfs/fs.go
@@ -4,6 +4,8 @@ import (
"fmt"
"os"
"path"
+
+ "github.com/prometheus/procfs/xfs"
)
// FS represents the pseudo-filesystem proc, which provides an interface to
@@ -31,3 +33,14 @@ func NewFS(mountPoint string) (FS, error) {
func (fs FS) Path(p ...string) string {
return path.Join(append([]string{string(fs)}, p...)...)
}
+
+// XFSStats retrieves XFS filesystem runtime statistics.
+func (fs FS) XFSStats() (*xfs.Stats, error) {
+ f, err := os.Open(fs.Path("fs/xfs/stat"))
+ if err != nil {
+ return nil, err
+ }
+ defer f.Close()
+
+ return xfs.ParseStats(f)
+}
diff --git a/vendor/github.com/prometheus/procfs/fs_test.go b/vendor/github.com/prometheus/procfs/fs_test.go
index 91f1c6c97..e492cde55 100644
--- a/vendor/github.com/prometheus/procfs/fs_test.go
+++ b/vendor/github.com/prometheus/procfs/fs_test.go
@@ -11,3 +11,16 @@ func TestNewFS(t *testing.T) {
t.Error("want NewFS to fail if mount point is not a directory")
}
}
+
+func TestFSXFSStats(t *testing.T) {
+ stats, err := FS("fixtures").XFSStats()
+ if err != nil {
+ t.Fatalf("failed to parse XFS stats: %v", err)
+ }
+
+ // Very lightweight test just to sanity check the path used
+ // to open XFS stats. Heavier tests in package xfs.
+ if want, got := uint32(92447), stats.ExtentAllocation.ExtentsAllocated; want != got {
+ t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got)
+ }
+}
diff --git a/vendor/github.com/prometheus/procfs/ipvs_test.go b/vendor/github.com/prometheus/procfs/ipvs_test.go
index c836c23ac..796ee5b88 100644
--- a/vendor/github.com/prometheus/procfs/ipvs_test.go
+++ b/vendor/github.com/prometheus/procfs/ipvs_test.go
@@ -14,7 +14,7 @@ var (
OutgoingBytes: 0,
}
expectedIPVSBackendStatuses = []IPVSBackendStatus{
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.22"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.82.22"),
@@ -24,7 +24,7 @@ var (
ActiveConn: 248,
InactConn: 2,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.22"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.83.24"),
@@ -34,7 +34,7 @@ var (
ActiveConn: 248,
InactConn: 2,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.22"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.83.21"),
@@ -44,7 +44,7 @@ var (
ActiveConn: 248,
InactConn: 1,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.57"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.84.22"),
@@ -54,7 +54,7 @@ var (
ActiveConn: 0,
InactConn: 0,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.57"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.82.21"),
@@ -64,7 +64,7 @@ var (
ActiveConn: 1499,
InactConn: 0,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.57"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.50.21"),
@@ -74,7 +74,7 @@ var (
ActiveConn: 1498,
InactConn: 0,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.55"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.50.26"),
@@ -84,7 +84,7 @@ var (
ActiveConn: 0,
InactConn: 0,
},
- IPVSBackendStatus{
+ {
LocalAddress: net.ParseIP("192.168.0.55"),
LocalPort: 3306,
RemoteAddress: net.ParseIP("192.168.49.32"),
diff --git a/vendor/github.com/prometheus/procfs/mdstat_test.go b/vendor/github.com/prometheus/procfs/mdstat_test.go
index ca5fe4d1b..fa463c2fb 100644
--- a/vendor/github.com/prometheus/procfs/mdstat_test.go
+++ b/vendor/github.com/prometheus/procfs/mdstat_test.go
@@ -11,13 +11,13 @@ func TestMDStat(t *testing.T) {
}
refs := map[string]MDStat{
- "md3": MDStat{"md3", "active", 8, 8, 5853468288, 5853468288},
- "md127": MDStat{"md127", "active", 2, 2, 312319552, 312319552},
- "md0": MDStat{"md0", "active", 2, 2, 248896, 248896},
- "md4": MDStat{"md4", "inactive", 2, 2, 4883648, 4883648},
- "md6": MDStat{"md6", "active", 1, 2, 195310144, 16775552},
- "md8": MDStat{"md8", "active", 2, 2, 195310144, 16775552},
- "md7": MDStat{"md7", "active", 3, 4, 7813735424, 7813735424},
+ "md3": {"md3", "active", 8, 8, 5853468288, 5853468288},
+ "md127": {"md127", "active", 2, 2, 312319552, 312319552},
+ "md0": {"md0", "active", 2, 2, 248896, 248896},
+ "md4": {"md4", "inactive", 2, 2, 4883648, 4883648},
+ "md6": {"md6", "active", 1, 2, 195310144, 16775552},
+ "md8": {"md8", "active", 2, 2, 195310144, 16775552},
+ "md7": {"md7", "active", 3, 4, 7813735424, 7813735424},
}
if want, have := len(refs), len(mdStates); want != have {
diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go
index 47ab0a744..fe8f1f6a2 100644
--- a/vendor/github.com/prometheus/procfs/mountstats.go
+++ b/vendor/github.com/prometheus/procfs/mountstats.go
@@ -123,7 +123,7 @@ type NFSEventsStats struct {
VFSFlush uint64
// Number of times fsync() has been called on directories and files.
VFSFsync uint64
- // Number of times locking has been attemped on a file.
+ // Number of times locking has been attempted on a file.
VFSLock uint64
// Number of times files have been closed and released.
VFSFileRelease uint64
@@ -356,7 +356,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e
}
// When encountering "per-operation statistics", we must break this
- // loop and parse them seperately to ensure we can terminate parsing
+ // loop and parse them separately to ensure we can terminate parsing
// before reaching another device entry; hence why this 'if' statement
// is not just another switch case
if ss[0] == fieldPerOpStats {
diff --git a/vendor/github.com/prometheus/procfs/mountstats_test.go b/vendor/github.com/prometheus/procfs/mountstats_test.go
index e65707939..75fd4a0f1 100644
--- a/vendor/github.com/prometheus/procfs/mountstats_test.go
+++ b/vendor/github.com/prometheus/procfs/mountstats_test.go
@@ -12,7 +12,6 @@ func TestMountStats(t *testing.T) {
tests := []struct {
name string
s string
- fs bool
mounts []*Mount
invalid bool
}{
@@ -113,7 +112,6 @@ func TestMountStats(t *testing.T) {
},
{
name: "fixtures OK",
- fs: true,
mounts: []*Mount{
{
Device: "rootfs",
@@ -201,10 +199,9 @@ func TestMountStats(t *testing.T) {
if tt.s != "" {
mounts, err = parseMountStats(strings.NewReader(tt.s))
- }
- if tt.fs {
- proc, err := FS("fixtures").NewProc(26231)
- if err != nil {
+ } else {
+ proc, e := FS("fixtures").NewProc(26231)
+ if e != nil {
t.Fatalf("failed to create proc: %v", err)
}
diff --git a/vendor/github.com/prometheus/procfs/xfs/parse.go b/vendor/github.com/prometheus/procfs/xfs/parse.go
new file mode 100644
index 000000000..d1285fa6c
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/xfs/parse.go
@@ -0,0 +1,361 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package xfs
+
+import (
+ "bufio"
+ "fmt"
+ "io"
+ "log"
+ "strconv"
+ "strings"
+)
+
+// ParseStats parses a Stats from an input io.Reader, using the format
+// found in /proc/fs/xfs/stat.
+func ParseStats(r io.Reader) (*Stats, error) {
+ const (
+ // Fields parsed into stats structures.
+ fieldExtentAlloc = "extent_alloc"
+ fieldAbt = "abt"
+ fieldBlkMap = "blk_map"
+ fieldBmbt = "bmbt"
+ fieldDir = "dir"
+ fieldTrans = "trans"
+ fieldIg = "ig"
+ fieldLog = "log"
+ fieldRw = "rw"
+ fieldAttr = "attr"
+ fieldIcluster = "icluster"
+ fieldVnodes = "vnodes"
+ fieldBuf = "buf"
+ fieldXpc = "xpc"
+
+ // Unimplemented at this time due to lack of documentation.
+ fieldPushAil = "push_ail"
+ fieldXstrat = "xstrat"
+ fieldAbtb2 = "abtb2"
+ fieldAbtc2 = "abtc2"
+ fieldBmbt2 = "bmbt2"
+ fieldIbt2 = "ibt2"
+ fieldFibt2 = "fibt2"
+ fieldQm = "qm"
+ fieldDebug = "debug"
+ )
+
+ var xfss Stats
+
+ s := bufio.NewScanner(r)
+ for s.Scan() {
+ // Expect at least a string label and a single integer value, ex:
+ // - abt 0
+ // - rw 1 2
+ ss := strings.Fields(string(s.Bytes()))
+ if len(ss) < 2 {
+ continue
+ }
+ label := ss[0]
+
+ // Extended precision counters are uint64 values.
+ if label == fieldXpc {
+ us, err := parseUint64s(ss[1:])
+ if err != nil {
+ return nil, err
+ }
+
+ xfss.ExtendedPrecision, err = extendedPrecisionStats(us)
+ if err != nil {
+ return nil, err
+ }
+
+ continue
+ }
+
+ // All other counters are uint32 values.
+ us, err := parseUint32s(ss[1:])
+ if err != nil {
+ return nil, err
+ }
+
+ switch label {
+ case fieldExtentAlloc:
+ xfss.ExtentAllocation, err = extentAllocationStats(us)
+ case fieldAbt:
+ xfss.AllocationBTree, err = btreeStats(us)
+ case fieldBlkMap:
+ xfss.BlockMapping, err = blockMappingStats(us)
+ case fieldBmbt:
+ xfss.BlockMapBTree, err = btreeStats(us)
+ case fieldDir:
+ xfss.DirectoryOperation, err = directoryOperationStats(us)
+ case fieldTrans:
+ xfss.Transaction, err = transactionStats(us)
+ case fieldIg:
+ xfss.InodeOperation, err = inodeOperationStats(us)
+ case fieldLog:
+ xfss.LogOperation, err = logOperationStats(us)
+ case fieldRw:
+ xfss.ReadWrite, err = readWriteStats(us)
+ case fieldAttr:
+ xfss.AttributeOperation, err = attributeOperationStats(us)
+ case fieldIcluster:
+ xfss.InodeClustering, err = inodeClusteringStats(us)
+ case fieldVnodes:
+ xfss.Vnode, err = vnodeStats(us)
+ case fieldBuf:
+ xfss.Buffer, err = bufferStats(us)
+ }
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return &xfss, s.Err()
+}
+
+// extentAllocationStats builds an ExtentAllocationStats from a slice of uint32s.
+func extentAllocationStats(us []uint32) (ExtentAllocationStats, error) {
+ if l := len(us); l != 4 {
+ return ExtentAllocationStats{}, fmt.Errorf("incorrect number of values for XFS extent allocation stats: %d", l)
+ }
+
+ return ExtentAllocationStats{
+ ExtentsAllocated: us[0],
+ BlocksAllocated: us[1],
+ ExtentsFreed: us[2],
+ BlocksFreed: us[3],
+ }, nil
+}
+
+// btreeStats builds a BTreeStats from a slice of uint32s.
+func btreeStats(us []uint32) (BTreeStats, error) {
+ if l := len(us); l != 4 {
+ return BTreeStats{}, fmt.Errorf("incorrect number of values for XFS btree stats: %d", l)
+ }
+
+ return BTreeStats{
+ Lookups: us[0],
+ Compares: us[1],
+ RecordsInserted: us[2],
+ RecordsDeleted: us[3],
+ }, nil
+}
+
+// BlockMappingStat builds a BlockMappingStats from a slice of uint32s.
+func blockMappingStats(us []uint32) (BlockMappingStats, error) {
+ if l := len(us); l != 7 {
+ return BlockMappingStats{}, fmt.Errorf("incorrect number of values for XFS block mapping stats: %d", l)
+ }
+
+ return BlockMappingStats{
+ Reads: us[0],
+ Writes: us[1],
+ Unmaps: us[2],
+ ExtentListInsertions: us[3],
+ ExtentListDeletions: us[4],
+ ExtentListLookups: us[5],
+ ExtentListCompares: us[6],
+ }, nil
+}
+
+// DirectoryOperationStats builds a DirectoryOperationStats from a slice of uint32s.
+func directoryOperationStats(us []uint32) (DirectoryOperationStats, error) {
+ if l := len(us); l != 4 {
+ return DirectoryOperationStats{}, fmt.Errorf("incorrect number of values for XFS directory operation stats: %d", l)
+ }
+
+ return DirectoryOperationStats{
+ Lookups: us[0],
+ Creates: us[1],
+ Removes: us[2],
+ Getdents: us[3],
+ }, nil
+}
+
+// TransactionStats builds a TransactionStats from a slice of uint32s.
+func transactionStats(us []uint32) (TransactionStats, error) {
+ if l := len(us); l != 3 {
+ return TransactionStats{}, fmt.Errorf("incorrect number of values for XFS transaction stats: %d", l)
+ }
+
+ return TransactionStats{
+ Sync: us[0],
+ Async: us[1],
+ Empty: us[2],
+ }, nil
+}
+
+// InodeOperationStats builds an InodeOperationStats from a slice of uint32s.
+func inodeOperationStats(us []uint32) (InodeOperationStats, error) {
+ if l := len(us); l != 7 {
+ return InodeOperationStats{}, fmt.Errorf("incorrect number of values for XFS inode operation stats: %d", l)
+ }
+
+ return InodeOperationStats{
+ Attempts: us[0],
+ Found: us[1],
+ Recycle: us[2],
+ Missed: us[3],
+ Duplicate: us[4],
+ Reclaims: us[5],
+ AttributeChange: us[6],
+ }, nil
+}
+
+// LogOperationStats builds a LogOperationStats from a slice of uint32s.
+func logOperationStats(us []uint32) (LogOperationStats, error) {
+ if l := len(us); l != 5 {
+ return LogOperationStats{}, fmt.Errorf("incorrect number of values for XFS log operation stats: %d", l)
+ }
+
+ return LogOperationStats{
+ Writes: us[0],
+ Blocks: us[1],
+ NoInternalBuffers: us[2],
+ Force: us[3],
+ ForceSleep: us[4],
+ }, nil
+}
+
+// ReadWriteStats builds a ReadWriteStats from a slice of uint32s.
+func readWriteStats(us []uint32) (ReadWriteStats, error) {
+ if l := len(us); l != 2 {
+ return ReadWriteStats{}, fmt.Errorf("incorrect number of values for XFS read write stats: %d", l)
+ }
+
+ return ReadWriteStats{
+ Read: us[0],
+ Write: us[1],
+ }, nil
+}
+
+// AttributeOperationStats builds an AttributeOperationStats from a slice of uint32s.
+func attributeOperationStats(us []uint32) (AttributeOperationStats, error) {
+ if l := len(us); l != 4 {
+ return AttributeOperationStats{}, fmt.Errorf("incorrect number of values for XFS attribute operation stats: %d", l)
+ }
+
+ return AttributeOperationStats{
+ Get: us[0],
+ Set: us[1],
+ Remove: us[2],
+ List: us[3],
+ }, nil
+}
+
+// InodeClusteringStats builds an InodeClusteringStats from a slice of uint32s.
+func inodeClusteringStats(us []uint32) (InodeClusteringStats, error) {
+ if l := len(us); l != 3 {
+ return InodeClusteringStats{}, fmt.Errorf("incorrect number of values for XFS inode clustering stats: %d", l)
+ }
+
+ return InodeClusteringStats{
+ Iflush: us[0],
+ Flush: us[1],
+ FlushInode: us[2],
+ }, nil
+}
+
+// VnodeStats builds a VnodeStats from a slice of uint32s.
+func vnodeStats(us []uint32) (VnodeStats, error) {
+ // The attribute "Free" appears to not be available on older XFS
+ // stats versions. Therefore, 7 or 8 elements may appear in
+ // this slice.
+ l := len(us)
+ log.Println(l)
+ if l != 7 && l != 8 {
+ return VnodeStats{}, fmt.Errorf("incorrect number of values for XFS vnode stats: %d", l)
+ }
+
+ s := VnodeStats{
+ Active: us[0],
+ Allocate: us[1],
+ Get: us[2],
+ Hold: us[3],
+ Release: us[4],
+ Reclaim: us[5],
+ Remove: us[6],
+ }
+
+ // Skip adding free, unless it is present. The zero value will
+ // be used in place of an actual count.
+ if l == 7 {
+ return s, nil
+ }
+
+ s.Free = us[7]
+ return s, nil
+}
+
+// BufferStats builds a BufferStats from a slice of uint32s.
+func bufferStats(us []uint32) (BufferStats, error) {
+ if l := len(us); l != 9 {
+ return BufferStats{}, fmt.Errorf("incorrect number of values for XFS buffer stats: %d", l)
+ }
+
+ return BufferStats{
+ Get: us[0],
+ Create: us[1],
+ GetLocked: us[2],
+ GetLockedWaited: us[3],
+ BusyLocked: us[4],
+ MissLocked: us[5],
+ PageRetries: us[6],
+ PageFound: us[7],
+ GetRead: us[8],
+ }, nil
+}
+
+// ExtendedPrecisionStats builds an ExtendedPrecisionStats from a slice of uint32s.
+func extendedPrecisionStats(us []uint64) (ExtendedPrecisionStats, error) {
+ if l := len(us); l != 3 {
+ return ExtendedPrecisionStats{}, fmt.Errorf("incorrect number of values for XFS extended precision stats: %d", l)
+ }
+
+ return ExtendedPrecisionStats{
+ FlushBytes: us[0],
+ WriteBytes: us[1],
+ ReadBytes: us[2],
+ }, nil
+}
+
+// parseUint32s parses a slice of strings into a slice of uint32s.
+func parseUint32s(ss []string) ([]uint32, error) {
+ us := make([]uint32, 0, len(ss))
+ for _, s := range ss {
+ u, err := strconv.ParseUint(s, 10, 32)
+ if err != nil {
+ return nil, err
+ }
+
+ us = append(us, uint32(u))
+ }
+
+ return us, nil
+}
+
+// parseUint64s parses a slice of strings into a slice of uint64s.
+func parseUint64s(ss []string) ([]uint64, error) {
+ us := make([]uint64, 0, len(ss))
+ for _, s := range ss {
+ u, err := strconv.ParseUint(s, 10, 64)
+ if err != nil {
+ return nil, err
+ }
+
+ us = append(us, u)
+ }
+
+ return us, nil
+}
diff --git a/vendor/github.com/prometheus/procfs/xfs/parse_test.go b/vendor/github.com/prometheus/procfs/xfs/parse_test.go
new file mode 100644
index 000000000..11ddb7425
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/xfs/parse_test.go
@@ -0,0 +1,446 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package xfs_test
+
+import (
+ "log"
+ "reflect"
+ "strings"
+ "testing"
+
+ "github.com/prometheus/procfs"
+ "github.com/prometheus/procfs/xfs"
+)
+
+func TestParseStats(t *testing.T) {
+ tests := []struct {
+ name string
+ s string
+ fs bool
+ stats *xfs.Stats
+ invalid bool
+ }{
+ {
+ name: "empty file OK",
+ },
+ {
+ name: "short or empty lines and unknown labels ignored",
+ s: "one\n\ntwo 1 2 3\n",
+ stats: &xfs.Stats{},
+ },
+ {
+ name: "bad uint32",
+ s: "extent_alloc XXX",
+ invalid: true,
+ },
+ {
+ name: "bad uint64",
+ s: "xpc XXX",
+ invalid: true,
+ },
+ {
+ name: "extent_alloc bad",
+ s: "extent_alloc 1",
+ invalid: true,
+ },
+ {
+ name: "extent_alloc OK",
+ s: "extent_alloc 1 2 3 4",
+ stats: &xfs.Stats{
+ ExtentAllocation: xfs.ExtentAllocationStats{
+ ExtentsAllocated: 1,
+ BlocksAllocated: 2,
+ ExtentsFreed: 3,
+ BlocksFreed: 4,
+ },
+ },
+ },
+ {
+ name: "abt bad",
+ s: "abt 1",
+ invalid: true,
+ },
+ {
+ name: "abt OK",
+ s: "abt 1 2 3 4",
+ stats: &xfs.Stats{
+ AllocationBTree: xfs.BTreeStats{
+ Lookups: 1,
+ Compares: 2,
+ RecordsInserted: 3,
+ RecordsDeleted: 4,
+ },
+ },
+ },
+ {
+ name: "blk_map bad",
+ s: "blk_map 1",
+ invalid: true,
+ },
+ {
+ name: "blk_map OK",
+ s: "blk_map 1 2 3 4 5 6 7",
+ stats: &xfs.Stats{
+ BlockMapping: xfs.BlockMappingStats{
+ Reads: 1,
+ Writes: 2,
+ Unmaps: 3,
+ ExtentListInsertions: 4,
+ ExtentListDeletions: 5,
+ ExtentListLookups: 6,
+ ExtentListCompares: 7,
+ },
+ },
+ },
+ {
+ name: "bmbt bad",
+ s: "bmbt 1",
+ invalid: true,
+ },
+ {
+ name: "bmbt OK",
+ s: "bmbt 1 2 3 4",
+ stats: &xfs.Stats{
+ BlockMapBTree: xfs.BTreeStats{
+ Lookups: 1,
+ Compares: 2,
+ RecordsInserted: 3,
+ RecordsDeleted: 4,
+ },
+ },
+ },
+ {
+ name: "dir bad",
+ s: "dir 1",
+ invalid: true,
+ },
+ {
+ name: "dir OK",
+ s: "dir 1 2 3 4",
+ stats: &xfs.Stats{
+ DirectoryOperation: xfs.DirectoryOperationStats{
+ Lookups: 1,
+ Creates: 2,
+ Removes: 3,
+ Getdents: 4,
+ },
+ },
+ },
+ {
+ name: "trans bad",
+ s: "trans 1",
+ invalid: true,
+ },
+ {
+ name: "trans OK",
+ s: "trans 1 2 3",
+ stats: &xfs.Stats{
+ Transaction: xfs.TransactionStats{
+ Sync: 1,
+ Async: 2,
+ Empty: 3,
+ },
+ },
+ },
+ {
+ name: "ig bad",
+ s: "ig 1",
+ invalid: true,
+ },
+ {
+ name: "ig OK",
+ s: "ig 1 2 3 4 5 6 7",
+ stats: &xfs.Stats{
+ InodeOperation: xfs.InodeOperationStats{
+ Attempts: 1,
+ Found: 2,
+ Recycle: 3,
+ Missed: 4,
+ Duplicate: 5,
+ Reclaims: 6,
+ AttributeChange: 7,
+ },
+ },
+ },
+ {
+ name: "log bad",
+ s: "log 1",
+ invalid: true,
+ },
+ {
+ name: "log OK",
+ s: "log 1 2 3 4 5",
+ stats: &xfs.Stats{
+ LogOperation: xfs.LogOperationStats{
+ Writes: 1,
+ Blocks: 2,
+ NoInternalBuffers: 3,
+ Force: 4,
+ ForceSleep: 5,
+ },
+ },
+ },
+ {
+ name: "rw bad",
+ s: "rw 1",
+ invalid: true,
+ },
+ {
+ name: "rw OK",
+ s: "rw 1 2",
+ stats: &xfs.Stats{
+ ReadWrite: xfs.ReadWriteStats{
+ Read: 1,
+ Write: 2,
+ },
+ },
+ },
+ {
+ name: "attr bad",
+ s: "attr 1",
+ invalid: true,
+ },
+ {
+ name: "attr OK",
+ s: "attr 1 2 3 4",
+ stats: &xfs.Stats{
+ AttributeOperation: xfs.AttributeOperationStats{
+ Get: 1,
+ Set: 2,
+ Remove: 3,
+ List: 4,
+ },
+ },
+ },
+ {
+ name: "icluster bad",
+ s: "icluster 1",
+ invalid: true,
+ },
+ {
+ name: "icluster OK",
+ s: "icluster 1 2 3",
+ stats: &xfs.Stats{
+ InodeClustering: xfs.InodeClusteringStats{
+ Iflush: 1,
+ Flush: 2,
+ FlushInode: 3,
+ },
+ },
+ },
+ {
+ name: "vnodes bad",
+ s: "vnodes 1",
+ invalid: true,
+ },
+ {
+ name: "vnodes (missing free) OK",
+ s: "vnodes 1 2 3 4 5 6 7",
+ stats: &xfs.Stats{
+ Vnode: xfs.VnodeStats{
+ Active: 1,
+ Allocate: 2,
+ Get: 3,
+ Hold: 4,
+ Release: 5,
+ Reclaim: 6,
+ Remove: 7,
+ },
+ },
+ },
+ {
+ name: "vnodes (with free) OK",
+ s: "vnodes 1 2 3 4 5 6 7 8",
+ stats: &xfs.Stats{
+ Vnode: xfs.VnodeStats{
+ Active: 1,
+ Allocate: 2,
+ Get: 3,
+ Hold: 4,
+ Release: 5,
+ Reclaim: 6,
+ Remove: 7,
+ Free: 8,
+ },
+ },
+ },
+ {
+ name: "buf bad",
+ s: "buf 1",
+ invalid: true,
+ },
+ {
+ name: "buf OK",
+ s: "buf 1 2 3 4 5 6 7 8 9",
+ stats: &xfs.Stats{
+ Buffer: xfs.BufferStats{
+ Get: 1,
+ Create: 2,
+ GetLocked: 3,
+ GetLockedWaited: 4,
+ BusyLocked: 5,
+ MissLocked: 6,
+ PageRetries: 7,
+ PageFound: 8,
+ GetRead: 9,
+ },
+ },
+ },
+ {
+ name: "xpc bad",
+ s: "xpc 1",
+ invalid: true,
+ },
+ {
+ name: "xpc OK",
+ s: "xpc 1 2 3",
+ stats: &xfs.Stats{
+ ExtendedPrecision: xfs.ExtendedPrecisionStats{
+ FlushBytes: 1,
+ WriteBytes: 2,
+ ReadBytes: 3,
+ },
+ },
+ },
+ {
+ name: "fixtures OK",
+ fs: true,
+ stats: &xfs.Stats{
+ ExtentAllocation: xfs.ExtentAllocationStats{
+ ExtentsAllocated: 92447,
+ BlocksAllocated: 97589,
+ ExtentsFreed: 92448,
+ BlocksFreed: 93751,
+ },
+ AllocationBTree: xfs.BTreeStats{
+ Lookups: 0,
+ Compares: 0,
+ RecordsInserted: 0,
+ RecordsDeleted: 0,
+ },
+ BlockMapping: xfs.BlockMappingStats{
+ Reads: 1767055,
+ Writes: 188820,
+ Unmaps: 184891,
+ ExtentListInsertions: 92447,
+ ExtentListDeletions: 92448,
+ ExtentListLookups: 2140766,
+ ExtentListCompares: 0,
+ },
+ BlockMapBTree: xfs.BTreeStats{
+ Lookups: 0,
+ Compares: 0,
+ RecordsInserted: 0,
+ RecordsDeleted: 0,
+ },
+ DirectoryOperation: xfs.DirectoryOperationStats{
+ Lookups: 185039,
+ Creates: 92447,
+ Removes: 92444,
+ Getdents: 136422,
+ },
+ Transaction: xfs.TransactionStats{
+ Sync: 706,
+ Async: 944304,
+ Empty: 0,
+ },
+ InodeOperation: xfs.InodeOperationStats{
+ Attempts: 185045,
+ Found: 58807,
+ Recycle: 0,
+ Missed: 126238,
+ Duplicate: 0,
+ Reclaims: 33637,
+ AttributeChange: 22,
+ },
+ LogOperation: xfs.LogOperationStats{
+ Writes: 2883,
+ Blocks: 113448,
+ NoInternalBuffers: 9,
+ Force: 17360,
+ ForceSleep: 739,
+ },
+ ReadWrite: xfs.ReadWriteStats{
+ Read: 107739,
+ Write: 94045,
+ },
+ AttributeOperation: xfs.AttributeOperationStats{
+ Get: 4,
+ Set: 0,
+ Remove: 0,
+ List: 0,
+ },
+ InodeClustering: xfs.InodeClusteringStats{
+ Iflush: 8677,
+ Flush: 7849,
+ FlushInode: 135802,
+ },
+ Vnode: xfs.VnodeStats{
+ Active: 92601,
+ Allocate: 0,
+ Get: 0,
+ Hold: 0,
+ Release: 92444,
+ Reclaim: 92444,
+ Remove: 92444,
+ Free: 0,
+ },
+ Buffer: xfs.BufferStats{
+ Get: 2666287,
+ Create: 7122,
+ GetLocked: 2659202,
+ GetLockedWaited: 3599,
+ BusyLocked: 2,
+ MissLocked: 7085,
+ PageRetries: 0,
+ PageFound: 10297,
+ GetRead: 7085,
+ },
+ ExtendedPrecision: xfs.ExtendedPrecisionStats{
+ FlushBytes: 399724544,
+ WriteBytes: 92823103,
+ ReadBytes: 86219234,
+ },
+ },
+ },
+ }
+
+ for i, tt := range tests {
+ t.Logf("[%02d] test %q", i, tt.name)
+
+ var (
+ stats *xfs.Stats
+ err error
+ )
+
+ if tt.s != "" {
+ stats, err = xfs.ParseStats(strings.NewReader(tt.s))
+ }
+ if tt.fs {
+ stats, err = procfs.FS("../fixtures").XFSStats()
+ }
+
+ if tt.invalid && err == nil {
+ t.Error("expected an error, but none occurred")
+ }
+ if !tt.invalid && err != nil {
+ t.Errorf("unexpected error: %v", err)
+ }
+
+ if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) {
+ log.Printf("stats: %#v", have)
+ t.Errorf("unexpected XFS stats:\nwant:\n%v\nhave:\n%v", want, have)
+ }
+ }
+}
diff --git a/vendor/github.com/prometheus/procfs/xfs/xfs.go b/vendor/github.com/prometheus/procfs/xfs/xfs.go
new file mode 100644
index 000000000..ed77d907a
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/xfs/xfs.go
@@ -0,0 +1,158 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package xfs provides access to statistics exposed by the XFS filesystem.
+package xfs
+
+// Stats contains XFS filesystem runtime statistics, parsed from
+// /proc/fs/xfs/stat.
+//
+// The names and meanings of each statistic were taken from
+// http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux
+// kernel source. Most counters are uint32s (same data types used in
+// xfs_stats.h), but some of the "extended precision stats" are uint64s.
+type Stats struct {
+ ExtentAllocation ExtentAllocationStats
+ AllocationBTree BTreeStats
+ BlockMapping BlockMappingStats
+ BlockMapBTree BTreeStats
+ DirectoryOperation DirectoryOperationStats
+ Transaction TransactionStats
+ InodeOperation InodeOperationStats
+ LogOperation LogOperationStats
+ ReadWrite ReadWriteStats
+ AttributeOperation AttributeOperationStats
+ InodeClustering InodeClusteringStats
+ Vnode VnodeStats
+ Buffer BufferStats
+ ExtendedPrecision ExtendedPrecisionStats
+}
+
+// ExtentAllocationStats contains statistics regarding XFS extent allocations.
+type ExtentAllocationStats struct {
+ ExtentsAllocated uint32
+ BlocksAllocated uint32
+ ExtentsFreed uint32
+ BlocksFreed uint32
+}
+
+// BTreeStats contains statistics regarding an XFS internal B-tree.
+type BTreeStats struct {
+ Lookups uint32
+ Compares uint32
+ RecordsInserted uint32
+ RecordsDeleted uint32
+}
+
+// BlockMappingStats contains statistics regarding XFS block maps.
+type BlockMappingStats struct {
+ Reads uint32
+ Writes uint32
+ Unmaps uint32
+ ExtentListInsertions uint32
+ ExtentListDeletions uint32
+ ExtentListLookups uint32
+ ExtentListCompares uint32
+}
+
+// DirectoryOperationStats contains statistics regarding XFS directory entries.
+type DirectoryOperationStats struct {
+ Lookups uint32
+ Creates uint32
+ Removes uint32
+ Getdents uint32
+}
+
+// TransactionStats contains statistics regarding XFS metadata transactions.
+type TransactionStats struct {
+ Sync uint32
+ Async uint32
+ Empty uint32
+}
+
+// InodeOperationStats contains statistics regarding XFS inode operations.
+type InodeOperationStats struct {
+ Attempts uint32
+ Found uint32
+ Recycle uint32
+ Missed uint32
+ Duplicate uint32
+ Reclaims uint32
+ AttributeChange uint32
+}
+
+// LogOperationStats contains statistics regarding the XFS log buffer.
+type LogOperationStats struct {
+ Writes uint32
+ Blocks uint32
+ NoInternalBuffers uint32
+ Force uint32
+ ForceSleep uint32
+}
+
+// ReadWriteStats contains statistics regarding the number of read and write
+// system calls for XFS filesystems.
+type ReadWriteStats struct {
+ Read uint32
+ Write uint32
+}
+
+// AttributeOperationStats contains statistics regarding manipulation of
+// XFS extended file attributes.
+type AttributeOperationStats struct {
+ Get uint32
+ Set uint32
+ Remove uint32
+ List uint32
+}
+
+// InodeClusteringStats contains statistics regarding XFS inode clustering
+// operations.
+type InodeClusteringStats struct {
+ Iflush uint32
+ Flush uint32
+ FlushInode uint32
+}
+
+// VnodeStats contains statistics regarding XFS vnode operations.
+type VnodeStats struct {
+ Active uint32
+ Allocate uint32
+ Get uint32
+ Hold uint32
+ Release uint32
+ Reclaim uint32
+ Remove uint32
+ Free uint32
+}
+
+// BufferStats contains statistics regarding XFS read/write I/O buffers.
+type BufferStats struct {
+ Get uint32
+ Create uint32
+ GetLocked uint32
+ GetLockedWaited uint32
+ BusyLocked uint32
+ MissLocked uint32
+ PageRetries uint32
+ PageFound uint32
+ GetRead uint32
+}
+
+// ExtendedPrecisionStats contains high precision counters used to track the
+// total number of bytes read, written, or flushed, during XFS operations.
+type ExtendedPrecisionStats struct {
+ FlushBytes uint64
+ WriteBytes uint64
+ ReadBytes uint64
+}
diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml
index bd72adf68..42d1f57d3 100644
--- a/vendor/github.com/spf13/cobra/.travis.yml
+++ b/vendor/github.com/spf13/cobra/.travis.yml
@@ -5,8 +5,9 @@ matrix:
- go: 1.4.3
env: NOVET=true # No bundled vet.
- go: 1.5.4
- - go: 1.6.3
- - go: 1.7
+ - go: 1.6.4
+ - go: 1.7.5
+ - go: 1.8
- go: tip
allow_failures:
- go: tip
diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md
index 2efda5920..2de984012 100644
--- a/vendor/github.com/spf13/cobra/README.md
+++ b/vendor/github.com/spf13/cobra/README.md
@@ -8,6 +8,7 @@ Many of the most widely used Go projects are built using Cobra including:
* [Hugo](http://gohugo.io)
* [rkt](https://github.com/coreos/rkt)
* [etcd](https://github.com/coreos/etcd)
+* [Docker](https://github.com/docker/docker)
* [Docker (distribution)](https://github.com/docker/distribution)
* [OpenShift](https://www.openshift.com/)
* [Delve](https://github.com/derekparker/delve)
@@ -755,7 +756,7 @@ providing a way to handle the errors in one location. The current list of functi
* PersistentPostRunE
If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage`
-and `SilenceErrors` to `false` on the command. A child command respects these flags if they are set on the parent
+and `SilenceErrors` to `true` on the command. A child command respects these flags if they are set on the parent
command.
**Example Usage using RunE:**
diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go
index 3ee1a0a9d..ae3930dfc 100644
--- a/vendor/github.com/spf13/cobra/command.go
+++ b/vendor/github.com/spf13/cobra/command.go
@@ -57,6 +57,9 @@ type Command struct {
Deprecated string
// Is this command hidden and should NOT show up in the list of available commands?
Hidden bool
+ // Annotations are key/value pairs that can be used by applications to identify or
+ // group commands
+ Annotations map[string]string
// Full set of flags
flags *flag.FlagSet
// Set of flags childrens of this command will inherit
@@ -152,12 +155,12 @@ func (c *Command) SetUsageTemplate(s string) {
}
// SetFlagErrorFunc sets a function to generate an error when flag parsing
-// fails
+// fails.
func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) {
c.flagErrorFunc = f
}
-// SetHelpFunc sets help function. Can be defined by Application
+// SetHelpFunc sets help function. Can be defined by Application.
func (c *Command) SetHelpFunc(f func(*Command, []string)) {
c.helpFunc = f
}
@@ -184,7 +187,7 @@ func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string
}
}
-// OutOrStdout returns output to stdout
+// OutOrStdout returns output to stdout.
func (c *Command) OutOrStdout() io.Writer {
return c.getOut(os.Stdout)
}
@@ -342,19 +345,19 @@ Aliases:
{{end}}{{if .HasExample}}
Examples:
-{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
+{{ .Example }}{{end}}{{if .HasAvailableSubCommands}}
-Available Commands:{{range .Commands}}{{if .IsAvailableCommand}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableLocalFlags}}
+Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
+ {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
Flags:
-{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{ if .HasAvailableInheritedFlags}}
+{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasAvailableInheritedFlags}}
Global Flags:
{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
-Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
- {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableSubCommands }}
+Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
+ {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
`
@@ -381,20 +384,18 @@ func (c *Command) resetChildrensParents() {
}
}
-// Test if the named flag is a boolean flag.
-func isBooleanFlag(name string, f *flag.FlagSet) bool {
+func hasNoOptDefVal(name string, f *flag.FlagSet) bool {
flag := f.Lookup(name)
if flag == nil {
return false
}
- return flag.Value.Type() == "bool"
+ return len(flag.NoOptDefVal) > 0
}
-// Test if the named flag is a boolean flag.
-func isBooleanShortFlag(name string, f *flag.FlagSet) bool {
+func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool {
result := false
- f.VisitAll(func(f *flag.Flag) {
- if f.Shorthand == name && f.Value.Type() == "bool" {
+ fs.VisitAll(func(flag *flag.Flag) {
+ if flag.Shorthand == name && len(flag.NoOptDefVal) > 0 {
result = true
}
})
@@ -420,8 +421,8 @@ func stripFlags(args []string, c *Command) []string {
inQuote = true
case strings.HasPrefix(y, "--") && !strings.Contains(y, "="):
// TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
- inFlag = !isBooleanFlag(y[2:], c.Flags())
- case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !isBooleanShortFlag(y[1:], c.Flags()):
+ inFlag = !hasNoOptDefVal(y[2:], c.Flags())
+ case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !shortHasNoOptDefVal(y[1:], c.Flags()):
inFlag = true
case inFlag:
inFlag = false
@@ -455,7 +456,7 @@ func argsMinusFirstX(args []string, x string) []string {
return args
}
-// Find finds the target command given the args and command tree
+// Find the target command given the args and command tree
// Meant to be run on the highest node. Only searches down.
func (c *Command) Find(args []string) (*Command, []string, error) {
if c == nil {
@@ -695,7 +696,6 @@ func (c *Command) Execute() error {
// ExecuteC executes the command.
func (c *Command) ExecuteC() (cmd *Command, err error) {
-
// Regardless of what command execute is called on, run on Root only
if c.HasParent() {
return c.Root().ExecuteC()
@@ -780,7 +780,7 @@ func (c *Command) initHelpCmd() {
Run: func(c *Command, args []string) {
cmd, _, e := c.Root().Find(args)
if cmd == nil || e != nil {
- c.Printf("Unknown help topic %#q.", args)
+ c.Printf("Unknown help topic %#q\n", args)
c.Root().Usage()
} else {
cmd.Help()
@@ -969,7 +969,8 @@ func (c *Command) Name() string {
if i >= 0 {
name = name[:i]
}
- return name
+ c.name = name
+ return c.name
}
// HasAlias determines if a given string is an alias of the command.
@@ -1020,11 +1021,12 @@ func (c *Command) IsAvailableCommand() bool {
return false
}
-// IsHelpCommand determines if a command is a 'help' command; a help command is
-// determined by the fact that it is NOT runnable/hidden/deprecated, and has no
-// sub commands that are runnable/hidden/deprecated.
-func (c *Command) IsHelpCommand() bool {
-
+// IsAdditionalHelpTopicCommand determines if a command is an additional
+// help topic command; additional help topic command is determined by the
+// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
+// are runnable/hidden/deprecated.
+// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
+func (c *Command) IsAdditionalHelpTopicCommand() bool {
// if a command is runnable, deprecated, or hidden it is not a 'help' command
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
return false
@@ -1032,7 +1034,7 @@ func (c *Command) IsHelpCommand() bool {
// if any non-help sub commands are found, the command is not a 'help' command
for _, sub := range c.commands {
- if !sub.IsHelpCommand() {
+ if !sub.IsAdditionalHelpTopicCommand() {
return false
}
}
@@ -1045,10 +1047,9 @@ func (c *Command) IsHelpCommand() bool {
// that need to be shown in the usage/help default template under 'additional help
// topics'.
func (c *Command) HasHelpSubCommands() bool {
-
// return true on the first found available 'help' sub command
for _, sub := range c.commands {
- if sub.IsHelpCommand() {
+ if sub.IsAdditionalHelpTopicCommand() {
return true
}
}
@@ -1060,7 +1061,6 @@ func (c *Command) HasHelpSubCommands() bool {
// HasAvailableSubCommands determines if a command has available sub commands that
// need to be shown in the usage/help default template under 'available commands'.
func (c *Command) HasAvailableSubCommands() bool {
-
// return true on the first found available (non deprecated/help/hidden)
// sub command
for _, sub := range c.commands {
diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go
index fd7107c42..b9266c367 100644
--- a/vendor/github.com/spf13/cobra/doc/man_docs.go
+++ b/vendor/github.com/spf13/cobra/doc/man_docs.go
@@ -49,7 +49,7 @@ func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error {
header = &GenManHeader{}
}
for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsHelpCommand() {
+ if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
if err := GenManTreeFromOpts(c, opts); err != nil {
@@ -216,7 +216,7 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
children := cmd.Commands()
sort.Sort(byName(children))
for _, c := range children {
- if !c.IsAvailableCommand() || c.IsHelpCommand() {
+ if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)
diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go
index fa1363180..8d159c1d7 100644
--- a/vendor/github.com/spf13/cobra/doc/md_docs.go
+++ b/vendor/github.com/spf13/cobra/doc/md_docs.go
@@ -119,7 +119,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
sort.Sort(byName(children))
for _, child := range children {
- if !child.IsAvailableCommand() || child.IsHelpCommand() {
+ if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
continue
}
cname := name + " " + child.Name()
@@ -149,7 +149,7 @@ func GenMarkdownTree(cmd *cobra.Command, dir string) error {
func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsHelpCommand() {
+ if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
diff --git a/vendor/github.com/spf13/cobra/doc/util.go b/vendor/github.com/spf13/cobra/doc/util.go
index a7d2765a9..8d3dbecec 100644
--- a/vendor/github.com/spf13/cobra/doc/util.go
+++ b/vendor/github.com/spf13/cobra/doc/util.go
@@ -27,7 +27,7 @@ func hasSeeAlso(cmd *cobra.Command) bool {
return true
}
for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsHelpCommand() {
+ if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
return true
diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.go b/vendor/github.com/spf13/cobra/doc/yaml_docs.go
index 75474d299..ac8db89eb 100644
--- a/vendor/github.com/spf13/cobra/doc/yaml_docs.go
+++ b/vendor/github.com/spf13/cobra/doc/yaml_docs.go
@@ -57,7 +57,7 @@ func GenYamlTree(cmd *cobra.Command, dir string) error {
// GenYamlTreeCustom creates yaml structured ref files
func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsHelpCommand() {
+ if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
if err := GenYamlTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
@@ -117,7 +117,7 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str
children := cmd.Commands()
sort.Sort(byName(children))
for _, child := range children {
- if !child.IsAvailableCommand() || child.IsHelpCommand() {
+ if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
continue
}
result = append(result, child.Name()+" - "+child.Short)
diff --git a/vendor/github.com/tylerb/graceful/README.md b/vendor/github.com/tylerb/graceful/README.md
index 328c3acf8..c641b6e78 100644
--- a/vendor/github.com/tylerb/graceful/README.md
+++ b/vendor/github.com/tylerb/graceful/README.md
@@ -3,6 +3,11 @@ graceful [![GoDoc](https://godoc.org/github.com/tylerb/graceful?status.png)](htt
Graceful is a Go 1.3+ package enabling graceful shutdown of http.Handler servers.
+## Using Go 1.8?
+
+If you are using Go 1.8, you may not need to use this library! Consider using `http.Server`'s built-in [Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown)
+method for graceful shutdowns.
+
## Installation
To install, simply execute:
diff --git a/vendor/github.com/tylerb/graceful/graceful.go b/vendor/github.com/tylerb/graceful/graceful.go
index d6a9ca068..ebf0aeb7d 100644
--- a/vendor/github.com/tylerb/graceful/graceful.go
+++ b/vendor/github.com/tylerb/graceful/graceful.go
@@ -366,6 +366,7 @@ func (srv *Server) manageConnections(add, idle, active, remove chan net.Conn, sh
select {
case conn := <-add:
srv.connections[conn] = struct{}{}
+ srv.idleConnections[conn] = struct{}{} // Newly-added connections are considered idle until they become active.
case conn := <-idle:
srv.idleConnections[conn] = struct{}{}
case conn := <-active:
diff --git a/vendor/github.com/xenolf/lego/README.md b/vendor/github.com/xenolf/lego/README.md
index 9be562944..852f0a833 100644
--- a/vendor/github.com/xenolf/lego/README.md
+++ b/vendor/github.com/xenolf/lego/README.md
@@ -23,7 +23,11 @@ To build lego inside a Docker container, just run
```
docker build -t lego .
```
-
+##### From the package manager
+- [ArchLinux (AUR)](https://aur.archlinux.org/packages/lego-git):
+```
+yaourt -S lego-git
+```
#### Features
- Register with CA
diff --git a/vendor/github.com/xenolf/lego/acme/client.go b/vendor/github.com/xenolf/lego/acme/client.go
index e824f5080..ba56e796c 100644
--- a/vendor/github.com/xenolf/lego/acme/client.go
+++ b/vendor/github.com/xenolf/lego/acme/client.go
@@ -535,6 +535,7 @@ func (c *Client) getChallenges(domains []string) ([]authorizationResource, map[s
links := parseLinks(hdr["Link"])
if links["next"] == "" {
logf("[ERROR][%s] acme: Server did not provide next link to proceed", domain)
+ errc <- domainError{Domain: domain, Error: errors.New("Server did not provide next link to proceed")}
return
}
@@ -560,12 +561,20 @@ func (c *Client) getChallenges(domains []string) ([]authorizationResource, map[s
}
}
+ logAuthz(challenges)
+
close(resc)
close(errc)
return challenges, failures
}
+func logAuthz(authz []authorizationResource) {
+ for _, auth := range authz {
+ logf("[INFO][%s] AuthURL: %s", auth.Domain, auth.AuthURL)
+ }
+}
+
func (c *Client) requestCertificate(authz []authorizationResource, bundle bool, privKey crypto.PrivateKey, mustStaple bool) (CertificateResource, error) {
if len(authz) == 0 {
return CertificateResource{}, errors.New("Passed no authorizations to requestCertificate!")
diff --git a/vendor/github.com/xenolf/lego/acme/client_test.go b/vendor/github.com/xenolf/lego/acme/client_test.go
index e309554f3..b18334c8a 100644
--- a/vendor/github.com/xenolf/lego/acme/client_test.go
+++ b/vendor/github.com/xenolf/lego/acme/client_test.go
@@ -10,6 +10,7 @@ import (
"net/http/httptest"
"strings"
"testing"
+ "time"
)
func TestNewClient(t *testing.T) {
@@ -118,6 +119,39 @@ func TestClientOptPort(t *testing.T) {
}
}
+func TestNotHoldingLockWhileMakingHTTPRequests(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ time.Sleep(250 * time.Millisecond)
+ w.Header().Add("Replay-Nonce", "12345")
+ w.Header().Add("Retry-After", "0")
+ writeJSONResponse(w, &challenge{Type: "http-01", Status: "Valid", URI: "http://example.com/", Token: "token"})
+ }))
+ defer ts.Close()
+
+ privKey, _ := rsa.GenerateKey(rand.Reader, 512)
+ j := &jws{privKey: privKey, directoryURL: ts.URL}
+ ch := make(chan bool)
+ resultCh := make(chan bool)
+ go func() {
+ j.Nonce()
+ ch <- true
+ }()
+ go func() {
+ j.Nonce()
+ ch <- true
+ }()
+ go func() {
+ <-ch
+ <-ch
+ resultCh <- true
+ }()
+ select {
+ case <-resultCh:
+ case <-time.After(400 * time.Millisecond):
+ t.Fatal("JWS is probably holding a lock while making HTTP request")
+ }
+}
+
func TestValidate(t *testing.T) {
var statuses []string
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -168,6 +202,43 @@ func TestValidate(t *testing.T) {
}
}
+func TestGetChallenges(t *testing.T) {
+ var ts *httptest.Server
+ ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ switch r.Method {
+ case "GET", "HEAD":
+ w.Header().Add("Replay-Nonce", "12345")
+ w.Header().Add("Retry-After", "0")
+ writeJSONResponse(w, directory{NewAuthzURL: ts.URL, NewCertURL: ts.URL, NewRegURL: ts.URL, RevokeCertURL: ts.URL})
+ case "POST":
+ writeJSONResponse(w, authorization{})
+ }
+ }))
+ defer ts.Close()
+
+ keyBits := 512 // small value keeps test fast
+ keyType := RSA2048
+ key, err := rsa.GenerateKey(rand.Reader, keyBits)
+ if err != nil {
+ t.Fatal("Could not generate test key:", err)
+ }
+ user := mockUser{
+ email: "test@test.com",
+ regres: &RegistrationResource{NewAuthzURL: ts.URL},
+ privatekey: key,
+ }
+
+ client, err := NewClient(ts.URL, user, keyType)
+ if err != nil {
+ t.Fatalf("Could not create client: %v", err)
+ }
+
+ _, failures := client.getChallenges([]string{"example.com"})
+ if failures["example.com"] == nil {
+ t.Fatal("Expecting \"Server did not provide next link to proceed\" error, got nil")
+ }
+}
+
// writeJSONResponse marshals the body as JSON and writes it to the response.
func writeJSONResponse(w http.ResponseWriter, body interface{}) {
bs, err := json.Marshal(body)
diff --git a/vendor/github.com/xenolf/lego/acme/error.go b/vendor/github.com/xenolf/lego/acme/error.go
index 6d7013cf1..e4bc934c2 100644
--- a/vendor/github.com/xenolf/lego/acme/error.go
+++ b/vendor/github.com/xenolf/lego/acme/error.go
@@ -8,7 +8,10 @@ import (
"strings"
)
-const tosAgreementError = "Must agree to subscriber agreement before any further actions"
+const (
+ tosAgreementError = "Must agree to subscriber agreement before any further actions"
+ invalidNonceError = "JWS has invalid anti-replay nonce"
+)
// RemoteError is the base type for all errors specific to the ACME protocol.
type RemoteError struct {
@@ -28,6 +31,12 @@ type TOSError struct {
RemoteError
}
+// NonceError represents the error which is returned if the
+// nonce sent by the client was not accepted by the server.
+type NonceError struct {
+ RemoteError
+}
+
type domainError struct {
Domain string
Error error
@@ -73,6 +82,10 @@ func handleHTTPError(resp *http.Response) error {
return TOSError{errorDetail}
}
+ if errorDetail.StatusCode == http.StatusBadRequest && strings.HasPrefix(errorDetail.Detail, invalidNonceError) {
+ return NonceError{errorDetail}
+ }
+
return errorDetail
}
diff --git a/vendor/github.com/xenolf/lego/acme/http.go b/vendor/github.com/xenolf/lego/acme/http.go
index 180db786d..dc958046a 100644
--- a/vendor/github.com/xenolf/lego/acme/http.go
+++ b/vendor/github.com/xenolf/lego/acme/http.go
@@ -31,14 +31,14 @@ const (
func httpHead(url string) (resp *http.Response, err error) {
req, err := http.NewRequest("HEAD", url, nil)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to head %q: %v", url, err)
}
req.Header.Set("User-Agent", userAgent())
resp, err = HTTPClient.Do(req)
if err != nil {
- return resp, err
+ return resp, fmt.Errorf("failed to do head %q: %v", url, err)
}
resp.Body.Close()
return resp, err
@@ -49,7 +49,7 @@ func httpHead(url string) (resp *http.Response, err error) {
func httpPost(url string, bodyType string, body io.Reader) (resp *http.Response, err error) {
req, err := http.NewRequest("POST", url, body)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to post %q: %v", url, err)
}
req.Header.Set("Content-Type", bodyType)
req.Header.Set("User-Agent", userAgent())
@@ -62,7 +62,7 @@ func httpPost(url string, bodyType string, body io.Reader) (resp *http.Response,
func httpGet(url string) (resp *http.Response, err error) {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to get %q: %v", url, err)
}
req.Header.Set("User-Agent", userAgent())
@@ -74,7 +74,7 @@ func httpGet(url string) (resp *http.Response, err error) {
func getJSON(uri string, respBody interface{}) (http.Header, error) {
resp, err := httpGet(uri)
if err != nil {
- return nil, fmt.Errorf("failed to get %q: %v", uri, err)
+ return nil, fmt.Errorf("failed to get json %q: %v", uri, err)
}
defer resp.Body.Close()
diff --git a/vendor/github.com/xenolf/lego/acme/jws.go b/vendor/github.com/xenolf/lego/acme/jws.go
index 2a1fc244d..1b4d29d53 100644
--- a/vendor/github.com/xenolf/lego/acme/jws.go
+++ b/vendor/github.com/xenolf/lego/acme/jws.go
@@ -16,8 +16,7 @@ import (
type jws struct {
directoryURL string
privKey crypto.PrivateKey
- nonces []string
- sync.Mutex
+ nonces nonceManager
}
func keyAsJWK(key interface{}) *jose.JsonWebKey {
@@ -38,19 +37,31 @@ func keyAsJWK(key interface{}) *jose.JsonWebKey {
func (j *jws) post(url string, content []byte) (*http.Response, error) {
signedContent, err := j.signContent(content)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("Failed to sign content -> %s", err.Error())
}
resp, err := httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize())))
- if err != nil {
- return nil, err
+
+ // Even in case of an error, the response should still contain a nonce.
+ nonce, nonceErr := getNonceFromResponse(resp)
+ if nonceErr == nil {
+ j.nonces.Push(nonce)
}
- j.Lock()
- defer j.Unlock()
- j.getNonceFromResponse(resp)
+ if err != nil {
+ switch err.(type) {
+ case NonceError:
+ // In case of a nonce error - retry once
+ resp, err = httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize())))
+ if err != nil {
+ return nil, fmt.Errorf("Failed to HTTP POST to %s -> %s", url, err.Error())
+ }
+ default:
+ return nil, fmt.Errorf("Failed to HTTP POST to %s -> %s", url, err.Error())
+ }
+ }
- return resp, err
+ return resp, nil
}
func (j *jws) signContent(content []byte) (*jose.JsonWebSignature, error) {
@@ -69,49 +80,63 @@ func (j *jws) signContent(content []byte) (*jose.JsonWebSignature, error) {
signer, err := jose.NewSigner(alg, j.privKey)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("Failed to create jose signer -> %s", err.Error())
}
signer.SetNonceSource(j)
signed, err := signer.Sign(content)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("Failed to sign content -> %s", err.Error())
}
return signed, nil
}
-func (j *jws) getNonceFromResponse(resp *http.Response) error {
- nonce := resp.Header.Get("Replay-Nonce")
- if nonce == "" {
- return fmt.Errorf("Server did not respond with a proper nonce header.")
+func (j *jws) Nonce() (string, error) {
+ if nonce, ok := j.nonces.Pop(); ok {
+ return nonce, nil
}
- j.nonces = append(j.nonces, nonce)
- return nil
+ return getNonce(j.directoryURL)
}
-func (j *jws) getNonce() error {
- resp, err := httpHead(j.directoryURL)
- if err != nil {
- return err
+type nonceManager struct {
+ nonces []string
+ sync.Mutex
+}
+
+func (n *nonceManager) Pop() (string, bool) {
+ n.Lock()
+ defer n.Unlock()
+
+ if len(n.nonces) == 0 {
+ return "", false
}
- return j.getNonceFromResponse(resp)
+ nonce := n.nonces[len(n.nonces)-1]
+ n.nonces = n.nonces[:len(n.nonces)-1]
+ return nonce, true
}
-func (j *jws) Nonce() (string, error) {
- j.Lock()
- defer j.Unlock()
- nonce := ""
- if len(j.nonces) == 0 {
- err := j.getNonce()
- if err != nil {
- return nonce, err
- }
+func (n *nonceManager) Push(nonce string) {
+ n.Lock()
+ defer n.Unlock()
+ n.nonces = append(n.nonces, nonce)
+}
+
+func getNonce(url string) (string, error) {
+ resp, err := httpHead(url)
+ if err != nil {
+ return "", fmt.Errorf("Failed to get nonce from HTTP HEAD -> %s", err.Error())
}
- if len(j.nonces) == 0 {
- return "", fmt.Errorf("Can't get nonce")
+
+ return getNonceFromResponse(resp)
+}
+
+func getNonceFromResponse(resp *http.Response) (string, error) {
+ nonce := resp.Header.Get("Replay-Nonce")
+ if nonce == "" {
+ return "", fmt.Errorf("Server did not respond with a proper nonce header.")
}
- nonce, j.nonces = j.nonces[len(j.nonces)-1], j.nonces[:len(j.nonces)-1]
+
return nonce, nil
}
diff --git a/vendor/github.com/xenolf/lego/providers/http/memcached/memcached.go b/vendor/github.com/xenolf/lego/providers/http/memcached/memcached.go
index 9c5f6c0b4..9ac8b811d 100644
--- a/vendor/github.com/xenolf/lego/providers/http/memcached/memcached.go
+++ b/vendor/github.com/xenolf/lego/providers/http/memcached/memcached.go
@@ -1,4 +1,5 @@
-// Package webroot implements a HTTP provider for solving the HTTP-01 challenge using web server's root path.
+// Package memcached implements a HTTP provider for solving the HTTP-01 challenge using memcached
+// in combination with a webserver.
package memcached
import (
diff --git a/vendor/golang.org/x/crypto/acme/acme.go b/vendor/golang.org/x/crypto/acme/acme.go
index 8aafada09..8619508e5 100644
--- a/vendor/golang.org/x/crypto/acme/acme.go
+++ b/vendor/golang.org/x/crypto/acme/acme.go
@@ -47,6 +47,10 @@ const LetsEncryptURL = "https://acme-v01.api.letsencrypt.org/directory"
const (
maxChainLen = 5 // max depth and breadth of a certificate chain
maxCertSize = 1 << 20 // max size of a certificate, in bytes
+
+ // Max number of collected nonces kept in memory.
+ // Expect usual peak of 1 or 2.
+ maxNonces = 100
)
// CertOption is an optional argument type for Client methods which manipulate
@@ -108,6 +112,9 @@ type Client struct {
dirMu sync.Mutex // guards writes to dir
dir *Directory // cached result of Client's Discover method
+
+ noncesMu sync.Mutex
+ nonces map[string]struct{} // nonces collected from previous responses
}
// Discover performs ACME server discovery using c.DirectoryURL.
@@ -131,6 +138,7 @@ func (c *Client) Discover(ctx context.Context) (Directory, error) {
return Directory{}, err
}
defer res.Body.Close()
+ c.addNonce(res.Header)
if res.StatusCode != http.StatusOK {
return Directory{}, responseError(res)
}
@@ -192,7 +200,7 @@ func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration,
req.NotAfter = now.Add(exp).Format(time.RFC3339)
}
- res, err := postJWS(ctx, c.HTTPClient, c.Key, c.dir.CertURL, req)
+ res, err := c.postJWS(ctx, c.Key, c.dir.CertURL, req)
if err != nil {
return nil, "", err
}
@@ -267,7 +275,7 @@ func (c *Client) RevokeCert(ctx context.Context, key crypto.Signer, cert []byte,
if key == nil {
key = c.Key
}
- res, err := postJWS(ctx, c.HTTPClient, key, c.dir.RevokeURL, body)
+ res, err := c.postJWS(ctx, key, c.dir.RevokeURL, body)
if err != nil {
return err
}
@@ -355,7 +363,7 @@ func (c *Client) Authorize(ctx context.Context, domain string) (*Authorization,
Resource: "new-authz",
Identifier: authzID{Type: "dns", Value: domain},
}
- res, err := postJWS(ctx, c.HTTPClient, c.Key, c.dir.AuthzURL, req)
+ res, err := c.postJWS(ctx, c.Key, c.dir.AuthzURL, req)
if err != nil {
return nil, err
}
@@ -413,7 +421,7 @@ func (c *Client) RevokeAuthorization(ctx context.Context, url string) error {
Status: "deactivated",
Delete: true,
}
- res, err := postJWS(ctx, c.HTTPClient, c.Key, url, req)
+ res, err := c.postJWS(ctx, c.Key, url, req)
if err != nil {
return err
}
@@ -519,7 +527,7 @@ func (c *Client) Accept(ctx context.Context, chal *Challenge) (*Challenge, error
Type: chal.Type,
Auth: auth,
}
- res, err := postJWS(ctx, c.HTTPClient, c.Key, chal.URI, req)
+ res, err := c.postJWS(ctx, c.Key, chal.URI, req)
if err != nil {
return nil, err
}
@@ -652,7 +660,7 @@ func (c *Client) doReg(ctx context.Context, url string, typ string, acct *Accoun
req.Contact = acct.Contact
req.Agreement = acct.AgreedTerms
}
- res, err := postJWS(ctx, c.HTTPClient, c.Key, url, req)
+ res, err := c.postJWS(ctx, c.Key, url, req)
if err != nil {
return nil, err
}
@@ -689,6 +697,78 @@ func (c *Client) doReg(ctx context.Context, url string, typ string, acct *Accoun
}, nil
}
+// postJWS signs the body with the given key and POSTs it to the provided url.
+// The body argument must be JSON-serializable.
+func (c *Client) postJWS(ctx context.Context, key crypto.Signer, url string, body interface{}) (*http.Response, error) {
+ nonce, err := c.popNonce(ctx, url)
+ if err != nil {
+ return nil, err
+ }
+ b, err := jwsEncodeJSON(body, key, nonce)
+ if err != nil {
+ return nil, err
+ }
+ res, err := ctxhttp.Post(ctx, c.HTTPClient, url, "application/jose+json", bytes.NewReader(b))
+ if err != nil {
+ return nil, err
+ }
+ c.addNonce(res.Header)
+ return res, nil
+}
+
+// popNonce returns a nonce value previously stored with c.addNonce
+// or fetches a fresh one from the given URL.
+func (c *Client) popNonce(ctx context.Context, url string) (string, error) {
+ c.noncesMu.Lock()
+ defer c.noncesMu.Unlock()
+ if len(c.nonces) == 0 {
+ return fetchNonce(ctx, c.HTTPClient, url)
+ }
+ var nonce string
+ for nonce = range c.nonces {
+ delete(c.nonces, nonce)
+ break
+ }
+ return nonce, nil
+}
+
+// addNonce stores a nonce value found in h (if any) for future use.
+func (c *Client) addNonce(h http.Header) {
+ v := nonceFromHeader(h)
+ if v == "" {
+ return
+ }
+ c.noncesMu.Lock()
+ defer c.noncesMu.Unlock()
+ if len(c.nonces) >= maxNonces {
+ return
+ }
+ if c.nonces == nil {
+ c.nonces = make(map[string]struct{})
+ }
+ c.nonces[v] = struct{}{}
+}
+
+func fetchNonce(ctx context.Context, client *http.Client, url string) (string, error) {
+ resp, err := ctxhttp.Head(ctx, client, url)
+ if err != nil {
+ return "", err
+ }
+ defer resp.Body.Close()
+ nonce := nonceFromHeader(resp.Header)
+ if nonce == "" {
+ if resp.StatusCode > 299 {
+ return "", responseError(resp)
+ }
+ return "", errors.New("acme: nonce not found")
+ }
+ return nonce, nil
+}
+
+func nonceFromHeader(h http.Header) string {
+ return h.Get("Replay-Nonce")
+}
+
func responseCert(ctx context.Context, client *http.Client, res *http.Response, bundle bool) ([][]byte, error) {
b, err := ioutil.ReadAll(io.LimitReader(res.Body, maxCertSize+1))
if err != nil {
@@ -793,33 +873,6 @@ func chainCert(ctx context.Context, client *http.Client, url string, depth int)
return chain, nil
}
-// postJWS signs the body with the given key and POSTs it to the provided url.
-// The body argument must be JSON-serializable.
-func postJWS(ctx context.Context, client *http.Client, key crypto.Signer, url string, body interface{}) (*http.Response, error) {
- nonce, err := fetchNonce(ctx, client, url)
- if err != nil {
- return nil, err
- }
- b, err := jwsEncodeJSON(body, key, nonce)
- if err != nil {
- return nil, err
- }
- return ctxhttp.Post(ctx, client, url, "application/jose+json", bytes.NewReader(b))
-}
-
-func fetchNonce(ctx context.Context, client *http.Client, url string) (string, error) {
- resp, err := ctxhttp.Head(ctx, client, url)
- if err != nil {
- return "", nil
- }
- defer resp.Body.Close()
- enc := resp.Header.Get("replay-nonce")
- if enc == "" {
- return "", errors.New("acme: nonce not found")
- }
- return enc, nil
-}
-
// linkHeader returns URI-Reference values of all Link headers
// with relation-type rel.
// See https://tools.ietf.org/html/rfc5988#section-5 for details.
diff --git a/vendor/golang.org/x/crypto/acme/acme_test.go b/vendor/golang.org/x/crypto/acme/acme_test.go
index 4e618f292..1205dbb36 100644
--- a/vendor/golang.org/x/crypto/acme/acme_test.go
+++ b/vendor/golang.org/x/crypto/acme/acme_test.go
@@ -45,6 +45,28 @@ func decodeJWSRequest(t *testing.T, v interface{}, r *http.Request) {
}
}
+type jwsHead struct {
+ Alg string
+ Nonce string
+ JWK map[string]string `json:"jwk"`
+}
+
+func decodeJWSHead(r *http.Request) (*jwsHead, error) {
+ var req struct{ Protected string }
+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
+ return nil, err
+ }
+ b, err := base64.RawURLEncoding.DecodeString(req.Protected)
+ if err != nil {
+ return nil, err
+ }
+ var head jwsHead
+ if err := json.Unmarshal(b, &head); err != nil {
+ return nil, err
+ }
+ return &head, nil
+}
+
func TestDiscover(t *testing.T) {
const (
reg = "https://example.com/acme/new-reg"
@@ -916,7 +938,30 @@ func TestRevokeCert(t *testing.T) {
}
}
-func TestFetchNonce(t *testing.T) {
+func TestNonce_add(t *testing.T) {
+ var c Client
+ c.addNonce(http.Header{"Replay-Nonce": {"nonce"}})
+ c.addNonce(http.Header{"Replay-Nonce": {}})
+ c.addNonce(http.Header{"Replay-Nonce": {"nonce"}})
+
+ nonces := map[string]struct{}{"nonce": struct{}{}}
+ if !reflect.DeepEqual(c.nonces, nonces) {
+ t.Errorf("c.nonces = %q; want %q", c.nonces, nonces)
+ }
+}
+
+func TestNonce_addMax(t *testing.T) {
+ c := &Client{nonces: make(map[string]struct{})}
+ for i := 0; i < maxNonces; i++ {
+ c.nonces[fmt.Sprintf("%d", i)] = struct{}{}
+ }
+ c.addNonce(http.Header{"Replay-Nonce": {"nonce"}})
+ if n := len(c.nonces); n != maxNonces {
+ t.Errorf("len(c.nonces) = %d; want %d", n, maxNonces)
+ }
+}
+
+func TestNonce_fetch(t *testing.T) {
tests := []struct {
code int
nonce string
@@ -949,6 +994,76 @@ func TestFetchNonce(t *testing.T) {
}
}
+func TestNonce_fetchError(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusTooManyRequests)
+ }))
+ defer ts.Close()
+ _, err := fetchNonce(context.Background(), http.DefaultClient, ts.URL)
+ e, ok := err.(*Error)
+ if !ok {
+ t.Fatalf("err is %T; want *Error", err)
+ }
+ if e.StatusCode != http.StatusTooManyRequests {
+ t.Errorf("e.StatusCode = %d; want %d", e.StatusCode, http.StatusTooManyRequests)
+ }
+}
+
+func TestNonce_postJWS(t *testing.T) {
+ var count int
+ seen := make(map[string]bool)
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ count++
+ w.Header().Set("replay-nonce", fmt.Sprintf("nonce%d", count))
+ if r.Method == "HEAD" {
+ // We expect the client do a HEAD request
+ // but only to fetch the first nonce.
+ return
+ }
+ // Make client.Authorize happy; we're not testing its result.
+ defer func() {
+ w.WriteHeader(http.StatusCreated)
+ w.Write([]byte(`{"status":"valid"}`))
+ }()
+
+ head, err := decodeJWSHead(r)
+ if err != nil {
+ t.Errorf("decodeJWSHead: %v", err)
+ return
+ }
+ if head.Nonce == "" {
+ t.Error("head.Nonce is empty")
+ return
+ }
+ if seen[head.Nonce] {
+ t.Errorf("nonce is already used: %q", head.Nonce)
+ }
+ seen[head.Nonce] = true
+ }))
+ defer ts.Close()
+
+ client := Client{Key: testKey, dir: &Directory{AuthzURL: ts.URL}}
+ if _, err := client.Authorize(context.Background(), "example.com"); err != nil {
+ t.Errorf("client.Authorize 1: %v", err)
+ }
+ // The second call should not generate another extra HEAD request.
+ if _, err := client.Authorize(context.Background(), "example.com"); err != nil {
+ t.Errorf("client.Authorize 2: %v", err)
+ }
+
+ if count != 3 {
+ t.Errorf("total requests count: %d; want 3", count)
+ }
+ if n := len(client.nonces); n != 1 {
+ t.Errorf("len(client.nonces) = %d; want 1", n)
+ }
+ for k := range seen {
+ if _, exist := client.nonces[k]; exist {
+ t.Errorf("used nonce %q in client.nonces", k)
+ }
+ }
+}
+
func TestLinkHeader(t *testing.T) {
h := http.Header{"Link": {
`<https://example.com/acme/new-authz>;rel="next"`,
diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go
index 4bcd6d532..7afb21331 100644
--- a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go
+++ b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go
@@ -22,6 +22,7 @@ import (
"net/http"
"net/http/httptest"
"reflect"
+ "sync"
"testing"
"time"
@@ -51,26 +52,44 @@ var authzTmpl = template.Must(template.New("authz").Parse(`{
]
}`))
-type memCache map[string][]byte
+type memCache struct {
+ mu sync.Mutex
+ keyData map[string][]byte
+}
+
+func (m *memCache) Get(ctx context.Context, key string) ([]byte, error) {
+ m.mu.Lock()
+ defer m.mu.Unlock()
-func (m memCache) Get(ctx context.Context, key string) ([]byte, error) {
- v, ok := m[key]
+ v, ok := m.keyData[key]
if !ok {
return nil, ErrCacheMiss
}
return v, nil
}
-func (m memCache) Put(ctx context.Context, key string, data []byte) error {
- m[key] = data
+func (m *memCache) Put(ctx context.Context, key string, data []byte) error {
+ m.mu.Lock()
+ defer m.mu.Unlock()
+
+ m.keyData[key] = data
return nil
}
-func (m memCache) Delete(ctx context.Context, key string) error {
- delete(m, key)
+func (m *memCache) Delete(ctx context.Context, key string) error {
+ m.mu.Lock()
+ defer m.mu.Unlock()
+
+ delete(m.keyData, key)
return nil
}
+func newMemCache() *memCache {
+ return &memCache{
+ keyData: make(map[string][]byte),
+ }
+}
+
func dummyCert(pub interface{}, san ...string) ([]byte, error) {
return dateDummyCert(pub, time.Now(), time.Now().Add(90*24*time.Hour), san...)
}
@@ -124,7 +143,7 @@ func TestGetCertificate_trailingDot(t *testing.T) {
func TestGetCertificate_ForceRSA(t *testing.T) {
man := &Manager{
Prompt: AcceptTOS,
- Cache: make(memCache),
+ Cache: newMemCache(),
ForceRSA: true,
}
defer man.stopRenew()
@@ -280,8 +299,7 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl
}
func TestAccountKeyCache(t *testing.T) {
- cache := make(memCache)
- m := Manager{Cache: cache}
+ m := Manager{Cache: newMemCache()}
ctx := context.Background()
k1, err := m.accountKey(ctx)
if err != nil {
@@ -315,8 +333,7 @@ func TestCache(t *testing.T) {
PrivateKey: privKey,
}
- cache := make(memCache)
- man := &Manager{Cache: cache}
+ man := &Manager{Cache: newMemCache()}
defer man.stopRenew()
if err := man.cachePut("example.org", tlscert); err != nil {
t.Fatalf("man.cachePut: %v", err)
diff --git a/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go b/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go
index d1ec52f4d..10c811ac4 100644
--- a/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go
+++ b/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go
@@ -111,7 +111,7 @@ func TestRenewFromCache(t *testing.T) {
}
man := &Manager{
Prompt: AcceptTOS,
- Cache: make(memCache),
+ Cache: newMemCache(),
RenewBefore: 24 * time.Hour,
Client: &acme.Client{
Key: key,
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s
index 96a51d524..784bce6a9 100644
--- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s
+++ b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s
@@ -54,68 +54,223 @@ DATA ·AVX_c48<>+0x00(SB)/8, $0x0100070605040302
DATA ·AVX_c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a
GLOBL ·AVX_c48<>(SB), (NOPTR+RODATA), $16
-// unfortunately the BYTE representation of VPERMQ must be used
+#define VPERMQ_0x39_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x39
+#define VPERMQ_0x93_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x93
+#define VPERMQ_0x4E_Y2_Y2 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2; BYTE $0x4e
+#define VPERMQ_0x93_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x93
+#define VPERMQ_0x39_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x39
+
#define ROUND_AVX2(m0, m1, m2, m3, t, c40, c48) \
- VPADDQ m0, Y0, Y0; \
- VPADDQ Y1, Y0, Y0; \
- VPXOR Y0, Y3, Y3; \
- VPSHUFD $-79, Y3, Y3; \
- VPADDQ Y3, Y2, Y2; \
- VPXOR Y2, Y1, Y1; \
- VPSHUFB c40, Y1, Y1; \
- VPADDQ m1, Y0, Y0; \
- VPADDQ Y1, Y0, Y0; \
- VPXOR Y0, Y3, Y3; \
- VPSHUFB c48, Y3, Y3; \
- VPADDQ Y3, Y2, Y2; \
- VPXOR Y2, Y1, Y1; \
- VPADDQ Y1, Y1, t; \
- VPSRLQ $63, Y1, Y1; \
- VPXOR t, Y1, Y1; \
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x39 \ // VPERMQ 0x39, Y1, Y1
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2; BYTE $0x4e \ // VPERMQ 0x4e, Y2, Y2
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x93 \ // VPERMQ 0x93, Y3, Y3
- VPADDQ m2, Y0, Y0; \
- VPADDQ Y1, Y0, Y0; \
- VPXOR Y0, Y3, Y3; \
- VPSHUFD $-79, Y3, Y3; \
- VPADDQ Y3, Y2, Y2; \
- VPXOR Y2, Y1, Y1; \
- VPSHUFB c40, Y1, Y1; \
- VPADDQ m3, Y0, Y0; \
- VPADDQ Y1, Y0, Y0; \
- VPXOR Y0, Y3, Y3; \
- VPSHUFB c48, Y3, Y3; \
- VPADDQ Y3, Y2, Y2; \
- VPXOR Y2, Y1, Y1; \
- VPADDQ Y1, Y1, t; \
- VPSRLQ $63, Y1, Y1; \
- VPXOR t, Y1, Y1; \
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x39 \ // VPERMQ 0x39, Y3, Y3
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2; BYTE $0x4e \ // VPERMQ 0x4e, Y2, Y2
- BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x93 \ // VPERMQ 0x93, Y1, Y1
-
-// load msg into Y12, Y13, Y14, Y15
-#define LOAD_MSG_AVX2(src, i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15) \
- MOVQ i0*8(src), X12; \
- PINSRQ $1, i1*8(src), X12; \
- MOVQ i2*8(src), X11; \
- PINSRQ $1, i3*8(src), X11; \
- VINSERTI128 $1, X11, Y12, Y12; \
- MOVQ i4*8(src), X13; \
- PINSRQ $1, i5*8(src), X13; \
- MOVQ i6*8(src), X11; \
- PINSRQ $1, i7*8(src), X11; \
- VINSERTI128 $1, X11, Y13, Y13; \
- MOVQ i8*8(src), X14; \
- PINSRQ $1, i9*8(src), X14; \
- MOVQ i10*8(src), X11; \
- PINSRQ $1, i11*8(src), X11; \
+ VPADDQ m0, Y0, Y0; \
+ VPADDQ Y1, Y0, Y0; \
+ VPXOR Y0, Y3, Y3; \
+ VPSHUFD $-79, Y3, Y3; \
+ VPADDQ Y3, Y2, Y2; \
+ VPXOR Y2, Y1, Y1; \
+ VPSHUFB c40, Y1, Y1; \
+ VPADDQ m1, Y0, Y0; \
+ VPADDQ Y1, Y0, Y0; \
+ VPXOR Y0, Y3, Y3; \
+ VPSHUFB c48, Y3, Y3; \
+ VPADDQ Y3, Y2, Y2; \
+ VPXOR Y2, Y1, Y1; \
+ VPADDQ Y1, Y1, t; \
+ VPSRLQ $63, Y1, Y1; \
+ VPXOR t, Y1, Y1; \
+ VPERMQ_0x39_Y1_Y1; \
+ VPERMQ_0x4E_Y2_Y2; \
+ VPERMQ_0x93_Y3_Y3; \
+ VPADDQ m2, Y0, Y0; \
+ VPADDQ Y1, Y0, Y0; \
+ VPXOR Y0, Y3, Y3; \
+ VPSHUFD $-79, Y3, Y3; \
+ VPADDQ Y3, Y2, Y2; \
+ VPXOR Y2, Y1, Y1; \
+ VPSHUFB c40, Y1, Y1; \
+ VPADDQ m3, Y0, Y0; \
+ VPADDQ Y1, Y0, Y0; \
+ VPXOR Y0, Y3, Y3; \
+ VPSHUFB c48, Y3, Y3; \
+ VPADDQ Y3, Y2, Y2; \
+ VPXOR Y2, Y1, Y1; \
+ VPADDQ Y1, Y1, t; \
+ VPSRLQ $63, Y1, Y1; \
+ VPXOR t, Y1, Y1; \
+ VPERMQ_0x39_Y3_Y3; \
+ VPERMQ_0x4E_Y2_Y2; \
+ VPERMQ_0x93_Y1_Y1
+
+#define VMOVQ_SI_X11_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x1E
+#define VMOVQ_SI_X12_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x26
+#define VMOVQ_SI_X13_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x2E
+#define VMOVQ_SI_X14_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x36
+#define VMOVQ_SI_X15_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x3E
+
+#define VMOVQ_SI_X11(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x5E; BYTE $n
+#define VMOVQ_SI_X12(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x66; BYTE $n
+#define VMOVQ_SI_X13(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x6E; BYTE $n
+#define VMOVQ_SI_X14(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x76; BYTE $n
+#define VMOVQ_SI_X15(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x7E; BYTE $n
+
+#define VPINSRQ_1_SI_X11_0 BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x1E; BYTE $0x01
+#define VPINSRQ_1_SI_X12_0 BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x26; BYTE $0x01
+#define VPINSRQ_1_SI_X13_0 BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x2E; BYTE $0x01
+#define VPINSRQ_1_SI_X14_0 BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x36; BYTE $0x01
+#define VPINSRQ_1_SI_X15_0 BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x3E; BYTE $0x01
+
+#define VPINSRQ_1_SI_X11(n) BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x5E; BYTE $n; BYTE $0x01
+#define VPINSRQ_1_SI_X12(n) BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x66; BYTE $n; BYTE $0x01
+#define VPINSRQ_1_SI_X13(n) BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x6E; BYTE $n; BYTE $0x01
+#define VPINSRQ_1_SI_X14(n) BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x76; BYTE $n; BYTE $0x01
+#define VPINSRQ_1_SI_X15(n) BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x7E; BYTE $n; BYTE $0x01
+
+#define VMOVQ_R8_X15 BYTE $0xC4; BYTE $0x41; BYTE $0xF9; BYTE $0x6E; BYTE $0xF8
+#define VPINSRQ_1_R9_X15 BYTE $0xC4; BYTE $0x43; BYTE $0x81; BYTE $0x22; BYTE $0xF9; BYTE $0x01
+
+// load msg: Y12 = (i0, i1, i2, i3)
+// i0, i1, i2, i3 must not be 0
+#define LOAD_MSG_AVX2_Y12(i0, i1, i2, i3) \
+ VMOVQ_SI_X12(i0*8); \
+ VMOVQ_SI_X11(i2*8); \
+ VPINSRQ_1_SI_X12(i1*8); \
+ VPINSRQ_1_SI_X11(i3*8); \
+ VINSERTI128 $1, X11, Y12, Y12
+
+// load msg: Y13 = (i0, i1, i2, i3)
+// i0, i1, i2, i3 must not be 0
+#define LOAD_MSG_AVX2_Y13(i0, i1, i2, i3) \
+ VMOVQ_SI_X13(i0*8); \
+ VMOVQ_SI_X11(i2*8); \
+ VPINSRQ_1_SI_X13(i1*8); \
+ VPINSRQ_1_SI_X11(i3*8); \
+ VINSERTI128 $1, X11, Y13, Y13
+
+// load msg: Y14 = (i0, i1, i2, i3)
+// i0, i1, i2, i3 must not be 0
+#define LOAD_MSG_AVX2_Y14(i0, i1, i2, i3) \
+ VMOVQ_SI_X14(i0*8); \
+ VMOVQ_SI_X11(i2*8); \
+ VPINSRQ_1_SI_X14(i1*8); \
+ VPINSRQ_1_SI_X11(i3*8); \
+ VINSERTI128 $1, X11, Y14, Y14
+
+// load msg: Y15 = (i0, i1, i2, i3)
+// i0, i1, i2, i3 must not be 0
+#define LOAD_MSG_AVX2_Y15(i0, i1, i2, i3) \
+ VMOVQ_SI_X15(i0*8); \
+ VMOVQ_SI_X11(i2*8); \
+ VPINSRQ_1_SI_X15(i1*8); \
+ VPINSRQ_1_SI_X11(i3*8); \
+ VINSERTI128 $1, X11, Y15, Y15
+
+#define LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15() \
+ VMOVQ_SI_X12_0; \
+ VMOVQ_SI_X11(4*8); \
+ VPINSRQ_1_SI_X12(2*8); \
+ VPINSRQ_1_SI_X11(6*8); \
+ VINSERTI128 $1, X11, Y12, Y12; \
+ LOAD_MSG_AVX2_Y13(1, 3, 5, 7); \
+ LOAD_MSG_AVX2_Y14(8, 10, 12, 14); \
+ LOAD_MSG_AVX2_Y15(9, 11, 13, 15)
+
+#define LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3() \
+ LOAD_MSG_AVX2_Y12(14, 4, 9, 13); \
+ LOAD_MSG_AVX2_Y13(10, 8, 15, 6); \
+ VMOVQ_SI_X11(11*8); \
+ VPSHUFD $0x4E, 0*8(SI), X14; \
+ VPINSRQ_1_SI_X11(5*8); \
VINSERTI128 $1, X11, Y14, Y14; \
- MOVQ i12*8(src), X15; \
- PINSRQ $1, i13*8(src), X15; \
- MOVQ i14*8(src), X11; \
- PINSRQ $1, i15*8(src), X11; \
+ LOAD_MSG_AVX2_Y15(12, 2, 7, 3)
+
+#define LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4() \
+ VMOVQ_SI_X11(5*8); \
+ VMOVDQU 11*8(SI), X12; \
+ VPINSRQ_1_SI_X11(15*8); \
+ VINSERTI128 $1, X11, Y12, Y12; \
+ VMOVQ_SI_X13(8*8); \
+ VMOVQ_SI_X11(2*8); \
+ VPINSRQ_1_SI_X13_0; \
+ VPINSRQ_1_SI_X11(13*8); \
+ VINSERTI128 $1, X11, Y13, Y13; \
+ LOAD_MSG_AVX2_Y14(10, 3, 7, 9); \
+ LOAD_MSG_AVX2_Y15(14, 6, 1, 4)
+
+#define LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8() \
+ LOAD_MSG_AVX2_Y12(7, 3, 13, 11); \
+ LOAD_MSG_AVX2_Y13(9, 1, 12, 14); \
+ LOAD_MSG_AVX2_Y14(2, 5, 4, 15); \
+ VMOVQ_SI_X15(6*8); \
+ VMOVQ_SI_X11_0; \
+ VPINSRQ_1_SI_X15(10*8); \
+ VPINSRQ_1_SI_X11(8*8); \
+ VINSERTI128 $1, X11, Y15, Y15
+
+#define LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13() \
+ LOAD_MSG_AVX2_Y12(9, 5, 2, 10); \
+ VMOVQ_SI_X13_0; \
+ VMOVQ_SI_X11(4*8); \
+ VPINSRQ_1_SI_X13(7*8); \
+ VPINSRQ_1_SI_X11(15*8); \
+ VINSERTI128 $1, X11, Y13, Y13; \
+ LOAD_MSG_AVX2_Y14(14, 11, 6, 3); \
+ LOAD_MSG_AVX2_Y15(1, 12, 8, 13)
+
+#define LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9() \
+ VMOVQ_SI_X12(2*8); \
+ VMOVQ_SI_X11_0; \
+ VPINSRQ_1_SI_X12(6*8); \
+ VPINSRQ_1_SI_X11(8*8); \
+ VINSERTI128 $1, X11, Y12, Y12; \
+ LOAD_MSG_AVX2_Y13(12, 10, 11, 3); \
+ LOAD_MSG_AVX2_Y14(4, 7, 15, 1); \
+ LOAD_MSG_AVX2_Y15(13, 5, 14, 9)
+
+#define LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11() \
+ LOAD_MSG_AVX2_Y12(12, 1, 14, 4); \
+ LOAD_MSG_AVX2_Y13(5, 15, 13, 10); \
+ VMOVQ_SI_X14_0; \
+ VPSHUFD $0x4E, 8*8(SI), X11; \
+ VPINSRQ_1_SI_X14(6*8); \
+ VINSERTI128 $1, X11, Y14, Y14; \
+ LOAD_MSG_AVX2_Y15(7, 3, 2, 11)
+
+#define LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10() \
+ LOAD_MSG_AVX2_Y12(13, 7, 12, 3); \
+ LOAD_MSG_AVX2_Y13(11, 14, 1, 9); \
+ LOAD_MSG_AVX2_Y14(5, 15, 8, 2); \
+ VMOVQ_SI_X15_0; \
+ VMOVQ_SI_X11(6*8); \
+ VPINSRQ_1_SI_X15(4*8); \
+ VPINSRQ_1_SI_X11(10*8); \
+ VINSERTI128 $1, X11, Y15, Y15
+
+#define LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5() \
+ VMOVQ_SI_X12(6*8); \
+ VMOVQ_SI_X11(11*8); \
+ VPINSRQ_1_SI_X12(14*8); \
+ VPINSRQ_1_SI_X11_0; \
+ VINSERTI128 $1, X11, Y12, Y12; \
+ LOAD_MSG_AVX2_Y13(15, 9, 3, 8); \
+ VMOVQ_SI_X11(1*8); \
+ VMOVDQU 12*8(SI), X14; \
+ VPINSRQ_1_SI_X11(10*8); \
+ VINSERTI128 $1, X11, Y14, Y14; \
+ VMOVQ_SI_X15(2*8); \
+ VMOVDQU 4*8(SI), X11; \
+ VPINSRQ_1_SI_X15(7*8); \
+ VINSERTI128 $1, X11, Y15, Y15
+
+#define LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0() \
+ LOAD_MSG_AVX2_Y12(10, 8, 7, 1); \
+ VMOVQ_SI_X13(2*8); \
+ VPSHUFD $0x4E, 5*8(SI), X11; \
+ VPINSRQ_1_SI_X13(4*8); \
+ VINSERTI128 $1, X11, Y13, Y13; \
+ LOAD_MSG_AVX2_Y14(15, 9, 3, 13); \
+ VMOVQ_SI_X15(11*8); \
+ VMOVQ_SI_X11(12*8); \
+ VPINSRQ_1_SI_X15(14*8); \
+ VPINSRQ_1_SI_X11_0; \
VINSERTI128 $1, X11, Y15, Y15
// func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
@@ -162,34 +317,34 @@ noinc:
VMOVDQA Y6, Y2
VPXOR 0(SP), Y7, Y3
- LOAD_MSG_AVX2(SI, 0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15)
+ LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15()
VMOVDQA Y12, 32(SP)
VMOVDQA Y13, 64(SP)
VMOVDQA Y14, 96(SP)
VMOVDQA Y15, 128(SP)
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 14, 4, 9, 13, 10, 8, 15, 6, 1, 0, 11, 5, 12, 2, 7, 3)
+ LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3()
VMOVDQA Y12, 160(SP)
VMOVDQA Y13, 192(SP)
VMOVDQA Y14, 224(SP)
VMOVDQA Y15, 256(SP)
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 11, 12, 5, 15, 8, 0, 2, 13, 10, 3, 7, 9, 14, 6, 1, 4)
+ LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 7, 3, 13, 11, 9, 1, 12, 14, 2, 5, 4, 15, 6, 10, 0, 8)
+ LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 9, 5, 2, 10, 0, 7, 4, 15, 14, 11, 6, 3, 1, 12, 8, 13)
+ LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 2, 6, 0, 8, 12, 10, 11, 3, 4, 7, 15, 1, 13, 5, 14, 9)
+ LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 12, 1, 14, 4, 5, 15, 13, 10, 0, 6, 9, 8, 7, 3, 2, 11)
+ LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 13, 7, 12, 3, 11, 14, 1, 9, 5, 15, 8, 2, 0, 4, 6, 10)
+ LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 6, 14, 11, 0, 15, 9, 3, 8, 12, 13, 1, 10, 2, 7, 4, 5)
+ LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
- LOAD_MSG_AVX2(SI, 10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0)
+ LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0()
ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5)
ROUND_AVX2(32(SP), 64(SP), 96(SP), 128(SP), Y10, Y4, Y5)
@@ -209,56 +364,55 @@ noinc:
VMOVDQU Y8, 0(AX)
VMOVDQU Y9, 32(AX)
+ VZEROUPPER
MOVQ DX, SP
RET
-// unfortunately the BYTE representation of VPUNPCKLQDQ and VPUNPCKHQDQ must be used
-#define VPUNPCKLQDQ_X8_X8_X10 BYTE $0xC4; BYTE $0x41; BYTE $0x39; BYTE $0x6C; BYTE $0xD0
-#define VPUNPCKHQDQ_X7_X10_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xF2
-#define VPUNPCKLQDQ_X7_X7_X10 BYTE $0xC5; BYTE $0x41; BYTE $0x6C; BYTE $0xD7
-#define VPUNPCKHQDQ_X8_X10_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x39; BYTE $0x6D; BYTE $0xFA
-#define VPUNPCKLQDQ_X3_X3_X10 BYTE $0xC5; BYTE $0x61; BYTE $0x6C; BYTE $0xD3
-#define VPUNPCKHQDQ_X2_X10_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x69; BYTE $0x6D; BYTE $0xD2
-#define VPUNPCKLQDQ_X9_X9_X10 BYTE $0xC4; BYTE $0x41; BYTE $0x31; BYTE $0x6C; BYTE $0xD1
-#define VPUNPCKHQDQ_X3_X10_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xDA
-#define VPUNPCKLQDQ_X2_X2_X10 BYTE $0xC5; BYTE $0x69; BYTE $0x6C; BYTE $0xD2
-#define VPUNPCKHQDQ_X3_X10_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xD2
-#define VPUNPCKHQDQ_X8_X10_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x39; BYTE $0x6D; BYTE $0xDA
-#define VPUNPCKHQDQ_X6_X10_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x49; BYTE $0x6D; BYTE $0xF2
-#define VPUNPCKHQDQ_X7_X10_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xFA
-
-// shuffle X2 and X6 using the temp registers X8, X9, X10
+#define VPUNPCKLQDQ_X2_X2_X15 BYTE $0xC5; BYTE $0x69; BYTE $0x6C; BYTE $0xFA
+#define VPUNPCKLQDQ_X3_X3_X15 BYTE $0xC5; BYTE $0x61; BYTE $0x6C; BYTE $0xFB
+#define VPUNPCKLQDQ_X7_X7_X15 BYTE $0xC5; BYTE $0x41; BYTE $0x6C; BYTE $0xFF
+#define VPUNPCKLQDQ_X13_X13_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x11; BYTE $0x6C; BYTE $0xFD
+#define VPUNPCKLQDQ_X14_X14_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x09; BYTE $0x6C; BYTE $0xFE
+
+#define VPUNPCKHQDQ_X15_X2_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x69; BYTE $0x6D; BYTE $0xD7
+#define VPUNPCKHQDQ_X15_X3_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xDF
+#define VPUNPCKHQDQ_X15_X6_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x49; BYTE $0x6D; BYTE $0xF7
+#define VPUNPCKHQDQ_X15_X7_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xFF
+#define VPUNPCKHQDQ_X15_X3_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xD7
+#define VPUNPCKHQDQ_X15_X7_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xF7
+#define VPUNPCKHQDQ_X15_X13_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xDF
+#define VPUNPCKHQDQ_X15_X13_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xFF
+
#define SHUFFLE_AVX() \
- VMOVDQA X4, X9; \
- VMOVDQA X5, X4; \
- VMOVDQA X9, X5; \
- VMOVDQA X6, X8; \
- VPUNPCKLQDQ_X8_X8_X10; \
- VPUNPCKHQDQ_X7_X10_X6; \
- VPUNPCKLQDQ_X7_X7_X10; \
- VPUNPCKHQDQ_X8_X10_X7; \
- VPUNPCKLQDQ_X3_X3_X10; \
- VMOVDQA X2, X9; \
- VPUNPCKHQDQ_X2_X10_X2; \
- VPUNPCKLQDQ_X9_X9_X10; \
- VPUNPCKHQDQ_X3_X10_X3; \
-
-// inverse shuffle X2 and X6 using the temp registers X8, X9, X10
+ VMOVDQA X6, X13; \
+ VMOVDQA X2, X14; \
+ VMOVDQA X4, X6; \
+ VPUNPCKLQDQ_X13_X13_X15; \
+ VMOVDQA X5, X4; \
+ VMOVDQA X6, X5; \
+ VPUNPCKHQDQ_X15_X7_X6; \
+ VPUNPCKLQDQ_X7_X7_X15; \
+ VPUNPCKHQDQ_X15_X13_X7; \
+ VPUNPCKLQDQ_X3_X3_X15; \
+ VPUNPCKHQDQ_X15_X2_X2; \
+ VPUNPCKLQDQ_X14_X14_X15; \
+ VPUNPCKHQDQ_X15_X3_X3; \
+
#define SHUFFLE_AVX_INV() \
- VMOVDQA X4, X9; \
- VMOVDQA X5, X4; \
- VMOVDQA X9, X5; \
- VMOVDQA X2, X8; \
- VPUNPCKLQDQ_X2_X2_X10; \
- VPUNPCKHQDQ_X3_X10_X2; \
- VPUNPCKLQDQ_X3_X3_X10; \
- VPUNPCKHQDQ_X8_X10_X3; \
- VPUNPCKLQDQ_X7_X7_X10; \
- VMOVDQA X6, X9; \
- VPUNPCKHQDQ_X6_X10_X6; \
- VPUNPCKLQDQ_X9_X9_X10; \
- VPUNPCKHQDQ_X7_X10_X7; \
+ VMOVDQA X2, X13; \
+ VMOVDQA X4, X14; \
+ VPUNPCKLQDQ_X2_X2_X15; \
+ VMOVDQA X5, X4; \
+ VPUNPCKHQDQ_X15_X3_X2; \
+ VMOVDQA X14, X5; \
+ VPUNPCKLQDQ_X3_X3_X15; \
+ VMOVDQA X6, X14; \
+ VPUNPCKHQDQ_X15_X13_X3; \
+ VPUNPCKLQDQ_X7_X7_X15; \
+ VPUNPCKHQDQ_X15_X6_X6; \
+ VPUNPCKLQDQ_X14_X14_X15; \
+ VPUNPCKHQDQ_X15_X7_X7; \
#define HALF_ROUND_AVX(v0, v1, v2, v3, v4, v5, v6, v7, m0, m1, m2, m3, t0, c40, c48) \
VPADDQ m0, v0, v0; \
@@ -294,28 +448,133 @@ noinc:
VPSRLQ $63, v3, v3; \
VPXOR t0, v3, v3
-// unfortunately the BYTE representation of VPINSRQ must be used
-#define VPINSRQ_1_R10_X8_X8 BYTE $0xC4; BYTE $0x43; BYTE $0xB9; BYTE $0x22; BYTE $0xC2; BYTE $0x01
-#define VPINSRQ_1_R11_X9_X9 BYTE $0xC4; BYTE $0x43; BYTE $0xB1; BYTE $0x22; BYTE $0xCB; BYTE $0x01
-#define VPINSRQ_1_R12_X10_X10 BYTE $0xC4; BYTE $0x43; BYTE $0xA9; BYTE $0x22; BYTE $0xD4; BYTE $0x01
-#define VPINSRQ_1_R13_X11_X11 BYTE $0xC4; BYTE $0x43; BYTE $0xA1; BYTE $0x22; BYTE $0xDD; BYTE $0x01
-
-#define VPINSRQ_1_R9_X8_X8 BYTE $0xC4; BYTE $0x43; BYTE $0xB9; BYTE $0x22; BYTE $0xC1; BYTE $0x01
-
-// load src into X8, X9, X10 and X11 using R10, R11, R12 and R13 for temp registers
-#define LOAD_MSG_AVX(src, i0, i1, i2, i3, i4, i5, i6, i7) \
- MOVQ i0*8(src), X8; \
- MOVQ i1*8(src), R10; \
- MOVQ i2*8(src), X9; \
- MOVQ i3*8(src), R11; \
- MOVQ i4*8(src), X10; \
- MOVQ i5*8(src), R12; \
- MOVQ i6*8(src), X11; \
- MOVQ i7*8(src), R13; \
- VPINSRQ_1_R10_X8_X8; \
- VPINSRQ_1_R11_X9_X9; \
- VPINSRQ_1_R12_X10_X10; \
- VPINSRQ_1_R13_X11_X11
+// load msg: X12 = (i0, i1), X13 = (i2, i3), X14 = (i4, i5), X15 = (i6, i7)
+// i0, i1, i2, i3, i4, i5, i6, i7 must not be 0
+#define LOAD_MSG_AVX(i0, i1, i2, i3, i4, i5, i6, i7) \
+ VMOVQ_SI_X12(i0*8); \
+ VMOVQ_SI_X13(i2*8); \
+ VMOVQ_SI_X14(i4*8); \
+ VMOVQ_SI_X15(i6*8); \
+ VPINSRQ_1_SI_X12(i1*8); \
+ VPINSRQ_1_SI_X13(i3*8); \
+ VPINSRQ_1_SI_X14(i5*8); \
+ VPINSRQ_1_SI_X15(i7*8)
+
+// load msg: X12 = (0, 2), X13 = (4, 6), X14 = (1, 3), X15 = (5, 7)
+#define LOAD_MSG_AVX_0_2_4_6_1_3_5_7() \
+ VMOVQ_SI_X12_0; \
+ VMOVQ_SI_X13(4*8); \
+ VMOVQ_SI_X14(1*8); \
+ VMOVQ_SI_X15(5*8); \
+ VPINSRQ_1_SI_X12(2*8); \
+ VPINSRQ_1_SI_X13(6*8); \
+ VPINSRQ_1_SI_X14(3*8); \
+ VPINSRQ_1_SI_X15(7*8)
+
+// load msg: X12 = (1, 0), X13 = (11, 5), X14 = (12, 2), X15 = (7, 3)
+#define LOAD_MSG_AVX_1_0_11_5_12_2_7_3() \
+ VPSHUFD $0x4E, 0*8(SI), X12; \
+ VMOVQ_SI_X13(11*8); \
+ VMOVQ_SI_X14(12*8); \
+ VMOVQ_SI_X15(7*8); \
+ VPINSRQ_1_SI_X13(5*8); \
+ VPINSRQ_1_SI_X14(2*8); \
+ VPINSRQ_1_SI_X15(3*8)
+
+// load msg: X12 = (11, 12), X13 = (5, 15), X14 = (8, 0), X15 = (2, 13)
+#define LOAD_MSG_AVX_11_12_5_15_8_0_2_13() \
+ VMOVDQU 11*8(SI), X12; \
+ VMOVQ_SI_X13(5*8); \
+ VMOVQ_SI_X14(8*8); \
+ VMOVQ_SI_X15(2*8); \
+ VPINSRQ_1_SI_X13(15*8); \
+ VPINSRQ_1_SI_X14_0; \
+ VPINSRQ_1_SI_X15(13*8)
+
+// load msg: X12 = (2, 5), X13 = (4, 15), X14 = (6, 10), X15 = (0, 8)
+#define LOAD_MSG_AVX_2_5_4_15_6_10_0_8() \
+ VMOVQ_SI_X12(2*8); \
+ VMOVQ_SI_X13(4*8); \
+ VMOVQ_SI_X14(6*8); \
+ VMOVQ_SI_X15_0; \
+ VPINSRQ_1_SI_X12(5*8); \
+ VPINSRQ_1_SI_X13(15*8); \
+ VPINSRQ_1_SI_X14(10*8); \
+ VPINSRQ_1_SI_X15(8*8)
+
+// load msg: X12 = (9, 5), X13 = (2, 10), X14 = (0, 7), X15 = (4, 15)
+#define LOAD_MSG_AVX_9_5_2_10_0_7_4_15() \
+ VMOVQ_SI_X12(9*8); \
+ VMOVQ_SI_X13(2*8); \
+ VMOVQ_SI_X14_0; \
+ VMOVQ_SI_X15(4*8); \
+ VPINSRQ_1_SI_X12(5*8); \
+ VPINSRQ_1_SI_X13(10*8); \
+ VPINSRQ_1_SI_X14(7*8); \
+ VPINSRQ_1_SI_X15(15*8)
+
+// load msg: X12 = (2, 6), X13 = (0, 8), X14 = (12, 10), X15 = (11, 3)
+#define LOAD_MSG_AVX_2_6_0_8_12_10_11_3() \
+ VMOVQ_SI_X12(2*8); \
+ VMOVQ_SI_X13_0; \
+ VMOVQ_SI_X14(12*8); \
+ VMOVQ_SI_X15(11*8); \
+ VPINSRQ_1_SI_X12(6*8); \
+ VPINSRQ_1_SI_X13(8*8); \
+ VPINSRQ_1_SI_X14(10*8); \
+ VPINSRQ_1_SI_X15(3*8)
+
+// load msg: X12 = (0, 6), X13 = (9, 8), X14 = (7, 3), X15 = (2, 11)
+#define LOAD_MSG_AVX_0_6_9_8_7_3_2_11() \
+ MOVQ 0*8(SI), X12; \
+ VPSHUFD $0x4E, 8*8(SI), X13; \
+ MOVQ 7*8(SI), X14; \
+ MOVQ 2*8(SI), X15; \
+ VPINSRQ_1_SI_X12(6*8); \
+ VPINSRQ_1_SI_X14(3*8); \
+ VPINSRQ_1_SI_X15(11*8)
+
+// load msg: X12 = (6, 14), X13 = (11, 0), X14 = (15, 9), X15 = (3, 8)
+#define LOAD_MSG_AVX_6_14_11_0_15_9_3_8() \
+ MOVQ 6*8(SI), X12; \
+ MOVQ 11*8(SI), X13; \
+ MOVQ 15*8(SI), X14; \
+ MOVQ 3*8(SI), X15; \
+ VPINSRQ_1_SI_X12(14*8); \
+ VPINSRQ_1_SI_X13_0; \
+ VPINSRQ_1_SI_X14(9*8); \
+ VPINSRQ_1_SI_X15(8*8)
+
+// load msg: X12 = (5, 15), X13 = (8, 2), X14 = (0, 4), X15 = (6, 10)
+#define LOAD_MSG_AVX_5_15_8_2_0_4_6_10() \
+ MOVQ 5*8(SI), X12; \
+ MOVQ 8*8(SI), X13; \
+ MOVQ 0*8(SI), X14; \
+ MOVQ 6*8(SI), X15; \
+ VPINSRQ_1_SI_X12(15*8); \
+ VPINSRQ_1_SI_X13(2*8); \
+ VPINSRQ_1_SI_X14(4*8); \
+ VPINSRQ_1_SI_X15(10*8)
+
+// load msg: X12 = (12, 13), X13 = (1, 10), X14 = (2, 7), X15 = (4, 5)
+#define LOAD_MSG_AVX_12_13_1_10_2_7_4_5() \
+ VMOVDQU 12*8(SI), X12; \
+ MOVQ 1*8(SI), X13; \
+ MOVQ 2*8(SI), X14; \
+ VPINSRQ_1_SI_X13(10*8); \
+ VPINSRQ_1_SI_X14(7*8); \
+ VMOVDQU 4*8(SI), X15
+
+// load msg: X12 = (15, 9), X13 = (3, 13), X14 = (11, 14), X15 = (12, 0)
+#define LOAD_MSG_AVX_15_9_3_13_11_14_12_0() \
+ MOVQ 15*8(SI), X12; \
+ MOVQ 3*8(SI), X13; \
+ MOVQ 11*8(SI), X14; \
+ MOVQ 12*8(SI), X15; \
+ VPINSRQ_1_SI_X12(9*8); \
+ VPINSRQ_1_SI_X13(13*8); \
+ VPINSRQ_1_SI_X14(14*8); \
+ VPINSRQ_1_SI_X15_0
// func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
TEXT ·hashBlocksAVX(SB), 4, $288-48 // frame size = 272 + 16 byte alignment
@@ -331,15 +590,17 @@ TEXT ·hashBlocksAVX(SB), 4, $288-48 // frame size = 272 + 16 byte alignment
ANDQ $~15, R9
MOVQ R9, SP
- MOVOU ·AVX_c40<>(SB), X13
- MOVOU ·AVX_c48<>(SB), X14
+ VMOVDQU ·AVX_c40<>(SB), X0
+ VMOVDQU ·AVX_c48<>(SB), X1
+ VMOVDQA X0, X8
+ VMOVDQA X1, X9
VMOVDQU ·AVX_iv3<>(SB), X0
VMOVDQA X0, 0(SP)
XORQ CX, 0(SP) // 0(SP) = ·AVX_iv3 ^ (CX || 0)
- VMOVDQU 0(AX), X12
- VMOVDQU 16(AX), X15
+ VMOVDQU 0(AX), X10
+ VMOVDQU 16(AX), X11
VMOVDQU 32(AX), X2
VMOVDQU 48(AX), X3
@@ -353,124 +614,124 @@ loop:
INCQ R9
noinc:
- MOVQ R8, X8
- VPINSRQ_1_R9_X8_X8
+ VMOVQ_R8_X15
+ VPINSRQ_1_R9_X15
- VMOVDQA X12, X0
- VMOVDQA X15, X1
+ VMOVDQA X10, X0
+ VMOVDQA X11, X1
VMOVDQU ·AVX_iv0<>(SB), X4
VMOVDQU ·AVX_iv1<>(SB), X5
VMOVDQU ·AVX_iv2<>(SB), X6
- VPXOR X8, X6, X6
+ VPXOR X15, X6, X6
VMOVDQA 0(SP), X7
- LOAD_MSG_AVX(SI, 0, 2, 4, 6, 1, 3, 5, 7)
- VMOVDQA X8, 16(SP)
- VMOVDQA X9, 32(SP)
- VMOVDQA X10, 48(SP)
- VMOVDQA X11, 64(SP)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_0_2_4_6_1_3_5_7()
+ VMOVDQA X12, 16(SP)
+ VMOVDQA X13, 32(SP)
+ VMOVDQA X14, 48(SP)
+ VMOVDQA X15, 64(SP)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 8, 10, 12, 14, 9, 11, 13, 15)
- VMOVDQA X8, 80(SP)
- VMOVDQA X9, 96(SP)
- VMOVDQA X10, 112(SP)
- VMOVDQA X11, 128(SP)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(8, 10, 12, 14, 9, 11, 13, 15)
+ VMOVDQA X12, 80(SP)
+ VMOVDQA X13, 96(SP)
+ VMOVDQA X14, 112(SP)
+ VMOVDQA X15, 128(SP)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 14, 4, 9, 13, 10, 8, 15, 6)
- VMOVDQA X8, 144(SP)
- VMOVDQA X9, 160(SP)
- VMOVDQA X10, 176(SP)
- VMOVDQA X11, 192(SP)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(14, 4, 9, 13, 10, 8, 15, 6)
+ VMOVDQA X12, 144(SP)
+ VMOVDQA X13, 160(SP)
+ VMOVDQA X14, 176(SP)
+ VMOVDQA X15, 192(SP)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 1, 0, 11, 5, 12, 2, 7, 3)
- VMOVDQA X8, 208(SP)
- VMOVDQA X9, 224(SP)
- VMOVDQA X10, 240(SP)
- VMOVDQA X11, 256(SP)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_1_0_11_5_12_2_7_3()
+ VMOVDQA X12, 208(SP)
+ VMOVDQA X13, 224(SP)
+ VMOVDQA X14, 240(SP)
+ VMOVDQA X15, 256(SP)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 11, 12, 5, 15, 8, 0, 2, 13)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_11_12_5_15_8_0_2_13()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 10, 3, 7, 9, 14, 6, 1, 4)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(10, 3, 7, 9, 14, 6, 1, 4)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 7, 3, 13, 11, 9, 1, 12, 14)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(7, 3, 13, 11, 9, 1, 12, 14)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 2, 5, 4, 15, 6, 10, 0, 8)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_2_5_4_15_6_10_0_8()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 9, 5, 2, 10, 0, 7, 4, 15)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_9_5_2_10_0_7_4_15()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 14, 11, 6, 3, 1, 12, 8, 13)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(14, 11, 6, 3, 1, 12, 8, 13)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 2, 6, 0, 8, 12, 10, 11, 3)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_2_6_0_8_12_10_11_3()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 4, 7, 15, 1, 13, 5, 14, 9)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(4, 7, 15, 1, 13, 5, 14, 9)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 12, 1, 14, 4, 5, 15, 13, 10)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(12, 1, 14, 4, 5, 15, 13, 10)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 0, 6, 9, 8, 7, 3, 2, 11)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_0_6_9_8_7_3_2_11()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 13, 7, 12, 3, 11, 14, 1, 9)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(13, 7, 12, 3, 11, 14, 1, 9)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 5, 15, 8, 2, 0, 4, 6, 10)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_5_15_8_2_0_4_6_10()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 6, 14, 11, 0, 15, 9, 3, 8)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_6_14_11_0_15_9_3_8()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 12, 13, 1, 10, 2, 7, 4, 5)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_12_13_1_10_2_7_4_5()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- LOAD_MSG_AVX(SI, 10, 8, 7, 1, 2, 4, 6, 5)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX(10, 8, 7, 1, 2, 4, 6, 5)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX()
- LOAD_MSG_AVX(SI, 15, 9, 3, 13, 11, 14, 12, 0)
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14)
+ LOAD_MSG_AVX_15_9_3_13_11_14_12_0()
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9)
SHUFFLE_AVX_INV()
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 16(SP), 32(SP), 48(SP), 64(SP), X11, X13, X14)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 16(SP), 32(SP), 48(SP), 64(SP), X15, X8, X9)
SHUFFLE_AVX()
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 80(SP), 96(SP), 112(SP), 128(SP), X11, X13, X14)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 80(SP), 96(SP), 112(SP), 128(SP), X15, X8, X9)
SHUFFLE_AVX_INV()
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 144(SP), 160(SP), 176(SP), 192(SP), X11, X13, X14)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 144(SP), 160(SP), 176(SP), 192(SP), X15, X8, X9)
SHUFFLE_AVX()
- HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 208(SP), 224(SP), 240(SP), 256(SP), X11, X13, X14)
+ HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, 208(SP), 224(SP), 240(SP), 256(SP), X15, X8, X9)
SHUFFLE_AVX_INV()
- VMOVDQU 32(AX), X10
- VMOVDQU 48(AX), X11
- VPXOR X0, X12, X12
- VPXOR X1, X15, X15
- VPXOR X2, X10, X10
- VPXOR X3, X11, X11
- VPXOR X4, X12, X12
- VPXOR X5, X15, X15
- VPXOR X6, X10, X2
- VPXOR X7, X11, X3
+ VMOVDQU 32(AX), X14
+ VMOVDQU 48(AX), X15
+ VPXOR X0, X10, X10
+ VPXOR X1, X11, X11
+ VPXOR X2, X14, X14
+ VPXOR X3, X15, X15
+ VPXOR X4, X10, X10
+ VPXOR X5, X11, X11
+ VPXOR X6, X14, X2
+ VPXOR X7, X15, X3
VMOVDQU X2, 32(AX)
VMOVDQU X3, 48(AX)
@@ -478,12 +739,11 @@ noinc:
SUBQ $128, DI
JNE loop
- VMOVDQU X12, 0(AX)
- VMOVDQU X15, 16(AX)
+ VMOVDQU X10, 0(AX)
+ VMOVDQU X11, 16(AX)
MOVQ R8, 0(BX)
MOVQ R9, 8(BX)
-
VZEROUPPER
MOVQ BP, SP
diff --git a/vendor/golang.org/x/crypto/blake2b/register.go b/vendor/golang.org/x/crypto/blake2b/register.go
new file mode 100644
index 000000000..efd689af4
--- /dev/null
+++ b/vendor/golang.org/x/crypto/blake2b/register.go
@@ -0,0 +1,32 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9
+
+package blake2b
+
+import (
+ "crypto"
+ "hash"
+)
+
+func init() {
+ newHash256 := func() hash.Hash {
+ h, _ := New256(nil)
+ return h
+ }
+ newHash384 := func() hash.Hash {
+ h, _ := New384(nil)
+ return h
+ }
+
+ newHash512 := func() hash.Hash {
+ h, _ := New512(nil)
+ return h
+ }
+
+ crypto.RegisterHash(crypto.BLAKE2b_256, newHash256)
+ crypto.RegisterHash(crypto.BLAKE2b_384, newHash384)
+ crypto.RegisterHash(crypto.BLAKE2b_512, newHash512)
+}
diff --git a/vendor/golang.org/x/crypto/blake2s/register.go b/vendor/golang.org/x/crypto/blake2s/register.go
new file mode 100644
index 000000000..d277459a1
--- /dev/null
+++ b/vendor/golang.org/x/crypto/blake2s/register.go
@@ -0,0 +1,21 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9
+
+package blake2s
+
+import (
+ "crypto"
+ "hash"
+)
+
+func init() {
+ newHash256 := func() hash.Hash {
+ h, _ := New256(nil)
+ return h
+ }
+
+ crypto.RegisterHash(crypto.BLAKE2s_256, newHash256)
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/asn1.go b/vendor/golang.org/x/crypto/cryptobyte/asn1.go
new file mode 100644
index 000000000..166e22d7b
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/asn1.go
@@ -0,0 +1,604 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cryptobyte
+
+import (
+ "encoding/asn1"
+ "fmt"
+ "math/big"
+ "reflect"
+ "time"
+)
+
+// This file contains ASN.1-related methods for String and Builder.
+
+// Tag represents an ASN.1 tag number and class (together also referred to as
+// identifier octets). Methods in this package only support the low-tag-number
+// form, i.e. a single identifier octet with bits 7-8 encoding the class and
+// bits 1-6 encoding the tag number.
+type Tag uint8
+
+// Contructed returns t with the context-specific class bit set.
+func (t Tag) ContextSpecific() Tag { return t | 0x80 }
+
+// Contructed returns t with the constructed class bit set.
+func (t Tag) Constructed() Tag { return t | 0x20 }
+
+// Builder
+
+// AddASN1Int64 appends a DER-encoded ASN.1 INTEGER.
+func (b *Builder) AddASN1Int64(v int64) {
+ b.addASN1Signed(asn1.TagInteger, v)
+}
+
+// AddASN1Enum appends a DER-encoded ASN.1 ENUMERATION.
+func (b *Builder) AddASN1Enum(v int64) {
+ b.addASN1Signed(asn1.TagEnum, v)
+}
+
+func (b *Builder) addASN1Signed(tag Tag, v int64) {
+ b.AddASN1(tag, func(c *Builder) {
+ length := 1
+ for i := v; i >= 0x80 || i < -0x80; i >>= 8 {
+ length++
+ }
+
+ for ; length > 0; length-- {
+ i := v >> uint((length-1)*8) & 0xff
+ c.AddUint8(uint8(i))
+ }
+ })
+}
+
+// AddASN1Uint64 appends a DER-encoded ASN.1 INTEGER.
+func (b *Builder) AddASN1Uint64(v uint64) {
+ b.AddASN1(asn1.TagInteger, func(c *Builder) {
+ length := 1
+ for i := v; i >= 0x80; i >>= 8 {
+ length++
+ }
+
+ for ; length > 0; length-- {
+ i := v >> uint((length-1)*8) & 0xff
+ c.AddUint8(uint8(i))
+ }
+ })
+}
+
+// AddASN1BigInt appends a DER-encoded ASN.1 INTEGER.
+func (b *Builder) AddASN1BigInt(n *big.Int) {
+ if b.err != nil {
+ return
+ }
+
+ b.AddASN1(asn1.TagInteger, func(c *Builder) {
+ if n.Sign() < 0 {
+ // A negative number has to be converted to two's-complement form. So we
+ // invert and subtract 1. If the most-significant-bit isn't set then
+ // we'll need to pad the beginning with 0xff in order to keep the number
+ // negative.
+ nMinus1 := new(big.Int).Neg(n)
+ nMinus1.Sub(nMinus1, bigOne)
+ bytes := nMinus1.Bytes()
+ for i := range bytes {
+ bytes[i] ^= 0xff
+ }
+ if bytes[0]&0x80 == 0 {
+ c.add(0xff)
+ }
+ c.add(bytes...)
+ } else if n.Sign() == 0 {
+ c.add(0)
+ } else {
+ bytes := n.Bytes()
+ if bytes[0]&0x80 != 0 {
+ c.add(0)
+ }
+ c.add(bytes...)
+ }
+ })
+}
+
+// AddASN1OctetString appends a DER-encoded ASN.1 OCTET STRING.
+func (b *Builder) AddASN1OctetString(bytes []byte) {
+ b.AddASN1(asn1.TagOctetString, func(c *Builder) {
+ c.AddBytes(bytes)
+ })
+}
+
+const generalizedTimeFormatStr = "20060102150405Z0700"
+
+// AddASN1GeneralizedTime appends a DER-encoded ASN.1 GENERALIZEDTIME.
+func (b *Builder) AddASN1GeneralizedTime(t time.Time) {
+ if t.Year() < 0 || t.Year() > 9999 {
+ b.err = fmt.Errorf("cryptobyte: cannot represent %v as a GeneralizedTime", t)
+ return
+ }
+ b.AddASN1(asn1.TagGeneralizedTime, func(c *Builder) {
+ c.AddBytes([]byte(t.Format(generalizedTimeFormatStr)))
+ })
+}
+
+// AddASN1BitString appends a DER-encoded ASN.1 BIT STRING.
+func (b *Builder) AddASN1BitString(s asn1.BitString) {
+ // TODO(martinkr): Implement.
+ b.MarshalASN1(s)
+}
+
+// MarshalASN1 calls asn1.Marshal on its input and appends the result if
+// successful or records an error if one occurred.
+func (b *Builder) MarshalASN1(v interface{}) {
+ // NOTE(martinkr): This is somewhat of a hack to allow propagation of
+ // asn1.Marshal errors into Builder.err. N.B. if you call MarshalASN1 with a
+ // value embedded into a struct, its tag information is lost.
+ if b.err != nil {
+ return
+ }
+ bytes, err := asn1.Marshal(v)
+ if err != nil {
+ b.err = err
+ return
+ }
+ b.AddBytes(bytes)
+}
+
+// AddASN1 appends an ASN.1 object. The object is prefixed with the given tag.
+// Tags greater than 30 are not supported and result in an error (i.e.
+// low-tag-number form only). The child builder passed to the
+// BuilderContinuation can be used to build the content of the ASN.1 object.
+func (b *Builder) AddASN1(tag Tag, f BuilderContinuation) {
+ if b.err != nil {
+ return
+ }
+ // Identifiers with the low five bits set indicate high-tag-number format
+ // (two or more octets), which we don't support.
+ if tag&0x1f == 0x1f {
+ b.err = fmt.Errorf("cryptobyte: high-tag number identifier octects not supported: 0x%x", tag)
+ return
+ }
+ b.AddUint8(uint8(tag))
+ b.addLengthPrefixed(1, true, f)
+}
+
+// String
+
+var bigIntType = reflect.TypeOf((*big.Int)(nil)).Elem()
+
+// ReadASN1Integer decodes an ASN.1 INTEGER into out and advances. If out does
+// not point to an integer or to a big.Int, it panics. It returns true on
+// success and false on error.
+func (s *String) ReadASN1Integer(out interface{}) bool {
+ if reflect.TypeOf(out).Kind() != reflect.Ptr {
+ panic("out is not a pointer")
+ }
+ switch reflect.ValueOf(out).Elem().Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ var i int64
+ if !s.readASN1Int64(&i) || reflect.ValueOf(out).Elem().OverflowInt(i) {
+ return false
+ }
+ reflect.ValueOf(out).Elem().SetInt(i)
+ return true
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ var u uint64
+ if !s.readASN1Uint64(&u) || reflect.ValueOf(out).Elem().OverflowUint(u) {
+ return false
+ }
+ reflect.ValueOf(out).Elem().SetUint(u)
+ return true
+ case reflect.Struct:
+ if reflect.TypeOf(out).Elem() == bigIntType {
+ return s.readASN1BigInt(out.(*big.Int))
+ }
+ }
+ panic("out does not point to an integer type")
+}
+
+func checkASN1Integer(bytes []byte) bool {
+ if len(bytes) == 0 {
+ // An INTEGER is encoded with at least one octet.
+ return false
+ }
+ if len(bytes) == 1 {
+ return true
+ }
+ if bytes[0] == 0 && bytes[1]&0x80 == 0 || bytes[0] == 0xff && bytes[1]&0x80 == 0x80 {
+ // Value is not minimally encoded.
+ return false
+ }
+ return true
+}
+
+var bigOne = big.NewInt(1)
+
+func (s *String) readASN1BigInt(out *big.Int) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagInteger) || !checkASN1Integer(bytes) {
+ return false
+ }
+ if bytes[0]&0x80 == 0x80 {
+ // Negative number.
+ neg := make([]byte, len(bytes))
+ for i, b := range bytes {
+ neg[i] = ^b
+ }
+ out.SetBytes(neg)
+ out.Add(out, bigOne)
+ out.Neg(out)
+ } else {
+ out.SetBytes(bytes)
+ }
+ return true
+}
+
+func (s *String) readASN1Int64(out *int64) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagInteger) || !checkASN1Integer(bytes) || !asn1Signed(out, bytes) {
+ return false
+ }
+ return true
+}
+
+func asn1Signed(out *int64, n []byte) bool {
+ length := len(n)
+ if length > 8 {
+ return false
+ }
+ for i := 0; i < length; i++ {
+ *out <<= 8
+ *out |= int64(n[i])
+ }
+ // Shift up and down in order to sign extend the result.
+ *out <<= 64 - uint8(length)*8
+ *out >>= 64 - uint8(length)*8
+ return true
+}
+
+func (s *String) readASN1Uint64(out *uint64) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagInteger) || !checkASN1Integer(bytes) || !asn1Unsigned(out, bytes) {
+ return false
+ }
+ return true
+}
+
+func asn1Unsigned(out *uint64, n []byte) bool {
+ length := len(n)
+ if length > 9 || length == 9 && n[0] != 0 {
+ // Too large for uint64.
+ return false
+ }
+ if n[0]&0x80 != 0 {
+ // Negative number.
+ return false
+ }
+ for i := 0; i < length; i++ {
+ *out <<= 8
+ *out |= uint64(n[i])
+ }
+ return true
+}
+
+// ReadASN1Enum decodes an ASN.1 ENUMERATION into out and advances. It returns
+// true on success and false on error.
+func (s *String) ReadASN1Enum(out *int) bool {
+ var bytes String
+ var i int64
+ if !s.ReadASN1(&bytes, asn1.TagEnum) || !checkASN1Integer(bytes) || !asn1Signed(&i, bytes) {
+ return false
+ }
+ if int64(int(i)) != i {
+ return false
+ }
+ *out = int(i)
+ return true
+}
+
+func (s *String) readBase128Int(out *int) bool {
+ ret := 0
+ for i := 0; len(*s) > 0; i++ {
+ if i == 4 {
+ return false
+ }
+ ret <<= 7
+ b := s.read(1)[0]
+ ret |= int(b & 0x7f)
+ if b&0x80 == 0 {
+ *out = ret
+ return true
+ }
+ }
+ return false // truncated
+}
+
+// ReadASN1ObjectIdentifier decodes an ASN.1 OBJECT IDENTIFIER into out and
+// advances. It returns true on success and false on error.
+func (s *String) ReadASN1ObjectIdentifier(out *asn1.ObjectIdentifier) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagOID) || len(bytes) == 0 {
+ return false
+ }
+
+ // In the worst case, we get two elements from the first byte (which is
+ // encoded differently) and then every varint is a single byte long.
+ components := make([]int, len(bytes)+1)
+
+ // The first varint is 40*value1 + value2:
+ // According to this packing, value1 can take the values 0, 1 and 2 only.
+ // When value1 = 0 or value1 = 1, then value2 is <= 39. When value1 = 2,
+ // then there are no restrictions on value2.
+ var v int
+ if !bytes.readBase128Int(&v) {
+ return false
+ }
+ if v < 80 {
+ components[0] = v / 40
+ components[1] = v % 40
+ } else {
+ components[0] = 2
+ components[1] = v - 80
+ }
+
+ i := 2
+ for ; len(bytes) > 0; i++ {
+ if !bytes.readBase128Int(&v) {
+ return false
+ }
+ components[i] = v
+ }
+ *out = components[:i]
+ return true
+}
+
+// ReadASN1GeneralizedTime decodes an ASN.1 GENERALIZEDTIME into out and
+// advances. It returns true on success and false on error.
+func (s *String) ReadASN1GeneralizedTime(out *time.Time) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagGeneralizedTime) {
+ return false
+ }
+ t := string(bytes)
+ res, err := time.Parse(generalizedTimeFormatStr, t)
+ if err != nil {
+ return false
+ }
+ if serialized := res.Format(generalizedTimeFormatStr); serialized != t {
+ return false
+ }
+ *out = res
+ return true
+}
+
+// ReadASN1BitString decodes an ASN.1 BIT STRING into out and advances. It
+// returns true on success and false on error.
+func (s *String) ReadASN1BitString(out *asn1.BitString) bool {
+ var bytes String
+ if !s.ReadASN1(&bytes, asn1.TagBitString) || len(bytes) == 0 {
+ return false
+ }
+
+ paddingBits := uint8(bytes[0])
+ bytes = bytes[1:]
+ if paddingBits > 7 ||
+ len(bytes) == 0 && paddingBits != 0 ||
+ len(bytes) > 0 && bytes[len(bytes)-1]&(1<<paddingBits-1) != 0 {
+ return false
+ }
+
+ out.BitLength = len(bytes)*8 - int(paddingBits)
+ out.Bytes = bytes
+ return true
+}
+
+// ReadASN1Bytes reads the contents of a DER-encoded ASN.1 element (not including
+// tag and length bytes) into out, and advances. The element must match the
+// given tag. It returns true on success and false on error.
+func (s *String) ReadASN1Bytes(out *[]byte, tag Tag) bool {
+ return s.ReadASN1((*String)(out), tag)
+}
+
+// ReadASN1 reads the contents of a DER-encoded ASN.1 element (not including
+// tag and length bytes) into out, and advances. The element must match the
+// given tag. It returns true on success and false on error.
+//
+// Tags greater than 30 are not supported (i.e. low-tag-number format only).
+func (s *String) ReadASN1(out *String, tag Tag) bool {
+ var t Tag
+ if !s.ReadAnyASN1(out, &t) || t != tag {
+ return false
+ }
+ return true
+}
+
+// ReadASN1Element reads the contents of a DER-encoded ASN.1 element (including
+// tag and length bytes) into out, and advances. The element must match the
+// given tag. It returns true on success and false on error.
+//
+// Tags greater than 30 are not supported (i.e. low-tag-number format only).
+func (s *String) ReadASN1Element(out *String, tag Tag) bool {
+ var t Tag
+ if !s.ReadAnyASN1Element(out, &t) || t != tag {
+ return false
+ }
+ return true
+}
+
+// ReadAnyASN1 reads the contents of a DER-encoded ASN.1 element (not including
+// tag and length bytes) into out, sets outTag to its tag, and advances. It
+// returns true on success and false on error.
+//
+// Tags greater than 30 are not supported (i.e. low-tag-number format only).
+func (s *String) ReadAnyASN1(out *String, outTag *Tag) bool {
+ return s.readASN1(out, outTag, true /* skip header */)
+}
+
+// ReadAnyASN1Element reads the contents of a DER-encoded ASN.1 element
+// (including tag and length bytes) into out, sets outTag to is tag, and
+// advances. It returns true on success and false on error.
+//
+// Tags greater than 30 are not supported (i.e. low-tag-number format only).
+func (s *String) ReadAnyASN1Element(out *String, outTag *Tag) bool {
+ return s.readASN1(out, outTag, false /* include header */)
+}
+
+// PeekASN1Tag returns true if the next ASN.1 value on the string starts with
+// the given tag.
+func (s String) PeekASN1Tag(tag Tag) bool {
+ if len(s) == 0 {
+ return false
+ }
+ return Tag(s[0]) == tag
+}
+
+// ReadOptionalASN1 attempts to read the contents of a DER-encoded ASN.Element
+// (not including tag and length bytes) tagged with the given tag into out. It
+// stores whether an element with the tag was found in outPresent, unless
+// outPresent is nil. It returns true on success and false on error.
+func (s *String) ReadOptionalASN1(out *String, outPresent *bool, tag Tag) bool {
+ present := s.PeekASN1Tag(tag)
+ if outPresent != nil {
+ *outPresent = present
+ }
+ if present && !s.ReadASN1(out, tag) {
+ return false
+ }
+ return true
+}
+
+// ReadOptionalASN1Integer attempts to read an optional ASN.1 INTEGER
+// explicitly tagged with tag into out and advances. If no element with a
+// matching tag is present, it writes defaultValue into out instead. If out
+// does not point to an integer or to a big.Int, it panics. It returns true on
+// success and false on error.
+func (s *String) ReadOptionalASN1Integer(out interface{}, tag Tag, defaultValue interface{}) bool {
+ if reflect.TypeOf(out).Kind() != reflect.Ptr {
+ panic("out is not a pointer")
+ }
+ var present bool
+ var i String
+ if !s.ReadOptionalASN1(&i, &present, tag) {
+ return false
+ }
+ if !present {
+ switch reflect.ValueOf(out).Elem().Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ reflect.ValueOf(out).Elem().Set(reflect.ValueOf(defaultValue))
+ case reflect.Struct:
+ if reflect.TypeOf(out).Elem() != bigIntType {
+ panic("invalid integer type")
+ }
+ if reflect.TypeOf(defaultValue).Kind() != reflect.Ptr ||
+ reflect.TypeOf(defaultValue).Elem() != bigIntType {
+ panic("out points to big.Int, but defaultValue does not")
+ }
+ out.(*big.Int).Set(defaultValue.(*big.Int))
+ default:
+ panic("invalid integer type")
+ }
+ return true
+ }
+ if !i.ReadASN1Integer(out) || !i.Empty() {
+ return false
+ }
+ return true
+}
+
+// ReadOptionalASN1OctetString attempts to read an optional ASN.1 OCTET STRING
+// explicitly tagged with tag into out and advances. If no element with a
+// matching tag is present, it writes defaultValue into out instead. It returns
+// true on success and false on error.
+func (s *String) ReadOptionalASN1OctetString(out *[]byte, outPresent *bool, tag Tag) bool {
+ var present bool
+ var child String
+ if !s.ReadOptionalASN1(&child, &present, tag) {
+ return false
+ }
+ if outPresent != nil {
+ *outPresent = present
+ }
+ if present {
+ var oct String
+ if !child.ReadASN1(&oct, asn1.TagOctetString) || !child.Empty() {
+ return false
+ }
+ *out = oct
+ } else {
+ *out = nil
+ }
+ return true
+}
+
+func (s *String) readASN1(out *String, outTag *Tag, skipHeader bool) bool {
+ if len(*s) < 2 {
+ return false
+ }
+ tag, lenByte := (*s)[0], (*s)[1]
+
+ if tag&0x1f == 0x1f {
+ // ITU-T X.690 section 8.1.2
+ //
+ // An identifier octet with a tag part of 0x1f indicates a high-tag-number
+ // form identifier with two or more octets. We only support tags less than
+ // 31 (i.e. low-tag-number form, single octet identifier).
+ return false
+ }
+
+ if outTag != nil {
+ *outTag = Tag(tag)
+ }
+
+ // ITU-T X.690 section 8.1.3
+ //
+ // Bit 8 of the first length byte indicates whether the length is short- or
+ // long-form.
+ var length, headerLen uint32 // length includes headerLen
+ if lenByte&0x80 == 0 {
+ // Short-form length (section 8.1.3.4), encoded in bits 1-7.
+ length = uint32(lenByte) + 2
+ headerLen = 2
+ } else {
+ // Long-form length (section 8.1.3.5). Bits 1-7 encode the number of octets
+ // used to encode the length.
+ lenLen := lenByte & 0x7f
+ var len32 uint32
+
+ if lenLen == 0 || lenLen > 4 || len(*s) < int(2+lenLen) {
+ return false
+ }
+
+ lenBytes := String((*s)[2 : 2+lenLen])
+ if !lenBytes.readUnsigned(&len32, int(lenLen)) {
+ return false
+ }
+
+ // ITU-T X.690 section 10.1 (DER length forms) requires encoding the length
+ // with the minimum number of octets.
+ if len32 < 128 {
+ // Length should have used short-form encoding.
+ return false
+ }
+ if len32>>((lenLen-1)*8) == 0 {
+ // Leading octet is 0. Length should have been at least one byte shorter.
+ return false
+ }
+
+ headerLen = 2 + uint32(lenLen)
+ if headerLen+len32 < len32 {
+ // Overflow.
+ return false
+ }
+ length = headerLen + len32
+ }
+
+ if uint32(int(length)) != length || !s.ReadBytes((*[]byte)(out), int(length)) {
+ return false
+ }
+ if skipHeader && !out.Skip(int(headerLen)) {
+ panic("cryptobyte: internal error")
+ }
+
+ return true
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/asn1_test.go b/vendor/golang.org/x/crypto/cryptobyte/asn1_test.go
new file mode 100644
index 000000000..c8c187032
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/asn1_test.go
@@ -0,0 +1,285 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cryptobyte
+
+import (
+ "bytes"
+ "encoding/asn1"
+ "math/big"
+ "reflect"
+ "testing"
+ "time"
+)
+
+type readASN1Test struct {
+ name string
+ in []byte
+ tag Tag
+ ok bool
+ out interface{}
+}
+
+var readASN1TestData = []readASN1Test{
+ {"valid", []byte{0x30, 2, 1, 2}, 0x30, true, []byte{1, 2}},
+ {"truncated", []byte{0x30, 3, 1, 2}, 0x30, false, nil},
+ {"zero length of length", []byte{0x30, 0x80}, 0x30, false, nil},
+ {"invalid long form length", []byte{0x30, 0x81, 1, 1}, 0x30, false, nil},
+ {"non-minimal length", append([]byte{0x30, 0x82, 0, 0x80}, make([]byte, 0x80)...), 0x30, false, nil},
+ {"invalid tag", []byte{0xa1, 3, 0x4, 1, 1}, 31, false, nil},
+ {"high tag", []byte{0x1f, 0x81, 0x80, 0x01, 2, 1, 2}, 0xff /* actually 0x4001, but tag is uint8 */, false, nil},
+}
+
+func TestReadASN1(t *testing.T) {
+ for _, test := range readASN1TestData {
+ t.Run(test.name, func(t *testing.T) {
+ var in, out String = test.in, nil
+ ok := in.ReadASN1(&out, test.tag)
+ if ok != test.ok || ok && !bytes.Equal(out, test.out.([]byte)) {
+ t.Errorf("in.ReadASN1() = %v, want %v; out = %v, want %v", ok, test.ok, out, test.out)
+ }
+ })
+ }
+}
+
+func TestReadASN1Optional(t *testing.T) {
+ var empty String
+ var present bool
+ ok := empty.ReadOptionalASN1(nil, &present, 0xa0)
+ if !ok || present {
+ t.Errorf("empty.ReadOptionalASN1() = %v, want true; present = %v want false", ok, present)
+ }
+
+ var in, out String = []byte{0xa1, 3, 0x4, 1, 1}, nil
+ ok = in.ReadOptionalASN1(&out, &present, 0xa0)
+ if !ok || present {
+ t.Errorf("in.ReadOptionalASN1() = %v, want true, present = %v, want false", ok, present)
+ }
+ ok = in.ReadOptionalASN1(&out, &present, 0xa1)
+ wantBytes := []byte{4, 1, 1}
+ if !ok || !present || !bytes.Equal(out, wantBytes) {
+ t.Errorf("in.ReadOptionalASN1() = %v, want true; present = %v, want true; out = %v, want = %v", ok, present, out, wantBytes)
+ }
+}
+
+var optionalOctetStringTestData = []struct {
+ readASN1Test
+ present bool
+}{
+ {readASN1Test{"empty", []byte{}, 0xa0, true, []byte{}}, false},
+ {readASN1Test{"invalid", []byte{0xa1, 3, 0x4, 2, 1}, 0xa1, false, []byte{}}, true},
+ {readASN1Test{"missing", []byte{0xa1, 3, 0x4, 1, 1}, 0xa0, true, []byte{}}, false},
+ {readASN1Test{"present", []byte{0xa1, 3, 0x4, 1, 1}, 0xa1, true, []byte{1}}, true},
+}
+
+func TestReadASN1OptionalOctetString(t *testing.T) {
+ for _, test := range optionalOctetStringTestData {
+ t.Run(test.name, func(t *testing.T) {
+ in := String(test.in)
+ var out []byte
+ var present bool
+ ok := in.ReadOptionalASN1OctetString(&out, &present, test.tag)
+ if ok != test.ok || present != test.present || !bytes.Equal(out, test.out.([]byte)) {
+ t.Errorf("in.ReadOptionalASN1OctetString() = %v, want %v; present = %v want %v; out = %v, want %v", ok, test.ok, present, test.present, out, test.out)
+ }
+ })
+ }
+}
+
+const defaultInt = -1
+
+var optionalIntTestData = []readASN1Test{
+ {"empty", []byte{}, 0xa0, true, defaultInt},
+ {"invalid", []byte{0xa1, 3, 0x2, 2, 127}, 0xa1, false, 0},
+ {"missing", []byte{0xa1, 3, 0x2, 1, 127}, 0xa0, true, defaultInt},
+ {"present", []byte{0xa1, 3, 0x2, 1, 42}, 0xa1, true, 42},
+}
+
+func TestReadASN1OptionalInteger(t *testing.T) {
+ for _, test := range optionalIntTestData {
+ t.Run(test.name, func(t *testing.T) {
+ in := String(test.in)
+ var out int
+ ok := in.ReadOptionalASN1Integer(&out, test.tag, defaultInt)
+ if ok != test.ok || ok && out != test.out.(int) {
+ t.Errorf("in.ReadOptionalASN1Integer() = %v, want %v; out = %v, want %v", ok, test.ok, out, test.out)
+ }
+ })
+ }
+}
+
+func TestReadASN1IntegerSigned(t *testing.T) {
+ testData64 := []struct {
+ in []byte
+ out int64
+ }{
+ {[]byte{2, 3, 128, 0, 0}, -0x800000},
+ {[]byte{2, 2, 255, 0}, -256},
+ {[]byte{2, 2, 255, 127}, -129},
+ {[]byte{2, 1, 128}, -128},
+ {[]byte{2, 1, 255}, -1},
+ {[]byte{2, 1, 0}, 0},
+ {[]byte{2, 1, 1}, 1},
+ {[]byte{2, 1, 2}, 2},
+ {[]byte{2, 1, 127}, 127},
+ {[]byte{2, 2, 0, 128}, 128},
+ {[]byte{2, 2, 1, 0}, 256},
+ {[]byte{2, 4, 0, 128, 0, 0}, 0x800000},
+ }
+ for i, test := range testData64 {
+ in := String(test.in)
+ var out int64
+ ok := in.ReadASN1Integer(&out)
+ if !ok || out != test.out {
+ t.Errorf("#%d: in.ReadASN1Integer() = %v, want true; out = %d, want %d", i, ok, out, test.out)
+ }
+ }
+
+ // Repeat the same cases, reading into a big.Int.
+ t.Run("big.Int", func(t *testing.T) {
+ for i, test := range testData64 {
+ in := String(test.in)
+ var out big.Int
+ ok := in.ReadASN1Integer(&out)
+ if !ok || out.Int64() != test.out {
+ t.Errorf("#%d: in.ReadASN1Integer() = %v, want true; out = %d, want %d", i, ok, out.Int64(), test.out)
+ }
+ }
+ })
+}
+
+func TestReadASN1IntegerUnsigned(t *testing.T) {
+ testData := []struct {
+ in []byte
+ out uint64
+ }{
+ {[]byte{2, 1, 0}, 0},
+ {[]byte{2, 1, 1}, 1},
+ {[]byte{2, 1, 2}, 2},
+ {[]byte{2, 1, 127}, 127},
+ {[]byte{2, 2, 0, 128}, 128},
+ {[]byte{2, 2, 1, 0}, 256},
+ {[]byte{2, 4, 0, 128, 0, 0}, 0x800000},
+ {[]byte{2, 8, 127, 255, 255, 255, 255, 255, 255, 255}, 0x7fffffffffffffff},
+ {[]byte{2, 9, 0, 128, 0, 0, 0, 0, 0, 0, 0}, 0x8000000000000000},
+ {[]byte{2, 9, 0, 255, 255, 255, 255, 255, 255, 255, 255}, 0xffffffffffffffff},
+ }
+ for i, test := range testData {
+ in := String(test.in)
+ var out uint64
+ ok := in.ReadASN1Integer(&out)
+ if !ok || out != test.out {
+ t.Errorf("#%d: in.ReadASN1Integer() = %v, want true; out = %d, want %d", i, ok, out, test.out)
+ }
+ }
+}
+
+func TestReadASN1IntegerInvalid(t *testing.T) {
+ testData := []String{
+ []byte{3, 1, 0}, // invalid tag
+ // truncated
+ []byte{2, 1},
+ []byte{2, 2, 0},
+ // not minimally encoded
+ []byte{2, 2, 0, 1},
+ []byte{2, 2, 0xff, 0xff},
+ }
+
+ for i, test := range testData {
+ var out int64
+ if test.ReadASN1Integer(&out) {
+ t.Errorf("#%d: in.ReadASN1Integer() = true, want false (out = %d)", i, out)
+ }
+ }
+}
+
+func TestReadASN1ObjectIdentifier(t *testing.T) {
+ testData := []struct {
+ in []byte
+ ok bool
+ out []int
+ }{
+ {[]byte{}, false, []int{}},
+ {[]byte{6, 0}, false, []int{}},
+ {[]byte{5, 1, 85}, false, []int{2, 5}},
+ {[]byte{6, 1, 85}, true, []int{2, 5}},
+ {[]byte{6, 2, 85, 0x02}, true, []int{2, 5, 2}},
+ {[]byte{6, 4, 85, 0x02, 0xc0, 0x00}, true, []int{2, 5, 2, 0x2000}},
+ {[]byte{6, 3, 0x81, 0x34, 0x03}, true, []int{2, 100, 3}},
+ {[]byte{6, 7, 85, 0x02, 0xc0, 0x80, 0x80, 0x80, 0x80}, false, []int{}},
+ }
+
+ for i, test := range testData {
+ in := String(test.in)
+ var out asn1.ObjectIdentifier
+ ok := in.ReadASN1ObjectIdentifier(&out)
+ if ok != test.ok || ok && !out.Equal(test.out) {
+ t.Errorf("#%d: in.ReadASN1ObjectIdentifier() = %v, want %v; out = %v, want %v", i, ok, test.ok, out, test.out)
+ }
+ }
+}
+
+func TestReadASN1GeneralizedTime(t *testing.T) {
+ testData := []struct {
+ in string
+ ok bool
+ out time.Time
+ }{
+ {"20100102030405Z", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.UTC)},
+ {"20100102030405", false, time.Time{}},
+ {"20100102030405+0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", 6*60*60+7*60))},
+ {"20100102030405-0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", -6*60*60-7*60))},
+ /* These are invalid times. However, the time package normalises times
+ * and they were accepted in some versions. See #11134. */
+ {"00000100000000Z", false, time.Time{}},
+ {"20101302030405Z", false, time.Time{}},
+ {"20100002030405Z", false, time.Time{}},
+ {"20100100030405Z", false, time.Time{}},
+ {"20100132030405Z", false, time.Time{}},
+ {"20100231030405Z", false, time.Time{}},
+ {"20100102240405Z", false, time.Time{}},
+ {"20100102036005Z", false, time.Time{}},
+ {"20100102030460Z", false, time.Time{}},
+ {"-20100102030410Z", false, time.Time{}},
+ {"2010-0102030410Z", false, time.Time{}},
+ {"2010-0002030410Z", false, time.Time{}},
+ {"201001-02030410Z", false, time.Time{}},
+ {"20100102-030410Z", false, time.Time{}},
+ {"2010010203-0410Z", false, time.Time{}},
+ {"201001020304-10Z", false, time.Time{}},
+ }
+ for i, test := range testData {
+ in := String(append([]byte{asn1.TagGeneralizedTime, byte(len(test.in))}, test.in...))
+ var out time.Time
+ ok := in.ReadASN1GeneralizedTime(&out)
+ if ok != test.ok || ok && !reflect.DeepEqual(out, test.out) {
+ t.Errorf("#%d: in.ReadASN1GeneralizedTime() = %v, want %v; out = %q, want %q", i, ok, test.ok, out, test.out)
+ }
+ }
+}
+
+func TestReadASN1BitString(t *testing.T) {
+ testData := []struct {
+ in []byte
+ ok bool
+ out asn1.BitString
+ }{
+ {[]byte{}, false, asn1.BitString{}},
+ {[]byte{0x00}, true, asn1.BitString{}},
+ {[]byte{0x07, 0x00}, true, asn1.BitString{Bytes: []byte{0}, BitLength: 1}},
+ {[]byte{0x07, 0x01}, false, asn1.BitString{}},
+ {[]byte{0x07, 0x40}, false, asn1.BitString{}},
+ {[]byte{0x08, 0x00}, false, asn1.BitString{}},
+ {[]byte{0xff}, false, asn1.BitString{}},
+ {[]byte{0xfe, 0x00}, false, asn1.BitString{}},
+ }
+ for i, test := range testData {
+ in := String(append([]byte{3, byte(len(test.in))}, test.in...))
+ var out asn1.BitString
+ ok := in.ReadASN1BitString(&out)
+ if ok != test.ok || ok && (!bytes.Equal(out.Bytes, test.out.Bytes) || out.BitLength != test.out.BitLength) {
+ t.Errorf("#%d: in.ReadASN1BitString() = %v, want %v; out = %v, want %v", i, ok, test.ok, out, test.out)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/builder.go b/vendor/golang.org/x/crypto/cryptobyte/builder.go
new file mode 100644
index 000000000..9883fb3c3
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/builder.go
@@ -0,0 +1,255 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cryptobyte
+
+import (
+ "errors"
+ "fmt"
+)
+
+// A Builder builds byte strings from fixed-length and length-prefixed values.
+// The zero value is a usable Builder that allocates space as needed.
+type Builder struct {
+ err error
+ result []byte
+ fixedSize bool
+ child *Builder
+ offset int
+ pendingLenLen int
+ pendingIsASN1 bool
+}
+
+// NewBuilder creates a Builder that appends its output to the given buffer.
+// Like append(), the slice will be reallocated if its capacity is exceeded.
+// Use Bytes to get the final buffer.
+func NewBuilder(buffer []byte) *Builder {
+ return &Builder{
+ result: buffer,
+ }
+}
+
+// NewFixedBuilder creates a Builder that appends its output into the given
+// buffer. This builder does not reallocate the output buffer. Writes that
+// would exceed the buffer's capacity are treated as an error.
+func NewFixedBuilder(buffer []byte) *Builder {
+ return &Builder{
+ result: buffer,
+ fixedSize: true,
+ }
+}
+
+// Bytes returns the bytes written by the builder or an error if one has
+// occurred during during building.
+func (b *Builder) Bytes() ([]byte, error) {
+ if b.err != nil {
+ return nil, b.err
+ }
+ return b.result[b.offset:], nil
+}
+
+// BytesOrPanic returns the bytes written by the builder or panics if an error
+// has occurred during building.
+func (b *Builder) BytesOrPanic() []byte {
+ if b.err != nil {
+ panic(b.err)
+ }
+ return b.result[b.offset:]
+}
+
+// AddUint8 appends an 8-bit value to the byte string.
+func (b *Builder) AddUint8(v uint8) {
+ b.add(byte(v))
+}
+
+// AddUint16 appends a big-endian, 16-bit value to the byte string.
+func (b *Builder) AddUint16(v uint16) {
+ b.add(byte(v>>8), byte(v))
+}
+
+// AddUint24 appends a big-endian, 24-bit value to the byte string. The highest
+// byte of the 32-bit input value is silently truncated.
+func (b *Builder) AddUint24(v uint32) {
+ b.add(byte(v>>16), byte(v>>8), byte(v))
+}
+
+// AddUint32 appends a big-endian, 32-bit value to the byte string.
+func (b *Builder) AddUint32(v uint32) {
+ b.add(byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
+}
+
+// AddBytes appends a sequence of bytes to the byte string.
+func (b *Builder) AddBytes(v []byte) {
+ b.add(v...)
+}
+
+// BuilderContinuation is continuation-passing interface for building
+// length-prefixed byte sequences. Builder methods for length-prefixed
+// sequences (AddUint8LengthPrefixed etc.) will invoke the BuilderContinuation
+// supplied to them. The child builder passed to the continuation can be used
+// to build the content of the length-prefixed sequence. Example:
+//
+// parent := cryptobyte.NewBuilder()
+// parent.AddUint8LengthPrefixed(func (child *Builder) {
+// child.AddUint8(42)
+// child.AddUint8LengthPrefixed(func (grandchild *Builder) {
+// grandchild.AddUint8(5)
+// })
+// })
+//
+// It is an error to write more bytes to the child than allowed by the reserved
+// length prefix. After the continuation returns, the child must be considered
+// invalid, i.e. users must not store any copies or references of the child
+// that outlive the continuation.
+type BuilderContinuation func(child *Builder)
+
+// AddUint8LengthPrefixed adds a 8-bit length-prefixed byte sequence.
+func (b *Builder) AddUint8LengthPrefixed(f BuilderContinuation) {
+ b.addLengthPrefixed(1, false, f)
+}
+
+// AddUint16LengthPrefixed adds a big-endian, 16-bit length-prefixed byte sequence.
+func (b *Builder) AddUint16LengthPrefixed(f BuilderContinuation) {
+ b.addLengthPrefixed(2, false, f)
+}
+
+// AddUint24LengthPrefixed adds a big-endian, 24-bit length-prefixed byte sequence.
+func (b *Builder) AddUint24LengthPrefixed(f BuilderContinuation) {
+ b.addLengthPrefixed(3, false, f)
+}
+
+func (b *Builder) addLengthPrefixed(lenLen int, isASN1 bool, f BuilderContinuation) {
+ // Subsequent writes can be ignored if the builder has encountered an error.
+ if b.err != nil {
+ return
+ }
+
+ offset := len(b.result)
+ b.add(make([]byte, lenLen)...)
+
+ b.child = &Builder{
+ result: b.result,
+ fixedSize: b.fixedSize,
+ offset: offset,
+ pendingLenLen: lenLen,
+ pendingIsASN1: isASN1,
+ }
+
+ f(b.child)
+ b.flushChild()
+ if b.child != nil {
+ panic("cryptobyte: internal error")
+ }
+}
+
+func (b *Builder) flushChild() {
+ if b.child == nil {
+ return
+ }
+ b.child.flushChild()
+ child := b.child
+ b.child = nil
+
+ if child.err != nil {
+ b.err = child.err
+ return
+ }
+
+ length := len(child.result) - child.pendingLenLen - child.offset
+
+ if length < 0 {
+ panic("cryptobyte: internal error") // result unexpectedly shrunk
+ }
+
+ if child.pendingIsASN1 {
+ // For ASN.1, we reserved a single byte for the length. If that turned out
+ // to be incorrect, we have to move the contents along in order to make
+ // space.
+ if child.pendingLenLen != 1 {
+ panic("cryptobyte: internal error")
+ }
+ var lenLen, lenByte uint8
+ if int64(length) > 0xfffffffe {
+ b.err = errors.New("pending ASN.1 child too long")
+ return
+ } else if length > 0xffffff {
+ lenLen = 5
+ lenByte = 0x80 | 4
+ } else if length > 0xffff {
+ lenLen = 4
+ lenByte = 0x80 | 3
+ } else if length > 0xff {
+ lenLen = 3
+ lenByte = 0x80 | 2
+ } else if length > 0x7f {
+ lenLen = 2
+ lenByte = 0x80 | 1
+ } else {
+ lenLen = 1
+ lenByte = uint8(length)
+ length = 0
+ }
+
+ // Insert the initial length byte, make space for successive length bytes,
+ // and adjust the offset.
+ child.result[child.offset] = lenByte
+ extraBytes := int(lenLen - 1)
+ if extraBytes != 0 {
+ child.add(make([]byte, extraBytes)...)
+ childStart := child.offset + child.pendingLenLen
+ copy(child.result[childStart+extraBytes:], child.result[childStart:])
+ }
+ child.offset++
+ child.pendingLenLen = extraBytes
+ }
+
+ l := length
+ for i := child.pendingLenLen - 1; i >= 0; i-- {
+ child.result[child.offset+i] = uint8(l)
+ l >>= 8
+ }
+ if l != 0 {
+ b.err = fmt.Errorf("cryptobyte: pending child length %d exceeds %d-byte length prefix", length, child.pendingLenLen)
+ return
+ }
+
+ if !b.fixedSize {
+ b.result = child.result // In case child reallocated result.
+ }
+}
+
+func (b *Builder) add(bytes ...byte) {
+ if b.err != nil {
+ return
+ }
+ if b.child != nil {
+ panic("attempted write while child is pending")
+ }
+ if len(b.result)+len(bytes) < len(bytes) {
+ b.err = errors.New("cryptobyte: length overflow")
+ }
+ if b.fixedSize && len(b.result)+len(bytes) > cap(b.result) {
+ b.err = errors.New("cryptobyte: Builder is exceeding its fixed-size buffer")
+ return
+ }
+ b.result = append(b.result, bytes...)
+}
+
+// A MarshalingValue marshals itself into a Builder.
+type MarshalingValue interface {
+ // Marshal is called by Builder.AddValue. It receives a pointer to a builder
+ // to marshal itself into. It may return an error that occurred during
+ // marshaling, such as unset or invalid values.
+ Marshal(b *Builder) error
+}
+
+// AddValue calls Marshal on v, passing a pointer to the builder to append to.
+// If Marshal returns an error, it is set on the Builder so that subsequent
+// appends don't have an effect.
+func (b *Builder) AddValue(v MarshalingValue) {
+ err := v.Marshal(b)
+ if err != nil {
+ b.err = err
+ }
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/cryptobyte_test.go b/vendor/golang.org/x/crypto/cryptobyte/cryptobyte_test.go
new file mode 100644
index 000000000..49c61dca4
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/cryptobyte_test.go
@@ -0,0 +1,379 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cryptobyte
+
+import (
+ "bytes"
+ "fmt"
+ "testing"
+)
+
+func builderBytesEq(b *Builder, want ...byte) error {
+ got := b.BytesOrPanic()
+ if !bytes.Equal(got, want) {
+ return fmt.Errorf("Bytes() = %v, want %v", got, want)
+ }
+ return nil
+}
+
+func TestBytes(t *testing.T) {
+ var b Builder
+ v := []byte("foobarbaz")
+ b.AddBytes(v[0:3])
+ b.AddBytes(v[3:4])
+ b.AddBytes(v[4:9])
+ if err := builderBytesEq(&b, v...); err != nil {
+ t.Error(err)
+ }
+ s := String(b.BytesOrPanic())
+ for _, w := range []string{"foo", "bar", "baz"} {
+ var got []byte
+ if !s.ReadBytes(&got, 3) {
+ t.Errorf("ReadBytes() = false, want true (w = %v)", w)
+ }
+ want := []byte(w)
+ if !bytes.Equal(got, want) {
+ t.Errorf("ReadBytes(): got = %v, want %v", got, want)
+ }
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUint8(t *testing.T) {
+ var b Builder
+ b.AddUint8(42)
+ if err := builderBytesEq(&b, 42); err != nil {
+ t.Error(err)
+ }
+
+ var s String = b.BytesOrPanic()
+ var v uint8
+ if !s.ReadUint8(&v) {
+ t.Error("ReadUint8() = false, want true")
+ }
+ if v != 42 {
+ t.Errorf("v = %d, want 42", v)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUint16(t *testing.T) {
+ var b Builder
+ b.AddUint16(65534)
+ if err := builderBytesEq(&b, 255, 254); err != nil {
+ t.Error(err)
+ }
+ var s String = b.BytesOrPanic()
+ var v uint16
+ if !s.ReadUint16(&v) {
+ t.Error("ReadUint16() == false, want true")
+ }
+ if v != 65534 {
+ t.Errorf("v = %d, want 65534", v)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUint24(t *testing.T) {
+ var b Builder
+ b.AddUint24(0xfffefd)
+ if err := builderBytesEq(&b, 255, 254, 253); err != nil {
+ t.Error(err)
+ }
+
+ var s String = b.BytesOrPanic()
+ var v uint32
+ if !s.ReadUint24(&v) {
+ t.Error("ReadUint8() = false, want true")
+ }
+ if v != 0xfffefd {
+ t.Errorf("v = %d, want fffefd", v)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUint24Truncation(t *testing.T) {
+ var b Builder
+ b.AddUint24(0x10111213)
+ if err := builderBytesEq(&b, 0x11, 0x12, 0x13); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestUint32(t *testing.T) {
+ var b Builder
+ b.AddUint32(0xfffefdfc)
+ if err := builderBytesEq(&b, 255, 254, 253, 252); err != nil {
+ t.Error(err)
+ }
+
+ var s String = b.BytesOrPanic()
+ var v uint32
+ if !s.ReadUint32(&v) {
+ t.Error("ReadUint8() = false, want true")
+ }
+ if v != 0xfffefdfc {
+ t.Errorf("v = %x, want fffefdfc", v)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUMultiple(t *testing.T) {
+ var b Builder
+ b.AddUint8(23)
+ b.AddUint32(0xfffefdfc)
+ b.AddUint16(42)
+ if err := builderBytesEq(&b, 23, 255, 254, 253, 252, 0, 42); err != nil {
+ t.Error(err)
+ }
+
+ var s String = b.BytesOrPanic()
+ var (
+ x uint8
+ y uint32
+ z uint16
+ )
+ if !s.ReadUint8(&x) || !s.ReadUint32(&y) || !s.ReadUint16(&z) {
+ t.Error("ReadUint8() = false, want true")
+ }
+ if x != 23 || y != 0xfffefdfc || z != 42 {
+ t.Errorf("x, y, z = %d, %d, %d; want 23, 4294901244, 5", x, y, z)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+}
+
+func TestUint8LengthPrefixedSimple(t *testing.T) {
+ var b Builder
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8(23)
+ c.AddUint8(42)
+ })
+ if err := builderBytesEq(&b, 2, 23, 42); err != nil {
+ t.Error(err)
+ }
+
+ var base, child String = b.BytesOrPanic(), nil
+ var x, y uint8
+ if !base.ReadUint8LengthPrefixed(&child) || !child.ReadUint8(&x) ||
+ !child.ReadUint8(&y) {
+ t.Error("parsing failed")
+ }
+ if x != 23 || y != 42 {
+ t.Errorf("want x, y == 23, 42; got %d, %d", x, y)
+ }
+ if len(base) != 0 {
+ t.Errorf("len(base) = %d, want 0", len(base))
+ }
+ if len(child) != 0 {
+ t.Errorf("len(child) = %d, want 0", len(child))
+ }
+}
+
+func TestUint8LengthPrefixedMulti(t *testing.T) {
+ var b Builder
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8(23)
+ c.AddUint8(42)
+ })
+ b.AddUint8(5)
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8(123)
+ c.AddUint8(234)
+ })
+ if err := builderBytesEq(&b, 2, 23, 42, 5, 2, 123, 234); err != nil {
+ t.Error(err)
+ }
+
+ var s, child String = b.BytesOrPanic(), nil
+ var u, v, w, x, y uint8
+ if !s.ReadUint8LengthPrefixed(&child) || !child.ReadUint8(&u) || !child.ReadUint8(&v) ||
+ !s.ReadUint8(&w) || !s.ReadUint8LengthPrefixed(&child) || !child.ReadUint8(&x) || !child.ReadUint8(&y) {
+ t.Error("parsing failed")
+ }
+ if u != 23 || v != 42 || w != 5 || x != 123 || y != 234 {
+ t.Errorf("u, v, w, x, y = %d, %d, %d, %d, %d; want 23, 42, 5, 123, 234",
+ u, v, w, x, y)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+ if len(child) != 0 {
+ t.Errorf("len(child) = %d, want 0", len(child))
+ }
+}
+
+func TestUint8LengthPrefixedNested(t *testing.T) {
+ var b Builder
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8(5)
+ c.AddUint8LengthPrefixed(func(d *Builder) {
+ d.AddUint8(23)
+ d.AddUint8(42)
+ })
+ c.AddUint8(123)
+ })
+ if err := builderBytesEq(&b, 5, 5, 2, 23, 42, 123); err != nil {
+ t.Error(err)
+ }
+
+ var base, child1, child2 String = b.BytesOrPanic(), nil, nil
+ var u, v, w, x uint8
+ if !base.ReadUint8LengthPrefixed(&child1) {
+ t.Error("parsing base failed")
+ }
+ if !child1.ReadUint8(&u) || !child1.ReadUint8LengthPrefixed(&child2) || !child1.ReadUint8(&x) {
+ t.Error("parsing child1 failed")
+ }
+ if !child2.ReadUint8(&v) || !child2.ReadUint8(&w) {
+ t.Error("parsing child2 failed")
+ }
+ if u != 5 || v != 23 || w != 42 || x != 123 {
+ t.Errorf("u, v, w, x = %d, %d, %d, %d, want 5, 23, 42, 123",
+ u, v, w, x)
+ }
+ if len(base) != 0 {
+ t.Errorf("len(base) = %d, want 0", len(base))
+ }
+ if len(child1) != 0 {
+ t.Errorf("len(child1) = %d, want 0", len(child1))
+ }
+ if len(base) != 0 {
+ t.Errorf("len(child2) = %d, want 0", len(child2))
+ }
+}
+
+func TestPreallocatedBuffer(t *testing.T) {
+ var buf [5]byte
+ b := NewBuilder(buf[0:0])
+ b.AddUint8(1)
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8(3)
+ c.AddUint8(4)
+ })
+ b.AddUint16(1286) // Outgrow buf by one byte.
+ want := []byte{1, 2, 3, 4, 0}
+ if !bytes.Equal(buf[:], want) {
+ t.Errorf("buf = %v want %v", buf, want)
+ }
+ if err := builderBytesEq(b, 1, 2, 3, 4, 5, 6); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestWriteWithPendingChild(t *testing.T) {
+ var b Builder
+ b.AddUint8LengthPrefixed(func(c *Builder) {
+ c.AddUint8LengthPrefixed(func(d *Builder) {
+ defer func() {
+ if recover() == nil {
+ t.Errorf("recover() = nil, want error; c.AddUint8() did not panic")
+ }
+ }()
+ c.AddUint8(2) // panics
+
+ defer func() {
+ if recover() == nil {
+ t.Errorf("recover() = nil, want error; b.AddUint8() did not panic")
+ }
+ }()
+ b.AddUint8(2) // panics
+ })
+
+ defer func() {
+ if recover() == nil {
+ t.Errorf("recover() = nil, want error; b.AddUint8() did not panic")
+ }
+ }()
+ b.AddUint8(2) // panics
+ })
+}
+
+// ASN.1
+
+func TestASN1Int64(t *testing.T) {
+ tests := []struct {
+ in int64
+ want []byte
+ }{
+ {-0x800000, []byte{2, 3, 128, 0, 0}},
+ {-256, []byte{2, 2, 255, 0}},
+ {-129, []byte{2, 2, 255, 127}},
+ {-128, []byte{2, 1, 128}},
+ {-1, []byte{2, 1, 255}},
+ {0, []byte{2, 1, 0}},
+ {1, []byte{2, 1, 1}},
+ {2, []byte{2, 1, 2}},
+ {127, []byte{2, 1, 127}},
+ {128, []byte{2, 2, 0, 128}},
+ {256, []byte{2, 2, 1, 0}},
+ {0x800000, []byte{2, 4, 0, 128, 0, 0}},
+ }
+ for i, tt := range tests {
+ var b Builder
+ b.AddASN1Int64(tt.in)
+ if err := builderBytesEq(&b, tt.want...); err != nil {
+ t.Errorf("%v, (i = %d; in = %v)", err, i, tt.in)
+ }
+
+ var n int64
+ s := String(b.BytesOrPanic())
+ ok := s.ReadASN1Integer(&n)
+ if !ok || n != tt.in {
+ t.Errorf("s.ReadASN1Integer(&n) = %v, n = %d; want true, n = %d (i = %d)",
+ ok, n, tt.in, i)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+ }
+}
+
+func TestASN1Uint64(t *testing.T) {
+ tests := []struct {
+ in uint64
+ want []byte
+ }{
+ {0, []byte{2, 1, 0}},
+ {1, []byte{2, 1, 1}},
+ {2, []byte{2, 1, 2}},
+ {127, []byte{2, 1, 127}},
+ {128, []byte{2, 2, 0, 128}},
+ {256, []byte{2, 2, 1, 0}},
+ {0x800000, []byte{2, 4, 0, 128, 0, 0}},
+ {0x7fffffffffffffff, []byte{2, 8, 127, 255, 255, 255, 255, 255, 255, 255}},
+ {0x8000000000000000, []byte{2, 9, 0, 128, 0, 0, 0, 0, 0, 0, 0}},
+ {0xffffffffffffffff, []byte{2, 9, 0, 255, 255, 255, 255, 255, 255, 255, 255}},
+ }
+ for i, tt := range tests {
+ var b Builder
+ b.AddASN1Uint64(tt.in)
+ if err := builderBytesEq(&b, tt.want...); err != nil {
+ t.Errorf("%v, (i = %d; in = %v)", err, i, tt.in)
+ }
+
+ var n uint64
+ s := String(b.BytesOrPanic())
+ ok := s.ReadASN1Integer(&n)
+ if !ok || n != tt.in {
+ t.Errorf("s.ReadASN1Integer(&n) = %v, n = %d; want true, n = %d (i = %d)",
+ ok, n, tt.in, i)
+ }
+ if len(s) != 0 {
+ t.Errorf("len(s) = %d, want 0", len(s))
+ }
+ }
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/example_test.go b/vendor/golang.org/x/crypto/cryptobyte/example_test.go
new file mode 100644
index 000000000..7d3c06e12
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/example_test.go
@@ -0,0 +1,120 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cryptobyte_test
+
+import (
+ "encoding/asn1"
+ "fmt"
+ "golang.org/x/crypto/cryptobyte"
+)
+
+func ExampleString_lengthPrefixed() {
+ // This is an example of parsing length-prefixed data (as found in, for
+ // example, TLS). Imagine a 16-bit prefixed series of 8-bit prefixed
+ // strings.
+
+ input := cryptobyte.String([]byte{0, 12, 5, 'h', 'e', 'l', 'l', 'o', 5, 'w', 'o', 'r', 'l', 'd'})
+ var result []string
+
+ var values cryptobyte.String
+ if !input.ReadUint16LengthPrefixed(&values) ||
+ !input.Empty() {
+ panic("bad format")
+ }
+
+ for !values.Empty() {
+ var value cryptobyte.String
+ if !values.ReadUint8LengthPrefixed(&value) {
+ panic("bad format")
+ }
+
+ result = append(result, string(value))
+ }
+
+ // Output: []string{"hello", "world"}
+ fmt.Printf("%#v\n", result)
+}
+
+func ExampleString_asn1() {
+ // This is an example of parsing ASN.1 data that looks like:
+ // Foo ::= SEQUENCE {
+ // version [6] INTEGER DEFAULT 0
+ // data OCTET STRING
+ // }
+
+ input := cryptobyte.String([]byte{0x30, 12, 0xa6, 3, 2, 1, 2, 4, 5, 'h', 'e', 'l', 'l', 'o'})
+
+ var (
+ version int64
+ data, inner, versionBytes cryptobyte.String
+ haveVersion bool
+ )
+ if !input.ReadASN1(&inner, cryptobyte.Tag(asn1.TagSequence).Constructed()) ||
+ !input.Empty() ||
+ !inner.ReadOptionalASN1(&versionBytes, &haveVersion, cryptobyte.Tag(6).Constructed().ContextSpecific()) ||
+ (haveVersion && !versionBytes.ReadASN1Integer(&version)) ||
+ (haveVersion && !versionBytes.Empty()) ||
+ !inner.ReadASN1(&data, asn1.TagOctetString) ||
+ !inner.Empty() {
+ panic("bad format")
+ }
+
+ // Output: haveVersion: true, version: 2, data: hello
+ fmt.Printf("haveVersion: %t, version: %d, data: %s\n", haveVersion, version, string(data))
+}
+
+func ExampleBuilder_asn1() {
+ // This is an example of building ASN.1 data that looks like:
+ // Foo ::= SEQUENCE {
+ // version [6] INTEGER DEFAULT 0
+ // data OCTET STRING
+ // }
+
+ version := int64(2)
+ data := []byte("hello")
+ const defaultVersion = 0
+
+ var b cryptobyte.Builder
+ b.AddASN1(cryptobyte.Tag(asn1.TagSequence).Constructed(), func(b *cryptobyte.Builder) {
+ if version != defaultVersion {
+ b.AddASN1(cryptobyte.Tag(6).Constructed().ContextSpecific(), func(b *cryptobyte.Builder) {
+ b.AddASN1Int64(version)
+ })
+ }
+ b.AddASN1OctetString(data)
+ })
+
+ result, err := b.Bytes()
+ if err != nil {
+ panic(err)
+ }
+
+ // Output: 300ca603020102040568656c6c6f
+ fmt.Printf("%x\n", result)
+}
+
+func ExampleBuilder_lengthPrefixed() {
+ // This is an example of building length-prefixed data (as found in,
+ // for example, TLS). Imagine a 16-bit prefixed series of 8-bit
+ // prefixed strings.
+ input := []string{"hello", "world"}
+
+ var b cryptobyte.Builder
+ b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
+ for _, value := range input {
+ b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) {
+ b.AddBytes([]byte(value))
+ })
+ }
+ })
+
+ result, err := b.Bytes()
+ if err != nil {
+ panic(err)
+ }
+
+ // Output: 000c0568656c6c6f05776f726c64
+ fmt.Printf("%x\n", result)
+}
diff --git a/vendor/golang.org/x/crypto/cryptobyte/string.go b/vendor/golang.org/x/crypto/cryptobyte/string.go
new file mode 100644
index 000000000..b1215b3bf
--- /dev/null
+++ b/vendor/golang.org/x/crypto/cryptobyte/string.go
@@ -0,0 +1,157 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package cryptobyte implements building and parsing of byte strings for
+// DER-encoded ASN.1 and TLS messages. See the examples for the Builder and
+// String types to get started.
+package cryptobyte
+
+// String represents a string of bytes. It provides methods for parsing
+// fixed-length and length-prefixed values from it.
+type String []byte
+
+// read advances a String by n bytes and returns them. If less than n bytes
+// remain, it returns nil.
+func (s *String) read(n int) []byte {
+ if len(*s) < n {
+ return nil
+ }
+ v := (*s)[:n]
+ *s = (*s)[n:]
+ return v
+}
+
+// Skip advances the String by n byte and reports whether it was successful.
+func (s *String) Skip(n int) bool {
+ return s.read(n) != nil
+}
+
+// ReadUint8 decodes an 8-bit value into out and advances over it. It
+// returns true on success and false on error.
+func (s *String) ReadUint8(out *uint8) bool {
+ v := s.read(1)
+ if v == nil {
+ return false
+ }
+ *out = uint8(v[0])
+ return true
+}
+
+// ReadUint16 decodes a big-endian, 16-bit value into out and advances over it.
+// It returns true on success and false on error.
+func (s *String) ReadUint16(out *uint16) bool {
+ v := s.read(2)
+ if v == nil {
+ return false
+ }
+ *out = uint16(v[0])<<8 | uint16(v[1])
+ return true
+}
+
+// ReadUint24 decodes a big-endian, 24-bit value into out and advances over it.
+// It returns true on success and false on error.
+func (s *String) ReadUint24(out *uint32) bool {
+ v := s.read(3)
+ if v == nil {
+ return false
+ }
+ *out = uint32(v[0])<<16 | uint32(v[1])<<8 | uint32(v[2])
+ return true
+}
+
+// ReadUint32 decodes a big-endian, 32-bit value into out and advances over it.
+// It returns true on success and false on error.
+func (s *String) ReadUint32(out *uint32) bool {
+ v := s.read(4)
+ if v == nil {
+ return false
+ }
+ *out = uint32(v[0])<<24 | uint32(v[1])<<16 | uint32(v[2])<<8 | uint32(v[3])
+ return true
+}
+
+func (s *String) readUnsigned(out *uint32, length int) bool {
+ v := s.read(length)
+ if v == nil {
+ return false
+ }
+ var result uint32
+ for i := 0; i < length; i++ {
+ result <<= 8
+ result |= uint32(v[i])
+ }
+ *out = result
+ return true
+}
+
+func (s *String) readLengthPrefixed(lenLen int, outChild *String) bool {
+ lenBytes := s.read(lenLen)
+ if lenBytes == nil {
+ return false
+ }
+ var length uint32
+ for _, b := range lenBytes {
+ length = length << 8
+ length = length | uint32(b)
+ }
+ if int(length) < 0 {
+ // This currently cannot overflow because we read uint24 at most, but check
+ // anyway in case that changes in the future.
+ return false
+ }
+ v := s.read(int(length))
+ if v == nil {
+ return false
+ }
+ *outChild = v
+ return true
+}
+
+// ReadUint8LengthPrefixed reads the content of an 8-bit length-prefixed value
+// into out and advances over it. It returns true on success and false on
+// error.
+func (s *String) ReadUint8LengthPrefixed(out *String) bool {
+ return s.readLengthPrefixed(1, out)
+}
+
+// ReadUint16LengthPrefixed reads the content of a big-endian, 16-bit
+// length-prefixed value into out and advances over it. It returns true on
+// success and false on error.
+func (s *String) ReadUint16LengthPrefixed(out *String) bool {
+ return s.readLengthPrefixed(2, out)
+}
+
+// ReadUint24LengthPrefixed reads the content of a big-endian, 24-bit
+// length-prefixed value into out and advances over it. It returns true on
+// success and false on error.
+func (s *String) ReadUint24LengthPrefixed(out *String) bool {
+ return s.readLengthPrefixed(3, out)
+}
+
+// ReadBytes reads n bytes into out and advances over them. It returns true on
+// success and false and error.
+func (s *String) ReadBytes(out *[]byte, n int) bool {
+ v := s.read(n)
+ if v == nil {
+ return false
+ }
+ *out = v
+ return true
+}
+
+// CopyBytes copies len(out) bytes into out and advances over them. It returns
+// true on success and false on error.
+func (s *String) CopyBytes(out []byte) bool {
+ n := len(out)
+ v := s.read(n)
+ if v == nil {
+ return false
+ }
+ return copy(out, v) == n
+}
+
+// Empty reports whether the string does not contain any bytes.
+func (s String) Empty() bool {
+ return len(s) == 0
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/const_amd64.h b/vendor/golang.org/x/crypto/curve25519/const_amd64.h
new file mode 100644
index 000000000..80ad2220f
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/const_amd64.h
@@ -0,0 +1,8 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This code was translated into a form compatible with 6a from the public
+// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
+
+#define REDMASK51 0x0007FFFFFFFFFFFF
diff --git a/vendor/golang.org/x/crypto/curve25519/const_amd64.s b/vendor/golang.org/x/crypto/curve25519/const_amd64.s
index 797f9b051..0ad539885 100644
--- a/vendor/golang.org/x/crypto/curve25519/const_amd64.s
+++ b/vendor/golang.org/x/crypto/curve25519/const_amd64.s
@@ -7,8 +7,8 @@
// +build amd64,!gccgo,!appengine
-DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF
-GLOBL ·REDMASK51(SB), 8, $8
+// These constants cannot be encoded in non-MOVQ immediates.
+// We access them directly from memory instead.
DATA ·_121666_213(SB)/8, $996687872
GLOBL ·_121666_213(SB), 8, $8
diff --git a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s b/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
index 932800b8d..536479bf6 100644
--- a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
+++ b/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
@@ -7,6 +7,8 @@
// +build amd64,!gccgo,!appengine
+#include "const_amd64.h"
+
// func freeze(inout *[5]uint64)
TEXT ·freeze(SB),7,$0-8
MOVQ inout+0(FP), DI
@@ -16,7 +18,7 @@ TEXT ·freeze(SB),7,$0-8
MOVQ 16(DI),CX
MOVQ 24(DI),R8
MOVQ 32(DI),R9
- MOVQ ·REDMASK51(SB),AX
+ MOVQ $REDMASK51,AX
MOVQ AX,R10
SUBQ $18,R10
MOVQ $3,R11
diff --git a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
index ee7b36c36..7074e5cd9 100644
--- a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
+++ b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
@@ -7,6 +7,8 @@
// +build amd64,!gccgo,!appengine
+#include "const_amd64.h"
+
// func ladderstep(inout *[5][5]uint64)
TEXT ·ladderstep(SB),0,$296-8
MOVQ inout+0(FP),DI
@@ -118,7 +120,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 72(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -233,7 +235,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -438,7 +440,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 72(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -588,7 +590,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -728,7 +730,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 152(DI)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -843,7 +845,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 192(DI)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -993,7 +995,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(DI)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -1143,7 +1145,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 112(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
@@ -1329,7 +1331,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 192(SP)
ADDQ AX,R12
ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
+ MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
diff --git a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
index 33ce57dcd..b162e6515 100644
--- a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
+++ b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
@@ -7,6 +7,8 @@
// +build amd64,!gccgo,!appengine
+#include "const_amd64.h"
+
// func mul(dest, a, b *[5]uint64)
TEXT ·mul(SB),0,$16-24
MOVQ dest+0(FP), DI
@@ -121,7 +123,7 @@ TEXT ·mul(SB),0,$16-24
MULQ 32(CX)
ADDQ AX,R14
ADCQ DX,R15
- MOVQ ·REDMASK51(SB),SI
+ MOVQ $REDMASK51,SI
SHLQ $13,R9:R8
ANDQ SI,R8
SHLQ $13,R11:R10
diff --git a/vendor/golang.org/x/crypto/curve25519/square_amd64.s b/vendor/golang.org/x/crypto/curve25519/square_amd64.s
index 3a92804dd..4e864a83e 100644
--- a/vendor/golang.org/x/crypto/curve25519/square_amd64.s
+++ b/vendor/golang.org/x/crypto/curve25519/square_amd64.s
@@ -7,6 +7,8 @@
// +build amd64,!gccgo,!appengine
+#include "const_amd64.h"
+
// func square(out, in *[5]uint64)
TEXT ·square(SB),7,$0-16
MOVQ out+0(FP), DI
@@ -84,7 +86,7 @@ TEXT ·square(SB),7,$0-16
MULQ 32(SI)
ADDQ AX,R13
ADCQ DX,R14
- MOVQ ·REDMASK51(SB),SI
+ MOVQ $REDMASK51,SI
SHLQ $13,R8:CX
ANDQ SI,CX
SHLQ $13,R10:R9
diff --git a/vendor/golang.org/x/crypto/ocsp/ocsp_test.go b/vendor/golang.org/x/crypto/ocsp/ocsp_test.go
index a3c898619..d325d851e 100644
--- a/vendor/golang.org/x/crypto/ocsp/ocsp_test.go
+++ b/vendor/golang.org/x/crypto/ocsp/ocsp_test.go
@@ -225,7 +225,6 @@ func TestOCSPResponse(t *testing.T) {
},
}
- producedAt := time.Now().Truncate(time.Minute)
thisUpdate := time.Date(2010, 7, 7, 15, 1, 5, 0, time.UTC)
nextUpdate := time.Date(2010, 7, 7, 18, 35, 17, 0, time.UTC)
template := Response{
@@ -284,8 +283,9 @@ func TestOCSPResponse(t *testing.T) {
t.Errorf("resp.Extensions: got %v, want %v", resp.Extensions, template.ExtraExtensions)
}
- if !resp.ProducedAt.Equal(producedAt) {
- t.Errorf("resp.ProducedAt: got %d, want %d", resp.ProducedAt, producedAt)
+ delay := time.Since(resp.ProducedAt)
+ if delay < -time.Hour || delay > time.Hour {
+ t.Errorf("resp.ProducedAt: got %s, want close to current time (%s)", resp.ProducedAt, time.Now())
}
if resp.Status != template.Status {
diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305_test.go b/vendor/golang.org/x/crypto/poly1305/poly1305_test.go
index 7b8ab2fe1..017027fe6 100644
--- a/vendor/golang.org/x/crypto/poly1305/poly1305_test.go
+++ b/vendor/golang.org/x/crypto/poly1305/poly1305_test.go
@@ -6,10 +6,14 @@ package poly1305
import (
"bytes"
+ "encoding/hex"
+ "flag"
"testing"
"unsafe"
)
+var stressFlag = flag.Bool("stress", false, "run slow stress tests")
+
var testData = []struct {
in, k, correct []byte
}{
@@ -88,6 +92,39 @@ func testSum(t *testing.T, unaligned bool) {
}
}
+func TestBurnin(t *testing.T) {
+ // This test can be used to sanity-check significant changes. It can
+ // take about many minutes to run, even on fast machines. It's disabled
+ // by default.
+ if !*stressFlag {
+ t.Skip("skipping without -stress")
+ }
+
+ var key [32]byte
+ var input [25]byte
+ var output [16]byte
+
+ for i := range key {
+ key[i] = 1
+ }
+ for i := range input {
+ input[i] = 2
+ }
+
+ for i := uint64(0); i < 1e10; i++ {
+ Sum(&output, input[:], &key)
+ copy(key[0:], output[:])
+ copy(key[16:], output[:])
+ copy(input[:], output[:])
+ copy(input[16:], output[:])
+ }
+
+ const expected = "5e3b866aea0b636d240c83c428f84bfa"
+ if got := hex.EncodeToString(output[:]); got != expected {
+ t.Errorf("expected %s, got %s", expected, got)
+ }
+}
+
func TestSum(t *testing.T) { testSum(t, false) }
func TestSumUnaligned(t *testing.T) { testSum(t, true) }
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ref.go b/vendor/golang.org/x/crypto/poly1305/sum_ref.go
index dbe50e78a..b2805a5ca 100644
--- a/vendor/golang.org/x/crypto/poly1305/sum_ref.go
+++ b/vendor/golang.org/x/crypto/poly1305/sum_ref.go
@@ -6,1526 +6,136 @@
package poly1305
-// Based on original, public domain implementation from NaCl by D. J.
-// Bernstein.
+import "encoding/binary"
-import "math"
-
-const (
- alpham80 = 0.00000000558793544769287109375
- alpham48 = 24.0
- alpham16 = 103079215104.0
- alpha0 = 6755399441055744.0
- alpha18 = 1770887431076116955136.0
- alpha32 = 29014219670751100192948224.0
- alpha50 = 7605903601369376408980219232256.0
- alpha64 = 124615124604835863084731911901282304.0
- alpha82 = 32667107224410092492483962313449748299776.0
- alpha96 = 535217884764734955396857238543560676143529984.0
- alpha112 = 35076039295941670036888435985190792471742381031424.0
- alpha130 = 9194973245195333150150082162901855101712434733101613056.0
- scale = 0.0000000000000000000000000000000000000036734198463196484624023016788195177431833298649127735047148490821200539357960224151611328125
- offset0 = 6755408030990331.0
- offset1 = 29014256564239239022116864.0
- offset2 = 124615283061160854719918951570079744.0
- offset3 = 535219245894202480694386063513315216128475136.0
-)
-
-// Sum generates an authenticator for m using a one-time key and puts the
+// Sum generates an authenticator for msg using a one-time key and puts the
// 16-byte result into out. Authenticating two different messages with the same
// key allows an attacker to forge messages at will.
-func Sum(out *[16]byte, m []byte, key *[32]byte) {
- r := key
- s := key[16:]
+func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) {
var (
- y7 float64
- y6 float64
- y1 float64
- y0 float64
- y5 float64
- y4 float64
- x7 float64
- x6 float64
- x1 float64
- x0 float64
- y3 float64
- y2 float64
- x5 float64
- r3lowx0 float64
- x4 float64
- r0lowx6 float64
- x3 float64
- r3highx0 float64
- x2 float64
- r0highx6 float64
- r0lowx0 float64
- sr1lowx6 float64
- r0highx0 float64
- sr1highx6 float64
- sr3low float64
- r1lowx0 float64
- sr2lowx6 float64
- r1highx0 float64
- sr2highx6 float64
- r2lowx0 float64
- sr3lowx6 float64
- r2highx0 float64
- sr3highx6 float64
- r1highx4 float64
- r1lowx4 float64
- r0highx4 float64
- r0lowx4 float64
- sr3highx4 float64
- sr3lowx4 float64
- sr2highx4 float64
- sr2lowx4 float64
- r0lowx2 float64
- r0highx2 float64
- r1lowx2 float64
- r1highx2 float64
- r2lowx2 float64
- r2highx2 float64
- sr3lowx2 float64
- sr3highx2 float64
- z0 float64
- z1 float64
- z2 float64
- z3 float64
- m0 int64
- m1 int64
- m2 int64
- m3 int64
- m00 uint32
- m01 uint32
- m02 uint32
- m03 uint32
- m10 uint32
- m11 uint32
- m12 uint32
- m13 uint32
- m20 uint32
- m21 uint32
- m22 uint32
- m23 uint32
- m30 uint32
- m31 uint32
- m32 uint32
- m33 uint64
- lbelow2 int32
- lbelow3 int32
- lbelow4 int32
- lbelow5 int32
- lbelow6 int32
- lbelow7 int32
- lbelow8 int32
- lbelow9 int32
- lbelow10 int32
- lbelow11 int32
- lbelow12 int32
- lbelow13 int32
- lbelow14 int32
- lbelow15 int32
- s00 uint32
- s01 uint32
- s02 uint32
- s03 uint32
- s10 uint32
- s11 uint32
- s12 uint32
- s13 uint32
- s20 uint32
- s21 uint32
- s22 uint32
- s23 uint32
- s30 uint32
- s31 uint32
- s32 uint32
- s33 uint32
- bits32 uint64
- f uint64
- f0 uint64
- f1 uint64
- f2 uint64
- f3 uint64
- f4 uint64
- g uint64
- g0 uint64
- g1 uint64
- g2 uint64
- g3 uint64
- g4 uint64
+ h0, h1, h2, h3, h4 uint32 // the hash accumulators
+ r0, r1, r2, r3, r4 uint64 // the r part of the key
)
- var p int32
-
- l := int32(len(m))
-
- r00 := uint32(r[0])
-
- r01 := uint32(r[1])
-
- r02 := uint32(r[2])
- r0 := int64(2151)
-
- r03 := uint32(r[3])
- r03 &= 15
- r0 <<= 51
-
- r10 := uint32(r[4])
- r10 &= 252
- r01 <<= 8
- r0 += int64(r00)
-
- r11 := uint32(r[5])
- r02 <<= 16
- r0 += int64(r01)
-
- r12 := uint32(r[6])
- r03 <<= 24
- r0 += int64(r02)
-
- r13 := uint32(r[7])
- r13 &= 15
- r1 := int64(2215)
- r0 += int64(r03)
-
- d0 := r0
- r1 <<= 51
- r2 := int64(2279)
-
- r20 := uint32(r[8])
- r20 &= 252
- r11 <<= 8
- r1 += int64(r10)
-
- r21 := uint32(r[9])
- r12 <<= 16
- r1 += int64(r11)
-
- r22 := uint32(r[10])
- r13 <<= 24
- r1 += int64(r12)
-
- r23 := uint32(r[11])
- r23 &= 15
- r2 <<= 51
- r1 += int64(r13)
-
- d1 := r1
- r21 <<= 8
- r2 += int64(r20)
-
- r30 := uint32(r[12])
- r30 &= 252
- r22 <<= 16
- r2 += int64(r21)
-
- r31 := uint32(r[13])
- r23 <<= 24
- r2 += int64(r22)
-
- r32 := uint32(r[14])
- r2 += int64(r23)
- r3 := int64(2343)
-
- d2 := r2
- r3 <<= 51
-
- r33 := uint32(r[15])
- r33 &= 15
- r31 <<= 8
- r3 += int64(r30)
-
- r32 <<= 16
- r3 += int64(r31)
-
- r33 <<= 24
- r3 += int64(r32)
-
- r3 += int64(r33)
- h0 := alpha32 - alpha32
-
- d3 := r3
- h1 := alpha32 - alpha32
-
- h2 := alpha32 - alpha32
-
- h3 := alpha32 - alpha32
-
- h4 := alpha32 - alpha32
-
- r0low := math.Float64frombits(uint64(d0))
- h5 := alpha32 - alpha32
-
- r1low := math.Float64frombits(uint64(d1))
- h6 := alpha32 - alpha32
-
- r2low := math.Float64frombits(uint64(d2))
- h7 := alpha32 - alpha32
-
- r0low -= alpha0
-
- r1low -= alpha32
-
- r2low -= alpha64
-
- r0high := r0low + alpha18
-
- r3low := math.Float64frombits(uint64(d3))
-
- r1high := r1low + alpha50
- sr1low := scale * r1low
-
- r2high := r2low + alpha82
- sr2low := scale * r2low
-
- r0high -= alpha18
- r0high_stack := r0high
-
- r3low -= alpha96
-
- r1high -= alpha50
- r1high_stack := r1high
-
- sr1high := sr1low + alpham80
-
- r0low -= r0high
-
- r2high -= alpha82
- sr3low = scale * r3low
-
- sr2high := sr2low + alpham48
-
- r1low -= r1high
- r1low_stack := r1low
-
- sr1high -= alpham80
- sr1high_stack := sr1high
-
- r2low -= r2high
- r2low_stack := r2low
-
- sr2high -= alpham48
- sr2high_stack := sr2high
-
- r3high := r3low + alpha112
- r0low_stack := r0low
-
- sr1low -= sr1high
- sr1low_stack := sr1low
-
- sr3high := sr3low + alpham16
- r2high_stack := r2high
-
- sr2low -= sr2high
- sr2low_stack := sr2low
-
- r3high -= alpha112
- r3high_stack := r3high
-
- sr3high -= alpham16
- sr3high_stack := sr3high
-
- r3low -= r3high
- r3low_stack := r3low
-
- sr3low -= sr3high
- sr3low_stack := sr3low
-
- if l < 16 {
- goto addatmost15bytes
- }
-
- m00 = uint32(m[p+0])
- m0 = 2151
-
- m0 <<= 51
- m1 = 2215
- m01 = uint32(m[p+1])
-
- m1 <<= 51
- m2 = 2279
- m02 = uint32(m[p+2])
-
- m2 <<= 51
- m3 = 2343
- m03 = uint32(m[p+3])
-
- m10 = uint32(m[p+4])
- m01 <<= 8
- m0 += int64(m00)
-
- m11 = uint32(m[p+5])
- m02 <<= 16
- m0 += int64(m01)
-
- m12 = uint32(m[p+6])
- m03 <<= 24
- m0 += int64(m02)
-
- m13 = uint32(m[p+7])
- m3 <<= 51
- m0 += int64(m03)
-
- m20 = uint32(m[p+8])
- m11 <<= 8
- m1 += int64(m10)
-
- m21 = uint32(m[p+9])
- m12 <<= 16
- m1 += int64(m11)
-
- m22 = uint32(m[p+10])
- m13 <<= 24
- m1 += int64(m12)
-
- m23 = uint32(m[p+11])
- m1 += int64(m13)
-
- m30 = uint32(m[p+12])
- m21 <<= 8
- m2 += int64(m20)
-
- m31 = uint32(m[p+13])
- m22 <<= 16
- m2 += int64(m21)
-
- m32 = uint32(m[p+14])
- m23 <<= 24
- m2 += int64(m22)
-
- m33 = uint64(m[p+15])
- m2 += int64(m23)
-
- d0 = m0
- m31 <<= 8
- m3 += int64(m30)
-
- d1 = m1
- m32 <<= 16
- m3 += int64(m31)
-
- d2 = m2
- m33 += 256
-
- m33 <<= 24
- m3 += int64(m32)
-
- m3 += int64(m33)
- d3 = m3
-
- p += 16
- l -= 16
-
- z0 = math.Float64frombits(uint64(d0))
-
- z1 = math.Float64frombits(uint64(d1))
-
- z2 = math.Float64frombits(uint64(d2))
-
- z3 = math.Float64frombits(uint64(d3))
-
- z0 -= alpha0
-
- z1 -= alpha32
-
- z2 -= alpha64
-
- z3 -= alpha96
-
- h0 += z0
-
- h1 += z1
-
- h3 += z2
-
- h5 += z3
-
- if l < 16 {
- goto multiplyaddatmost15bytes
+ r0 = uint64(binary.LittleEndian.Uint32(key[0:]) & 0x3ffffff)
+ r1 = uint64((binary.LittleEndian.Uint32(key[3:]) >> 2) & 0x3ffff03)
+ r2 = uint64((binary.LittleEndian.Uint32(key[6:]) >> 4) & 0x3ffc0ff)
+ r3 = uint64((binary.LittleEndian.Uint32(key[9:]) >> 6) & 0x3f03fff)
+ r4 = uint64((binary.LittleEndian.Uint32(key[12:]) >> 8) & 0x00fffff)
+
+ R1, R2, R3, R4 := r1*5, r2*5, r3*5, r4*5
+
+ for len(msg) >= TagSize {
+ // h += msg
+ h0 += binary.LittleEndian.Uint32(msg[0:]) & 0x3ffffff
+ h1 += (binary.LittleEndian.Uint32(msg[3:]) >> 2) & 0x3ffffff
+ h2 += (binary.LittleEndian.Uint32(msg[6:]) >> 4) & 0x3ffffff
+ h3 += (binary.LittleEndian.Uint32(msg[9:]) >> 6) & 0x3ffffff
+ h4 += (binary.LittleEndian.Uint32(msg[12:]) >> 8) | (1 << 24)
+
+ // h *= r
+ d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1)
+ d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2)
+ d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3)
+ d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4)
+ d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0)
+
+ // h %= p
+ h0 = uint32(d0) & 0x3ffffff
+ h1 = uint32(d1) & 0x3ffffff
+ h2 = uint32(d2) & 0x3ffffff
+ h3 = uint32(d3) & 0x3ffffff
+ h4 = uint32(d4) & 0x3ffffff
+
+ h0 += uint32(d4>>26) * 5
+ h1 += h0 >> 26
+ h0 = h0 & 0x3ffffff
+
+ msg = msg[TagSize:]
}
-multiplyaddatleast16bytes:
-
- m2 = 2279
- m20 = uint32(m[p+8])
- y7 = h7 + alpha130
-
- m2 <<= 51
- m3 = 2343
- m21 = uint32(m[p+9])
- y6 = h6 + alpha130
-
- m3 <<= 51
- m0 = 2151
- m22 = uint32(m[p+10])
- y1 = h1 + alpha32
-
- m0 <<= 51
- m1 = 2215
- m23 = uint32(m[p+11])
- y0 = h0 + alpha32
-
- m1 <<= 51
- m30 = uint32(m[p+12])
- y7 -= alpha130
-
- m21 <<= 8
- m2 += int64(m20)
- m31 = uint32(m[p+13])
- y6 -= alpha130
-
- m22 <<= 16
- m2 += int64(m21)
- m32 = uint32(m[p+14])
- y1 -= alpha32
-
- m23 <<= 24
- m2 += int64(m22)
- m33 = uint64(m[p+15])
- y0 -= alpha32
-
- m2 += int64(m23)
- m00 = uint32(m[p+0])
- y5 = h5 + alpha96
-
- m31 <<= 8
- m3 += int64(m30)
- m01 = uint32(m[p+1])
- y4 = h4 + alpha96
-
- m32 <<= 16
- m02 = uint32(m[p+2])
- x7 = h7 - y7
- y7 *= scale
-
- m33 += 256
- m03 = uint32(m[p+3])
- x6 = h6 - y6
- y6 *= scale
-
- m33 <<= 24
- m3 += int64(m31)
- m10 = uint32(m[p+4])
- x1 = h1 - y1
-
- m01 <<= 8
- m3 += int64(m32)
- m11 = uint32(m[p+5])
- x0 = h0 - y0
-
- m3 += int64(m33)
- m0 += int64(m00)
- m12 = uint32(m[p+6])
- y5 -= alpha96
-
- m02 <<= 16
- m0 += int64(m01)
- m13 = uint32(m[p+7])
- y4 -= alpha96
-
- m03 <<= 24
- m0 += int64(m02)
- d2 = m2
- x1 += y7
-
- m0 += int64(m03)
- d3 = m3
- x0 += y6
-
- m11 <<= 8
- m1 += int64(m10)
- d0 = m0
- x7 += y5
-
- m12 <<= 16
- m1 += int64(m11)
- x6 += y4
-
- m13 <<= 24
- m1 += int64(m12)
- y3 = h3 + alpha64
-
- m1 += int64(m13)
- d1 = m1
- y2 = h2 + alpha64
-
- x0 += x1
-
- x6 += x7
-
- y3 -= alpha64
- r3low = r3low_stack
-
- y2 -= alpha64
- r0low = r0low_stack
-
- x5 = h5 - y5
- r3lowx0 = r3low * x0
- r3high = r3high_stack
-
- x4 = h4 - y4
- r0lowx6 = r0low * x6
- r0high = r0high_stack
-
- x3 = h3 - y3
- r3highx0 = r3high * x0
- sr1low = sr1low_stack
-
- x2 = h2 - y2
- r0highx6 = r0high * x6
- sr1high = sr1high_stack
-
- x5 += y3
- r0lowx0 = r0low * x0
- r1low = r1low_stack
-
- h6 = r3lowx0 + r0lowx6
- sr1lowx6 = sr1low * x6
- r1high = r1high_stack
-
- x4 += y2
- r0highx0 = r0high * x0
- sr2low = sr2low_stack
-
- h7 = r3highx0 + r0highx6
- sr1highx6 = sr1high * x6
- sr2high = sr2high_stack
-
- x3 += y1
- r1lowx0 = r1low * x0
- r2low = r2low_stack
-
- h0 = r0lowx0 + sr1lowx6
- sr2lowx6 = sr2low * x6
- r2high = r2high_stack
-
- x2 += y0
- r1highx0 = r1high * x0
- sr3low = sr3low_stack
-
- h1 = r0highx0 + sr1highx6
- sr2highx6 = sr2high * x6
- sr3high = sr3high_stack
-
- x4 += x5
- r2lowx0 = r2low * x0
- z2 = math.Float64frombits(uint64(d2))
-
- h2 = r1lowx0 + sr2lowx6
- sr3lowx6 = sr3low * x6
-
- x2 += x3
- r2highx0 = r2high * x0
- z3 = math.Float64frombits(uint64(d3))
-
- h3 = r1highx0 + sr2highx6
- sr3highx6 = sr3high * x6
-
- r1highx4 = r1high * x4
- z2 -= alpha64
-
- h4 = r2lowx0 + sr3lowx6
- r1lowx4 = r1low * x4
-
- r0highx4 = r0high * x4
- z3 -= alpha96
-
- h5 = r2highx0 + sr3highx6
- r0lowx4 = r0low * x4
-
- h7 += r1highx4
- sr3highx4 = sr3high * x4
-
- h6 += r1lowx4
- sr3lowx4 = sr3low * x4
-
- h5 += r0highx4
- sr2highx4 = sr2high * x4
-
- h4 += r0lowx4
- sr2lowx4 = sr2low * x4
-
- h3 += sr3highx4
- r0lowx2 = r0low * x2
-
- h2 += sr3lowx4
- r0highx2 = r0high * x2
-
- h1 += sr2highx4
- r1lowx2 = r1low * x2
-
- h0 += sr2lowx4
- r1highx2 = r1high * x2
-
- h2 += r0lowx2
- r2lowx2 = r2low * x2
-
- h3 += r0highx2
- r2highx2 = r2high * x2
-
- h4 += r1lowx2
- sr3lowx2 = sr3low * x2
-
- h5 += r1highx2
- sr3highx2 = sr3high * x2
-
- p += 16
- l -= 16
- h6 += r2lowx2
-
- h7 += r2highx2
-
- z1 = math.Float64frombits(uint64(d1))
- h0 += sr3lowx2
-
- z0 = math.Float64frombits(uint64(d0))
- h1 += sr3highx2
-
- z1 -= alpha32
-
- z0 -= alpha0
-
- h5 += z3
-
- h3 += z2
-
- h1 += z1
-
- h0 += z0
-
- if l >= 16 {
- goto multiplyaddatleast16bytes
- }
-
-multiplyaddatmost15bytes:
-
- y7 = h7 + alpha130
-
- y6 = h6 + alpha130
-
- y1 = h1 + alpha32
-
- y0 = h0 + alpha32
-
- y7 -= alpha130
-
- y6 -= alpha130
-
- y1 -= alpha32
-
- y0 -= alpha32
-
- y5 = h5 + alpha96
-
- y4 = h4 + alpha96
-
- x7 = h7 - y7
- y7 *= scale
-
- x6 = h6 - y6
- y6 *= scale
-
- x1 = h1 - y1
-
- x0 = h0 - y0
-
- y5 -= alpha96
-
- y4 -= alpha96
-
- x1 += y7
-
- x0 += y6
-
- x7 += y5
-
- x6 += y4
-
- y3 = h3 + alpha64
-
- y2 = h2 + alpha64
-
- x0 += x1
-
- x6 += x7
-
- y3 -= alpha64
- r3low = r3low_stack
-
- y2 -= alpha64
- r0low = r0low_stack
-
- x5 = h5 - y5
- r3lowx0 = r3low * x0
- r3high = r3high_stack
-
- x4 = h4 - y4
- r0lowx6 = r0low * x6
- r0high = r0high_stack
-
- x3 = h3 - y3
- r3highx0 = r3high * x0
- sr1low = sr1low_stack
-
- x2 = h2 - y2
- r0highx6 = r0high * x6
- sr1high = sr1high_stack
-
- x5 += y3
- r0lowx0 = r0low * x0
- r1low = r1low_stack
-
- h6 = r3lowx0 + r0lowx6
- sr1lowx6 = sr1low * x6
- r1high = r1high_stack
-
- x4 += y2
- r0highx0 = r0high * x0
- sr2low = sr2low_stack
-
- h7 = r3highx0 + r0highx6
- sr1highx6 = sr1high * x6
- sr2high = sr2high_stack
-
- x3 += y1
- r1lowx0 = r1low * x0
- r2low = r2low_stack
-
- h0 = r0lowx0 + sr1lowx6
- sr2lowx6 = sr2low * x6
- r2high = r2high_stack
-
- x2 += y0
- r1highx0 = r1high * x0
- sr3low = sr3low_stack
-
- h1 = r0highx0 + sr1highx6
- sr2highx6 = sr2high * x6
- sr3high = sr3high_stack
-
- x4 += x5
- r2lowx0 = r2low * x0
-
- h2 = r1lowx0 + sr2lowx6
- sr3lowx6 = sr3low * x6
-
- x2 += x3
- r2highx0 = r2high * x0
-
- h3 = r1highx0 + sr2highx6
- sr3highx6 = sr3high * x6
-
- r1highx4 = r1high * x4
-
- h4 = r2lowx0 + sr3lowx6
- r1lowx4 = r1low * x4
-
- r0highx4 = r0high * x4
-
- h5 = r2highx0 + sr3highx6
- r0lowx4 = r0low * x4
-
- h7 += r1highx4
- sr3highx4 = sr3high * x4
-
- h6 += r1lowx4
- sr3lowx4 = sr3low * x4
-
- h5 += r0highx4
- sr2highx4 = sr2high * x4
-
- h4 += r0lowx4
- sr2lowx4 = sr2low * x4
-
- h3 += sr3highx4
- r0lowx2 = r0low * x2
-
- h2 += sr3lowx4
- r0highx2 = r0high * x2
-
- h1 += sr2highx4
- r1lowx2 = r1low * x2
-
- h0 += sr2lowx4
- r1highx2 = r1high * x2
-
- h2 += r0lowx2
- r2lowx2 = r2low * x2
-
- h3 += r0highx2
- r2highx2 = r2high * x2
-
- h4 += r1lowx2
- sr3lowx2 = sr3low * x2
-
- h5 += r1highx2
- sr3highx2 = sr3high * x2
-
- h6 += r2lowx2
-
- h7 += r2highx2
-
- h0 += sr3lowx2
-
- h1 += sr3highx2
-
-addatmost15bytes:
-
- if l == 0 {
- goto nomorebytes
+ if len(msg) > 0 {
+ var block [TagSize]byte
+ off := copy(block[:], msg)
+ block[off] = 0x01
+
+ // h += msg
+ h0 += binary.LittleEndian.Uint32(block[0:]) & 0x3ffffff
+ h1 += (binary.LittleEndian.Uint32(block[3:]) >> 2) & 0x3ffffff
+ h2 += (binary.LittleEndian.Uint32(block[6:]) >> 4) & 0x3ffffff
+ h3 += (binary.LittleEndian.Uint32(block[9:]) >> 6) & 0x3ffffff
+ h4 += (binary.LittleEndian.Uint32(block[12:]) >> 8)
+
+ // h *= r
+ d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1)
+ d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2)
+ d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3)
+ d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4)
+ d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0)
+
+ // h %= p
+ h0 = uint32(d0) & 0x3ffffff
+ h1 = uint32(d1) & 0x3ffffff
+ h2 = uint32(d2) & 0x3ffffff
+ h3 = uint32(d3) & 0x3ffffff
+ h4 = uint32(d4) & 0x3ffffff
+
+ h0 += uint32(d4>>26) * 5
+ h1 += h0 >> 26
+ h0 = h0 & 0x3ffffff
}
- lbelow2 = l - 2
-
- lbelow3 = l - 3
-
- lbelow2 >>= 31
- lbelow4 = l - 4
-
- m00 = uint32(m[p+0])
- lbelow3 >>= 31
- p += lbelow2
-
- m01 = uint32(m[p+1])
- lbelow4 >>= 31
- p += lbelow3
-
- m02 = uint32(m[p+2])
- p += lbelow4
- m0 = 2151
-
- m03 = uint32(m[p+3])
- m0 <<= 51
- m1 = 2215
-
- m0 += int64(m00)
- m01 &^= uint32(lbelow2)
-
- m02 &^= uint32(lbelow3)
- m01 -= uint32(lbelow2)
-
- m01 <<= 8
- m03 &^= uint32(lbelow4)
-
- m0 += int64(m01)
- lbelow2 -= lbelow3
-
- m02 += uint32(lbelow2)
- lbelow3 -= lbelow4
-
- m02 <<= 16
- m03 += uint32(lbelow3)
-
- m03 <<= 24
- m0 += int64(m02)
-
- m0 += int64(m03)
- lbelow5 = l - 5
-
- lbelow6 = l - 6
- lbelow7 = l - 7
-
- lbelow5 >>= 31
- lbelow8 = l - 8
-
- lbelow6 >>= 31
- p += lbelow5
-
- m10 = uint32(m[p+4])
- lbelow7 >>= 31
- p += lbelow6
-
- m11 = uint32(m[p+5])
- lbelow8 >>= 31
- p += lbelow7
-
- m12 = uint32(m[p+6])
- m1 <<= 51
- p += lbelow8
-
- m13 = uint32(m[p+7])
- m10 &^= uint32(lbelow5)
- lbelow4 -= lbelow5
-
- m10 += uint32(lbelow4)
- lbelow5 -= lbelow6
-
- m11 &^= uint32(lbelow6)
- m11 += uint32(lbelow5)
-
- m11 <<= 8
- m1 += int64(m10)
-
- m1 += int64(m11)
- m12 &^= uint32(lbelow7)
-
- lbelow6 -= lbelow7
- m13 &^= uint32(lbelow8)
-
- m12 += uint32(lbelow6)
- lbelow7 -= lbelow8
-
- m12 <<= 16
- m13 += uint32(lbelow7)
-
- m13 <<= 24
- m1 += int64(m12)
-
- m1 += int64(m13)
- m2 = 2279
-
- lbelow9 = l - 9
- m3 = 2343
-
- lbelow10 = l - 10
- lbelow11 = l - 11
-
- lbelow9 >>= 31
- lbelow12 = l - 12
-
- lbelow10 >>= 31
- p += lbelow9
-
- m20 = uint32(m[p+8])
- lbelow11 >>= 31
- p += lbelow10
-
- m21 = uint32(m[p+9])
- lbelow12 >>= 31
- p += lbelow11
-
- m22 = uint32(m[p+10])
- m2 <<= 51
- p += lbelow12
-
- m23 = uint32(m[p+11])
- m20 &^= uint32(lbelow9)
- lbelow8 -= lbelow9
-
- m20 += uint32(lbelow8)
- lbelow9 -= lbelow10
-
- m21 &^= uint32(lbelow10)
- m21 += uint32(lbelow9)
-
- m21 <<= 8
- m2 += int64(m20)
-
- m2 += int64(m21)
- m22 &^= uint32(lbelow11)
-
- lbelow10 -= lbelow11
- m23 &^= uint32(lbelow12)
-
- m22 += uint32(lbelow10)
- lbelow11 -= lbelow12
-
- m22 <<= 16
- m23 += uint32(lbelow11)
-
- m23 <<= 24
- m2 += int64(m22)
-
- m3 <<= 51
- lbelow13 = l - 13
-
- lbelow13 >>= 31
- lbelow14 = l - 14
-
- lbelow14 >>= 31
- p += lbelow13
- lbelow15 = l - 15
-
- m30 = uint32(m[p+12])
- lbelow15 >>= 31
- p += lbelow14
-
- m31 = uint32(m[p+13])
- p += lbelow15
- m2 += int64(m23)
-
- m32 = uint32(m[p+14])
- m30 &^= uint32(lbelow13)
- lbelow12 -= lbelow13
-
- m30 += uint32(lbelow12)
- lbelow13 -= lbelow14
-
- m3 += int64(m30)
- m31 &^= uint32(lbelow14)
-
- m31 += uint32(lbelow13)
- m32 &^= uint32(lbelow15)
-
- m31 <<= 8
- lbelow14 -= lbelow15
-
- m3 += int64(m31)
- m32 += uint32(lbelow14)
- d0 = m0
-
- m32 <<= 16
- m33 = uint64(lbelow15 + 1)
- d1 = m1
-
- m33 <<= 24
- m3 += int64(m32)
- d2 = m2
-
- m3 += int64(m33)
- d3 = m3
-
- z3 = math.Float64frombits(uint64(d3))
-
- z2 = math.Float64frombits(uint64(d2))
-
- z1 = math.Float64frombits(uint64(d1))
-
- z0 = math.Float64frombits(uint64(d0))
-
- z3 -= alpha96
-
- z2 -= alpha64
-
- z1 -= alpha32
-
- z0 -= alpha0
-
- h5 += z3
-
- h3 += z2
-
- h1 += z1
-
- h0 += z0
-
- y7 = h7 + alpha130
-
- y6 = h6 + alpha130
-
- y1 = h1 + alpha32
-
- y0 = h0 + alpha32
-
- y7 -= alpha130
-
- y6 -= alpha130
-
- y1 -= alpha32
-
- y0 -= alpha32
-
- y5 = h5 + alpha96
-
- y4 = h4 + alpha96
-
- x7 = h7 - y7
- y7 *= scale
-
- x6 = h6 - y6
- y6 *= scale
-
- x1 = h1 - y1
-
- x0 = h0 - y0
-
- y5 -= alpha96
-
- y4 -= alpha96
-
- x1 += y7
-
- x0 += y6
-
- x7 += y5
-
- x6 += y4
-
- y3 = h3 + alpha64
-
- y2 = h2 + alpha64
-
- x0 += x1
-
- x6 += x7
-
- y3 -= alpha64
- r3low = r3low_stack
-
- y2 -= alpha64
- r0low = r0low_stack
-
- x5 = h5 - y5
- r3lowx0 = r3low * x0
- r3high = r3high_stack
-
- x4 = h4 - y4
- r0lowx6 = r0low * x6
- r0high = r0high_stack
-
- x3 = h3 - y3
- r3highx0 = r3high * x0
- sr1low = sr1low_stack
-
- x2 = h2 - y2
- r0highx6 = r0high * x6
- sr1high = sr1high_stack
-
- x5 += y3
- r0lowx0 = r0low * x0
- r1low = r1low_stack
-
- h6 = r3lowx0 + r0lowx6
- sr1lowx6 = sr1low * x6
- r1high = r1high_stack
-
- x4 += y2
- r0highx0 = r0high * x0
- sr2low = sr2low_stack
-
- h7 = r3highx0 + r0highx6
- sr1highx6 = sr1high * x6
- sr2high = sr2high_stack
-
- x3 += y1
- r1lowx0 = r1low * x0
- r2low = r2low_stack
-
- h0 = r0lowx0 + sr1lowx6
- sr2lowx6 = sr2low * x6
- r2high = r2high_stack
-
- x2 += y0
- r1highx0 = r1high * x0
- sr3low = sr3low_stack
-
- h1 = r0highx0 + sr1highx6
- sr2highx6 = sr2high * x6
- sr3high = sr3high_stack
-
- x4 += x5
- r2lowx0 = r2low * x0
-
- h2 = r1lowx0 + sr2lowx6
- sr3lowx6 = sr3low * x6
-
- x2 += x3
- r2highx0 = r2high * x0
-
- h3 = r1highx0 + sr2highx6
- sr3highx6 = sr3high * x6
-
- r1highx4 = r1high * x4
-
- h4 = r2lowx0 + sr3lowx6
- r1lowx4 = r1low * x4
-
- r0highx4 = r0high * x4
-
- h5 = r2highx0 + sr3highx6
- r0lowx4 = r0low * x4
-
- h7 += r1highx4
- sr3highx4 = sr3high * x4
-
- h6 += r1lowx4
- sr3lowx4 = sr3low * x4
-
- h5 += r0highx4
- sr2highx4 = sr2high * x4
-
- h4 += r0lowx4
- sr2lowx4 = sr2low * x4
-
- h3 += sr3highx4
- r0lowx2 = r0low * x2
-
- h2 += sr3lowx4
- r0highx2 = r0high * x2
-
- h1 += sr2highx4
- r1lowx2 = r1low * x2
-
- h0 += sr2lowx4
- r1highx2 = r1high * x2
-
- h2 += r0lowx2
- r2lowx2 = r2low * x2
-
- h3 += r0highx2
- r2highx2 = r2high * x2
-
- h4 += r1lowx2
- sr3lowx2 = sr3low * x2
-
- h5 += r1highx2
- sr3highx2 = sr3high * x2
-
- h6 += r2lowx2
-
- h7 += r2highx2
-
- h0 += sr3lowx2
-
- h1 += sr3highx2
-
-nomorebytes:
-
- y7 = h7 + alpha130
-
- y0 = h0 + alpha32
-
- y1 = h1 + alpha32
-
- y2 = h2 + alpha64
-
- y7 -= alpha130
-
- y3 = h3 + alpha64
-
- y4 = h4 + alpha96
-
- y5 = h5 + alpha96
-
- x7 = h7 - y7
- y7 *= scale
-
- y0 -= alpha32
-
- y1 -= alpha32
-
- y2 -= alpha64
-
- h6 += x7
-
- y3 -= alpha64
-
- y4 -= alpha96
-
- y5 -= alpha96
-
- y6 = h6 + alpha130
-
- x0 = h0 - y0
-
- x1 = h1 - y1
-
- x2 = h2 - y2
-
- y6 -= alpha130
-
- x0 += y7
-
- x3 = h3 - y3
-
- x4 = h4 - y4
-
- x5 = h5 - y5
-
- x6 = h6 - y6
-
- y6 *= scale
-
- x2 += y0
-
- x3 += y1
-
- x4 += y2
-
- x0 += y6
-
- x5 += y3
-
- x6 += y4
-
- x2 += x3
-
- x0 += x1
-
- x4 += x5
-
- x6 += y5
-
- x2 += offset1
- d1 = int64(math.Float64bits(x2))
-
- x0 += offset0
- d0 = int64(math.Float64bits(x0))
-
- x4 += offset2
- d2 = int64(math.Float64bits(x4))
-
- x6 += offset3
- d3 = int64(math.Float64bits(x6))
-
- f0 = uint64(d0)
-
- f1 = uint64(d1)
- bits32 = math.MaxUint64
-
- f2 = uint64(d2)
- bits32 >>= 32
-
- f3 = uint64(d3)
- f = f0 >> 32
-
- f0 &= bits32
- f &= 255
-
- f1 += f
- g0 = f0 + 5
-
- g = g0 >> 32
- g0 &= bits32
-
- f = f1 >> 32
- f1 &= bits32
-
- f &= 255
- g1 = f1 + g
-
- g = g1 >> 32
- f2 += f
-
- f = f2 >> 32
- g1 &= bits32
-
- f2 &= bits32
- f &= 255
-
- f3 += f
- g2 = f2 + g
-
- g = g2 >> 32
- g2 &= bits32
-
- f4 = f3 >> 32
- f3 &= bits32
-
- f4 &= 255
- g3 = f3 + g
-
- g = g3 >> 32
- g3 &= bits32
-
- g4 = f4 + g
-
- g4 = g4 - 4
- s00 = uint32(s[0])
-
- f = uint64(int64(g4) >> 63)
- s01 = uint32(s[1])
-
- f0 &= f
- g0 &^= f
- s02 = uint32(s[2])
-
- f1 &= f
- f0 |= g0
- s03 = uint32(s[3])
-
- g1 &^= f
- f2 &= f
- s10 = uint32(s[4])
-
- f3 &= f
- g2 &^= f
- s11 = uint32(s[5])
-
- g3 &^= f
- f1 |= g1
- s12 = uint32(s[6])
-
- f2 |= g2
- f3 |= g3
- s13 = uint32(s[7])
-
- s01 <<= 8
- f0 += uint64(s00)
- s20 = uint32(s[8])
-
- s02 <<= 16
- f0 += uint64(s01)
- s21 = uint32(s[9])
-
- s03 <<= 24
- f0 += uint64(s02)
- s22 = uint32(s[10])
-
- s11 <<= 8
- f1 += uint64(s10)
- s23 = uint32(s[11])
-
- s12 <<= 16
- f1 += uint64(s11)
- s30 = uint32(s[12])
-
- s13 <<= 24
- f1 += uint64(s12)
- s31 = uint32(s[13])
-
- f0 += uint64(s03)
- f1 += uint64(s13)
- s32 = uint32(s[14])
-
- s21 <<= 8
- f2 += uint64(s20)
- s33 = uint32(s[15])
-
- s22 <<= 16
- f2 += uint64(s21)
-
- s23 <<= 24
- f2 += uint64(s22)
-
- s31 <<= 8
- f3 += uint64(s30)
-
- s32 <<= 16
- f3 += uint64(s31)
-
- s33 <<= 24
- f3 += uint64(s32)
-
- f2 += uint64(s23)
- f3 += uint64(s33)
-
- out[0] = byte(f0)
- f0 >>= 8
- out[1] = byte(f0)
- f0 >>= 8
- out[2] = byte(f0)
- f0 >>= 8
- out[3] = byte(f0)
- f0 >>= 8
- f1 += f0
-
- out[4] = byte(f1)
- f1 >>= 8
- out[5] = byte(f1)
- f1 >>= 8
- out[6] = byte(f1)
- f1 >>= 8
- out[7] = byte(f1)
- f1 >>= 8
- f2 += f1
-
- out[8] = byte(f2)
- f2 >>= 8
- out[9] = byte(f2)
- f2 >>= 8
- out[10] = byte(f2)
- f2 >>= 8
- out[11] = byte(f2)
- f2 >>= 8
- f3 += f2
-
- out[12] = byte(f3)
- f3 >>= 8
- out[13] = byte(f3)
- f3 >>= 8
- out[14] = byte(f3)
- f3 >>= 8
- out[15] = byte(f3)
+ // h %= p reduction
+ h2 += h1 >> 26
+ h1 &= 0x3ffffff
+ h3 += h2 >> 26
+ h2 &= 0x3ffffff
+ h4 += h3 >> 26
+ h3 &= 0x3ffffff
+ h0 += 5 * (h4 >> 26)
+ h4 &= 0x3ffffff
+ h1 += h0 >> 26
+ h0 &= 0x3ffffff
+
+ // h - p
+ t0 := h0 + 5
+ t1 := h1 + (t0 >> 26)
+ t2 := h2 + (t1 >> 26)
+ t3 := h3 + (t2 >> 26)
+ t4 := h4 + (t3 >> 26) - (1 << 26)
+ t0 &= 0x3ffffff
+ t1 &= 0x3ffffff
+ t2 &= 0x3ffffff
+ t3 &= 0x3ffffff
+
+ // select h if h < p else h - p
+ t_mask := (t4 >> 31) - 1
+ h_mask := ^t_mask
+ h0 = (h0 & h_mask) | (t0 & t_mask)
+ h1 = (h1 & h_mask) | (t1 & t_mask)
+ h2 = (h2 & h_mask) | (t2 & t_mask)
+ h3 = (h3 & h_mask) | (t3 & t_mask)
+ h4 = (h4 & h_mask) | (t4 & t_mask)
+
+ // h %= 2^128
+ h0 |= h1 << 26
+ h1 = ((h1 >> 6) | (h2 << 20))
+ h2 = ((h2 >> 12) | (h3 << 14))
+ h3 = ((h3 >> 18) | (h4 << 8))
+
+ // s: the s part of the key
+ // tag = (h + s) % (2^128)
+ t := uint64(h0) + uint64(binary.LittleEndian.Uint32(key[16:]))
+ h0 = uint32(t)
+ t = uint64(h1) + uint64(binary.LittleEndian.Uint32(key[20:])) + (t >> 32)
+ h1 = uint32(t)
+ t = uint64(h2) + uint64(binary.LittleEndian.Uint32(key[24:])) + (t >> 32)
+ h2 = uint32(t)
+ t = uint64(h3) + uint64(binary.LittleEndian.Uint32(key[28:])) + (t >> 32)
+ h3 = uint32(t)
+
+ binary.LittleEndian.PutUint32(out[0:], h0)
+ binary.LittleEndian.PutUint32(out[4:], h1)
+ binary.LittleEndian.PutUint32(out[8:], h2)
+ binary.LittleEndian.PutUint32(out[12:], h3)
}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/client_test.go b/vendor/golang.org/x/crypto/ssh/agent/client_test.go
index e33d47138..a13a65001 100644
--- a/vendor/golang.org/x/crypto/ssh/agent/client_test.go
+++ b/vendor/golang.org/x/crypto/ssh/agent/client_test.go
@@ -180,7 +180,7 @@ func TestCert(t *testing.T) {
// therefore is buffered (net.Pipe deadlocks if both sides start with
// a write.)
func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", "127.0.0.1:0")
+ listener, err := net.Listen("tcp", ":0")
if err != nil {
return nil, nil, err
}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
index 34d3917c4..13484ab4b 100644
--- a/vendor/golang.org/x/crypto/ssh/cipher.go
+++ b/vendor/golang.org/x/crypto/ssh/cipher.go
@@ -135,6 +135,7 @@ const prefixLen = 5
type streamPacketCipher struct {
mac hash.Hash
cipher cipher.Stream
+ etm bool
// The following members are to avoid per-packet allocations.
prefix [prefixLen]byte
@@ -150,7 +151,14 @@ func (s *streamPacketCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, err
return nil, err
}
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
+ var encryptedPaddingLength [1]byte
+ if s.mac != nil && s.etm {
+ copy(encryptedPaddingLength[:], s.prefix[4:5])
+ s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
+ } else {
+ s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
+ }
+
length := binary.BigEndian.Uint32(s.prefix[0:4])
paddingLength := uint32(s.prefix[4])
@@ -159,7 +167,12 @@ func (s *streamPacketCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, err
s.mac.Reset()
binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
s.mac.Write(s.seqNumBytes[:])
- s.mac.Write(s.prefix[:])
+ if s.etm {
+ s.mac.Write(s.prefix[:4])
+ s.mac.Write(encryptedPaddingLength[:])
+ } else {
+ s.mac.Write(s.prefix[:])
+ }
macSize = uint32(s.mac.Size())
}
@@ -184,10 +197,17 @@ func (s *streamPacketCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, err
}
mac := s.packetData[length-1:]
data := s.packetData[:length-1]
+
+ if s.mac != nil && s.etm {
+ s.mac.Write(data)
+ }
+
s.cipher.XORKeyStream(data, data)
if s.mac != nil {
- s.mac.Write(data)
+ if !s.etm {
+ s.mac.Write(data)
+ }
s.macResult = s.mac.Sum(s.macResult[:0])
if subtle.ConstantTimeCompare(s.macResult, mac) != 1 {
return nil, errors.New("ssh: MAC failure")
@@ -203,7 +223,13 @@ func (s *streamPacketCipher) writePacket(seqNum uint32, w io.Writer, rand io.Rea
return errors.New("ssh: packet too large")
}
- paddingLength := packetSizeMultiple - (prefixLen+len(packet))%packetSizeMultiple
+ aadlen := 0
+ if s.mac != nil && s.etm {
+ // packet length is not encrypted for EtM modes
+ aadlen = 4
+ }
+
+ paddingLength := packetSizeMultiple - (prefixLen+len(packet)-aadlen)%packetSizeMultiple
if paddingLength < 4 {
paddingLength += packetSizeMultiple
}
@@ -220,15 +246,37 @@ func (s *streamPacketCipher) writePacket(seqNum uint32, w io.Writer, rand io.Rea
s.mac.Reset()
binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
s.mac.Write(s.seqNumBytes[:])
+
+ if s.etm {
+ // For EtM algorithms, the packet length must stay unencrypted,
+ // but the following data (padding length) must be encrypted
+ s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
+ }
+
s.mac.Write(s.prefix[:])
- s.mac.Write(packet)
- s.mac.Write(padding)
+
+ if !s.etm {
+ // For non-EtM algorithms, the algorithm is applied on unencrypted data
+ s.mac.Write(packet)
+ s.mac.Write(padding)
+ }
+ }
+
+ if !(s.mac != nil && s.etm) {
+ // For EtM algorithms, the padding length has already been encrypted
+ // and the packet length must remain unencrypted
+ s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
}
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
s.cipher.XORKeyStream(packet, packet)
s.cipher.XORKeyStream(padding, padding)
+ if s.mac != nil && s.etm {
+ // For EtM algorithms, packet and padding must be encrypted
+ s.mac.Write(packet)
+ s.mac.Write(padding)
+ }
+
if _, err := w.Write(s.prefix[:]); err != nil {
return err
}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher_test.go b/vendor/golang.org/x/crypto/ssh/cipher_test.go
index eced8d851..5cfa17a62 100644
--- a/vendor/golang.org/x/crypto/ssh/cipher_test.go
+++ b/vendor/golang.org/x/crypto/ssh/cipher_test.go
@@ -26,39 +26,41 @@ func TestPacketCiphers(t *testing.T) {
defer delete(cipherModes, aes128cbcID)
for cipher := range cipherModes {
- kr := &kexResult{Hash: crypto.SHA1}
- algs := directionAlgorithms{
- Cipher: cipher,
- MAC: "hmac-sha1",
- Compression: "none",
- }
- client, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Errorf("newPacketCipher(client, %q): %v", cipher, err)
- continue
- }
- server, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Errorf("newPacketCipher(client, %q): %v", cipher, err)
- continue
- }
-
- want := "bla bla"
- input := []byte(want)
- buf := &bytes.Buffer{}
- if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
- t.Errorf("writePacket(%q): %v", cipher, err)
- continue
- }
-
- packet, err := server.readPacket(0, buf)
- if err != nil {
- t.Errorf("readPacket(%q): %v", cipher, err)
- continue
- }
-
- if string(packet) != want {
- t.Errorf("roundtrip(%q): got %q, want %q", cipher, packet, want)
+ for mac := range macModes {
+ kr := &kexResult{Hash: crypto.SHA1}
+ algs := directionAlgorithms{
+ Cipher: cipher,
+ MAC: mac,
+ Compression: "none",
+ }
+ client, err := newPacketCipher(clientKeys, algs, kr)
+ if err != nil {
+ t.Errorf("newPacketCipher(client, %q, %q): %v", cipher, mac, err)
+ continue
+ }
+ server, err := newPacketCipher(clientKeys, algs, kr)
+ if err != nil {
+ t.Errorf("newPacketCipher(client, %q, %q): %v", cipher, mac, err)
+ continue
+ }
+
+ want := "bla bla"
+ input := []byte(want)
+ buf := &bytes.Buffer{}
+ if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
+ t.Errorf("writePacket(%q, %q): %v", cipher, mac, err)
+ continue
+ }
+
+ packet, err := server.readPacket(0, buf)
+ if err != nil {
+ t.Errorf("readPacket(%q, %q): %v", cipher, mac, err)
+ continue
+ }
+
+ if string(packet) != want {
+ t.Errorf("roundtrip(%q, %q): got %q, want %q", cipher, mac, packet, want)
+ }
}
}
}
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/vendor/golang.org/x/crypto/ssh/client_auth_test.go
index 1d9681a06..e384c796b 100644
--- a/vendor/golang.org/x/crypto/ssh/client_auth_test.go
+++ b/vendor/golang.org/x/crypto/ssh/client_auth_test.go
@@ -333,14 +333,14 @@ func TestClientLoginCert(t *testing.T) {
}
// allowed source address
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42/24"}
+ cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42/24,::42/120"}
cert.SignCert(rand.Reader, testSigners["ecdsa"])
if err := tryAuth(t, clientConfig); err != nil {
t.Errorf("cert login with source-address failed: %v", err)
}
// disallowed source address
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42"}
+ cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42,::42"}
cert.SignCert(rand.Reader, testSigners["ecdsa"])
if err := tryAuth(t, clientConfig); err == nil {
t.Errorf("cert login with source-address succeeded")
diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go
index faabb7ef9..8656d0f85 100644
--- a/vendor/golang.org/x/crypto/ssh/common.go
+++ b/vendor/golang.org/x/crypto/ssh/common.go
@@ -56,7 +56,7 @@ var supportedHostKeyAlgos = []string{
// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
// because they have reached the end of their useful life.
var supportedMACs = []string{
- "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
+ "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
}
var supportedCompressions = []string{compressionNone}
diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go
index 57f2d3daf..8de650644 100644
--- a/vendor/golang.org/x/crypto/ssh/handshake.go
+++ b/vendor/golang.org/x/crypto/ssh/handshake.go
@@ -66,8 +66,8 @@ type handshakeTransport struct {
// If the read loop wants to schedule a kex, it pings this
// channel, and the write loop will send out a kex
- // message. The boolean is whether this is the first request or not.
- requestKex chan bool
+ // message.
+ requestKex chan struct{}
// If the other side requests or confirms a kex, its kexInit
// packet is sent here for the write loop to find it.
@@ -102,14 +102,14 @@ func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion,
serverVersion: serverVersion,
clientVersion: clientVersion,
incoming: make(chan []byte, chanSize),
- requestKex: make(chan bool, 1),
+ requestKex: make(chan struct{}, 1),
startKex: make(chan *pendingKex, 1),
config: config,
}
// We always start with a mandatory key exchange.
- t.requestKex <- true
+ t.requestKex <- struct{}{}
return t
}
@@ -166,6 +166,7 @@ func (t *handshakeTransport) printPacket(p []byte, write bool) {
if write {
action = "sent"
}
+
if p[0] == msgChannelData || p[0] == msgChannelExtendedData {
log.Printf("%s %s data (packet %d bytes)", t.id(), action, len(p))
} else {
@@ -230,14 +231,13 @@ func (t *handshakeTransport) recordWriteError(err error) {
func (t *handshakeTransport) requestKeyExchange() {
select {
- case t.requestKex <- false:
+ case t.requestKex <- struct{}{}:
default:
// something already requested a kex, so do nothing.
}
}
func (t *handshakeTransport) kexLoop() {
- firstSent := false
write:
for t.getWriteError() == nil {
@@ -251,18 +251,8 @@ write:
if !ok {
break write
}
- case requestFirst := <-t.requestKex:
- // For the first key exchange, both
- // sides will initiate a key exchange,
- // and both channels will fire. To
- // avoid doing two key exchanges in a
- // row, ignore our own request for an
- // initial kex if we have already sent
- // it out.
- if firstSent && requestFirst {
-
- continue
- }
+ case <-t.requestKex:
+ break
}
if !sent {
@@ -270,7 +260,6 @@ write:
t.recordWriteError(err)
break
}
- firstSent = true
sent = true
}
}
@@ -287,7 +276,8 @@ write:
// We're not servicing t.startKex, but the remote end
// has just sent us a kexInitMsg, so it can't send
- // another key change request.
+ // another key change request, until we close the done
+ // channel on the pendingKex request.
err := t.enterKeyExchange(request.otherInit)
@@ -301,6 +291,23 @@ write:
} else if t.algorithms != nil {
t.writeBytesLeft = t.algorithms.w.rekeyBytes()
}
+
+ // we have completed the key exchange. Since the
+ // reader is still blocked, it is safe to clear out
+ // the requestKex channel. This avoids the situation
+ // where: 1) we consumed our own request for the
+ // initial kex, and 2) the kex from the remote side
+ // caused another send on the requestKex channel,
+ clear:
+ for {
+ select {
+ case <-t.requestKex:
+ //
+ default:
+ break clear
+ }
+ }
+
request.done <- t.writeError
// kex finished. Push packets that we received while
@@ -314,7 +321,7 @@ write:
break
}
}
- t.pendingPackets = t.pendingPackets[0:]
+ t.pendingPackets = t.pendingPackets[:0]
t.mu.Unlock()
}
diff --git a/vendor/golang.org/x/crypto/ssh/handshake_test.go b/vendor/golang.org/x/crypto/ssh/handshake_test.go
index e61348fea..1b831127e 100644
--- a/vendor/golang.org/x/crypto/ssh/handshake_test.go
+++ b/vendor/golang.org/x/crypto/ssh/handshake_test.go
@@ -40,7 +40,7 @@ func (t *testChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error
// therefore is buffered (net.Pipe deadlocks if both sides start with
// a write.)
func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", "127.0.0.1:0")
+ listener, err := net.Listen("tcp", ":0")
if err != nil {
return nil, nil, err
}
@@ -125,7 +125,12 @@ func TestHandshakeBasic(t *testing.T) {
t.Skip("see golang.org/issue/7237")
}
- checker := &syncChecker{make(chan int, 10)}
+ checker := &syncChecker{
+ waitCall: make(chan int, 10),
+ called: make(chan int, 10),
+ }
+
+ checker.waitCall <- 1
trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr", false)
if err != nil {
t.Fatalf("handshakePair: %v", err)
@@ -134,22 +139,25 @@ func TestHandshakeBasic(t *testing.T) {
defer trC.Close()
defer trS.Close()
+ // Let first kex complete normally.
<-checker.called
clientDone := make(chan int, 0)
gotHalf := make(chan int, 0)
+ const N = 20
go func() {
defer close(clientDone)
// Client writes a bunch of stuff, and does a key
// change in the middle. This should not confuse the
- // handshake in progress
- for i := 0; i < 10; i++ {
+ // handshake in progress. We do this twice, so we test
+ // that the packet buffer is reset correctly.
+ for i := 0; i < N; i++ {
p := []byte{msgRequestSuccess, byte(i)}
if err := trC.writePacket(p); err != nil {
t.Fatalf("sendPacket: %v", err)
}
- if i == 5 {
+ if (i % 10) == 5 {
<-gotHalf
// halfway through, we request a key change.
trC.requestKeyExchange()
@@ -159,32 +167,38 @@ func TestHandshakeBasic(t *testing.T) {
// write more.
<-checker.called
}
+ if (i % 10) == 7 {
+ // write some packets until the kex
+ // completes, to test buffering of
+ // packets.
+ checker.waitCall <- 1
+ }
}
}()
// Server checks that client messages come in cleanly
i := 0
err = nil
- for ; i < 10; i++ {
+ for ; i < N; i++ {
var p []byte
p, err = trS.readPacket()
if err != nil {
break
}
- if i == 5 {
+ if (i % 10) == 5 {
gotHalf <- 1
}
want := []byte{msgRequestSuccess, byte(i)}
if bytes.Compare(p, want) != 0 {
- t.Errorf("message %d: got %q, want %q", i, p, want)
+ t.Errorf("message %d: got %v, want %v", i, p, want)
}
}
<-clientDone
if err != nil && err != io.EOF {
t.Fatalf("server error: %v", err)
}
- if i != 10 {
+ if i != N {
t.Errorf("received %d messages, want 10.", i)
}
@@ -239,7 +253,10 @@ func TestForceFirstKex(t *testing.T) {
}
func TestHandshakeAutoRekeyWrite(t *testing.T) {
- checker := &syncChecker{make(chan int, 10)}
+ checker := &syncChecker{
+ called: make(chan int, 10),
+ waitCall: nil,
+ }
clientConf := &ClientConfig{HostKeyCallback: checker.Check}
clientConf.RekeyThreshold = 500
trC, trS, err := handshakePair(clientConf, "addr", false)
@@ -249,14 +266,19 @@ func TestHandshakeAutoRekeyWrite(t *testing.T) {
defer trC.Close()
defer trS.Close()
+ input := make([]byte, 251)
+ input[0] = msgRequestSuccess
+
done := make(chan int, 1)
const numPacket = 5
go func() {
defer close(done)
j := 0
for ; j < numPacket; j++ {
- if _, err := trS.readPacket(); err != nil {
+ if p, err := trS.readPacket(); err != nil {
break
+ } else if !bytes.Equal(input, p) {
+ t.Errorf("got packet type %d, want %d", p[0], input[0])
}
}
@@ -268,9 +290,9 @@ func TestHandshakeAutoRekeyWrite(t *testing.T) {
<-checker.called
for i := 0; i < numPacket; i++ {
- packet := make([]byte, 251)
- packet[0] = msgRequestSuccess
- if err := trC.writePacket(packet); err != nil {
+ p := make([]byte, len(input))
+ copy(p, input)
+ if err := trC.writePacket(p); err != nil {
t.Errorf("writePacket: %v", err)
}
if i == 2 {
@@ -283,16 +305,23 @@ func TestHandshakeAutoRekeyWrite(t *testing.T) {
}
type syncChecker struct {
- called chan int
+ waitCall chan int
+ called chan int
}
func (c *syncChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error {
c.called <- 1
+ if c.waitCall != nil {
+ <-c.waitCall
+ }
return nil
}
func TestHandshakeAutoRekeyRead(t *testing.T) {
- sync := &syncChecker{make(chan int, 2)}
+ sync := &syncChecker{
+ called: make(chan int, 2),
+ waitCall: nil,
+ }
clientConf := &ClientConfig{
HostKeyCallback: sync.Check,
}
diff --git a/vendor/golang.org/x/crypto/ssh/mac.go b/vendor/golang.org/x/crypto/ssh/mac.go
index 07744ad67..c07a06285 100644
--- a/vendor/golang.org/x/crypto/ssh/mac.go
+++ b/vendor/golang.org/x/crypto/ssh/mac.go
@@ -15,6 +15,7 @@ import (
type macMode struct {
keySize int
+ etm bool
new func(key []byte) hash.Hash
}
@@ -45,13 +46,16 @@ func (t truncatingMAC) Size() int {
func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
var macModes = map[string]*macMode{
- "hmac-sha2-256": {32, func(key []byte) hash.Hash {
+ "hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
return hmac.New(sha256.New, key)
}},
- "hmac-sha1": {20, func(key []byte) hash.Hash {
+ "hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
+ return hmac.New(sha256.New, key)
+ }},
+ "hmac-sha1": {20, false, func(key []byte) hash.Hash {
return hmac.New(sha1.New, key)
}},
- "hmac-sha1-96": {20, func(key []byte) hash.Hash {
+ "hmac-sha1-96": {20, false, func(key []byte) hash.Hash {
return truncatingMAC{12, hmac.New(sha1.New, key)}
}},
}
diff --git a/vendor/golang.org/x/crypto/ssh/mux_test.go b/vendor/golang.org/x/crypto/ssh/mux_test.go
index 591aae8e8..25d2181d6 100644
--- a/vendor/golang.org/x/crypto/ssh/mux_test.go
+++ b/vendor/golang.org/x/crypto/ssh/mux_test.go
@@ -499,4 +499,7 @@ func TestDebug(t *testing.T) {
if debugHandshake {
t.Error("handshake debug switched on")
}
+ if debugTransport {
+ t.Error("transport debug switched on")
+ }
}
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
index 28b109a9c..77c84d165 100644
--- a/vendor/golang.org/x/crypto/ssh/server.go
+++ b/vendor/golang.org/x/crypto/ssh/server.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"net"
+ "strings"
)
// The Permissions type holds fine-grained permissions that are
@@ -231,7 +232,7 @@ func isAcceptableAlgo(algo string) bool {
return false
}
-func checkSourceAddress(addr net.Addr, sourceAddr string) error {
+func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
if addr == nil {
return errors.New("ssh: no address known for client, but source-address match required")
}
@@ -241,18 +242,20 @@ func checkSourceAddress(addr net.Addr, sourceAddr string) error {
return fmt.Errorf("ssh: remote address %v is not an TCP address when checking source-address match", addr)
}
- if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
- if allowedIP.Equal(tcpAddr.IP) {
- return nil
- }
- } else {
- _, ipNet, err := net.ParseCIDR(sourceAddr)
- if err != nil {
- return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
- }
+ for _, sourceAddr := range strings.Split(sourceAddrs, ",") {
+ if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
+ if allowedIP.Equal(tcpAddr.IP) {
+ return nil
+ }
+ } else {
+ _, ipNet, err := net.ParseCIDR(sourceAddr)
+ if err != nil {
+ return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
+ }
- if ipNet.Contains(tcpAddr.IP) {
- return nil
+ if ipNet.Contains(tcpAddr.IP) {
+ return nil
+ }
}
}
diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go
index fd199324d..f9780e0ae 100644
--- a/vendor/golang.org/x/crypto/ssh/transport.go
+++ b/vendor/golang.org/x/crypto/ssh/transport.go
@@ -8,8 +8,13 @@ import (
"bufio"
"errors"
"io"
+ "log"
)
+// debugTransport if set, will print packet types as they go over the
+// wire. No message decoding is done, to minimize the impact on timing.
+const debugTransport = false
+
const (
gcmCipherID = "aes128-gcm@openssh.com"
aes128cbcID = "aes128-cbc"
@@ -40,7 +45,7 @@ type transport struct {
bufReader *bufio.Reader
bufWriter *bufio.Writer
rand io.Reader
-
+ isClient bool
io.Closer
}
@@ -86,6 +91,22 @@ func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) err
return nil
}
+func (t *transport) printPacket(p []byte, write bool) {
+ if len(p) == 0 {
+ return
+ }
+ who := "server"
+ if t.isClient {
+ who = "client"
+ }
+ what := "read"
+ if write {
+ what = "write"
+ }
+
+ log.Println(what, who, p[0])
+}
+
// Read and decrypt next packet.
func (t *transport) readPacket() (p []byte, err error) {
for {
@@ -97,6 +118,9 @@ func (t *transport) readPacket() (p []byte, err error) {
break
}
}
+ if debugTransport {
+ t.printPacket(p, false)
+ }
return p, err
}
@@ -141,6 +165,9 @@ func (s *connectionState) readPacket(r *bufio.Reader) ([]byte, error) {
}
func (t *transport) writePacket(packet []byte) error {
+ if debugTransport {
+ t.printPacket(packet, true)
+ }
return t.writer.writePacket(t.bufWriter, t.rand, packet)
}
@@ -181,6 +208,8 @@ func newTransport(rwc io.ReadWriteCloser, rand io.Reader, isClient bool) *transp
},
Closer: rwc,
}
+ t.isClient = isClient
+
if isClient {
t.reader.dir = serverKeys
t.writer.dir = clientKeys
@@ -238,6 +267,7 @@ func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (pac
c := &streamPacketCipher{
mac: macModes[algs.MAC].new(macKey),
+ etm: macModes[algs.MAC].etm,
}
c.macResult = make([]byte, c.mac.Size())
diff --git a/vendor/golang.org/x/image/draw/draw.go b/vendor/golang.org/x/image/draw/draw.go
index b92e3c7f9..dfaa7fc55 100644
--- a/vendor/golang.org/x/image/draw/draw.go
+++ b/vendor/golang.org/x/image/draw/draw.go
@@ -11,12 +11,12 @@
// package in the standard library.
package draw
-// This file just contains the API exported by the image/draw package in the
-// standard library. Other files in this package provide additional features.
+// This file, and the go1_*.go files, just contains the API exported by the
+// image/draw package in the standard library. Other files in this package
+// provide additional features.
import (
"image"
- "image/color"
"image/draw"
)
@@ -32,13 +32,6 @@ func DrawMask(dst Image, r image.Rectangle, src image.Image, sp image.Point, mas
draw.DrawMask(dst, r, src, sp, mask, mp, draw.Op(op))
}
-// Drawer contains the Draw method.
-type Drawer interface {
- // Draw aligns r.Min in dst with sp in src and then replaces the
- // rectangle r in dst with the result of drawing src on dst.
- Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)
-}
-
// FloydSteinberg is a Drawer that is the Src Op with Floyd-Steinberg error
// diffusion.
var FloydSteinberg Drawer = floydSteinberg{}
@@ -48,32 +41,3 @@ type floydSteinberg struct{}
func (floydSteinberg) Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) {
draw.FloydSteinberg.Draw(dst, r, src, sp)
}
-
-// Image is an image.Image with a Set method to change a single pixel.
-type Image interface {
- image.Image
- Set(x, y int, c color.Color)
-}
-
-// Op is a Porter-Duff compositing operator.
-type Op int
-
-const (
- // Over specifies ``(src in mask) over dst''.
- Over Op = Op(draw.Over)
- // Src specifies ``src in mask''.
- Src Op = Op(draw.Src)
-)
-
-// Draw implements the Drawer interface by calling the Draw function with
-// this Op.
-func (op Op) Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) {
- (draw.Op(op)).Draw(dst, r, src, sp)
-}
-
-// Quantizer produces a palette for an image.
-type Quantizer interface {
- // Quantize appends up to cap(p) - len(p) colors to p and returns the
- // updated palette suitable for converting m to a paletted image.
- Quantize(p color.Palette, m image.Image) color.Palette
-}
diff --git a/vendor/golang.org/x/image/draw/gen.go b/vendor/golang.org/x/image/draw/gen.go
index 0fed47437..65a712350 100644
--- a/vendor/golang.org/x/image/draw/gen.go
+++ b/vendor/golang.org/x/image/draw/gen.go
@@ -804,7 +804,7 @@ func cOffset(x, y, sratio string) string {
func ycbcrToRGB(lhs, tmp string) string {
s := `
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- $yy1 := int(src.Y[$i]) * 0x10100
+ $yy1 := int(src.Y[$i]) * 0x10101
$cb1 := int(src.Cb[$j]) - 128
$cr1 := int(src.Cr[$j]) - 128
$r@ := ($yy1 + 91881*$cr1) >> 8
diff --git a/vendor/golang.org/x/image/draw/go1_8.go b/vendor/golang.org/x/image/draw/go1_8.go
new file mode 100644
index 000000000..ec192b717
--- /dev/null
+++ b/vendor/golang.org/x/image/draw/go1_8.go
@@ -0,0 +1,49 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !go1.9,!go1.8.typealias
+
+package draw
+
+import (
+ "image"
+ "image/color"
+ "image/draw"
+)
+
+// Drawer contains the Draw method.
+type Drawer interface {
+ // Draw aligns r.Min in dst with sp in src and then replaces the
+ // rectangle r in dst with the result of drawing src on dst.
+ Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)
+}
+
+// Image is an image.Image with a Set method to change a single pixel.
+type Image interface {
+ image.Image
+ Set(x, y int, c color.Color)
+}
+
+// Op is a Porter-Duff compositing operator.
+type Op int
+
+const (
+ // Over specifies ``(src in mask) over dst''.
+ Over Op = Op(draw.Over)
+ // Src specifies ``src in mask''.
+ Src Op = Op(draw.Src)
+)
+
+// Draw implements the Drawer interface by calling the Draw function with
+// this Op.
+func (op Op) Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) {
+ (draw.Op(op)).Draw(dst, r, src, sp)
+}
+
+// Quantizer produces a palette for an image.
+type Quantizer interface {
+ // Quantize appends up to cap(p) - len(p) colors to p and returns the
+ // updated palette suitable for converting m to a paletted image.
+ Quantize(p color.Palette, m image.Image) color.Palette
+}
diff --git a/vendor/golang.org/x/image/draw/go1_9.go b/vendor/golang.org/x/image/draw/go1_9.go
new file mode 100644
index 000000000..fc548e947
--- /dev/null
+++ b/vendor/golang.org/x/image/draw/go1_9.go
@@ -0,0 +1,57 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9 go1.8.typealias
+
+package draw
+
+import (
+ "image/draw"
+)
+
+// We use type aliases (new in Go 1.9) for the exported names from the standard
+// library's image/draw package. This is not merely syntactic sugar for
+//
+// type Drawer draw.Drawer
+//
+// as aliasing means that the types in this package, such as draw.Image and
+// draw.Op, are identical to the corresponding draw.Image and draw.Op types in
+// the standard library. In comparison, prior to Go 1.9, the code in go1_8.go
+// defines new types that mimic the old but are different types.
+//
+// The package documentation, in draw.go, explicitly gives the intent of this
+// package:
+//
+// This package is a superset of and a drop-in replacement for the
+// image/draw package in the standard library.
+//
+// Drop-in replacement means that I can replace all of my "image/draw" imports
+// with "golang.org/x/image/draw", to access additional features in this
+// package, and no further changes are required. That's mostly true, but not
+// completely true unless we use type aliases.
+//
+// Without type aliases, users might need to import both "image/draw" and
+// "golang.org/x/image/draw" in order to convert from two conceptually
+// equivalent but different (from the compiler's point of view) types, such as
+// from one draw.Op type to another draw.Op type, to satisfy some other
+// interface or function signature.
+
+// Drawer contains the Draw method.
+type Drawer = draw.Drawer
+
+// Image is an image.Image with a Set method to change a single pixel.
+type Image = draw.Image
+
+// Op is a Porter-Duff compositing operator.
+type Op = draw.Op
+
+const (
+ // Over specifies ``(src in mask) over dst''.
+ Over Op = draw.Over
+ // Src specifies ``src in mask''.
+ Src Op = draw.Src
+)
+
+// Quantizer produces a palette for an image.
+type Quantizer = draw.Quantizer
diff --git a/vendor/golang.org/x/image/draw/impl.go b/vendor/golang.org/x/image/draw/impl.go
index d6484d734..637887be6 100644
--- a/vendor/golang.org/x/image/draw/impl.go
+++ b/vendor/golang.org/x/image/draw/impl.go
@@ -343,7 +343,7 @@ func (nnInterpolator) scale_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Rec
pj := (sr.Min.Y+int(sy)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(sx) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -386,7 +386,7 @@ func (nnInterpolator) scale_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Rec
pj := (sr.Min.Y+int(sy)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(sx))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -429,7 +429,7 @@ func (nnInterpolator) scale_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Rec
pj := ((sr.Min.Y+int(sy))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(sx))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -472,7 +472,7 @@ func (nnInterpolator) scale_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Rec
pj := ((sr.Min.Y+int(sy))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(sx) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -759,7 +759,7 @@ func (nnInterpolator) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image
pj := (sy0-src.Rect.Min.Y)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -803,7 +803,7 @@ func (nnInterpolator) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image
pj := (sy0-src.Rect.Min.Y)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -847,7 +847,7 @@ func (nnInterpolator) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image
pj := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -891,7 +891,7 @@ func (nnInterpolator) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image
pj := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pr := (pyy1 + 91881*pcr1) >> 8
@@ -1756,7 +1756,7 @@ func (ablInterpolator) scale_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Re
s00j := (sr.Min.Y+int(sy0)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(sx0) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -1785,7 +1785,7 @@ func (ablInterpolator) scale_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Re
s10j := (sr.Min.Y+int(sy0)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(sx1) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -1817,7 +1817,7 @@ func (ablInterpolator) scale_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Re
s01j := (sr.Min.Y+int(sy1)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(sx0) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -1846,7 +1846,7 @@ func (ablInterpolator) scale_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Re
s11j := (sr.Min.Y+int(sy1)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(sx1) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -1931,7 +1931,7 @@ func (ablInterpolator) scale_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Re
s00j := (sr.Min.Y+int(sy0)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(sx0))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -1960,7 +1960,7 @@ func (ablInterpolator) scale_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Re
s10j := (sr.Min.Y+int(sy0)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(sx1))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -1992,7 +1992,7 @@ func (ablInterpolator) scale_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Re
s01j := (sr.Min.Y+int(sy1)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(sx0))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -2021,7 +2021,7 @@ func (ablInterpolator) scale_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Re
s11j := (sr.Min.Y+int(sy1)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(sx1))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -2106,7 +2106,7 @@ func (ablInterpolator) scale_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Re
s00j := ((sr.Min.Y+int(sy0))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(sx0))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -2135,7 +2135,7 @@ func (ablInterpolator) scale_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Re
s10j := ((sr.Min.Y+int(sy0))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(sx1))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -2167,7 +2167,7 @@ func (ablInterpolator) scale_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Re
s01j := ((sr.Min.Y+int(sy1))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(sx0))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -2196,7 +2196,7 @@ func (ablInterpolator) scale_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Re
s11j := ((sr.Min.Y+int(sy1))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(sx1))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -2281,7 +2281,7 @@ func (ablInterpolator) scale_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Re
s00j := ((sr.Min.Y+int(sy0))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(sx0) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -2310,7 +2310,7 @@ func (ablInterpolator) scale_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Re
s10j := ((sr.Min.Y+int(sy0))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(sx1) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -2342,7 +2342,7 @@ func (ablInterpolator) scale_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Re
s01j := ((sr.Min.Y+int(sy1))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(sx0) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -2371,7 +2371,7 @@ func (ablInterpolator) scale_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Re
s11j := ((sr.Min.Y+int(sy1))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(sx1) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -3345,7 +3345,7 @@ func (ablInterpolator) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr imag
s00j := (sy0-src.Rect.Min.Y)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -3374,7 +3374,7 @@ func (ablInterpolator) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr imag
s10j := (sy0-src.Rect.Min.Y)*src.CStride + (sx1 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -3406,7 +3406,7 @@ func (ablInterpolator) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr imag
s01j := (sy1-src.Rect.Min.Y)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -3435,7 +3435,7 @@ func (ablInterpolator) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr imag
s11j := (sy1-src.Rect.Min.Y)*src.CStride + (sx1 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -3521,7 +3521,7 @@ func (ablInterpolator) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr imag
s00j := (sy0-src.Rect.Min.Y)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -3550,7 +3550,7 @@ func (ablInterpolator) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr imag
s10j := (sy0-src.Rect.Min.Y)*src.CStride + ((sx1)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -3582,7 +3582,7 @@ func (ablInterpolator) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr imag
s01j := (sy1-src.Rect.Min.Y)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -3611,7 +3611,7 @@ func (ablInterpolator) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr imag
s11j := (sy1-src.Rect.Min.Y)*src.CStride + ((sx1)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -3697,7 +3697,7 @@ func (ablInterpolator) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr imag
s00j := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -3726,7 +3726,7 @@ func (ablInterpolator) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr imag
s10j := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + ((sx1)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -3758,7 +3758,7 @@ func (ablInterpolator) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr imag
s01j := ((sy1)/2-src.Rect.Min.Y/2)*src.CStride + ((sx0)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -3787,7 +3787,7 @@ func (ablInterpolator) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr imag
s11j := ((sy1)/2-src.Rect.Min.Y/2)*src.CStride + ((sx1)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -3873,7 +3873,7 @@ func (ablInterpolator) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr imag
s00j := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s00yy1 := int(src.Y[s00i]) * 0x10100
+ s00yy1 := int(src.Y[s00i]) * 0x10101
s00cb1 := int(src.Cb[s00j]) - 128
s00cr1 := int(src.Cr[s00j]) - 128
s00ru := (s00yy1 + 91881*s00cr1) >> 8
@@ -3902,7 +3902,7 @@ func (ablInterpolator) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr imag
s10j := ((sy0)/2-src.Rect.Min.Y/2)*src.CStride + (sx1 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s10yy1 := int(src.Y[s10i]) * 0x10100
+ s10yy1 := int(src.Y[s10i]) * 0x10101
s10cb1 := int(src.Cb[s10j]) - 128
s10cr1 := int(src.Cr[s10j]) - 128
s10ru := (s10yy1 + 91881*s10cr1) >> 8
@@ -3934,7 +3934,7 @@ func (ablInterpolator) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr imag
s01j := ((sy1)/2-src.Rect.Min.Y/2)*src.CStride + (sx0 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s01yy1 := int(src.Y[s01i]) * 0x10100
+ s01yy1 := int(src.Y[s01i]) * 0x10101
s01cb1 := int(src.Cb[s01j]) - 128
s01cr1 := int(src.Cr[s01j]) - 128
s01ru := (s01yy1 + 91881*s01cr1) >> 8
@@ -3963,7 +3963,7 @@ func (ablInterpolator) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr imag
s11j := ((sy1)/2-src.Rect.Min.Y/2)*src.CStride + (sx1 - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- s11yy1 := int(src.Y[s11i]) * 0x10100
+ s11yy1 := int(src.Y[s11i]) * 0x10101
s11cb1 := int(src.Cb[s11j]) - 128
s11cr1 := int(src.Cr[s11j]) - 128
s11ru := (s11yy1 + 91881*s11cr1) >> 8
@@ -4729,7 +4729,7 @@ func (z *kernelScaler) scaleX_YCbCr444(tmp [][4]float64, src *image.YCbCr, sr im
pj := (sr.Min.Y+int(y)-src.Rect.Min.Y)*src.CStride + (sr.Min.X + int(c.coord) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -4776,7 +4776,7 @@ func (z *kernelScaler) scaleX_YCbCr422(tmp [][4]float64, src *image.YCbCr, sr im
pj := (sr.Min.Y+int(y)-src.Rect.Min.Y)*src.CStride + ((sr.Min.X+int(c.coord))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -4823,7 +4823,7 @@ func (z *kernelScaler) scaleX_YCbCr420(tmp [][4]float64, src *image.YCbCr, sr im
pj := ((sr.Min.Y+int(y))/2-src.Rect.Min.Y/2)*src.CStride + ((sr.Min.X+int(c.coord))/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -4870,7 +4870,7 @@ func (z *kernelScaler) scaleX_YCbCr440(tmp [][4]float64, src *image.YCbCr, sr im
pj := ((sr.Min.Y+int(y))/2-src.Rect.Min.Y/2)*src.CStride + (sr.Min.X + int(c.coord) - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -5759,7 +5759,7 @@ func (q *Kernel) transform_RGBA_YCbCr444_Src(dst *image.RGBA, dr, adr image.Rect
pj := (ky-src.Rect.Min.Y)*src.CStride + (kx - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -5883,7 +5883,7 @@ func (q *Kernel) transform_RGBA_YCbCr422_Src(dst *image.RGBA, dr, adr image.Rect
pj := (ky-src.Rect.Min.Y)*src.CStride + ((kx)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -6007,7 +6007,7 @@ func (q *Kernel) transform_RGBA_YCbCr420_Src(dst *image.RGBA, dr, adr image.Rect
pj := ((ky)/2-src.Rect.Min.Y/2)*src.CStride + ((kx)/2 - src.Rect.Min.X/2)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
@@ -6131,7 +6131,7 @@ func (q *Kernel) transform_RGBA_YCbCr440_Src(dst *image.RGBA, dr, adr image.Rect
pj := ((ky)/2-src.Rect.Min.Y/2)*src.CStride + (kx - src.Rect.Min.X)
// This is an inline version of image/color/ycbcr.go's YCbCr.RGBA method.
- pyy1 := int(src.Y[pi]) * 0x10100
+ pyy1 := int(src.Y[pi]) * 0x10101
pcb1 := int(src.Cb[pj]) - 128
pcr1 := int(src.Cr[pj]) - 128
pru := (pyy1 + 91881*pcr1) >> 8
diff --git a/vendor/golang.org/x/image/draw/stdlib_test.go b/vendor/golang.org/x/image/draw/stdlib_test.go
index c45f78c2e..9015bfd6f 100644
--- a/vendor/golang.org/x/image/draw/stdlib_test.go
+++ b/vendor/golang.org/x/image/draw/stdlib_test.go
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.5
+// +build go1.9
package draw
// This file contains tests that depend on the exact behavior of the
// image/color package in the standard library. The color conversion formula
-// from YCbCr to RGBA changed between Go 1.4 and Go 1.5, so this file's tests
-// are only enabled for Go 1.5 and above.
+// from YCbCr to RGBA changed between Go 1.4 and Go 1.5, and between Go 1.8 and
+// Go 1.9, so this file's tests are only enabled for Go 1.9 and above.
import (
"bytes"
diff --git a/vendor/golang.org/x/image/font/sfnt/cmap.go b/vendor/golang.org/x/image/font/sfnt/cmap.go
new file mode 100644
index 000000000..42338f1bc
--- /dev/null
+++ b/vendor/golang.org/x/image/font/sfnt/cmap.go
@@ -0,0 +1,269 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sfnt
+
+import (
+ "unicode/utf8"
+
+ "golang.org/x/text/encoding/charmap"
+)
+
+// Platform IDs and Platform Specific IDs as per
+// https://www.microsoft.com/typography/otspec/name.htm
+const (
+ pidUnicode = 0
+ pidMacintosh = 1
+ pidWindows = 3
+
+ psidUnicode2BMPOnly = 3
+ psidUnicode2FullRepertoire = 4
+ // Note that FontForge may generate a bogus Platform Specific ID (value 10)
+ // for the Unicode Platform ID (value 0). See
+ // https://github.com/fontforge/fontforge/issues/2728
+
+ psidMacintoshRoman = 0
+
+ psidWindowsSymbol = 0
+ psidWindowsUCS2 = 1
+ psidWindowsUCS4 = 10
+)
+
+// platformEncodingWidth returns the number of bytes per character assumed by
+// the given Platform ID and Platform Specific ID.
+//
+// Very old fonts, from before Unicode was widely adopted, assume only 1 byte
+// per character: a character map.
+//
+// Old fonts, from when Unicode meant the Basic Multilingual Plane (BMP),
+// assume that 2 bytes per character is sufficient.
+//
+// Recent fonts naturally support the full range of Unicode code points, which
+// can take up to 4 bytes per character. Such fonts might still choose one of
+// the legacy encodings if e.g. their repertoire is limited to the BMP, for
+// greater compatibility with older software, or because the resultant file
+// size can be smaller.
+func platformEncodingWidth(pid, psid uint16) int {
+ switch pid {
+ case pidUnicode:
+ switch psid {
+ case psidUnicode2BMPOnly:
+ return 2
+ case psidUnicode2FullRepertoire:
+ return 4
+ }
+
+ case pidMacintosh:
+ switch psid {
+ case psidMacintoshRoman:
+ return 1
+ }
+
+ case pidWindows:
+ switch psid {
+ case psidWindowsSymbol:
+ return 2
+ case psidWindowsUCS2:
+ return 2
+ case psidWindowsUCS4:
+ return 4
+ }
+ }
+ return 0
+}
+
+// The various cmap formats are described at
+// https://www.microsoft.com/typography/otspec/cmap.htm
+
+var supportedCmapFormat = func(format, pid, psid uint16) bool {
+ switch format {
+ case 0:
+ return pid == pidMacintosh && psid == psidMacintoshRoman
+ case 4:
+ return true
+ case 12:
+ return true
+ }
+ return false
+}
+
+func (f *Font) makeCachedGlyphIndex(buf []byte, offset, length uint32, format uint16) ([]byte, glyphIndexFunc, error) {
+ switch format {
+ case 0:
+ return f.makeCachedGlyphIndexFormat0(buf, offset, length)
+ case 4:
+ return f.makeCachedGlyphIndexFormat4(buf, offset, length)
+ case 12:
+ return f.makeCachedGlyphIndexFormat12(buf, offset, length)
+ }
+ panic("unreachable")
+}
+
+func (f *Font) makeCachedGlyphIndexFormat0(buf []byte, offset, length uint32) ([]byte, glyphIndexFunc, error) {
+ if length != 6+256 || offset+length > f.cmap.length {
+ return nil, nil, errInvalidCmapTable
+ }
+ var err error
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), int(length))
+ if err != nil {
+ return nil, nil, err
+ }
+ var table [256]byte
+ copy(table[:], buf[6:])
+ return buf, func(f *Font, b *Buffer, r rune) (GlyphIndex, error) {
+ // TODO: for this closure to be goroutine-safe, the
+ // golang.org/x/text/encoding/charmap API needs to allocate a new
+ // Encoder and new []byte buffers, for every call to this closure, even
+ // though all we want to do is to encode one rune as one byte. We could
+ // possibly add some fields in the Buffer struct to re-use these
+ // allocations, but a better solution is to improve the charmap API.
+ var dst, src [utf8.UTFMax]byte
+ n := utf8.EncodeRune(src[:], r)
+ _, _, err = charmap.Macintosh.NewEncoder().Transform(dst[:], src[:n], true)
+ if err != nil {
+ // The source rune r is not representable in the Macintosh-Roman encoding.
+ return 0, nil
+ }
+ return GlyphIndex(table[dst[0]]), nil
+ }, nil
+}
+
+func (f *Font) makeCachedGlyphIndexFormat4(buf []byte, offset, length uint32) ([]byte, glyphIndexFunc, error) {
+ const headerSize = 14
+ if offset+headerSize > f.cmap.length {
+ return nil, nil, errInvalidCmapTable
+ }
+ var err error
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), headerSize)
+ if err != nil {
+ return nil, nil, err
+ }
+ offset += headerSize
+
+ segCount := u16(buf[6:])
+ if segCount&1 != 0 {
+ return nil, nil, errInvalidCmapTable
+ }
+ segCount /= 2
+ if segCount > maxCmapSegments {
+ return nil, nil, errUnsupportedNumberOfCmapSegments
+ }
+
+ eLength := 8*uint32(segCount) + 2
+ if offset+eLength > f.cmap.length {
+ return nil, nil, errInvalidCmapTable
+ }
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), int(eLength))
+ if err != nil {
+ return nil, nil, err
+ }
+ offset += eLength
+
+ entries := make([]cmapEntry16, segCount)
+ for i := range entries {
+ entries[i] = cmapEntry16{
+ end: u16(buf[0*len(entries)+0+2*i:]),
+ start: u16(buf[2*len(entries)+2+2*i:]),
+ delta: u16(buf[4*len(entries)+2+2*i:]),
+ offset: u16(buf[6*len(entries)+2+2*i:]),
+ }
+ }
+ indexesBase := f.cmap.offset + offset
+ indexesLength := f.cmap.length - offset
+
+ return buf, func(f *Font, b *Buffer, r rune) (GlyphIndex, error) {
+ if uint32(r) > 0xffff {
+ return 0, nil
+ }
+
+ c := uint16(r)
+ for i, j := 0, len(entries); i < j; {
+ h := i + (j-i)/2
+ entry := &entries[h]
+ if c < entry.start {
+ j = h
+ } else if entry.end < c {
+ i = h + 1
+ } else if entry.offset == 0 {
+ return GlyphIndex(c + entry.delta), nil
+ } else {
+ offset := uint32(entry.offset) + 2*uint32(h-len(entries)+int(c-entry.start))
+ if offset > indexesLength || offset+2 > indexesLength {
+ return 0, errInvalidCmapTable
+ }
+ x, err := b.view(&f.src, int(indexesBase+offset), 2)
+ if err != nil {
+ return 0, err
+ }
+ return GlyphIndex(u16(x)), nil
+ }
+ }
+ return 0, nil
+ }, nil
+}
+
+func (f *Font) makeCachedGlyphIndexFormat12(buf []byte, offset, _ uint32) ([]byte, glyphIndexFunc, error) {
+ const headerSize = 16
+ if offset+headerSize > f.cmap.length {
+ return nil, nil, errInvalidCmapTable
+ }
+ var err error
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), headerSize)
+ if err != nil {
+ return nil, nil, err
+ }
+ length := u32(buf[4:])
+ if f.cmap.length < offset || length > f.cmap.length-offset {
+ return nil, nil, errInvalidCmapTable
+ }
+ offset += headerSize
+
+ numGroups := u32(buf[12:])
+ if numGroups > maxCmapSegments {
+ return nil, nil, errUnsupportedNumberOfCmapSegments
+ }
+
+ eLength := 12 * numGroups
+ if headerSize+eLength != length {
+ return nil, nil, errInvalidCmapTable
+ }
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), int(eLength))
+ if err != nil {
+ return nil, nil, err
+ }
+ offset += eLength
+
+ entries := make([]cmapEntry32, numGroups)
+ for i := range entries {
+ entries[i] = cmapEntry32{
+ start: u32(buf[0+12*i:]),
+ end: u32(buf[4+12*i:]),
+ delta: u32(buf[8+12*i:]),
+ }
+ }
+
+ return buf, func(f *Font, b *Buffer, r rune) (GlyphIndex, error) {
+ c := uint32(r)
+ for i, j := 0, len(entries); i < j; {
+ h := i + (j-i)/2
+ entry := &entries[h]
+ if c < entry.start {
+ j = h
+ } else if entry.end < c {
+ i = h + 1
+ } else {
+ return GlyphIndex(c - entry.start + entry.delta), nil
+ }
+ }
+ return 0, nil
+ }, nil
+}
+
+type cmapEntry16 struct {
+ end, start, delta, offset uint16
+}
+
+type cmapEntry32 struct {
+ start, end, delta uint32
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/data.go b/vendor/golang.org/x/image/font/sfnt/data.go
new file mode 100644
index 000000000..ad0c139aa
--- /dev/null
+++ b/vendor/golang.org/x/image/font/sfnt/data.go
@@ -0,0 +1,68 @@
+// generated by go run gen.go; DO NOT EDIT
+
+package sfnt
+
+const numBuiltInPostNames = 258
+
+const builtInPostNamesData = "" +
+ ".notdef.nullnonmarkingreturnspaceexclamquotedblnumbersigndollarp" +
+ "ercentampersandquotesingleparenleftparenrightasteriskpluscommahy" +
+ "phenperiodslashzeroonetwothreefourfivesixseveneightninecolonsemi" +
+ "colonlessequalgreaterquestionatABCDEFGHIJKLMNOPQRSTUVWXYZbracket" +
+ "leftbackslashbracketrightasciicircumunderscoregraveabcdefghijklm" +
+ "nopqrstuvwxyzbraceleftbarbracerightasciitildeAdieresisAringCcedi" +
+ "llaEacuteNtildeOdieresisUdieresisaacuteagraveacircumflexadieresi" +
+ "satildearingccedillaeacuteegraveecircumflexedieresisiacuteigrave" +
+ "icircumflexidieresisntildeoacuteograveocircumflexodieresisotilde" +
+ "uacuteugraveucircumflexudieresisdaggerdegreecentsterlingsectionb" +
+ "ulletparagraphgermandblsregisteredcopyrighttrademarkacutedieresi" +
+ "snotequalAEOslashinfinityplusminuslessequalgreaterequalyenmupart" +
+ "ialdiffsummationproductpiintegralordfeminineordmasculineOmegaaeo" +
+ "slashquestiondownexclamdownlogicalnotradicalflorinapproxequalDel" +
+ "taguillemotleftguillemotrightellipsisnonbreakingspaceAgraveAtild" +
+ "eOtildeOEoeendashemdashquotedblleftquotedblrightquoteleftquoteri" +
+ "ghtdividelozengeydieresisYdieresisfractioncurrencyguilsinglleftg" +
+ "uilsinglrightfifldaggerdblperiodcenteredquotesinglbasequotedblba" +
+ "seperthousandAcircumflexEcircumflexAacuteEdieresisEgraveIacuteIc" +
+ "ircumflexIdieresisIgraveOacuteOcircumflexappleOgraveUacuteUcircu" +
+ "mflexUgravedotlessicircumflextildemacronbrevedotaccentringcedill" +
+ "ahungarumlautogonekcaronLslashlslashScaronscaronZcaronzcaronbrok" +
+ "enbarEthethYacuteyacuteThornthornminusmultiplyonesuperiortwosupe" +
+ "riorthreesuperioronehalfonequarterthreequartersfrancGbrevegbreve" +
+ "IdotaccentScedillascedillaCacutecacuteCcaronccarondcroat"
+
+var builtInPostNamesOffsets = [...]uint16{
+ 0x0000, 0x0007, 0x000c, 0x001c, 0x0021, 0x0027, 0x002f, 0x0039,
+ 0x003f, 0x0046, 0x004f, 0x005a, 0x0063, 0x006d, 0x0075, 0x0079,
+ 0x007e, 0x0084, 0x008a, 0x008f, 0x0093, 0x0096, 0x0099, 0x009e,
+ 0x00a2, 0x00a6, 0x00a9, 0x00ae, 0x00b3, 0x00b7, 0x00bc, 0x00c5,
+ 0x00c9, 0x00ce, 0x00d5, 0x00dd, 0x00df, 0x00e0, 0x00e1, 0x00e2,
+ 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea,
+ 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2,
+ 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x0104,
+ 0x010d, 0x0119, 0x0124, 0x012e, 0x0133, 0x0134, 0x0135, 0x0136,
+ 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e,
+ 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0146,
+ 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, 0x0156,
+ 0x0159, 0x0163, 0x016d, 0x0176, 0x017b, 0x0183, 0x0189, 0x018f,
+ 0x0198, 0x01a1, 0x01a7, 0x01ad, 0x01b8, 0x01c1, 0x01c7, 0x01cc,
+ 0x01d4, 0x01da, 0x01e0, 0x01eb, 0x01f4, 0x01fa, 0x0200, 0x020b,
+ 0x0214, 0x021a, 0x0220, 0x0226, 0x0231, 0x023a, 0x0240, 0x0246,
+ 0x024c, 0x0257, 0x0260, 0x0266, 0x026c, 0x0270, 0x0278, 0x027f,
+ 0x0285, 0x028e, 0x0298, 0x02a2, 0x02ab, 0x02b4, 0x02b9, 0x02c1,
+ 0x02c9, 0x02cb, 0x02d1, 0x02d9, 0x02e2, 0x02eb, 0x02f7, 0x02fa,
+ 0x02fc, 0x0307, 0x0310, 0x0317, 0x0319, 0x0321, 0x032c, 0x0338,
+ 0x033d, 0x033f, 0x0345, 0x0351, 0x035b, 0x0365, 0x036c, 0x0372,
+ 0x037d, 0x0382, 0x038f, 0x039d, 0x03a5, 0x03b5, 0x03bb, 0x03c1,
+ 0x03c7, 0x03c9, 0x03cb, 0x03d1, 0x03d7, 0x03e3, 0x03f0, 0x03f9,
+ 0x0403, 0x0409, 0x0410, 0x0419, 0x0422, 0x042a, 0x0432, 0x043f,
+ 0x044d, 0x044f, 0x0451, 0x045a, 0x0468, 0x0476, 0x0482, 0x048d,
+ 0x0498, 0x04a3, 0x04a9, 0x04b2, 0x04b8, 0x04be, 0x04c9, 0x04d2,
+ 0x04d8, 0x04de, 0x04e9, 0x04ee, 0x04f4, 0x04fa, 0x0505, 0x050b,
+ 0x0513, 0x051d, 0x0522, 0x0528, 0x052d, 0x0536, 0x053a, 0x0541,
+ 0x054d, 0x0553, 0x0558, 0x055e, 0x0564, 0x056a, 0x0570, 0x0576,
+ 0x057c, 0x0585, 0x0588, 0x058b, 0x0591, 0x0597, 0x059c, 0x05a1,
+ 0x05a6, 0x05ae, 0x05b9, 0x05c4, 0x05d1, 0x05d8, 0x05e2, 0x05ef,
+ 0x05f4, 0x05fa, 0x0600, 0x060a, 0x0612, 0x061a, 0x0620, 0x0626,
+ 0x062c, 0x0632, 0x0638,
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/example_test.go b/vendor/golang.org/x/image/font/sfnt/example_test.go
new file mode 100644
index 000000000..17431560f
--- /dev/null
+++ b/vendor/golang.org/x/image/font/sfnt/example_test.go
@@ -0,0 +1,128 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sfnt_test
+
+import (
+ "image"
+ "image/draw"
+ "log"
+ "os"
+
+ "golang.org/x/image/font/gofont/goregular"
+ "golang.org/x/image/font/sfnt"
+ "golang.org/x/image/math/fixed"
+ "golang.org/x/image/vector"
+)
+
+func ExampleRasterizeGlyph() {
+ const (
+ ppem = 32
+ width = 24
+ height = 32
+ originX = 0
+ originY = 28
+ )
+
+ f, err := sfnt.Parse(goregular.TTF)
+ if err != nil {
+ log.Fatalf("Parse: %v", err)
+ }
+ var b sfnt.Buffer
+ x, err := f.GlyphIndex(&b, 'G')
+ if err != nil {
+ log.Fatalf("GlyphIndex: %v", err)
+ }
+ if x == 0 {
+ log.Fatalf("GlyphIndex: no glyph index found for the rune 'G'")
+ }
+ segments, err := f.LoadGlyph(&b, x, fixed.I(ppem), nil)
+ if err != nil {
+ log.Fatalf("LoadGlyph: %v", err)
+ }
+
+ r := vector.NewRasterizer(width, height)
+ r.DrawOp = draw.Src
+ for _, seg := range segments {
+ // The divisions by 64 below is because the seg.Args values have type
+ // fixed.Int26_6, a 26.6 fixed point number, and 1<<6 == 64.
+ switch seg.Op {
+ case sfnt.SegmentOpMoveTo:
+ r.MoveTo(
+ originX+float32(seg.Args[0])/64,
+ originY-float32(seg.Args[1])/64,
+ )
+ case sfnt.SegmentOpLineTo:
+ r.LineTo(
+ originX+float32(seg.Args[0])/64,
+ originY-float32(seg.Args[1])/64,
+ )
+ case sfnt.SegmentOpQuadTo:
+ r.QuadTo(
+ originX+float32(seg.Args[0])/64,
+ originY-float32(seg.Args[1])/64,
+ originX+float32(seg.Args[2])/64,
+ originY-float32(seg.Args[3])/64,
+ )
+ case sfnt.SegmentOpCubeTo:
+ r.CubeTo(
+ originX+float32(seg.Args[0])/64,
+ originY-float32(seg.Args[1])/64,
+ originX+float32(seg.Args[2])/64,
+ originY-float32(seg.Args[3])/64,
+ originX+float32(seg.Args[4])/64,
+ originY-float32(seg.Args[5])/64,
+ )
+ }
+ }
+ // TODO: call ClosePath? Once overall or once per contour (i.e. MoveTo)?
+
+ dst := image.NewAlpha(image.Rect(0, 0, width, height))
+ r.Draw(dst, dst.Bounds(), image.Opaque, image.Point{})
+
+ const asciiArt = ".++8"
+ buf := make([]byte, 0, height*(width+1))
+ for y := 0; y < height; y++ {
+ for x := 0; x < width; x++ {
+ a := dst.AlphaAt(x, y).A
+ buf = append(buf, asciiArt[a>>6])
+ }
+ buf = append(buf, '\n')
+ }
+ os.Stdout.Write(buf)
+
+ // Output:
+ // ........................
+ // ........................
+ // ........................
+ // ........................
+ // ..........+++++++++.....
+ // .......+8888888888888+..
+ // ......8888888888888888..
+ // ....+8888+........++88..
+ // ....8888................
+ // ...8888.................
+ // ..+888+.................
+ // ..+888..................
+ // ..888+..................
+ // .+888+..................
+ // .+888...................
+ // .+888...................
+ // .+888...................
+ // .+888..........+++++++..
+ // .+888..........8888888..
+ // .+888+.........+++8888..
+ // ..888+............+888..
+ // ..8888............+888..
+ // ..+888+...........+888..
+ // ...8888+..........+888..
+ // ...+8888+.........+888..
+ // ....+88888+.......+888..
+ // .....+8888888888888888..
+ // .......+888888888888++..
+ // ..........++++++++......
+ // ........................
+ // ........................
+ // ........................
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/gen.go b/vendor/golang.org/x/image/font/sfnt/gen.go
new file mode 100644
index 000000000..12587d446
--- /dev/null
+++ b/vendor/golang.org/x/image/font/sfnt/gen.go
@@ -0,0 +1,321 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "go/format"
+ "io/ioutil"
+ "log"
+)
+
+func main() {
+ data, offsets := []byte(nil), []int{0}
+ for _, name := range names {
+ data = append(data, name...)
+ offsets = append(offsets, len(data))
+ }
+
+ b := new(bytes.Buffer)
+ fmt.Fprintf(b, "// generated by go run gen.go; DO NOT EDIT\n\n")
+ fmt.Fprintf(b, "package sfnt\n\n")
+
+ fmt.Fprintf(b, "const numBuiltInPostNames = %d\n\n", len(names))
+
+ fmt.Fprintf(b, "const builtInPostNamesData = \"\" +\n")
+ for s := data; ; {
+ if len(s) <= 64 {
+ fmt.Fprintf(b, "%q\n", s)
+ break
+ }
+ fmt.Fprintf(b, "%q +\n", s[:64])
+ s = s[64:]
+ }
+ fmt.Fprintf(b, "\n")
+
+ fmt.Fprintf(b, "var builtInPostNamesOffsets = [...]uint16{\n")
+ for i, o := range offsets {
+ fmt.Fprintf(b, "%#04x,", o)
+ if i%8 == 7 {
+ fmt.Fprintf(b, "\n")
+ }
+ }
+ fmt.Fprintf(b, "\n}\n")
+
+ dstUnformatted := b.Bytes()
+ dst, err := format.Source(dstUnformatted)
+ if err != nil {
+ log.Fatalf("format.Source: %v\n\n----\n%s\n----", err, dstUnformatted)
+ }
+ if err := ioutil.WriteFile("data.go", dst, 0666); err != nil {
+ log.Fatalf("ioutil.WriteFile: %v", err)
+ }
+}
+
+// names is the built-in post table names listed at
+// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6post.html
+var names = [258]string{
+ ".notdef",
+ ".null",
+ "nonmarkingreturn",
+ "space",
+ "exclam",
+ "quotedbl",
+ "numbersign",
+ "dollar",
+ "percent",
+ "ampersand",
+ "quotesingle",
+ "parenleft",
+ "parenright",
+ "asterisk",
+ "plus",
+ "comma",
+ "hyphen",
+ "period",
+ "slash",
+ "zero",
+ "one",
+ "two",
+ "three",
+ "four",
+ "five",
+ "six",
+ "seven",
+ "eight",
+ "nine",
+ "colon",
+ "semicolon",
+ "less",
+ "equal",
+ "greater",
+ "question",
+ "at",
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ "K",
+ "L",
+ "M",
+ "N",
+ "O",
+ "P",
+ "Q",
+ "R",
+ "S",
+ "T",
+ "U",
+ "V",
+ "W",
+ "X",
+ "Y",
+ "Z",
+ "bracketleft",
+ "backslash",
+ "bracketright",
+ "asciicircum",
+ "underscore",
+ "grave",
+ "a",
+ "b",
+ "c",
+ "d",
+ "e",
+ "f",
+ "g",
+ "h",
+ "i",
+ "j",
+ "k",
+ "l",
+ "m",
+ "n",
+ "o",
+ "p",
+ "q",
+ "r",
+ "s",
+ "t",
+ "u",
+ "v",
+ "w",
+ "x",
+ "y",
+ "z",
+ "braceleft",
+ "bar",
+ "braceright",
+ "asciitilde",
+ "Adieresis",
+ "Aring",
+ "Ccedilla",
+ "Eacute",
+ "Ntilde",
+ "Odieresis",
+ "Udieresis",
+ "aacute",
+ "agrave",
+ "acircumflex",
+ "adieresis",
+ "atilde",
+ "aring",
+ "ccedilla",
+ "eacute",
+ "egrave",
+ "ecircumflex",
+ "edieresis",
+ "iacute",
+ "igrave",
+ "icircumflex",
+ "idieresis",
+ "ntilde",
+ "oacute",
+ "ograve",
+ "ocircumflex",
+ "odieresis",
+ "otilde",
+ "uacute",
+ "ugrave",
+ "ucircumflex",
+ "udieresis",
+ "dagger",
+ "degree",
+ "cent",
+ "sterling",
+ "section",
+ "bullet",
+ "paragraph",
+ "germandbls",
+ "registered",
+ "copyright",
+ "trademark",
+ "acute",
+ "dieresis",
+ "notequal",
+ "AE",
+ "Oslash",
+ "infinity",
+ "plusminus",
+ "lessequal",
+ "greaterequal",
+ "yen",
+ "mu",
+ "partialdiff",
+ "summation",
+ "product",
+ "pi",
+ "integral",
+ "ordfeminine",
+ "ordmasculine",
+ "Omega",
+ "ae",
+ "oslash",
+ "questiondown",
+ "exclamdown",
+ "logicalnot",
+ "radical",
+ "florin",
+ "approxequal",
+ "Delta",
+ "guillemotleft",
+ "guillemotright",
+ "ellipsis",
+ "nonbreakingspace",
+ "Agrave",
+ "Atilde",
+ "Otilde",
+ "OE",
+ "oe",
+ "endash",
+ "emdash",
+ "quotedblleft",
+ "quotedblright",
+ "quoteleft",
+ "quoteright",
+ "divide",
+ "lozenge",
+ "ydieresis",
+ "Ydieresis",
+ "fraction",
+ "currency",
+ "guilsinglleft",
+ "guilsinglright",
+ "fi",
+ "fl",
+ "daggerdbl",
+ "periodcentered",
+ "quotesinglbase",
+ "quotedblbase",
+ "perthousand",
+ "Acircumflex",
+ "Ecircumflex",
+ "Aacute",
+ "Edieresis",
+ "Egrave",
+ "Iacute",
+ "Icircumflex",
+ "Idieresis",
+ "Igrave",
+ "Oacute",
+ "Ocircumflex",
+ "apple",
+ "Ograve",
+ "Uacute",
+ "Ucircumflex",
+ "Ugrave",
+ "dotlessi",
+ "circumflex",
+ "tilde",
+ "macron",
+ "breve",
+ "dotaccent",
+ "ring",
+ "cedilla",
+ "hungarumlaut",
+ "ogonek",
+ "caron",
+ "Lslash",
+ "lslash",
+ "Scaron",
+ "scaron",
+ "Zcaron",
+ "zcaron",
+ "brokenbar",
+ "Eth",
+ "eth",
+ "Yacute",
+ "yacute",
+ "Thorn",
+ "thorn",
+ "minus",
+ "multiply",
+ "onesuperior",
+ "twosuperior",
+ "threesuperior",
+ "onehalf",
+ "onequarter",
+ "threequarters",
+ "franc",
+ "Gbreve",
+ "gbreve",
+ "Idotaccent",
+ "Scedilla",
+ "scedilla",
+ "Cacute",
+ "cacute",
+ "Ccaron",
+ "ccaron",
+ "dcroat",
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/postscript.go b/vendor/golang.org/x/image/font/sfnt/postscript.go
index d5d6d9aed..ca1b8318c 100644
--- a/vendor/golang.org/x/image/font/sfnt/postscript.go
+++ b/vendor/golang.org/x/image/font/sfnt/postscript.go
@@ -566,8 +566,8 @@ var psOperators = [...][2][]psOperator{
23: {-1, "vstemhm", t2CStem},
24: {}, // rcurveline.
25: {}, // rlinecurve.
- 26: {}, // vvcurveto.
- 27: {}, // hhcurveto.
+ 26: {-1, "vvcurveto", t2CVvcurveto},
+ 27: {-1, "hhcurveto", t2CHhcurveto},
28: {}, // shortint.
29: {}, // callgsubr.
30: {-1, "vhcurveto", t2CVhcurveto},
@@ -653,8 +653,8 @@ func t2CAppendMoveto(p *psInterpreter) {
p.type2Charstrings.segments = append(p.type2Charstrings.segments, Segment{
Op: SegmentOpMoveTo,
Args: [6]fixed.Int26_6{
- 0: fixed.Int26_6(p.type2Charstrings.x) << 6,
- 1: fixed.Int26_6(p.type2Charstrings.y) << 6,
+ 0: fixed.Int26_6(p.type2Charstrings.x),
+ 1: fixed.Int26_6(p.type2Charstrings.y),
},
})
}
@@ -663,8 +663,8 @@ func t2CAppendLineto(p *psInterpreter) {
p.type2Charstrings.segments = append(p.type2Charstrings.segments, Segment{
Op: SegmentOpLineTo,
Args: [6]fixed.Int26_6{
- 0: fixed.Int26_6(p.type2Charstrings.x) << 6,
- 1: fixed.Int26_6(p.type2Charstrings.y) << 6,
+ 0: fixed.Int26_6(p.type2Charstrings.x),
+ 1: fixed.Int26_6(p.type2Charstrings.y),
},
})
}
@@ -685,12 +685,12 @@ func t2CAppendCubeto(p *psInterpreter, dxa, dya, dxb, dyb, dxc, dyc int32) {
p.type2Charstrings.segments = append(p.type2Charstrings.segments, Segment{
Op: SegmentOpCubeTo,
Args: [6]fixed.Int26_6{
- 0: fixed.Int26_6(xa) << 6,
- 1: fixed.Int26_6(ya) << 6,
- 2: fixed.Int26_6(xb) << 6,
- 3: fixed.Int26_6(yb) << 6,
- 4: fixed.Int26_6(xc) << 6,
- 5: fixed.Int26_6(yc) << 6,
+ 0: fixed.Int26_6(xa),
+ 1: fixed.Int26_6(ya),
+ 2: fixed.Int26_6(xb),
+ 3: fixed.Int26_6(yb),
+ 4: fixed.Int26_6(xc),
+ 5: fixed.Int26_6(yc),
},
})
}
@@ -770,6 +770,12 @@ func t2CRlineto(p *psInterpreter) error {
// As per 5177.Type2.pdf section 4.1 "Path Construction Operators",
//
+// hhcurveto is:
+// - dy1 {dxa dxb dyb dxc}+
+//
+// vvcurveto is:
+// - dx1 {dya dxb dyb dyc}+
+//
// hvcurveto is one of:
// - dx1 dx2 dy2 dy3 {dya dxb dyb dxc dxd dxe dye dyf}* dxf?
// - {dxa dxb dyb dyc dyd dxe dye dxf}+ dyf?
@@ -778,59 +784,84 @@ func t2CRlineto(p *psInterpreter) error {
// - dy1 dx2 dy2 dx3 {dxa dxb dyb dyc dyd dxe dye dxf}* dyf?
// - {dya dxb dyb dxc dxd dxe dye dyf}+ dxf?
-func t2CHvcurveto(p *psInterpreter) error { return t2CCurveto(p, false) }
-func t2CVhcurveto(p *psInterpreter) error { return t2CCurveto(p, true) }
+func t2CHhcurveto(p *psInterpreter) error { return t2CCurveto(p, false, false) }
+func t2CVvcurveto(p *psInterpreter) error { return t2CCurveto(p, false, true) }
+func t2CHvcurveto(p *psInterpreter) error { return t2CCurveto(p, true, false) }
+func t2CVhcurveto(p *psInterpreter) error { return t2CCurveto(p, true, true) }
-func t2CCurveto(p *psInterpreter, vertical bool) error {
+// t2CCurveto implements the hh / vv / hv / vh xxcurveto operators. N relative
+// cubic curve requires 6*N control points, but only 4*N+0 or 4*N+1 are used
+// here: all (or all but one) of the piecewise cubic curve's tangents are
+// implicitly horizontal or vertical.
+//
+// swap is whether that implicit horizontal / vertical constraint swaps as you
+// move along the piecewise cubic curve. If swap is false, the constraints are
+// either all horizontal or all vertical. If swap is true, it alternates.
+//
+// vertical is whether the first implicit constraint is vertical.
+func t2CCurveto(p *psInterpreter, swap, vertical bool) error {
if !p.type2Charstrings.seenWidth || p.stack.top < 4 {
return errInvalidCFFTable
}
- for i := int32(0); i != p.stack.top; vertical = !vertical {
+
+ i := int32(0)
+ switch p.stack.top & 3 {
+ case 0:
+ // No-op.
+ case 1:
+ if swap {
+ break
+ }
+ i = 1
if vertical {
- i = t2CVcurveto(p, i)
+ p.type2Charstrings.x += p.stack.a[0]
} else {
- i = t2CHcurveto(p, i)
+ p.type2Charstrings.y += p.stack.a[0]
}
+ default:
+ return errInvalidCFFTable
+ }
+
+ for i != p.stack.top {
+ i = t2CCurveto4(p, swap, vertical, i)
if i < 0 {
return errInvalidCFFTable
}
+ if swap {
+ vertical = !vertical
+ }
}
return nil
}
-func t2CHcurveto(p *psInterpreter, i int32) (j int32) {
+func t2CCurveto4(p *psInterpreter, swap bool, vertical bool, i int32) (j int32) {
if i+4 > p.stack.top {
return -1
}
dxa := p.stack.a[i+0]
+ dya := int32(0)
dxb := p.stack.a[i+1]
dyb := p.stack.a[i+2]
- dyc := p.stack.a[i+3]
- dxc := int32(0)
+ dxc := p.stack.a[i+3]
+ dyc := int32(0)
i += 4
- if i+1 == p.stack.top {
- dxc = p.stack.a[i]
- i++
+
+ if vertical {
+ dxa, dya = dya, dxa
}
- t2CAppendCubeto(p, dxa, 0, dxb, dyb, dxc, dyc)
- return i
-}
-func t2CVcurveto(p *psInterpreter, i int32) (j int32) {
- if i+4 > p.stack.top {
- return -1
+ if swap {
+ if i+1 == p.stack.top {
+ dyc = p.stack.a[i]
+ i++
+ }
}
- dya := p.stack.a[i+0]
- dxb := p.stack.a[i+1]
- dyb := p.stack.a[i+2]
- dxc := p.stack.a[i+3]
- dyc := int32(0)
- i += 4
- if i+1 == p.stack.top {
- dyc = p.stack.a[i]
- i++
+
+ if swap != vertical {
+ dxc, dyc = dyc, dxc
}
- t2CAppendCubeto(p, 0, dya, dxb, dyb, dxc, dyc)
+
+ t2CAppendCubeto(p, dxa, dya, dxb, dyb, dxc, dyc)
return i
}
diff --git a/vendor/golang.org/x/image/font/sfnt/proprietary_test.go b/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
new file mode 100644
index 000000000..b105ee593
--- /dev/null
+++ b/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
@@ -0,0 +1,479 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sfnt
+
+/*
+This file contains opt-in tests for popular, high quality, proprietary fonts,
+made by companies such as Adobe and Microsoft. These fonts are generally
+available, but copies are not explicitly included in this repository due to
+licensing differences or file size concerns. To opt-in, run:
+
+go test golang.org/x/image/font/sfnt -args -proprietary
+
+Not all tests pass out-of-the-box on all systems. For example, the Microsoft
+Times New Roman font is downloadable gratis even on non-Windows systems, but as
+per the ttf-mscorefonts-installer Debian package, this requires accepting an
+End User License Agreement (EULA) and a CAB format decoder. These tests assume
+that such fonts have already been installed. You may need to specify the
+directories for these fonts:
+
+go test golang.org/x/image/font/sfnt -args -proprietary -adobeDir=/foo/bar/aFonts -microsoftDir=/foo/bar/mFonts
+
+To only run those tests for the Microsoft fonts:
+
+go test golang.org/x/image/font/sfnt -test.run=ProprietaryMicrosoft -args -proprietary
+*/
+
+// TODO: add Apple system fonts? Google fonts (Droid? Noto?)? Emoji fonts?
+
+// TODO: enable Apple/Microsoft tests by default on Darwin/Windows?
+
+import (
+ "errors"
+ "flag"
+ "io/ioutil"
+ "path/filepath"
+ "testing"
+
+ "golang.org/x/image/font"
+ "golang.org/x/image/math/fixed"
+)
+
+var (
+ proprietary = flag.Bool("proprietary", false, "test proprietary fonts not included in this repository")
+
+ adobeDir = flag.String(
+ "adobeDir",
+ // This needs to be set explicitly. There is no default dir on Debian:
+ // https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736680
+ //
+ // Get the fonts from https://github.com/adobe-fonts, e.g.:
+ // - https://github.com/adobe-fonts/source-code-pro/releases/latest
+ // - https://github.com/adobe-fonts/source-han-sans/releases/latest
+ // - https://github.com/adobe-fonts/source-sans-pro/releases/latest
+ //
+ // Copy all of the TTF and OTF files to the one directory, such as
+ // $HOME/adobe-fonts, and pass that as the -adobeDir flag here.
+ "",
+ "directory name for the Adobe proprietary fonts",
+ )
+
+ microsoftDir = flag.String(
+ "microsoftDir",
+ "/usr/share/fonts/truetype/msttcorefonts",
+ "directory name for the Microsoft proprietary fonts",
+ )
+)
+
+func TestProprietaryAdobeSourceCodeProOTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceCodePro-Regular.otf", 1500, 2)
+}
+
+func TestProprietaryAdobeSourceCodeProTTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceCodePro-Regular.ttf", 1500, 36)
+}
+
+func TestProprietaryAdobeSourceHanSansSC(t *testing.T) {
+ testProprietary(t, "adobe", "SourceHanSansSC-Regular.otf", 65535, 2)
+}
+
+func TestProprietaryAdobeSourceSansProOTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Regular.otf", 1800, 2)
+}
+
+func TestProprietaryAdobeSourceSansProTTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Regular.ttf", 1800, 54)
+}
+
+func TestProprietaryMicrosoftArial(t *testing.T) {
+ testProprietary(t, "microsoft", "Arial.ttf", 1200, 98)
+}
+
+func TestProprietaryMicrosoftComicSansMS(t *testing.T) {
+ testProprietary(t, "microsoft", "Comic_Sans_MS.ttf", 550, 98)
+}
+
+func TestProprietaryMicrosoftTimesNewRoman(t *testing.T) {
+ testProprietary(t, "microsoft", "Times_New_Roman.ttf", 1200, 98)
+}
+
+func TestProprietaryMicrosoftWebdings(t *testing.T) {
+ testProprietary(t, "microsoft", "Webdings.ttf", 200, -1)
+}
+
+// testProprietary tests that we can load every glyph in the named font.
+//
+// The exact number of glyphs in the font can differ across its various
+// versions, but as a sanity check, there should be at least minNumGlyphs.
+//
+// While this package is a work-in-progress, not every glyph can be loaded. The
+// firstUnsupportedGlyph argument, if non-negative, is the index of the first
+// unsupported glyph in the font. This number should increase over time (or set
+// negative), as the TODO's in this package are done.
+func testProprietary(t *testing.T, proprietor, filename string, minNumGlyphs, firstUnsupportedGlyph int) {
+ if !*proprietary {
+ t.Skip("skipping proprietary font test")
+ }
+
+ file, err := []byte(nil), error(nil)
+ switch proprietor {
+ case "adobe":
+ file, err = ioutil.ReadFile(filepath.Join(*adobeDir, filename))
+ if err != nil {
+ t.Fatalf("%v\nPerhaps you need to set the -adobeDir=%v flag?", err, *adobeDir)
+ }
+ case "microsoft":
+ file, err = ioutil.ReadFile(filepath.Join(*microsoftDir, filename))
+ if err != nil {
+ t.Fatalf("%v\nPerhaps you need to set the -microsoftDir=%v flag?", err, *microsoftDir)
+ }
+ default:
+ panic("unreachable")
+ }
+ f, err := Parse(file)
+ if err != nil {
+ t.Fatalf("Parse: %v", err)
+ }
+ ppem := fixed.Int26_6(f.UnitsPerEm())
+ qualifiedFilename := proprietor + "/" + filename
+ var buf Buffer
+
+ // Some of the tests below, such as which glyph index a particular rune
+ // maps to, can depend on the specific version of the proprietary font. If
+ // tested against a different version of that font, the test might (but not
+ // necessarily will) fail, even though the Go code is good. If so, log a
+ // message, but don't automatically fail (i.e. dont' call t.Fatalf).
+ gotVersion, err := f.Name(&buf, NameIDVersion)
+ if err != nil {
+ t.Fatalf("Name: %v", err)
+ }
+ wantVersion := proprietaryVersions[qualifiedFilename]
+ if gotVersion != wantVersion {
+ t.Logf("font version provided differs from the one the tests were written against:"+
+ "\ngot %q\nwant %q", gotVersion, wantVersion)
+ }
+
+ numGlyphs := f.NumGlyphs()
+ if numGlyphs < minNumGlyphs {
+ t.Fatalf("NumGlyphs: got %d, want at least %d", numGlyphs, minNumGlyphs)
+ }
+
+ iMax := numGlyphs
+ if firstUnsupportedGlyph >= 0 {
+ iMax = firstUnsupportedGlyph
+ }
+ for i, numErrors := 0, 0; i < iMax; i++ {
+ if _, err := f.LoadGlyph(&buf, GlyphIndex(i), ppem, nil); err != nil {
+ t.Errorf("LoadGlyph(%d): %v", i, err)
+ numErrors++
+ }
+ if numErrors == 10 {
+ t.Fatal("LoadGlyph: too many errors")
+ }
+ }
+
+ for r, want := range proprietaryGlyphIndexTestCases[qualifiedFilename] {
+ got, err := f.GlyphIndex(&buf, r)
+ if err != nil {
+ t.Errorf("GlyphIndex(%q): %v", r, err)
+ continue
+ }
+ if got != want {
+ t.Errorf("GlyphIndex(%q): got %d, want %d", r, got, want)
+ continue
+ }
+ }
+
+ for r, want := range proprietaryGlyphTestCases[qualifiedFilename] {
+ x, err := f.GlyphIndex(&buf, r)
+ if err != nil {
+ t.Errorf("GlyphIndex(%q): %v", r, err)
+ continue
+ }
+ got, err := f.LoadGlyph(&buf, x, ppem, nil)
+ if err != nil {
+ t.Errorf("LoadGlyph(%q): %v", r, err)
+ continue
+ }
+ if err := checkSegmentsEqual(got, want); err != nil {
+ t.Errorf("LoadGlyph(%q): %v", r, err)
+ continue
+ }
+ }
+
+kernLoop:
+ for _, tc := range proprietaryKernTestCases[qualifiedFilename] {
+ var indexes [2]GlyphIndex
+ for i := range indexes {
+ x, err := f.GlyphIndex(&buf, tc.runes[i])
+ if x == 0 && err == nil {
+ err = errors.New("no glyph index found")
+ }
+ if err != nil {
+ t.Errorf("GlyphIndex(%q): %v", tc.runes[0], err)
+ continue kernLoop
+ }
+ indexes[i] = x
+ }
+ kern, err := f.Kern(&buf, indexes[0], indexes[1], tc.ppem, tc.hinting)
+ if err != nil {
+ t.Errorf("Kern(%q, %q, ppem=%d, hinting=%v): %v",
+ tc.runes[0], tc.runes[1], tc.ppem, tc.hinting, err)
+ continue
+ }
+ if got := Units(kern); got != tc.want {
+ t.Errorf("Kern(%q, %q, ppem=%d, hinting=%v): got %d, want %d",
+ tc.runes[0], tc.runes[1], tc.ppem, tc.hinting, got, tc.want)
+ continue
+ }
+ }
+}
+
+// proprietaryVersions holds the expected version string of each proprietary
+// font tested. If third parties such as Adobe or Microsoft update their fonts,
+// and the tests subsequently fail, these versions should be updated too.
+//
+// Updates are expected to be infrequent. For example, as of 2017, the fonts
+// installed by the Debian ttf-mscorefonts-installer package have last modified
+// times no later than 2001.
+var proprietaryVersions = map[string]string{
+ "adobe/SourceCodePro-Regular.otf": "Version 2.030;PS 1.0;hotconv 16.6.51;makeotf.lib2.5.65220",
+ "adobe/SourceCodePro-Regular.ttf": "Version 2.030;PS 1.000;hotconv 16.6.51;makeotf.lib2.5.65220",
+ "adobe/SourceHanSansSC-Regular.otf": "Version 1.004;PS 1.004;hotconv 1.0.82;makeotf.lib2.5.63406",
+ "adobe/SourceSansPro-Regular.otf": "Version 2.020;PS 2.0;hotconv 1.0.86;makeotf.lib2.5.63406",
+ "adobe/SourceSansPro-Regular.ttf": "Version 2.020;PS 2.000;hotconv 1.0.86;makeotf.lib2.5.63406",
+
+ "microsoft/Arial.ttf": "Version 2.82",
+ "microsoft/Comic_Sans_MS.ttf": "Version 2.10",
+ "microsoft/Times_New_Roman.ttf": "Version 2.82",
+ "microsoft/Webdings.ttf": "Version 1.03",
+}
+
+// proprietaryGlyphIndexTestCases hold a sample of each font's rune to glyph
+// index cmap. The numerical values can be verified by running the ttx tool.
+var proprietaryGlyphIndexTestCases = map[string]map[rune]GlyphIndex{
+ "adobe/SourceCodePro-Regular.otf": {
+ '\u0030': 877, // U+0030 DIGIT ZERO
+ '\u0041': 2, // U+0041 LATIN CAPITAL LETTER A
+ '\u0061': 28, // U+0061 LATIN SMALL LETTER A
+ '\u0104': 64, // U+0104 LATIN CAPITAL LETTER A WITH OGONEK
+ '\u0125': 323, // U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX
+ '\u01f4': 111, // U+01F4 LATIN CAPITAL LETTER G WITH ACUTE
+ '\u03a3': 623, // U+03A3 GREEK CAPITAL LETTER SIGMA
+ '\u2569': 1500, // U+2569 BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ '\U0001f100': 0, // U+0001F100 DIGIT ZERO FULL STOP
+ },
+ "adobe/SourceCodePro-Regular.ttf": {
+ '\u0030': 877, // U+0030 DIGIT ZERO
+ '\u0041': 2, // U+0041 LATIN CAPITAL LETTER A
+ '\u01f4': 111, // U+01F4 LATIN CAPITAL LETTER G WITH ACUTE
+ },
+ "adobe/SourceHanSansSC-Regular.otf": {
+ '\u0030': 17, // U+0030 DIGIT ZERO
+ '\u0041': 34, // U+0041 LATIN CAPITAL LETTER A
+ '\u00d7': 150, // U+00D7 MULTIPLICATION SIGN
+ '\u1100': 365, // U+1100 HANGUL CHOSEONG KIYEOK
+ '\u25ca': 1254, // U+25CA LOZENGE
+ '\u2e9c': 1359, // U+2E9C CJK RADICAL SUN
+ '\u304b': 1463, // U+304B HIRAGANA LETTER KA
+ '\u4e2d': 9893, // U+4E2D <CJK Ideograph>, 中
+ '\ua960': 47537, // U+A960 HANGUL CHOSEONG TIKEUT-MIEUM
+ '\ufb00': 58919, // U+FB00 LATIN SMALL LIGATURE FF
+ '\uffee': 59213, // U+FFEE HALFWIDTH WHITE CIRCLE
+ '\U0001f100': 59214, // U+0001F100 DIGIT ZERO FULL STOP
+ '\U0001f248': 59449, // U+0001F248 TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557
+ '\U0002f9f4': 61768, // U+0002F9F4 CJK COMPATIBILITY IDEOGRAPH-2F9F4
+ },
+ "adobe/SourceSansPro-Regular.otf": {
+ '\u0041': 2, // U+0041 LATIN CAPITAL LETTER A
+ '\u03a3': 592, // U+03A3 GREEK CAPITAL LETTER SIGMA
+ '\u0435': 999, // U+0435 CYRILLIC SMALL LETTER IE
+ '\u2030': 1728, // U+2030 PER MILLE SIGN
+ },
+ "adobe/SourceSansPro-Regular.ttf": {
+ '\u0041': 2, // U+0041 LATIN CAPITAL LETTER A
+ '\u03a3': 592, // U+03A3 GREEK CAPITAL LETTER SIGMA
+ '\u0435': 999, // U+0435 CYRILLIC SMALL LETTER IE
+ '\u2030': 1728, // U+2030 PER MILLE SIGN
+ },
+
+ "microsoft/Arial.ttf": {
+ '\u0041': 36, // U+0041 LATIN CAPITAL LETTER A
+ '\u00f1': 120, // U+00F1 LATIN SMALL LETTER N WITH TILDE
+ '\u0401': 556, // U+0401 CYRILLIC CAPITAL LETTER IO
+ '\u200d': 745, // U+200D ZERO WIDTH JOINER
+ '\u20ab': 1150, // U+20AB DONG SIGN
+ '\u2229': 320, // U+2229 INTERSECTION
+ '\u04e9': 1319, // U+04E9 CYRILLIC SMALL LETTER BARRED O
+ '\U0001f100': 0, // U+0001F100 DIGIT ZERO FULL STOP
+ },
+ "microsoft/Comic_Sans_MS.ttf": {
+ '\u0041': 36, // U+0041 LATIN CAPITAL LETTER A
+ '\u03af': 573, // U+03AF GREEK SMALL LETTER IOTA WITH TONOS
+ },
+ "microsoft/Times_New_Roman.ttf": {
+ '\u0041': 36, // U+0041 LATIN CAPITAL LETTER A
+ '\u0042': 37, // U+0041 LATIN CAPITAL LETTER B
+ '\u266a': 392, // U+266A EIGHTH NOTE
+ '\uf041': 0, // PRIVATE USE AREA
+ '\uf042': 0, // PRIVATE USE AREA
+ },
+ "microsoft/Webdings.ttf": {
+ '\u0041': 0, // U+0041 LATIN CAPITAL LETTER A
+ '\u0042': 0, // U+0041 LATIN CAPITAL LETTER B
+ '\u266a': 0, // U+266A EIGHTH NOTE
+ '\uf041': 36, // PRIVATE USE AREA
+ '\uf042': 37, // PRIVATE USE AREA
+ },
+}
+
+// proprietaryGlyphTestCases hold a sample of each font's glyph vectors. The
+// numerical values can be verified by running the ttx tool, remembering that:
+// - for PostScript glyphs, ttx coordinates are relative, and hstem / vstem
+// operators are hinting-related and can be ignored.
+// - for TrueType glyphs, ttx coordinates are absolute, and consecutive
+// off-curve points implies an on-curve point at the midpoint.
+var proprietaryGlyphTestCases = map[string]map[rune][]Segment{
+ "adobe/SourceSansPro-Regular.otf": {
+ ',': {
+ // - contour #0
+ // 67 -170 rmoveto
+ moveTo(67, -170),
+ // 81 34 50 67 86 vvcurveto
+ cubeTo(148, -136, 198, -69, 198, 17),
+ // 60 -26 37 -43 -33 -28 -22 -36 -37 27 -20 32 3 4 0 1 3 vhcurveto
+ cubeTo(198, 77, 172, 114, 129, 114),
+ cubeTo(96, 114, 68, 92, 68, 56),
+ cubeTo(68, 19, 95, -1, 127, -1),
+ cubeTo(130, -1, 134, -1, 137, 0),
+ // 1 -53 -34 -44 -57 -25 rrcurveto
+ cubeTo(138, -53, 104, -97, 47, -122),
+ },
+ 'Q': {
+ // - contour #0
+ // 332 57 rmoveto
+ moveTo(332, 57),
+ // -117 -77 106 168 163 77 101 117 117 77 -101 -163 -168 -77 -106 -117 hvcurveto
+ cubeTo(215, 57, 138, 163, 138, 331),
+ cubeTo(138, 494, 215, 595, 332, 595),
+ cubeTo(449, 595, 526, 494, 526, 331),
+ cubeTo(526, 163, 449, 57, 332, 57),
+ // - contour #1
+ // 201 -222 rmoveto
+ moveTo(533, -165),
+ // 39 35 7 8 20 hvcurveto
+ cubeTo(572, -165, 607, -158, 627, -150),
+ // -16 64 rlineto
+ lineTo(611, -86),
+ // -5 -18 -22 -4 -29 hhcurveto
+ cubeTo(593, -91, 571, -95, 542, -95),
+ // -71 -60 29 58 -30 hvcurveto
+ cubeTo(471, -95, 411, -66, 381, -8),
+ // 139 24 93 126 189 vvcurveto
+ cubeTo(520, 16, 613, 142, 613, 331),
+ // 209 -116 128 -165 -165 -115 -127 -210 -193 96 -127 143 -20 vhcurveto
+ cubeTo(613, 540, 497, 668, 332, 668),
+ cubeTo(167, 668, 52, 541, 52, 331),
+ cubeTo(52, 138, 148, 11, 291, -9),
+ // -90 38 83 -66 121 hhcurveto
+ cubeTo(329, -99, 412, -165, 533, -165),
+ },
+ },
+
+ "microsoft/Arial.ttf": {
+ ',': {
+ // - contour #0
+ moveTo(182, 0),
+ lineTo(182, 205),
+ lineTo(387, 205),
+ lineTo(387, 0),
+ quadTo(387, -113, 347, -182),
+ quadTo(307, -252, 220, -290),
+ lineTo(170, -213),
+ quadTo(227, -188, 254, -139),
+ quadTo(281, -91, 284, 0),
+ lineTo(182, 0),
+ },
+ 'i': {
+ // - contour #0
+ moveTo(136, 1259),
+ lineTo(136, 1466),
+ lineTo(316, 1466),
+ lineTo(316, 1259),
+ lineTo(136, 1259),
+ // - contour #1
+ moveTo(136, 0),
+ lineTo(136, 1062),
+ lineTo(316, 1062),
+ lineTo(316, 0),
+ lineTo(136, 0),
+ },
+ 'o': {
+ // - contour #0
+ moveTo(68, 531),
+ quadTo(68, 826, 232, 968),
+ quadTo(369, 1086, 566, 1086),
+ quadTo(785, 1086, 924, 942),
+ quadTo(1063, 799, 1063, 546),
+ quadTo(1063, 341, 1001, 223),
+ quadTo(940, 106, 822, 41),
+ quadTo(705, -24, 566, -24),
+ quadTo(343, -24, 205, 119),
+ quadTo(68, 262, 68, 531),
+ // - contour #1
+ moveTo(253, 531),
+ quadTo(253, 327, 342, 225),
+ quadTo(431, 124, 566, 124),
+ quadTo(700, 124, 789, 226),
+ quadTo(878, 328, 878, 537),
+ quadTo(878, 734, 788, 835),
+ quadTo(699, 937, 566, 937),
+ quadTo(431, 937, 342, 836),
+ quadTo(253, 735, 253, 531),
+ },
+ },
+}
+
+type kernTestCase struct {
+ ppem fixed.Int26_6
+ hinting font.Hinting
+ runes [2]rune
+ want Units
+}
+
+// proprietaryKernTestCases hold a sample of each font's kerning pairs. The
+// numerical values can be verified by running the ttx tool.
+var proprietaryKernTestCases = map[string][]kernTestCase{
+ "microsoft/Arial.ttf": {
+ {2048, font.HintingNone, [2]rune{'A', 'V'}, -152},
+ // U+03B8 GREEK SMALL LETTER THETA
+ // U+03BB GREEK SMALL LETTER LAMDA
+ {2048, font.HintingNone, [2]rune{'\u03b8', '\u03bb'}, -39},
+ {2048, font.HintingNone, [2]rune{'\u03bb', '\u03b8'}, -0},
+ },
+ "microsoft/Comic_Sans_MS.ttf": {
+ {2048, font.HintingNone, [2]rune{'A', 'V'}, 0},
+ },
+ "microsoft/Times_New_Roman.ttf": {
+ {768, font.HintingNone, [2]rune{'A', 'V'}, -99},
+ {768, font.HintingFull, [2]rune{'A', 'V'}, -128},
+ {2048, font.HintingNone, [2]rune{'A', 'A'}, 0},
+ {2048, font.HintingNone, [2]rune{'A', 'T'}, -227},
+ {2048, font.HintingNone, [2]rune{'A', 'V'}, -264},
+ {2048, font.HintingNone, [2]rune{'T', 'A'}, -164},
+ {2048, font.HintingNone, [2]rune{'T', 'T'}, 0},
+ {2048, font.HintingNone, [2]rune{'T', 'V'}, 0},
+ {2048, font.HintingNone, [2]rune{'V', 'A'}, -264},
+ {2048, font.HintingNone, [2]rune{'V', 'T'}, 0},
+ {2048, font.HintingNone, [2]rune{'V', 'V'}, 0},
+ // U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ // U+0393 GREEK CAPITAL LETTER GAMMA
+ {2048, font.HintingNone, [2]rune{'\u0390', '\u0393'}, 0},
+ {2048, font.HintingNone, [2]rune{'\u0393', '\u0390'}, 76},
+ },
+ "microsoft/Webdings.ttf": {
+ {2048, font.HintingNone, [2]rune{'\uf041', '\uf042'}, 0},
+ },
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/sfnt.go b/vendor/golang.org/x/image/font/sfnt/sfnt.go
index d4929a838..02efd5f3a 100644
--- a/vendor/golang.org/x/image/font/sfnt/sfnt.go
+++ b/vendor/golang.org/x/image/font/sfnt/sfnt.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:generate go run gen.go
+
// Package sfnt implements a decoder for SFNT font file formats, including
// TrueType and OpenType.
package sfnt // import "golang.org/x/image/font/sfnt"
@@ -13,11 +15,15 @@ package sfnt // import "golang.org/x/image/font/sfnt"
//
// The pyftinspect tool from https://github.com/fonttools/fonttools is useful
// for inspecting SFNT fonts.
+//
+// The ttfdump tool is also useful. For example:
+// ttfdump -t cmap ../testdata/CFFTest.otf dump.txt
import (
"errors"
"io"
+ "golang.org/x/image/font"
"golang.org/x/image/math/fixed"
"golang.org/x/text/encoding/charmap"
)
@@ -25,6 +31,20 @@ import (
// These constants are not part of the specifications, but are limitations used
// by this implementation.
const (
+ // This value is arbitrary, but defends against parsing malicious font
+ // files causing excessive memory allocations. For reference, Adobe's
+ // SourceHanSansSC-Regular.otf has 65535 glyphs and:
+ // - its format-4 cmap table has 1581 segments.
+ // - its format-12 cmap table has 16498 segments.
+ //
+ // TODO: eliminate this constraint? If the cmap table is very large, load
+ // some or all of it lazily (at the time Font.GlyphIndex is called) instead
+ // of all of it eagerly (at the time Font.initialize is called), while
+ // keeping an upper bound on the memory used? This will make the code in
+ // cmap.go more complicated, considering that all of the Font methods are
+ // safe to call concurrently, as long as each call has a different *Buffer.
+ maxCmapSegments = 20000
+
maxGlyphDataLength = 64 * 1024
maxHintBits = 256
maxNumTables = 256
@@ -41,27 +61,34 @@ var (
errInvalidBounds = errors.New("sfnt: invalid bounds")
errInvalidCFFTable = errors.New("sfnt: invalid CFF table")
+ errInvalidCmapTable = errors.New("sfnt: invalid cmap table")
errInvalidGlyphData = errors.New("sfnt: invalid glyph data")
errInvalidHeadTable = errors.New("sfnt: invalid head table")
+ errInvalidKernTable = errors.New("sfnt: invalid kern table")
errInvalidLocaTable = errors.New("sfnt: invalid loca table")
errInvalidLocationData = errors.New("sfnt: invalid location data")
errInvalidMaxpTable = errors.New("sfnt: invalid maxp table")
errInvalidNameTable = errors.New("sfnt: invalid name table")
+ errInvalidPostTable = errors.New("sfnt: invalid post table")
errInvalidSourceData = errors.New("sfnt: invalid source data")
errInvalidTableOffset = errors.New("sfnt: invalid table offset")
errInvalidTableTagOrder = errors.New("sfnt: invalid table tag order")
errInvalidUCS2String = errors.New("sfnt: invalid UCS-2 string")
errInvalidVersion = errors.New("sfnt: invalid version")
- errUnsupportedCFFVersion = errors.New("sfnt: unsupported CFF version")
- errUnsupportedCompoundGlyph = errors.New("sfnt: unsupported compound glyph")
- errUnsupportedGlyphDataLength = errors.New("sfnt: unsupported glyph data length")
- errUnsupportedRealNumberEncoding = errors.New("sfnt: unsupported real number encoding")
- errUnsupportedNumberOfHints = errors.New("sfnt: unsupported number of hints")
- errUnsupportedNumberOfTables = errors.New("sfnt: unsupported number of tables")
- errUnsupportedPlatformEncoding = errors.New("sfnt: unsupported platform encoding")
- errUnsupportedTableOffsetLength = errors.New("sfnt: unsupported table offset or length")
- errUnsupportedType2Charstring = errors.New("sfnt: unsupported Type 2 Charstring")
+ errUnsupportedCFFVersion = errors.New("sfnt: unsupported CFF version")
+ errUnsupportedCmapEncodings = errors.New("sfnt: unsupported cmap encodings")
+ errUnsupportedCompoundGlyph = errors.New("sfnt: unsupported compound glyph")
+ errUnsupportedGlyphDataLength = errors.New("sfnt: unsupported glyph data length")
+ errUnsupportedKernTable = errors.New("sfnt: unsupported kern table")
+ errUnsupportedRealNumberEncoding = errors.New("sfnt: unsupported real number encoding")
+ errUnsupportedNumberOfCmapSegments = errors.New("sfnt: unsupported number of cmap segments")
+ errUnsupportedNumberOfHints = errors.New("sfnt: unsupported number of hints")
+ errUnsupportedNumberOfTables = errors.New("sfnt: unsupported number of tables")
+ errUnsupportedPlatformEncoding = errors.New("sfnt: unsupported platform encoding")
+ errUnsupportedPostTable = errors.New("sfnt: unsupported post table")
+ errUnsupportedTableOffsetLength = errors.New("sfnt: unsupported table offset or length")
+ errUnsupportedType2Charstring = errors.New("sfnt: unsupported Type 2 Charstring")
)
// GlyphIndex is a glyph index in a Font.
@@ -107,16 +134,16 @@ const (
// display resolution (DPI) and font size (e.g. a 12 point font).
type Units int32
-// Platform IDs and Platform Specific IDs as per
-// https://www.microsoft.com/typography/otspec/name.htm
-const (
- pidMacintosh = 1
- pidWindows = 3
-
- psidMacintoshRoman = 0
-
- psidWindowsUCS2 = 1
-)
+// scale returns x divided by unitsPerEm, rounded to the nearest fixed.Int26_6
+// value (1/64th of a pixel).
+func scale(x fixed.Int26_6, unitsPerEm Units) fixed.Int26_6 {
+ if x >= 0 {
+ x += fixed.Int26_6(unitsPerEm) / 2
+ } else {
+ x -= fixed.Int26_6(unitsPerEm) / 2
+ }
+ return x / fixed.Int26_6(unitsPerEm)
+}
func u16(b []byte) uint16 {
_ = b[1] // Bounds check hint to compiler.
@@ -208,6 +235,20 @@ func (s *source) u16(buf []byte, t table, i int) (uint16, error) {
return u16(buf), nil
}
+// u32 returns the uint32 in the table t at the relative offset i.
+//
+// buf is an optional scratch buffer as per the source.view method.
+func (s *source) u32(buf []byte, t table, i int) (uint32, error) {
+ if i < 0 || uint(t.length) < uint(i+4) {
+ return 0, errInvalidBounds
+ }
+ buf, err := s.view(buf, int(t.offset)+i, 4)
+ if err != nil {
+ return 0, err
+ }
+ return u32(buf), nil
+}
+
// table is a section of the font data.
type table struct {
offset, length uint32
@@ -247,6 +288,18 @@ func ParseReaderAt(src io.ReaderAt) (*Font, error) {
//
// The Font methods that don't take a *Buffer argument are always safe to call
// concurrently.
+//
+// Some methods provide lengths or coordinates, e.g. bounds, font metrics and
+// control points. All of these methods take a ppem parameter, which is the
+// number of pixels in 1 em, expressed as a 26.6 fixed point value. For
+// example, if 1 em is 10 pixels then ppem is fixed.I(10), which equals
+// fixed.Int26_6(10 << 6).
+//
+// To get those lengths or coordinates in terms of font units instead of
+// pixels, use ppem = fixed.Int26_6(f.UnitsPerEm()) and if those methods take a
+// font.Hinting parameter, use font.HintingNone. The return values will have
+// type fixed.Int26_6, but those numbers can be converted back to Units with no
+// further scaling necessary.
type Font struct {
src source
@@ -283,11 +336,16 @@ type Font struct {
// https://www.microsoft.com/typography/otspec/otff.htm#otttables
// "Other OpenType Tables".
//
- // TODO: hdmx, kern, vmtx? Others?
+ // TODO: hdmx, vmtx? Others?
+ kern table
cached struct {
+ glyphIndex glyphIndexFunc
indexToLocFormat bool // false means short, true means long.
isPostScript bool
+ kernNumPairs int32
+ kernOffset int32
+ postTableVersion uint32
unitsPerEm Units
// The glyph data for the glyph index i is in
@@ -306,51 +364,96 @@ func (f *Font) initialize() error {
if !f.src.valid() {
return errInvalidSourceData
}
- var buf []byte
+ buf, isPostScript, err := f.initializeTables(nil)
+ if err != nil {
+ return err
+ }
+ // The order of these parseXxx calls matters. Later calls may depend on
+ // information parsed by earlier calls, such as the maxp table's numGlyphs.
+ // To enforce these dependencies, such information is passed and returned
+ // explicitly, and the f.cached fields are only set afterwards.
+ //
+ // When implementing new parseXxx methods, take care not to call methods
+ // such as Font.NumGlyphs that implicitly depend on f.cached fields.
+
+ buf, indexToLocFormat, unitsPerEm, err := f.parseHead(buf)
+ if err != nil {
+ return err
+ }
+ buf, numGlyphs, locations, err := f.parseMaxp(buf, indexToLocFormat, isPostScript)
+ if err != nil {
+ return err
+ }
+ buf, glyphIndex, err := f.parseCmap(buf)
+ if err != nil {
+ return err
+ }
+ buf, kernNumPairs, kernOffset, err := f.parseKern(buf)
+ if err != nil {
+ return err
+ }
+ buf, postTableVersion, err := f.parsePost(buf, numGlyphs)
+ if err != nil {
+ return err
+ }
+
+ f.cached.glyphIndex = glyphIndex
+ f.cached.indexToLocFormat = indexToLocFormat
+ f.cached.isPostScript = isPostScript
+ f.cached.kernNumPairs = kernNumPairs
+ f.cached.kernOffset = kernOffset
+ f.cached.postTableVersion = postTableVersion
+ f.cached.unitsPerEm = unitsPerEm
+ f.cached.locations = locations
+
+ return nil
+}
+
+func (f *Font) initializeTables(buf []byte) (buf1 []byte, isPostScript bool, err error) {
// https://www.microsoft.com/typography/otspec/otff.htm "Organization of an
// OpenType Font" says that "The OpenType font starts with the Offset
// Table", which is 12 bytes.
- buf, err := f.src.view(buf, 0, 12)
+ buf, err = f.src.view(buf, 0, 12)
if err != nil {
- return err
+ return nil, false, err
}
switch u32(buf) {
default:
- return errInvalidVersion
+ return nil, false, errInvalidVersion
case 0x00010000:
// No-op.
case 0x4f54544f: // "OTTO".
- f.cached.isPostScript = true
+ isPostScript = true
}
numTables := int(u16(buf[4:]))
if numTables > maxNumTables {
- return errUnsupportedNumberOfTables
+ return nil, false, errUnsupportedNumberOfTables
}
// "The Offset Table is followed immediately by the Table Record entries...
// sorted in ascending order by tag", 16 bytes each.
buf, err = f.src.view(buf, 12, 16*numTables)
if err != nil {
- return err
+ return nil, false, err
}
for b, first, prevTag := buf, true, uint32(0); len(b) > 0; b = b[16:] {
tag := u32(b)
if first {
first = false
} else if tag <= prevTag {
- return errInvalidTableTagOrder
+ return nil, false, errInvalidTableTagOrder
}
prevTag = tag
o, n := u32(b[8:12]), u32(b[12:16])
if o > maxTableOffset || n > maxTableLength {
- return errUnsupportedTableOffsetLength
+ return nil, false, errUnsupportedTableOffsetLength
}
// We ignore the checksums, but "all tables must begin on four byte
// boundries [sic]".
if o&3 != 0 {
- return errInvalidTableOffset
+ return nil, false, errInvalidTableOffset
}
// Match the 4-byte tag as a uint32. For example, "OS/2" is 0x4f532f32.
@@ -369,6 +472,8 @@ func (f *Font) initialize() error {
f.hhea = table{o, n}
case 0x686d7478:
f.hmtx = table{o, n}
+ case 0x6b65726e:
+ f.kern = table{o, n}
case 0x6c6f6361:
f.loca = table{o, n}
case 0x6d617870:
@@ -379,69 +484,258 @@ func (f *Font) initialize() error {
f.post = table{o, n}
}
}
+ return buf, isPostScript, nil
+}
- var u uint16
+func (f *Font) parseCmap(buf []byte) (buf1 []byte, glyphIndex glyphIndexFunc, err error) {
+ // https://www.microsoft.com/typography/OTSPEC/cmap.htm
+ const headerSize, entrySize = 4, 8
+ if f.cmap.length < headerSize {
+ return nil, nil, errInvalidCmapTable
+ }
+ u, err := f.src.u16(buf, f.cmap, 2)
+ if err != nil {
+ return nil, nil, err
+ }
+ numSubtables := int(u)
+ if f.cmap.length < headerSize+entrySize*uint32(numSubtables) {
+ return nil, nil, errInvalidCmapTable
+ }
+
+ var (
+ bestWidth int
+ bestOffset uint32
+ bestLength uint32
+ bestFormat uint16
+ )
+
+ // Scan all of the subtables, picking the widest supported one. See the
+ // platformEncodingWidth comment for more discussion of width.
+ for i := 0; i < numSubtables; i++ {
+ buf, err = f.src.view(buf, int(f.cmap.offset)+headerSize+entrySize*i, entrySize)
+ if err != nil {
+ return nil, nil, err
+ }
+ pid := u16(buf)
+ psid := u16(buf[2:])
+ width := platformEncodingWidth(pid, psid)
+ if width <= bestWidth {
+ continue
+ }
+ offset := u32(buf[4:])
+
+ if offset > f.cmap.length-4 {
+ return nil, nil, errInvalidCmapTable
+ }
+ buf, err = f.src.view(buf, int(f.cmap.offset+offset), 4)
+ if err != nil {
+ return nil, nil, err
+ }
+ format := u16(buf)
+ if !supportedCmapFormat(format, pid, psid) {
+ continue
+ }
+ length := uint32(u16(buf[2:]))
+
+ bestWidth = width
+ bestOffset = offset
+ bestLength = length
+ bestFormat = format
+ }
+
+ if bestWidth == 0 {
+ return nil, nil, errUnsupportedCmapEncodings
+ }
+ return f.makeCachedGlyphIndex(buf, bestOffset, bestLength, bestFormat)
+}
+
+func (f *Font) parseHead(buf []byte) (buf1 []byte, indexToLocFormat bool, unitsPerEm Units, err error) {
// https://www.microsoft.com/typography/otspec/head.htm
+
if f.head.length != 54 {
- return errInvalidHeadTable
+ return nil, false, 0, errInvalidHeadTable
}
- u, err = f.src.u16(buf, f.head, 18)
+ u, err := f.src.u16(buf, f.head, 18)
if err != nil {
- return err
+ return nil, false, 0, err
}
if u == 0 {
- return errInvalidHeadTable
+ return nil, false, 0, errInvalidHeadTable
}
- f.cached.unitsPerEm = Units(u)
+ unitsPerEm = Units(u)
u, err = f.src.u16(buf, f.head, 50)
if err != nil {
- return err
+ return nil, false, 0, err
+ }
+ indexToLocFormat = u != 0
+ return buf, indexToLocFormat, unitsPerEm, nil
+}
+
+func (f *Font) parseKern(buf []byte) (buf1 []byte, kernNumPairs, kernOffset int32, err error) {
+ // https://www.microsoft.com/typography/otspec/kern.htm
+
+ if f.kern.length == 0 {
+ return buf, 0, 0, nil
+ }
+ const headerSize = 4
+ if f.kern.length < headerSize {
+ return nil, 0, 0, errInvalidKernTable
+ }
+ buf, err = f.src.view(buf, int(f.kern.offset), headerSize)
+ if err != nil {
+ return nil, 0, 0, err
+ }
+ offset := int(f.kern.offset) + headerSize
+ length := int(f.kern.length) - headerSize
+
+ switch version := u16(buf); version {
+ case 0:
+ // TODO: support numTables != 1. Testing that requires finding such a font.
+ if numTables := int(u16(buf[2:])); numTables != 1 {
+ return nil, 0, 0, errUnsupportedKernTable
+ }
+ return f.parseKernVersion0(buf, offset, length)
+ case 1:
+ // TODO: find such a (proprietary?) font, and support it. Both of
+ // https://www.microsoft.com/typography/otspec/kern.htm
+ // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kern.html
+ // say that such fonts work on Mac OS but not on Windows.
+ }
+ return nil, 0, 0, errUnsupportedKernTable
+}
+
+func (f *Font) parseKernVersion0(buf []byte, offset, length int) (buf1 []byte, kernNumPairs, kernOffset int32, err error) {
+ const headerSize = 6
+ if length < headerSize {
+ return nil, 0, 0, errInvalidKernTable
+ }
+ buf, err = f.src.view(buf, offset, headerSize)
+ if err != nil {
+ return nil, 0, 0, err
}
- f.cached.indexToLocFormat = u != 0
+ if version := u16(buf); version != 0 {
+ return nil, 0, 0, errUnsupportedKernTable
+ }
+ subtableLength := int(u16(buf[2:]))
+ if subtableLength < headerSize || length < subtableLength {
+ return nil, 0, 0, errInvalidKernTable
+ }
+ if coverageBits := buf[5]; coverageBits != 0x01 {
+ // We only support horizontal kerning.
+ return nil, 0, 0, errUnsupportedKernTable
+ }
+ offset += headerSize
+ length -= headerSize
+ subtableLength -= headerSize
+
+ switch format := buf[4]; format {
+ case 0:
+ return f.parseKernFormat0(buf, offset, subtableLength)
+ case 2:
+ // TODO: find such a (proprietary?) font, and support it.
+ }
+ return nil, 0, 0, errUnsupportedKernTable
+}
+func (f *Font) parseKernFormat0(buf []byte, offset, length int) (buf1 []byte, kernNumPairs, kernOffset int32, err error) {
+ const headerSize, entrySize = 8, 6
+ if length < headerSize {
+ return nil, 0, 0, errInvalidKernTable
+ }
+ buf, err = f.src.view(buf, offset, headerSize)
+ if err != nil {
+ return nil, 0, 0, err
+ }
+ kernNumPairs = int32(u16(buf))
+ if length != headerSize+entrySize*int(kernNumPairs) {
+ return nil, 0, 0, errInvalidKernTable
+ }
+ return buf, kernNumPairs, int32(offset) + headerSize, nil
+}
+
+func (f *Font) parseMaxp(buf []byte, indexToLocFormat, isPostScript bool) (buf1 []byte, numGlyphs int, locations []uint32, err error) {
// https://www.microsoft.com/typography/otspec/maxp.htm
- if f.cached.isPostScript {
+
+ if isPostScript {
if f.maxp.length != 6 {
- return errInvalidMaxpTable
+ return nil, 0, nil, errInvalidMaxpTable
}
} else {
if f.maxp.length != 32 {
- return errInvalidMaxpTable
+ return nil, 0, nil, errInvalidMaxpTable
}
}
- u, err = f.src.u16(buf, f.maxp, 4)
+ u, err := f.src.u16(buf, f.maxp, 4)
if err != nil {
- return err
+ return nil, 0, nil, err
}
- numGlyphs := int(u)
+ numGlyphs = int(u)
- if f.cached.isPostScript {
+ if isPostScript {
p := cffParser{
src: &f.src,
base: int(f.cff.offset),
offset: int(f.cff.offset),
end: int(f.cff.offset + f.cff.length),
}
- f.cached.locations, err = p.parse()
+ locations, err = p.parse()
if err != nil {
- return err
+ return nil, 0, nil, err
}
} else {
- f.cached.locations, err = parseLoca(
- &f.src, f.loca, f.glyf.offset, f.cached.indexToLocFormat, numGlyphs)
+ locations, err = parseLoca(&f.src, f.loca, f.glyf.offset, indexToLocFormat, numGlyphs)
if err != nil {
- return err
+ return nil, 0, nil, err
}
}
- if len(f.cached.locations) != numGlyphs+1 {
- return errInvalidLocationData
+ if len(locations) != numGlyphs+1 {
+ return nil, 0, nil, errInvalidLocationData
}
- return nil
+
+ return buf, numGlyphs, locations, nil
}
-// TODO: func (f *Font) GlyphIndex(r rune) (x GlyphIndex, ok bool)
-// This will require parsing the cmap table.
+func (f *Font) parsePost(buf []byte, numGlyphs int) (buf1 []byte, postTableVersion uint32, err error) {
+ // https://www.microsoft.com/typography/otspec/post.htm
+
+ const headerSize = 32
+ if f.post.length < headerSize {
+ return nil, 0, errInvalidPostTable
+ }
+ u, err := f.src.u32(buf, f.post, 0)
+ if err != nil {
+ return nil, 0, err
+ }
+ switch u {
+ case 0x20000:
+ if f.post.length < headerSize+2+2*uint32(numGlyphs) {
+ return nil, 0, errInvalidPostTable
+ }
+ case 0x30000:
+ // No-op.
+ default:
+ return nil, 0, errUnsupportedPostTable
+ }
+ return buf, u, nil
+}
+
+// TODO: API for looking up glyph variants?? For example, some fonts may
+// provide both slashed and dotted zero glyphs ('0'), or regular and 'old
+// style' numerals, and users can direct software to choose a variant.
+
+type glyphIndexFunc func(f *Font, b *Buffer, r rune) (GlyphIndex, error)
+
+// GlyphIndex returns the glyph index for the given rune.
+//
+// It returns (0, nil) if there is no glyph for r.
+// https://www.microsoft.com/typography/OTSPEC/cmap.htm says that "Character
+// codes that do not correspond to any glyph in the font should be mapped to
+// glyph index 0. The glyph at this location must be a special glyph
+// representing a missing character, commonly known as .notdef."
+func (f *Font) GlyphIndex(b *Buffer, r rune) (GlyphIndex, error) {
+ return f.cached.glyphIndex(f, b, r)
+}
func (f *Font) viewGlyphData(b *Buffer, x GlyphIndex) ([]byte, error) {
xx := int(x)
@@ -458,15 +752,16 @@ func (f *Font) viewGlyphData(b *Buffer, x GlyphIndex) ([]byte, error) {
// LoadGlyphOptions are the options to the Font.LoadGlyph method.
type LoadGlyphOptions struct {
- // TODO: scale / transform / hinting.
+ // TODO: transform / hinting.
}
-// LoadGlyph returns the vector segments for the x'th glyph.
+// LoadGlyph returns the vector segments for the x'th glyph. ppem is the number
+// of pixels in 1 em.
//
// If b is non-nil, the segments become invalid to use once b is re-used.
//
// It returns ErrNotFound if the glyph index is out of range.
-func (f *Font) LoadGlyph(b *Buffer, x GlyphIndex, opts *LoadGlyphOptions) ([]Segment, error) {
+func (f *Font) LoadGlyph(b *Buffer, x GlyphIndex, ppem fixed.Int26_6, opts *LoadGlyphOptions) ([]Segment, error) {
if b == nil {
b = &Buffer{}
}
@@ -491,11 +786,153 @@ func (f *Font) LoadGlyph(b *Buffer, x GlyphIndex, opts *LoadGlyphOptions) ([]Seg
b.segments = segments
}
- // TODO: look at opts to scale / transform / hint the Buffer.segments.
+ // Scale the segments. If we want to support hinting, we'll have to push
+ // the scaling computation into the PostScript / TrueType specific glyph
+ // loading code, such as the appendGlyfSegments body, since TrueType
+ // hinting bytecode works on the scaled glyph vectors. For now, though,
+ // it's simpler to scale as a post-processing step.
+ for i := range b.segments {
+ s := &b.segments[i]
+ for j := range s.Args {
+ s.Args[j] = scale(s.Args[j]*ppem, f.cached.unitsPerEm)
+ }
+ }
+
+ // TODO: look at opts to transform / hint the Buffer.segments.
return b.segments, nil
}
+// GlyphName returns the name of the x'th glyph.
+//
+// Not every font contains glyph names. If not present, GlyphName will return
+// ("", nil).
+//
+// If present, the glyph name, provided by the font, is assumed to follow the
+// Adobe Glyph List Specification:
+// https://github.com/adobe-type-tools/agl-specification/blob/master/README.md
+//
+// This is also known as the "Adobe Glyph Naming convention", the "Adobe
+// document [for] Unicode and Glyph Names" or "PostScript glyph names".
+//
+// It returns ErrNotFound if the glyph index is out of range.
+func (f *Font) GlyphName(b *Buffer, x GlyphIndex) (string, error) {
+ if int(x) >= f.NumGlyphs() {
+ return "", ErrNotFound
+ }
+ if f.cached.postTableVersion != 0x20000 {
+ return "", nil
+ }
+ if b == nil {
+ b = &Buffer{}
+ }
+
+ // The wire format for a Version 2 post table is documented at:
+ // https://www.microsoft.com/typography/otspec/post.htm
+ const glyphNameIndexOffset = 34
+
+ buf, err := b.view(&f.src, int(f.post.offset)+glyphNameIndexOffset+2*int(x), 2)
+ if err != nil {
+ return "", err
+ }
+ u := u16(buf)
+ if u < numBuiltInPostNames {
+ i := builtInPostNamesOffsets[u+0]
+ j := builtInPostNamesOffsets[u+1]
+ return builtInPostNamesData[i:j], nil
+ }
+ // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6post.html
+ // says that "32768 through 65535 are reserved for future use".
+ if u > 32767 {
+ return "", errUnsupportedPostTable
+ }
+ u -= numBuiltInPostNames
+
+ // Iterate through the list of Pascal-formatted strings. A linear scan is
+ // clearly O(u), which isn't great (as the obvious loop, calling
+ // Font.GlyphName, to get all of the glyph names in a font has quadratic
+ // complexity), but the wire format doesn't suggest a better alternative.
+
+ offset := glyphNameIndexOffset + 2*f.NumGlyphs()
+ buf, err = b.view(&f.src, int(f.post.offset)+offset, int(f.post.length)-offset)
+ if err != nil {
+ return "", err
+ }
+
+ for {
+ if len(buf) == 0 {
+ return "", errInvalidPostTable
+ }
+ n := 1 + int(buf[0])
+ if len(buf) < n {
+ return "", errInvalidPostTable
+ }
+ if u == 0 {
+ return string(buf[1:n]), nil
+ }
+ buf = buf[n:]
+ u--
+ }
+}
+
+// Kern returns the horizontal adjustment for the kerning pair (x0, x1). A
+// positive kern means to move the glyphs further apart. ppem is the number of
+// pixels in 1 em.
+//
+// It returns ErrNotFound if either glyph index is out of range.
+func (f *Font) Kern(b *Buffer, x0, x1 GlyphIndex, ppem fixed.Int26_6, h font.Hinting) (fixed.Int26_6, error) {
+ // TODO: how should this work with the GPOS table and CFF fonts?
+ // https://www.microsoft.com/typography/otspec/kern.htm says that
+ // "OpenType™ fonts containing CFF outlines are not supported by the 'kern'
+ // table and must use the 'GPOS' OpenType Layout table."
+
+ if n := f.NumGlyphs(); int(x0) >= n || int(x1) >= n {
+ return 0, ErrNotFound
+ }
+ // Not every font has a kern table. If it doesn't, there's no need to
+ // allocate a Buffer.
+ if f.kern.length == 0 {
+ return 0, nil
+ }
+ if b == nil {
+ b = &Buffer{}
+ }
+
+ key := uint32(x0)<<16 | uint32(x1)
+ lo, hi := int32(0), f.cached.kernNumPairs
+ for lo < hi {
+ i := (lo + hi) / 2
+
+ // TODO: this view call inside the inner loop can lead to many small
+ // reads instead of fewer larger reads, which can be expensive. We
+ // should be able to do better, although we don't want to make (one)
+ // arbitrarily large read. Perhaps we should round up reads to 4K or 8K
+ // chunks. For reference, Arial.ttf's kern table is 5472 bytes.
+ // Times_New_Roman.ttf's kern table is 5220 bytes.
+ const entrySize = 6
+ buf, err := b.view(&f.src, int(f.cached.kernOffset+i*entrySize), entrySize)
+ if err != nil {
+ return 0, err
+ }
+
+ k := u32(buf)
+ if k < key {
+ lo = i + 1
+ } else if k > key {
+ hi = i
+ } else {
+ kern := fixed.Int26_6(int16(u16(buf[4:])))
+ kern = scale(kern*ppem, f.cached.unitsPerEm)
+ if h == font.HintingFull {
+ // Quantize the fixed.Int26_6 value to the nearest pixel.
+ kern = (kern + 32) &^ 63
+ }
+ return kern, nil
+ }
+ }
+ return 0, nil
+}
+
// Name returns the name value keyed by the given NameID.
//
// It returns ErrNotFound if there is no value for that key.
@@ -512,14 +949,14 @@ func (f *Font) Name(b *Buffer, id NameID) (string, error) {
if err != nil {
return "", err
}
- nSubtables := u16(buf[2:])
- if f.name.length < headerSize+entrySize*uint32(nSubtables) {
+ numSubtables := u16(buf[2:])
+ if f.name.length < headerSize+entrySize*uint32(numSubtables) {
return "", errInvalidNameTable
}
stringOffset := u16(buf[4:])
seen := false
- for i, n := 0, int(nSubtables); i < n; i++ {
+ for i, n := 0, int(numSubtables); i < n; i++ {
buf, err := b.view(&f.src, int(f.name.offset)+headerSize+entrySize*i, entrySize)
if err != nil {
return "", err
diff --git a/vendor/golang.org/x/image/font/sfnt/sfnt_test.go b/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
index 4ffd72f40..85d96a96f 100644
--- a/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
+++ b/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
@@ -6,6 +6,7 @@ package sfnt
import (
"bytes"
+ "fmt"
"io/ioutil"
"path/filepath"
"testing"
@@ -14,52 +15,48 @@ import (
"golang.org/x/image/math/fixed"
)
-func moveTo(xa, ya int) Segment {
+func moveTo(xa, ya fixed.Int26_6) Segment {
return Segment{
- Op: SegmentOpMoveTo,
- Args: [6]fixed.Int26_6{
- 0: fixed.I(xa),
- 1: fixed.I(ya),
- },
+ Op: SegmentOpMoveTo,
+ Args: [6]fixed.Int26_6{xa, ya},
}
}
-func lineTo(xa, ya int) Segment {
+func lineTo(xa, ya fixed.Int26_6) Segment {
return Segment{
- Op: SegmentOpLineTo,
- Args: [6]fixed.Int26_6{
- 0: fixed.I(xa),
- 1: fixed.I(ya),
- },
+ Op: SegmentOpLineTo,
+ Args: [6]fixed.Int26_6{xa, ya},
}
}
-func quadTo(xa, ya, xb, yb int) Segment {
+func quadTo(xa, ya, xb, yb fixed.Int26_6) Segment {
return Segment{
- Op: SegmentOpQuadTo,
- Args: [6]fixed.Int26_6{
- 0: fixed.I(xa),
- 1: fixed.I(ya),
- 2: fixed.I(xb),
- 3: fixed.I(yb),
- },
+ Op: SegmentOpQuadTo,
+ Args: [6]fixed.Int26_6{xa, ya, xb, yb},
}
}
-func cubeTo(xa, ya, xb, yb, xc, yc int) Segment {
+func cubeTo(xa, ya, xb, yb, xc, yc fixed.Int26_6) Segment {
return Segment{
- Op: SegmentOpCubeTo,
- Args: [6]fixed.Int26_6{
- 0: fixed.I(xa),
- 1: fixed.I(ya),
- 2: fixed.I(xb),
- 3: fixed.I(yb),
- 4: fixed.I(xc),
- 5: fixed.I(yc),
- },
+ Op: SegmentOpCubeTo,
+ Args: [6]fixed.Int26_6{xa, ya, xb, yb, xc, yc},
}
}
+func checkSegmentsEqual(got, want []Segment) error {
+ if len(got) != len(want) {
+ return fmt.Errorf("got %d elements, want %d\noverall:\ngot %v\nwant %v",
+ len(got), len(want), got, want)
+ }
+ for i, g := range got {
+ if w := want[i]; g != w {
+ return fmt.Errorf("element %d:\ngot %v\nwant %v\noverall:\ngot %v\nwant %v",
+ i, g, w, got, want)
+ }
+ }
+ return nil
+}
+
func TestTrueTypeParse(t *testing.T) {
f, err := Parse(goregular.TTF)
if err != nil {
@@ -88,6 +85,167 @@ func testTrueType(t *testing.T, f *Font) {
}
}
+func TestGoRegularGlyphIndex(t *testing.T) {
+ f, err := Parse(goregular.TTF)
+ if err != nil {
+ t.Fatalf("Parse: %v", err)
+ }
+
+ testCases := []struct {
+ r rune
+ want GlyphIndex
+ }{
+ // Glyphs that aren't present in Go Regular.
+ {'\u001f', 0}, // U+001F <control>
+ {'\u0200', 0}, // U+0200 LATIN CAPITAL LETTER A WITH DOUBLE GRAVE
+ {'\u2000', 0}, // U+2000 EN QUAD
+
+ // The want values below can be verified by running the ttx tool on
+ // Go-Regular.ttf.
+ //
+ // The actual values are ad hoc, and result from whatever tools the
+ // Bigelow & Holmes type foundry used and the order in which they
+ // crafted the glyphs. They may change over time as newer versions of
+ // the font are released. In practice, though, running this test with
+ // coverage analysis suggests that it covers both the zero and non-zero
+ // cmapEntry16.offset cases for a format-4 cmap table.
+
+ {'\u0020', 3}, // U+0020 SPACE
+ {'\u0021', 4}, // U+0021 EXCLAMATION MARK
+ {'\u0022', 5}, // U+0022 QUOTATION MARK
+ {'\u0023', 6}, // U+0023 NUMBER SIGN
+ {'\u0024', 223}, // U+0024 DOLLAR SIGN
+ {'\u0025', 7}, // U+0025 PERCENT SIGN
+ {'\u0026', 8}, // U+0026 AMPERSAND
+ {'\u0027', 9}, // U+0027 APOSTROPHE
+
+ {'\u03bd', 423}, // U+03BD GREEK SMALL LETTER NU
+ {'\u03be', 424}, // U+03BE GREEK SMALL LETTER XI
+ {'\u03bf', 438}, // U+03BF GREEK SMALL LETTER OMICRON
+ {'\u03c0', 208}, // U+03C0 GREEK SMALL LETTER PI
+ {'\u03c1', 425}, // U+03C1 GREEK SMALL LETTER RHO
+ {'\u03c2', 426}, // U+03C2 GREEK SMALL LETTER FINAL SIGMA
+ }
+
+ var b Buffer
+ for _, tc := range testCases {
+ got, err := f.GlyphIndex(&b, tc.r)
+ if err != nil {
+ t.Errorf("r=%q: %v", tc.r, err)
+ continue
+ }
+ if got != tc.want {
+ t.Errorf("r=%q: got %d, want %d", tc.r, got, tc.want)
+ continue
+ }
+ }
+}
+
+func TestGlyphIndex(t *testing.T) {
+ data, err := ioutil.ReadFile(filepath.FromSlash("../testdata/cmapTest.ttf"))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for _, format := range []int{-1, 0, 4, 12} {
+ testGlyphIndex(t, data, format)
+ }
+}
+
+func testGlyphIndex(t *testing.T, data []byte, cmapFormat int) {
+ if cmapFormat >= 0 {
+ originalSupportedCmapFormat := supportedCmapFormat
+ defer func() {
+ supportedCmapFormat = originalSupportedCmapFormat
+ }()
+ supportedCmapFormat = func(format, pid, psid uint16) bool {
+ return int(format) == cmapFormat && originalSupportedCmapFormat(format, pid, psid)
+ }
+ }
+
+ f, err := Parse(data)
+ if err != nil {
+ t.Errorf("cmapFormat=%d: %v", cmapFormat, err)
+ return
+ }
+
+ testCases := []struct {
+ r rune
+ want GlyphIndex
+ }{
+ // Glyphs that aren't present in cmapTest.ttf.
+ {'?', 0},
+ {'\ufffd', 0},
+ {'\U0001f4a9', 0},
+
+ // For a .TTF file, FontForge maps:
+ // - ".notdef" to glyph index 0.
+ // - ".null" to glyph index 1.
+ // - "nonmarkingreturn" to glyph index 2.
+
+ {'/', 0},
+ {'0', 3},
+ {'1', 4},
+ {'2', 5},
+ {'3', 0},
+
+ {'@', 0},
+ {'A', 6},
+ {'B', 7},
+ {'C', 0},
+
+ {'`', 0},
+ {'a', 8},
+ {'b', 0},
+
+ // Of the remaining runes, only U+00FF LATIN SMALL LETTER Y WITH
+ // DIAERESIS is in both the Mac Roman encoding and the cmapTest.ttf
+ // font file.
+ {'\u00fe', 0},
+ {'\u00ff', 9},
+ {'\u0100', 10},
+ {'\u0101', 11},
+ {'\u0102', 0},
+
+ {'\u4e2c', 0},
+ {'\u4e2d', 12},
+ {'\u4e2e', 0},
+
+ {'\U0001f0a0', 0},
+ {'\U0001f0a1', 13},
+ {'\U0001f0a2', 0},
+
+ {'\U0001f0b0', 0},
+ {'\U0001f0b1', 14},
+ {'\U0001f0b2', 15},
+ {'\U0001f0b3', 0},
+ }
+
+ var b Buffer
+ for _, tc := range testCases {
+ want := tc.want
+ switch {
+ case cmapFormat == 0 && tc.r > '\u007f' && tc.r != '\u00ff':
+ // cmap format 0, with the Macintosh Roman encoding, can only
+ // represent a limited set of non-ASCII runes, e.g. U+00FF.
+ want = 0
+ case cmapFormat == 4 && tc.r > '\uffff':
+ // cmap format 4 only supports the Basic Multilingual Plane (BMP).
+ want = 0
+ }
+
+ got, err := f.GlyphIndex(&b, tc.r)
+ if err != nil {
+ t.Errorf("cmapFormat=%d, r=%q: %v", cmapFormat, tc.r, err)
+ continue
+ }
+ if got != want {
+ t.Errorf("cmapFormat=%d, r=%q: got %d, want %d", cmapFormat, tc.r, got, want)
+ continue
+ }
+ }
+}
+
func TestPostScriptSegments(t *testing.T) {
// wants' vectors correspond 1-to-1 to what's in the CFFTest.sfd file,
// although OpenType/CFF and FontForge's SFD have reversed orders.
@@ -226,40 +384,32 @@ func TestTrueTypeSegments(t *testing.T) {
}
func testSegments(t *testing.T, filename string, wants [][]Segment) {
- data, err := ioutil.ReadFile(filepath.Join("..", "testdata", filename))
+ data, err := ioutil.ReadFile(filepath.FromSlash("../testdata/" + filename))
if err != nil {
- t.Fatal(err)
+ t.Fatalf("ReadFile: %v", err)
}
f, err := Parse(data)
if err != nil {
- t.Fatal(err)
+ t.Fatalf("Parse: %v", err)
}
+ ppem := fixed.Int26_6(f.UnitsPerEm())
if ng := f.NumGlyphs(); ng != len(wants) {
t.Fatalf("NumGlyphs: got %d, want %d", ng, len(wants))
}
var b Buffer
-loop:
for i, want := range wants {
- got, err := f.LoadGlyph(&b, GlyphIndex(i), nil)
+ got, err := f.LoadGlyph(&b, GlyphIndex(i), ppem, nil)
if err != nil {
t.Errorf("i=%d: LoadGlyph: %v", i, err)
continue
}
- if len(got) != len(want) {
- t.Errorf("i=%d: got %d elements, want %d\noverall:\ngot %v\nwant %v",
- i, len(got), len(want), got, want)
+ if err := checkSegmentsEqual(got, want); err != nil {
+ t.Errorf("i=%d: %v", i, err)
continue
}
- for j, g := range got {
- if w := want[j]; g != w {
- t.Errorf("i=%d: element %d:\ngot %v\nwant %v\noverall:\ngot %v\nwant %v",
- i, j, g, w, got, want)
- continue loop
- }
- }
}
- if _, err := f.LoadGlyph(nil, 0xffff, nil); err != ErrNotFound {
+ if _, err := f.LoadGlyph(nil, 0xffff, ppem, nil); err != ErrNotFound {
t.Errorf("LoadGlyph(..., 0xffff, ...):\ngot %v\nwant %v", err, ErrNotFound)
}
@@ -270,3 +420,131 @@ loop:
t.Errorf("Name:\ngot %q\nwant %q", name, want)
}
}
+
+func TestPPEM(t *testing.T) {
+ data, err := ioutil.ReadFile(filepath.FromSlash("../testdata/glyfTest.ttf"))
+ if err != nil {
+ t.Fatalf("ReadFile: %v", err)
+ }
+ f, err := Parse(data)
+ if err != nil {
+ t.Fatalf("Parse: %v", err)
+ }
+ var b Buffer
+ x, err := f.GlyphIndex(&b, '1')
+ if err != nil {
+ t.Fatalf("GlyphIndex: %v", err)
+ }
+ if x == 0 {
+ t.Fatalf("GlyphIndex: no glyph index found for the rune '1'")
+ }
+
+ testCases := []struct {
+ ppem fixed.Int26_6
+ want []Segment
+ }{{
+ ppem: fixed.Int26_6(12 << 6),
+ want: []Segment{
+ moveTo(77, 0),
+ lineTo(77, 614),
+ lineTo(230, 614),
+ lineTo(230, 0),
+ lineTo(77, 0),
+ },
+ }, {
+ ppem: fixed.Int26_6(2048),
+ want: []Segment{
+ moveTo(205, 0),
+ lineTo(205, 1638),
+ lineTo(614, 1638),
+ lineTo(614, 0),
+ lineTo(205, 0),
+ },
+ }}
+
+ for i, tc := range testCases {
+ got, err := f.LoadGlyph(&b, x, tc.ppem, nil)
+ if err != nil {
+ t.Errorf("i=%d: LoadGlyph: %v", i, err)
+ continue
+ }
+ if err := checkSegmentsEqual(got, tc.want); err != nil {
+ t.Errorf("i=%d: %v", i, err)
+ continue
+ }
+ }
+}
+
+func TestGlyphName(t *testing.T) {
+ f, err := Parse(goregular.TTF)
+ if err != nil {
+ t.Fatalf("Parse: %v", err)
+ }
+
+ testCases := []struct {
+ r rune
+ want string
+ }{
+ {'\x00', "NULL"},
+ {'!', "exclam"},
+ {'A', "A"},
+ {'{', "braceleft"},
+ {'\u00c4', "Adieresis"}, // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
+ {'\u2020', "dagger"}, // U+2020 DAGGER
+ {'\u2660', "spade"}, // U+2660 BLACK SPADE SUIT
+ {'\uf800', "gopher"}, // U+F800 <Private Use>
+ {'\ufffe', ".notdef"}, // Not in the Go Regular font, so GlyphIndex returns (0, nil).
+ }
+
+ var b Buffer
+ for _, tc := range testCases {
+ x, err := f.GlyphIndex(&b, tc.r)
+ if err != nil {
+ t.Errorf("r=%q: GlyphIndex: %v", tc.r, err)
+ continue
+ }
+ got, err := f.GlyphName(&b, x)
+ if err != nil {
+ t.Errorf("r=%q: GlyphName: %v", tc.r, err)
+ continue
+ }
+ if got != tc.want {
+ t.Errorf("r=%q: got %q, want %q", tc.r, got, tc.want)
+ continue
+ }
+ }
+}
+
+func TestBuiltInPostNames(t *testing.T) {
+ testCases := []struct {
+ x GlyphIndex
+ want string
+ }{
+ {0, ".notdef"},
+ {1, ".null"},
+ {2, "nonmarkingreturn"},
+ {13, "asterisk"},
+ {36, "A"},
+ {93, "z"},
+ {123, "ocircumflex"},
+ {202, "Edieresis"},
+ {255, "Ccaron"},
+ {256, "ccaron"},
+ {257, "dcroat"},
+ {258, ""},
+ {999, ""},
+ {0xffff, ""},
+ }
+
+ for _, tc := range testCases {
+ if tc.x >= numBuiltInPostNames {
+ continue
+ }
+ i := builtInPostNamesOffsets[tc.x+0]
+ j := builtInPostNamesOffsets[tc.x+1]
+ got := builtInPostNamesData[i:j]
+ if got != tc.want {
+ t.Errorf("x=%d: got %q, want %q", tc.x, got, tc.want)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/image/font/sfnt/truetype.go b/vendor/golang.org/x/image/font/sfnt/truetype.go
index 851904d10..c0eefba56 100644
--- a/vendor/golang.org/x/image/font/sfnt/truetype.go
+++ b/vendor/golang.org/x/image/font/sfnt/truetype.go
@@ -113,6 +113,11 @@ func appendGlyfSegments(dst []Segment, data []byte) ([]Segment, error) {
return nil, errInvalidGlyphData
}
+ // TODO: support compound glyphs.
+ if numContours < 0 {
+ return nil, errUnsupportedCompoundGlyph
+ }
+
// Skip the hinting instructions.
index += 2
if index > len(data) {
@@ -124,19 +129,14 @@ func appendGlyfSegments(dst []Segment, data []byte) ([]Segment, error) {
return nil, errInvalidGlyphData
}
- // TODO: support compound glyphs.
- if numContours < 0 {
- return nil, errUnsupportedCompoundGlyph
- }
-
// For simple (non-compound) glyphs, the remainder of the glyf data
// consists of (flags, x, y) points: the Bézier curve segments. These are
- // stored in columns (all the flags first, then all the x co-ordinates,
- // then all the y co-ordinates), not rows, as it compresses better.
+ // stored in columns (all the flags first, then all the x coordinates, then
+ // all the y coordinates), not rows, as it compresses better.
//
// Decoding those points in row order involves two passes. The first pass
// determines the indexes (relative to the data slice) of where the flags,
- // the x co-ordinates and the y co-ordinates each start.
+ // the x coordinates and the y coordinates each start.
flagIndex := int32(index)
xIndex, yIndex, ok := findXYIndexes(data, index, numPoints)
if !ok {
@@ -357,9 +357,18 @@ func (g *glyfIter) nextSegment() (ok bool) {
return true
}
+ // Convert the tuple (g.x, g.y) to a fixed.Point26_6, since the latter
+ // is what's held in a Segment. The input (g.x, g.y) is a pair of int16
+ // values, measured in font units, since that is what the underlying
+ // format provides. The output is a pair of fixed.Int26_6 values. A
+ // fixed.Int26_6 usually represents a 26.6 fixed number of pixels, but
+ // this here is just a straight numerical conversion, with no scaling
+ // factor. A later step scales the Segment.Args values by such a factor
+ // to convert e.g. 1792 font units to 10.5 pixels at 2048 font units
+ // per em and 12 ppem (pixels per em).
p := fixed.Point26_6{
- X: fixed.Int26_6(g.x) << 6,
- Y: fixed.Int26_6(g.y) << 6,
+ X: fixed.Int26_6(g.x),
+ Y: fixed.Int26_6(g.y),
}
if !g.firstOnCurveValid {
diff --git a/vendor/golang.org/x/image/font/testdata/cmapTest.sfd b/vendor/golang.org/x/image/font/testdata/cmapTest.sfd
new file mode 100644
index 000000000..34c7cd659
--- /dev/null
+++ b/vendor/golang.org/x/image/font/testdata/cmapTest.sfd
@@ -0,0 +1,265 @@
+SplineFontDB: 3.0
+FontName: cmapTest
+FullName: cmapTest
+FamilyName: cmapTest
+Weight: Regular
+Copyright: Copyright 2016 The Go Authors. All rights reserved.\nUse of this font is governed by a BSD-style license that can be found at https://golang.org/LICENSE.
+Version: 001.000
+ItalicAngle: -11.25
+UnderlinePosition: -204
+UnderlineWidth: 102
+Ascent: 1638
+Descent: 410
+LayerCount: 2
+Layer: 0 1 "Back" 1
+Layer: 1 1 "Fore" 0
+XUID: [1021 367 888937226 7862908]
+FSType: 8
+OS2Version: 0
+OS2_WeightWidthSlopeOnly: 0
+OS2_UseTypoMetrics: 1
+CreationTime: 1484386143
+ModificationTime: 1486021330
+PfmFamily: 17
+TTFWeight: 400
+TTFWidth: 5
+LineGap: 184
+VLineGap: 0
+OS2TypoAscent: 0
+OS2TypoAOffset: 1
+OS2TypoDescent: 0
+OS2TypoDOffset: 1
+OS2TypoLinegap: 184
+OS2WinAscent: 0
+OS2WinAOffset: 1
+OS2WinDescent: 0
+OS2WinDOffset: 1
+HheadAscent: 0
+HheadAOffset: 1
+HheadDescent: 0
+HheadDOffset: 1
+OS2Vendor: 'PfEd'
+MarkAttachClasses: 1
+DEI: 91125
+LangName: 1033
+Encoding: UnicodeFull
+UnicodeInterp: none
+NameList: Adobe Glyph List
+DisplaySize: -24
+AntiAlias: 1
+FitToEm: 1
+WinInfo: 126976 32 23
+BeginPrivate: 0
+EndPrivate
+TeXData: 1 0 0 346030 173015 115343 0 -1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
+BeginChars: 1114112 13
+
+StartChar: zero
+Encoding: 48 48 0
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: one
+Encoding: 49 49 1
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: two
+Encoding: 50 50 2
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: A
+Encoding: 65 65 3
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: uni4E2D
+Encoding: 20013 20013 4
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: u1F0A1
+Encoding: 127137 127137 5
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: ydieresis
+Encoding: 255 255 6
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: Amacron
+Encoding: 256 256 7
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: amacron
+Encoding: 257 257 8
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: B
+Encoding: 66 66 9
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: a
+Encoding: 97 97 10
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: u1F0B1
+Encoding: 127153 127153 11
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+
+StartChar: u1F0B2
+Encoding: 127154 127154 12
+Width: 800
+VWidth: 0
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+0 0 m 29,0,-1
+ 400 800 l 25,1,-1
+ 800 0 l 25,2,-1
+ 0 0 l 29,0,-1
+EndSplineSet
+Validated: 1
+EndChar
+EndChars
+EndSplineFont
diff --git a/vendor/golang.org/x/image/font/testdata/cmapTest.ttf b/vendor/golang.org/x/image/font/testdata/cmapTest.ttf
new file mode 100644
index 000000000..ebe6be200
--- /dev/null
+++ b/vendor/golang.org/x/image/font/testdata/cmapTest.ttf
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-down-ab.png b/vendor/golang.org/x/image/testdata/go-turns-two-down-ab.png
index 317c3afa1..ed5a2f6b2 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-down-ab.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-down-ab.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-down-bl.png b/vendor/golang.org/x/image/testdata/go-turns-two-down-bl.png
index 597d3628d..5c8b6529e 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-down-bl.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-down-bl.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-down-cr.png b/vendor/golang.org/x/image/testdata/go-turns-two-down-cr.png
index ad1c20a2f..633354d52 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-down-cr.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-down-cr.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-down-nn.png b/vendor/golang.org/x/image/testdata/go-turns-two-down-nn.png
index 166841a76..1debc306a 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-down-nn.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-down-nn.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-ab.png b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-ab.png
index 04fceaa77..a3703a92a 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-ab.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-ab.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-bl.png b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-bl.png
index c8b717e22..23105b3bd 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-bl.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-bl.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-cr.png b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-cr.png
index 7e5cd9f62..d8d9d21e9 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-cr.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-cr.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-nn.png b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-nn.png
index 702c86352..a5ba2822f 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-rotate-nn.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-rotate-nn.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-up-ab.png b/vendor/golang.org/x/image/testdata/go-turns-two-up-ab.png
index 072446dc9..98e92e258 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-up-ab.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-up-ab.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-up-bl.png b/vendor/golang.org/x/image/testdata/go-turns-two-up-bl.png
index c1bf630f4..4a2323dd1 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-up-bl.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-up-bl.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-up-cr.png b/vendor/golang.org/x/image/testdata/go-turns-two-up-cr.png
index 0ac83002f..1d9603332 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-up-cr.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-up-cr.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/go-turns-two-up-nn.png b/vendor/golang.org/x/image/testdata/go-turns-two-up-nn.png
index eb63cb91e..93a2806a3 100644
--- a/vendor/golang.org/x/image/testdata/go-turns-two-up-nn.png
+++ b/vendor/golang.org/x/image/testdata/go-turns-two-up-nn.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/tux-rotate-ab.png b/vendor/golang.org/x/image/testdata/tux-rotate-ab.png
index 181966cae..d604ec912 100644
--- a/vendor/golang.org/x/image/testdata/tux-rotate-ab.png
+++ b/vendor/golang.org/x/image/testdata/tux-rotate-ab.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/tux-rotate-bl.png b/vendor/golang.org/x/image/testdata/tux-rotate-bl.png
index af3f4b0d5..85b860282 100644
--- a/vendor/golang.org/x/image/testdata/tux-rotate-bl.png
+++ b/vendor/golang.org/x/image/testdata/tux-rotate-bl.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/tux-rotate-cr.png b/vendor/golang.org/x/image/testdata/tux-rotate-cr.png
index e5cff31f1..dbc42ab52 100644
--- a/vendor/golang.org/x/image/testdata/tux-rotate-cr.png
+++ b/vendor/golang.org/x/image/testdata/tux-rotate-cr.png
Binary files differ
diff --git a/vendor/golang.org/x/image/testdata/tux-rotate-nn.png b/vendor/golang.org/x/image/testdata/tux-rotate-nn.png
index c775c61dc..0d40c0d95 100644
--- a/vendor/golang.org/x/image/testdata/tux-rotate-nn.png
+++ b/vendor/golang.org/x/image/testdata/tux-rotate-nn.png
Binary files differ
diff --git a/vendor/golang.org/x/net/bpf/vm_bpf_test.go b/vendor/golang.org/x/net/bpf/vm_bpf_test.go
index 426362361..76dd970e6 100644
--- a/vendor/golang.org/x/net/bpf/vm_bpf_test.go
+++ b/vendor/golang.org/x/net/bpf/vm_bpf_test.go
@@ -33,7 +33,7 @@ func canUseOSVM() bool {
}
// All BPF tests against both the Go VM and OS VM are assumed to
-// be used with a UDP socket. As a result, the entire contents
+// be used with a UDP socket. As a result, the entire contents
// of a UDP datagram is sent through the BPF program, but only
// the body after the UDP header will ever be returned in output.
@@ -85,7 +85,7 @@ func (mvm *multiVirtualMachine) Run(in []byte) (int, error) {
}
// All tests have a UDP header as part of input, because the OS VM
- // packets always will. For the Go VM, this output is trimmed before
+ // packets always will. For the Go VM, this output is trimmed before
// being sent back to tests.
goOut, goErr := mvm.goVM.Run(in)
if goOut >= udpHeaderLen {
@@ -149,6 +149,9 @@ func testOSVM(t *testing.T, filter []bpf.Instruction) (virtualMachine, func()) {
p := ipv4.NewPacketConn(l)
if err = p.SetBPF(prog); err != nil {
+ if err.Error() == "operation not supported" { // TODO: gross. remove once 19051 fixed.
+ t.Skip("Skipping until Issue 19051 is fixed.")
+ }
t.Fatalf("failed to attach BPF program to listener: %v", err)
}
diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go
index 134654cf7..f143ed6a1 100644
--- a/vendor/golang.org/x/net/context/context.go
+++ b/vendor/golang.org/x/net/context/context.go
@@ -7,7 +7,7 @@
// and between processes.
//
// Incoming requests to a server should create a Context, and outgoing calls to
-// servers should accept a Context. The chain of function calls between must
+// servers should accept a Context. The chain of function calls between must
// propagate the Context, optionally replacing it with a modified copy created
// using WithDeadline, WithTimeout, WithCancel, or WithValue.
//
@@ -16,14 +16,14 @@
// propagation:
//
// Do not store Contexts inside a struct type; instead, pass a Context
-// explicitly to each function that needs it. The Context should be the first
+// explicitly to each function that needs it. The Context should be the first
// parameter, typically named ctx:
//
// func DoSomething(ctx context.Context, arg Arg) error {
// // ... use ctx ...
// }
//
-// Do not pass a nil Context, even if a function permits it. Pass context.TODO
+// Do not pass a nil Context, even if a function permits it. Pass context.TODO
// if you are unsure about which Context to use.
//
// Use context Values only for request-scoped data that transits processes and
@@ -44,13 +44,13 @@ import "time"
// Context's methods may be called by multiple goroutines simultaneously.
type Context interface {
// Deadline returns the time when work done on behalf of this context
- // should be canceled. Deadline returns ok==false when no deadline is
- // set. Successive calls to Deadline return the same results.
+ // should be canceled. Deadline returns ok==false when no deadline is
+ // set. Successive calls to Deadline return the same results.
Deadline() (deadline time.Time, ok bool)
// Done returns a channel that's closed when work done on behalf of this
- // context should be canceled. Done may return nil if this context can
- // never be canceled. Successive calls to Done return the same value.
+ // context should be canceled. Done may return nil if this context can
+ // never be canceled. Successive calls to Done return the same value.
//
// WithCancel arranges for Done to be closed when cancel is called;
// WithDeadline arranges for Done to be closed when the deadline
@@ -79,24 +79,24 @@ type Context interface {
// a Done channel for cancelation.
Done() <-chan struct{}
- // Err returns a non-nil error value after Done is closed. Err returns
+ // Err returns a non-nil error value after Done is closed. Err returns
// Canceled if the context was canceled or DeadlineExceeded if the
- // context's deadline passed. No other values for Err are defined.
+ // context's deadline passed. No other values for Err are defined.
// After Done is closed, successive calls to Err return the same value.
Err() error
// Value returns the value associated with this context for key, or nil
- // if no value is associated with key. Successive calls to Value with
+ // if no value is associated with key. Successive calls to Value with
// the same key returns the same result.
//
// Use context values only for request-scoped data that transits
// processes and API boundaries, not for passing optional parameters to
// functions.
//
- // A key identifies a specific value in a Context. Functions that wish
+ // A key identifies a specific value in a Context. Functions that wish
// to store values in Context typically allocate a key in a global
// variable then use that key as the argument to context.WithValue and
- // Context.Value. A key can be any type that supports equality;
+ // Context.Value. A key can be any type that supports equality;
// packages should define keys as an unexported type to avoid
// collisions.
//
@@ -115,7 +115,7 @@ type Context interface {
// // This prevents collisions with keys defined in other packages.
// type key int
//
- // // userKey is the key for user.User values in Contexts. It is
+ // // userKey is the key for user.User values in Contexts. It is
// // unexported; clients use user.NewContext and user.FromContext
// // instead of using this key directly.
// var userKey key = 0
@@ -134,14 +134,14 @@ type Context interface {
}
// Background returns a non-nil, empty Context. It is never canceled, has no
-// values, and has no deadline. It is typically used by the main function,
+// values, and has no deadline. It is typically used by the main function,
// initialization, and tests, and as the top-level Context for incoming
// requests.
func Background() Context {
return background
}
-// TODO returns a non-nil, empty Context. Code should use context.TODO when
+// TODO returns a non-nil, empty Context. Code should use context.TODO when
// it's unclear which Context to use or it is not yet available (because the
// surrounding function has not yet been extended to accept a Context
// parameter). TODO is recognized by static analysis tools that determine
diff --git a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go
index 9f0f90f1b..72411b1b6 100644
--- a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go
+++ b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go
@@ -19,6 +19,7 @@ func TestGo17Context(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "ok")
}))
+ defer ts.Close()
ctx := context.Background()
resp, err := Get(ctx, http.DefaultClient, ts.URL)
if resp == nil || err != nil {
diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go
index f8cda19ad..d20f52b7d 100644
--- a/vendor/golang.org/x/net/context/go17.go
+++ b/vendor/golang.org/x/net/context/go17.go
@@ -35,8 +35,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
}
// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
+// to be no later than d. If the parent's deadline is already earlier than d,
+// WithDeadline(parent, d) is semantically equivalent to parent. The returned
// context's Done channel is closed when the deadline expires, when the returned
// cancel function is called, or when the parent context's Done channel is
// closed, whichever happens first.
diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go
index 5a30acabd..0f35592df 100644
--- a/vendor/golang.org/x/net/context/pre_go17.go
+++ b/vendor/golang.org/x/net/context/pre_go17.go
@@ -13,7 +13,7 @@ import (
"time"
)
-// An emptyCtx is never canceled, has no values, and has no deadline. It is not
+// An emptyCtx is never canceled, has no values, and has no deadline. It is not
// struct{}, since vars of this type must have distinct addresses.
type emptyCtx int
@@ -104,7 +104,7 @@ func propagateCancel(parent Context, child canceler) {
}
// parentCancelCtx follows a chain of parent references until it finds a
-// *cancelCtx. This function understands how each of the concrete types in this
+// *cancelCtx. This function understands how each of the concrete types in this
// package represents its parent.
func parentCancelCtx(parent Context) (*cancelCtx, bool) {
for {
@@ -134,14 +134,14 @@ func removeChild(parent Context, child canceler) {
p.mu.Unlock()
}
-// A canceler is a context type that can be canceled directly. The
+// A canceler is a context type that can be canceled directly. The
// implementations are *cancelCtx and *timerCtx.
type canceler interface {
cancel(removeFromParent bool, err error)
Done() <-chan struct{}
}
-// A cancelCtx can be canceled. When canceled, it also cancels any children
+// A cancelCtx can be canceled. When canceled, it also cancels any children
// that implement canceler.
type cancelCtx struct {
Context
@@ -193,8 +193,8 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) {
}
// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
+// to be no later than d. If the parent's deadline is already earlier than d,
+// WithDeadline(parent, d) is semantically equivalent to parent. The returned
// context's Done channel is closed when the deadline expires, when the returned
// cancel function is called, or when the parent context's Done channel is
// closed, whichever happens first.
@@ -226,8 +226,8 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
return c, func() { c.cancel(true, Canceled) }
}
-// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
-// implement Done and Err. It implements cancel by stopping its timer then
+// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
+// implement Done and Err. It implements cancel by stopping its timer then
// delegating to cancelCtx.cancel.
type timerCtx struct {
*cancelCtx
@@ -281,7 +281,7 @@ func WithValue(parent Context, key interface{}, val interface{}) Context {
return &valueCtx{parent, key, val}
}
-// A valueCtx carries a key-value pair. It implements Value for that key and
+// A valueCtx carries a key-value pair. It implements Value for that key and
// delegates all other calls to the embedded Context.
type valueCtx struct {
Context
diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message.go b/vendor/golang.org/x/net/dns/dnsmessage/message.go
new file mode 100644
index 000000000..da43b0ba4
--- /dev/null
+++ b/vendor/golang.org/x/net/dns/dnsmessage/message.go
@@ -0,0 +1,1418 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package dnsmessage provides a mostly RFC 1035 compliant implementation of
+// DNS message packing and unpacking.
+//
+// This implementation is designed to minimize heap allocations and avoid
+// unnecessary packing and unpacking as much as possible.
+package dnsmessage
+
+import (
+ "errors"
+)
+
+// Packet formats
+
+// A Type is a type of DNS request and response.
+type Type uint16
+
+// A Class is a type of network.
+type Class uint16
+
+// An OpCode is a DNS operation code.
+type OpCode uint16
+
+// An RCode is a DNS response status code.
+type RCode uint16
+
+// Wire constants.
+const (
+ // ResourceHeader.Type and Question.Type
+ TypeA Type = 1
+ TypeNS Type = 2
+ TypeCNAME Type = 5
+ TypeSOA Type = 6
+ TypePTR Type = 12
+ TypeMX Type = 15
+ TypeTXT Type = 16
+ TypeAAAA Type = 28
+ TypeSRV Type = 33
+
+ // Question.Type
+ TypeWKS Type = 11
+ TypeHINFO Type = 13
+ TypeMINFO Type = 14
+ TypeAXFR Type = 252
+ TypeALL Type = 255
+
+ // ResourceHeader.Class and Question.Class
+ ClassINET Class = 1
+ ClassCSNET Class = 2
+ ClassCHAOS Class = 3
+ ClassHESIOD Class = 4
+
+ // Question.Class
+ ClassANY Class = 255
+
+ // Message.Rcode
+ RCodeSuccess RCode = 0
+ RCodeFormatError RCode = 1
+ RCodeServerFailure RCode = 2
+ RCodeNameError RCode = 3
+ RCodeNotImplemented RCode = 4
+ RCodeRefused RCode = 5
+)
+
+var (
+ // ErrNotStarted indicates that the prerequisite information isn't
+ // available yet because the previous records haven't been appropriately
+ // parsed or skipped.
+ ErrNotStarted = errors.New("parsing of this type isn't available yet")
+
+ // ErrSectionDone indicated that all records in the section have been
+ // parsed.
+ ErrSectionDone = errors.New("parsing of this section has completed")
+
+ errBaseLen = errors.New("insufficient data for base length type")
+ errCalcLen = errors.New("insufficient data for calculated length type")
+ errReserved = errors.New("segment prefix is reserved")
+ errTooManyPtr = errors.New("too many pointers (>10)")
+ errInvalidPtr = errors.New("invalid pointer")
+ errResourceLen = errors.New("insufficient data for resource body length")
+ errSegTooLong = errors.New("segment length too long")
+ errZeroSegLen = errors.New("zero length segment")
+ errResTooLong = errors.New("resource length too long")
+ errTooManyQuestions = errors.New("too many Questions to pack (>65535)")
+ errTooManyAnswers = errors.New("too many Answers to pack (>65535)")
+ errTooManyAuthorities = errors.New("too many Authorities to pack (>65535)")
+ errTooManyAdditionals = errors.New("too many Additionals to pack (>65535)")
+)
+
+type nestedError struct {
+ // s is the current level's error message.
+ s string
+
+ // err is the nested error.
+ err error
+}
+
+// nestedError implements error.Error.
+func (e *nestedError) Error() string {
+ return e.s + ": " + e.err.Error()
+}
+
+// Header is a representation of a DNS message header.
+type Header struct {
+ ID uint16
+ Response bool
+ OpCode OpCode
+ Authoritative bool
+ Truncated bool
+ RecursionDesired bool
+ RecursionAvailable bool
+ RCode RCode
+}
+
+func (m *Header) pack() (id uint16, bits uint16) {
+ id = m.ID
+ bits = uint16(m.OpCode)<<11 | uint16(m.RCode)
+ if m.RecursionAvailable {
+ bits |= headerBitRA
+ }
+ if m.RecursionDesired {
+ bits |= headerBitRD
+ }
+ if m.Truncated {
+ bits |= headerBitTC
+ }
+ if m.Authoritative {
+ bits |= headerBitAA
+ }
+ if m.Response {
+ bits |= headerBitQR
+ }
+ return
+}
+
+// Message is a representation of a DNS message.
+type Message struct {
+ Header
+ Questions []Question
+ Answers []Resource
+ Authorities []Resource
+ Additionals []Resource
+}
+
+type section uint8
+
+const (
+ sectionHeader section = iota
+ sectionQuestions
+ sectionAnswers
+ sectionAuthorities
+ sectionAdditionals
+ sectionDone
+
+ headerBitQR = 1 << 15 // query/response (response=1)
+ headerBitAA = 1 << 10 // authoritative
+ headerBitTC = 1 << 9 // truncated
+ headerBitRD = 1 << 8 // recursion desired
+ headerBitRA = 1 << 7 // recursion available
+)
+
+var sectionNames = map[section]string{
+ sectionHeader: "header",
+ sectionQuestions: "Question",
+ sectionAnswers: "Answer",
+ sectionAuthorities: "Authority",
+ sectionAdditionals: "Additional",
+}
+
+// header is the wire format for a DNS message header.
+type header struct {
+ id uint16
+ bits uint16
+ questions uint16
+ answers uint16
+ authorities uint16
+ additionals uint16
+}
+
+func (h *header) count(sec section) uint16 {
+ switch sec {
+ case sectionQuestions:
+ return h.questions
+ case sectionAnswers:
+ return h.answers
+ case sectionAuthorities:
+ return h.authorities
+ case sectionAdditionals:
+ return h.additionals
+ }
+ return 0
+}
+
+func (h *header) pack(msg []byte) []byte {
+ msg = packUint16(msg, h.id)
+ msg = packUint16(msg, h.bits)
+ msg = packUint16(msg, h.questions)
+ msg = packUint16(msg, h.answers)
+ msg = packUint16(msg, h.authorities)
+ return packUint16(msg, h.additionals)
+}
+
+func (h *header) unpack(msg []byte, off int) (int, error) {
+ newOff := off
+ var err error
+ if h.id, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"id", err}
+ }
+ if h.bits, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"bits", err}
+ }
+ if h.questions, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"questions", err}
+ }
+ if h.answers, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"answers", err}
+ }
+ if h.authorities, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"authorities", err}
+ }
+ if h.additionals, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"additionals", err}
+ }
+ return newOff, nil
+}
+
+func (h *header) header() Header {
+ return Header{
+ ID: h.id,
+ Response: (h.bits & headerBitQR) != 0,
+ OpCode: OpCode(h.bits>>11) & 0xF,
+ Authoritative: (h.bits & headerBitAA) != 0,
+ Truncated: (h.bits & headerBitTC) != 0,
+ RecursionDesired: (h.bits & headerBitRD) != 0,
+ RecursionAvailable: (h.bits & headerBitRA) != 0,
+ RCode: RCode(h.bits & 0xF),
+ }
+}
+
+// A Resource is a DNS resource record.
+type Resource interface {
+ // Header return's the Resource's ResourceHeader.
+ Header() *ResourceHeader
+
+ // pack packs a Resource except for its header.
+ pack(msg []byte, compression map[string]int) ([]byte, error)
+
+ // realType returns the actual type of the Resource. This is used to
+ // fill in the header Type field.
+ realType() Type
+}
+
+func packResource(msg []byte, resource Resource, compression map[string]int) ([]byte, error) {
+ oldMsg := msg
+ resource.Header().Type = resource.realType()
+ msg, length, err := resource.Header().pack(msg, compression)
+ if err != nil {
+ return msg, &nestedError{"ResourceHeader", err}
+ }
+ preLen := len(msg)
+ msg, err = resource.pack(msg, compression)
+ if err != nil {
+ return msg, &nestedError{"content", err}
+ }
+ conLen := len(msg) - preLen
+ if conLen > int(^uint16(0)) {
+ return oldMsg, errResTooLong
+ }
+ // Fill in the length now that we know how long the content is.
+ packUint16(length[:0], uint16(conLen))
+ resource.Header().Length = uint16(conLen)
+ return msg, nil
+}
+
+// A Parser allows incrementally parsing a DNS message.
+//
+// When parsing is started, the Header is parsed. Next, each Question can be
+// either parsed or skipped. Alternatively, all Questions can be skipped at
+// once. When all Questions have been parsed, attempting to parse Questions
+// will return (nil, nil) and attempting to skip Questions will return
+// (true, nil). After all Questions have been either parsed or skipped, all
+// Answers, Authorities and Additionals can be either parsed or skipped in the
+// same way, and each type of Resource must be fully parsed or skipped before
+// proceeding to the next type of Resource.
+//
+// Note that there is no requirement to fully skip or parse the message.
+type Parser struct {
+ msg []byte
+ header header
+
+ section section
+ off int
+ index int
+ resHeaderValid bool
+ resHeader ResourceHeader
+}
+
+// Start parses the header and enables the parsing of Questions.
+func (p *Parser) Start(msg []byte) (Header, error) {
+ if p.msg != nil {
+ *p = Parser{}
+ }
+ p.msg = msg
+ var err error
+ if p.off, err = p.header.unpack(msg, 0); err != nil {
+ return Header{}, &nestedError{"unpacking header", err}
+ }
+ p.section = sectionQuestions
+ return p.header.header(), nil
+}
+
+func (p *Parser) checkAdvance(sec section) error {
+ if p.section < sec {
+ return ErrNotStarted
+ }
+ if p.section > sec {
+ return ErrSectionDone
+ }
+ p.resHeaderValid = false
+ if p.index == int(p.header.count(sec)) {
+ p.index = 0
+ p.section++
+ return ErrSectionDone
+ }
+ return nil
+}
+
+func (p *Parser) resource(sec section) (Resource, error) {
+ var r Resource
+ hdr, err := p.resourceHeader(sec)
+ if err != nil {
+ return r, err
+ }
+ p.resHeaderValid = false
+ r, p.off, err = unpackResource(p.msg, p.off, hdr)
+ if err != nil {
+ return nil, &nestedError{"unpacking " + sectionNames[sec], err}
+ }
+ p.index++
+ return r, nil
+}
+
+func (p *Parser) resourceHeader(sec section) (ResourceHeader, error) {
+ if p.resHeaderValid {
+ return p.resHeader, nil
+ }
+ if err := p.checkAdvance(sec); err != nil {
+ return ResourceHeader{}, err
+ }
+ var hdr ResourceHeader
+ off, err := hdr.unpack(p.msg, p.off)
+ if err != nil {
+ return ResourceHeader{}, err
+ }
+ p.resHeaderValid = true
+ p.resHeader = hdr
+ p.off = off
+ return hdr, nil
+}
+
+func (p *Parser) skipResource(sec section) error {
+ if p.resHeaderValid {
+ newOff := p.off + int(p.resHeader.Length)
+ if newOff > len(p.msg) {
+ return errResourceLen
+ }
+ p.off = newOff
+ p.resHeaderValid = false
+ p.index++
+ return nil
+ }
+ if err := p.checkAdvance(sec); err != nil {
+ return err
+ }
+ var err error
+ p.off, err = skipResource(p.msg, p.off)
+ if err != nil {
+ return &nestedError{"skipping: " + sectionNames[sec], err}
+ }
+ p.index++
+ return nil
+}
+
+// Question parses a single Question.
+func (p *Parser) Question() (Question, error) {
+ if err := p.checkAdvance(sectionQuestions); err != nil {
+ return Question{}, err
+ }
+ name, off, err := unpackName(p.msg, p.off)
+ if err != nil {
+ return Question{}, &nestedError{"unpacking Question.Name", err}
+ }
+ typ, off, err := unpackType(p.msg, off)
+ if err != nil {
+ return Question{}, &nestedError{"unpacking Question.Type", err}
+ }
+ class, off, err := unpackClass(p.msg, off)
+ if err != nil {
+ return Question{}, &nestedError{"unpacking Question.Class", err}
+ }
+ p.off = off
+ p.index++
+ return Question{name, typ, class}, nil
+}
+
+// AllQuestions parses all Questions.
+func (p *Parser) AllQuestions() ([]Question, error) {
+ qs := make([]Question, 0, p.header.questions)
+ for {
+ q, err := p.Question()
+ if err == ErrSectionDone {
+ return qs, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ qs = append(qs, q)
+ }
+}
+
+// SkipQuestion skips a single Question.
+func (p *Parser) SkipQuestion() error {
+ if err := p.checkAdvance(sectionQuestions); err != nil {
+ return err
+ }
+ off, err := skipName(p.msg, p.off)
+ if err != nil {
+ return &nestedError{"skipping Question Name", err}
+ }
+ if off, err = skipType(p.msg, off); err != nil {
+ return &nestedError{"skipping Question Type", err}
+ }
+ if off, err = skipClass(p.msg, off); err != nil {
+ return &nestedError{"skipping Question Class", err}
+ }
+ p.off = off
+ p.index++
+ return nil
+}
+
+// SkipAllQuestions skips all Questions.
+func (p *Parser) SkipAllQuestions() error {
+ for {
+ if err := p.SkipQuestion(); err == ErrSectionDone {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+}
+
+// AnswerHeader parses a single Answer ResourceHeader.
+func (p *Parser) AnswerHeader() (ResourceHeader, error) {
+ return p.resourceHeader(sectionAnswers)
+}
+
+// Answer parses a single Answer Resource.
+func (p *Parser) Answer() (Resource, error) {
+ return p.resource(sectionAnswers)
+}
+
+// AllAnswers parses all Answer Resources.
+func (p *Parser) AllAnswers() ([]Resource, error) {
+ as := make([]Resource, 0, p.header.answers)
+ for {
+ a, err := p.Answer()
+ if err == ErrSectionDone {
+ return as, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ as = append(as, a)
+ }
+}
+
+// SkipAnswer skips a single Answer Resource.
+func (p *Parser) SkipAnswer() error {
+ return p.skipResource(sectionAnswers)
+}
+
+// SkipAllAnswers skips all Answer Resources.
+func (p *Parser) SkipAllAnswers() error {
+ for {
+ if err := p.SkipAnswer(); err == ErrSectionDone {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+}
+
+// AuthorityHeader parses a single Authority ResourceHeader.
+func (p *Parser) AuthorityHeader() (ResourceHeader, error) {
+ return p.resourceHeader(sectionAuthorities)
+}
+
+// Authority parses a single Authority Resource.
+func (p *Parser) Authority() (Resource, error) {
+ return p.resource(sectionAuthorities)
+}
+
+// AllAuthorities parses all Authority Resources.
+func (p *Parser) AllAuthorities() ([]Resource, error) {
+ as := make([]Resource, 0, p.header.authorities)
+ for {
+ a, err := p.Authority()
+ if err == ErrSectionDone {
+ return as, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ as = append(as, a)
+ }
+}
+
+// SkipAuthority skips a single Authority Resource.
+func (p *Parser) SkipAuthority() error {
+ return p.skipResource(sectionAuthorities)
+}
+
+// SkipAllAuthorities skips all Authority Resources.
+func (p *Parser) SkipAllAuthorities() error {
+ for {
+ if err := p.SkipAuthority(); err == ErrSectionDone {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+}
+
+// AdditionalHeader parses a single Additional ResourceHeader.
+func (p *Parser) AdditionalHeader() (ResourceHeader, error) {
+ return p.resourceHeader(sectionAdditionals)
+}
+
+// Additional parses a single Additional Resource.
+func (p *Parser) Additional() (Resource, error) {
+ return p.resource(sectionAdditionals)
+}
+
+// AllAdditionals parses all Additional Resources.
+func (p *Parser) AllAdditionals() ([]Resource, error) {
+ as := make([]Resource, 0, p.header.additionals)
+ for {
+ a, err := p.Additional()
+ if err == ErrSectionDone {
+ return as, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ as = append(as, a)
+ }
+}
+
+// SkipAdditional skips a single Additional Resource.
+func (p *Parser) SkipAdditional() error {
+ return p.skipResource(sectionAdditionals)
+}
+
+// SkipAllAdditionals skips all Additional Resources.
+func (p *Parser) SkipAllAdditionals() error {
+ for {
+ if err := p.SkipAdditional(); err == ErrSectionDone {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+}
+
+// Unpack parses a full Message.
+func (m *Message) Unpack(msg []byte) error {
+ var p Parser
+ var err error
+ if m.Header, err = p.Start(msg); err != nil {
+ return err
+ }
+ if m.Questions, err = p.AllQuestions(); err != nil {
+ return err
+ }
+ if m.Answers, err = p.AllAnswers(); err != nil {
+ return err
+ }
+ if m.Authorities, err = p.AllAuthorities(); err != nil {
+ return err
+ }
+ if m.Additionals, err = p.AllAdditionals(); err != nil {
+ return err
+ }
+ return nil
+}
+
+// Pack packs a full Message.
+func (m *Message) Pack() ([]byte, error) {
+ // Validate the lengths. It is very unlikely that anyone will try to
+ // pack more than 65535 of any particular type, but it is possible and
+ // we should fail gracefully.
+ if len(m.Questions) > int(^uint16(0)) {
+ return nil, errTooManyQuestions
+ }
+ if len(m.Answers) > int(^uint16(0)) {
+ return nil, errTooManyAnswers
+ }
+ if len(m.Authorities) > int(^uint16(0)) {
+ return nil, errTooManyAuthorities
+ }
+ if len(m.Additionals) > int(^uint16(0)) {
+ return nil, errTooManyAdditionals
+ }
+
+ var h header
+ h.id, h.bits = m.Header.pack()
+
+ h.questions = uint16(len(m.Questions))
+ h.answers = uint16(len(m.Answers))
+ h.authorities = uint16(len(m.Authorities))
+ h.additionals = uint16(len(m.Additionals))
+
+ // The starting capacity doesn't matter too much, but most DNS responses
+ // Will be <= 512 bytes as it is the limit for DNS over UDP.
+ msg := make([]byte, 0, 512)
+
+ msg = h.pack(msg)
+
+ // RFC 1035 allows (but does not require) compression for packing. RFC
+ // 1035 requires unpacking implementations to support compression, so
+ // unconditionally enabling it is fine.
+ //
+ // DNS lookups are typically done over UDP, and RFC 1035 states that UDP
+ // DNS packets can be a maximum of 512 bytes long. Without compression,
+ // many DNS response packets are over this limit, so enabling
+ // compression will help ensure compliance.
+ compression := map[string]int{}
+
+ for _, q := range m.Questions {
+ var err error
+ msg, err = q.pack(msg, compression)
+ if err != nil {
+ return nil, &nestedError{"packing Question", err}
+ }
+ }
+ for _, a := range m.Answers {
+ var err error
+ msg, err = packResource(msg, a, compression)
+ if err != nil {
+ return nil, &nestedError{"packing Answer", err}
+ }
+ }
+ for _, a := range m.Authorities {
+ var err error
+ msg, err = packResource(msg, a, compression)
+ if err != nil {
+ return nil, &nestedError{"packing Authority", err}
+ }
+ }
+ for _, a := range m.Additionals {
+ var err error
+ msg, err = packResource(msg, a, compression)
+ if err != nil {
+ return nil, &nestedError{"packing Additional", err}
+ }
+ }
+
+ return msg, nil
+}
+
+// An ResourceHeader is the header of a DNS resource record. There are
+// many types of DNS resource records, but they all share the same header.
+type ResourceHeader struct {
+ // Name is the domain name for which this resource record pertains.
+ Name string
+
+ // Type is the type of DNS resource record.
+ //
+ // This field will be set automatically during packing.
+ Type Type
+
+ // Class is the class of network to which this DNS resource record
+ // pertains.
+ Class Class
+
+ // TTL is the length of time (measured in seconds) which this resource
+ // record is valid for (time to live). All Resources in a set should
+ // have the same TTL (RFC 2181 Section 5.2).
+ TTL uint32
+
+ // Length is the length of data in the resource record after the header.
+ //
+ // This field will be set automatically during packing.
+ Length uint16
+}
+
+// Header implements Resource.Header.
+func (h *ResourceHeader) Header() *ResourceHeader {
+ return h
+}
+
+// pack packs all of the fields in a ResourceHeader except for the length. The
+// length bytes are returned as a slice so they can be filled in after the rest
+// of the Resource has been packed.
+func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]int) (msg []byte, length []byte, err error) {
+ msg = oldMsg
+ if msg, err = packName(msg, h.Name, compression); err != nil {
+ return oldMsg, nil, &nestedError{"Name", err}
+ }
+ msg = packType(msg, h.Type)
+ msg = packClass(msg, h.Class)
+ msg = packUint32(msg, h.TTL)
+ lenBegin := len(msg)
+ msg = packUint16(msg, h.Length)
+ return msg, msg[lenBegin:], nil
+}
+
+func (h *ResourceHeader) unpack(msg []byte, off int) (int, error) {
+ newOff := off
+ var err error
+ if h.Name, newOff, err = unpackName(msg, newOff); err != nil {
+ return off, &nestedError{"Name", err}
+ }
+ if h.Type, newOff, err = unpackType(msg, newOff); err != nil {
+ return off, &nestedError{"Type", err}
+ }
+ if h.Class, newOff, err = unpackClass(msg, newOff); err != nil {
+ return off, &nestedError{"Class", err}
+ }
+ if h.TTL, newOff, err = unpackUint32(msg, newOff); err != nil {
+ return off, &nestedError{"TTL", err}
+ }
+ if h.Length, newOff, err = unpackUint16(msg, newOff); err != nil {
+ return off, &nestedError{"Length", err}
+ }
+ return newOff, nil
+}
+
+func skipResource(msg []byte, off int) (int, error) {
+ newOff, err := skipName(msg, off)
+ if err != nil {
+ return off, &nestedError{"Name", err}
+ }
+ if newOff, err = skipType(msg, newOff); err != nil {
+ return off, &nestedError{"Type", err}
+ }
+ if newOff, err = skipClass(msg, newOff); err != nil {
+ return off, &nestedError{"Class", err}
+ }
+ if newOff, err = skipUint32(msg, newOff); err != nil {
+ return off, &nestedError{"TTL", err}
+ }
+ length, newOff, err := unpackUint16(msg, newOff)
+ if err != nil {
+ return off, &nestedError{"Length", err}
+ }
+ if newOff += int(length); newOff > len(msg) {
+ return off, errResourceLen
+ }
+ return newOff, nil
+}
+
+func packUint16(msg []byte, field uint16) []byte {
+ return append(msg, byte(field>>8), byte(field))
+}
+
+func unpackUint16(msg []byte, off int) (uint16, int, error) {
+ if off+2 > len(msg) {
+ return 0, off, errBaseLen
+ }
+ return uint16(msg[off])<<8 | uint16(msg[off+1]), off + 2, nil
+}
+
+func skipUint16(msg []byte, off int) (int, error) {
+ if off+2 > len(msg) {
+ return off, errBaseLen
+ }
+ return off + 2, nil
+}
+
+func packType(msg []byte, field Type) []byte {
+ return packUint16(msg, uint16(field))
+}
+
+func unpackType(msg []byte, off int) (Type, int, error) {
+ t, o, err := unpackUint16(msg, off)
+ return Type(t), o, err
+}
+
+func skipType(msg []byte, off int) (int, error) {
+ return skipUint16(msg, off)
+}
+
+func packClass(msg []byte, field Class) []byte {
+ return packUint16(msg, uint16(field))
+}
+
+func unpackClass(msg []byte, off int) (Class, int, error) {
+ c, o, err := unpackUint16(msg, off)
+ return Class(c), o, err
+}
+
+func skipClass(msg []byte, off int) (int, error) {
+ return skipUint16(msg, off)
+}
+
+func packUint32(msg []byte, field uint32) []byte {
+ return append(
+ msg,
+ byte(field>>24),
+ byte(field>>16),
+ byte(field>>8),
+ byte(field),
+ )
+}
+
+func unpackUint32(msg []byte, off int) (uint32, int, error) {
+ if off+4 > len(msg) {
+ return 0, off, errBaseLen
+ }
+ v := uint32(msg[off])<<24 | uint32(msg[off+1])<<16 | uint32(msg[off+2])<<8 | uint32(msg[off+3])
+ return v, off + 4, nil
+}
+
+func skipUint32(msg []byte, off int) (int, error) {
+ if off+4 > len(msg) {
+ return off, errBaseLen
+ }
+ return off + 4, nil
+}
+
+func packText(msg []byte, field string) []byte {
+ for len(field) > 0 {
+ l := len(field)
+ if l > 255 {
+ l = 255
+ }
+ msg = append(msg, byte(l))
+ msg = append(msg, field[:l]...)
+ field = field[l:]
+ }
+ return msg
+}
+
+func unpackText(msg []byte, off int) (string, int, error) {
+ if off >= len(msg) {
+ return "", off, errBaseLen
+ }
+ beginOff := off + 1
+ endOff := beginOff + int(msg[off])
+ if endOff > len(msg) {
+ return "", off, errCalcLen
+ }
+ return string(msg[beginOff:endOff]), endOff, nil
+}
+
+func skipText(msg []byte, off int) (int, error) {
+ if off >= len(msg) {
+ return off, errBaseLen
+ }
+ endOff := off + 1 + int(msg[off])
+ if endOff > len(msg) {
+ return off, errCalcLen
+ }
+ return endOff, nil
+}
+
+func packBytes(msg []byte, field []byte) []byte {
+ return append(msg, field...)
+}
+
+func unpackBytes(msg []byte, off int, field []byte) (int, error) {
+ newOff := off + len(field)
+ if newOff > len(msg) {
+ return off, errBaseLen
+ }
+ copy(field, msg[off:newOff])
+ return newOff, nil
+}
+
+func skipBytes(msg []byte, off int, field []byte) (int, error) {
+ newOff := off + len(field)
+ if newOff > len(msg) {
+ return off, errBaseLen
+ }
+ return newOff, nil
+}
+
+// packName packs a domain name.
+//
+// Domain names are a sequence of counted strings split at the dots. They end
+// with a zero-length string. Compression can be used to reuse domain suffixes.
+//
+// The compression map will be updated with new domain suffixes. If compression
+// is nil, compression will not be used.
+func packName(msg []byte, name string, compression map[string]int) ([]byte, error) {
+ oldMsg := msg
+
+ // Add a trailing dot to canonicalize name.
+ if n := len(name); n == 0 || name[n-1] != '.' {
+ name += "."
+ }
+
+ // Allow root domain.
+ if name == "." {
+ return append(msg, 0), nil
+ }
+
+ // Emit sequence of counted strings, chopping at dots.
+ for i, begin := 0, 0; i < len(name); i++ {
+ // Check for the end of the segment.
+ if name[i] == '.' {
+ // The two most significant bits have special meaning.
+ // It isn't allowed for segments to be long enough to
+ // need them.
+ if i-begin >= 1<<6 {
+ return oldMsg, errSegTooLong
+ }
+
+ // Segments must have a non-zero length.
+ if i-begin == 0 {
+ return oldMsg, errZeroSegLen
+ }
+
+ msg = append(msg, byte(i-begin))
+
+ for j := begin; j < i; j++ {
+ msg = append(msg, name[j])
+ }
+
+ begin = i + 1
+ continue
+ }
+
+ // We can only compress domain suffixes starting with a new
+ // segment. A pointer is two bytes with the two most significant
+ // bits set to 1 to indicate that it is a pointer.
+ if (i == 0 || name[i-1] == '.') && compression != nil {
+ if ptr, ok := compression[name[i:]]; ok {
+ // Hit. Emit a pointer instead of the rest of
+ // the domain.
+ return append(msg, byte(ptr>>8|0xC0), byte(ptr)), nil
+ }
+
+ // Miss. Add the suffix to the compression table if the
+ // offset can be stored in the available 14 bytes.
+ if len(msg) <= int(^uint16(0)>>2) {
+ compression[name[i:]] = len(msg)
+ }
+ }
+ }
+ return append(msg, 0), nil
+}
+
+// unpackName unpacks a domain name.
+func unpackName(msg []byte, off int) (string, int, error) {
+ // currOff is the current working offset.
+ currOff := off
+
+ // newOff is the offset where the next record will start. Pointers lead
+ // to data that belongs to other names and thus doesn't count towards to
+ // the usage of this name.
+ newOff := off
+
+ // name is the domain name being unpacked.
+ name := make([]byte, 0, 255)
+
+ // ptr is the number of pointers followed.
+ var ptr int
+Loop:
+ for {
+ if currOff >= len(msg) {
+ return "", off, errBaseLen
+ }
+ c := int(msg[currOff])
+ currOff++
+ switch c & 0xC0 {
+ case 0x00: // String segment
+ if c == 0x00 {
+ // A zero length signals the end of the name.
+ break Loop
+ }
+ endOff := currOff + c
+ if endOff > len(msg) {
+ return "", off, errCalcLen
+ }
+ name = append(name, msg[currOff:endOff]...)
+ name = append(name, '.')
+ currOff = endOff
+ case 0xC0: // Pointer
+ if currOff >= len(msg) {
+ return "", off, errInvalidPtr
+ }
+ c1 := msg[currOff]
+ currOff++
+ if ptr == 0 {
+ newOff = currOff
+ }
+ // Don't follow too many pointers, maybe there's a loop.
+ if ptr++; ptr > 10 {
+ return "", off, errTooManyPtr
+ }
+ currOff = (c^0xC0)<<8 | int(c1)
+ default:
+ // Prefixes 0x80 and 0x40 are reserved.
+ return "", off, errReserved
+ }
+ }
+ if len(name) == 0 {
+ name = append(name, '.')
+ }
+ if ptr == 0 {
+ newOff = currOff
+ }
+ return string(name), newOff, nil
+}
+
+func skipName(msg []byte, off int) (int, error) {
+ // newOff is the offset where the next record will start. Pointers lead
+ // to data that belongs to other names and thus doesn't count towards to
+ // the usage of this name.
+ newOff := off
+
+Loop:
+ for {
+ if newOff >= len(msg) {
+ return off, errBaseLen
+ }
+ c := int(msg[newOff])
+ newOff++
+ switch c & 0xC0 {
+ case 0x00:
+ if c == 0x00 {
+ // A zero length signals the end of the name.
+ break Loop
+ }
+ // literal string
+ newOff += c
+ if newOff > len(msg) {
+ return off, errCalcLen
+ }
+ case 0xC0:
+ // Pointer to somewhere else in msg.
+
+ // Pointers are two bytes.
+ newOff++
+
+ // Don't follow the pointer as the data here has ended.
+ break Loop
+ default:
+ // Prefixes 0x80 and 0x40 are reserved.
+ return off, errReserved
+ }
+ }
+
+ return newOff, nil
+}
+
+// A Question is a DNS query.
+type Question struct {
+ Name string
+ Type Type
+ Class Class
+}
+
+func (q *Question) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ msg, err := packName(msg, q.Name, compression)
+ if err != nil {
+ return msg, &nestedError{"Name", err}
+ }
+ msg = packType(msg, q.Type)
+ return packClass(msg, q.Class), nil
+}
+
+func unpackResource(msg []byte, off int, hdr ResourceHeader) (Resource, int, error) {
+ var (
+ r Resource
+ err error
+ name string
+ )
+ switch hdr.Type {
+ case TypeA:
+ r, err = unpackAResource(hdr, msg, off)
+ name = "A"
+ case TypeNS:
+ r, err = unpackNSResource(hdr, msg, off)
+ name = "NS"
+ case TypeCNAME:
+ r, err = unpackCNAMEResource(hdr, msg, off)
+ name = "CNAME"
+ case TypeSOA:
+ r, err = unpackSOAResource(hdr, msg, off)
+ name = "SOA"
+ case TypePTR:
+ r, err = unpackPTRResource(hdr, msg, off)
+ name = "PTR"
+ case TypeMX:
+ r, err = unpackMXResource(hdr, msg, off)
+ name = "MX"
+ case TypeTXT:
+ r, err = unpackTXTResource(hdr, msg, off)
+ name = "TXT"
+ case TypeAAAA:
+ r, err = unpackAAAAResource(hdr, msg, off)
+ name = "AAAA"
+ case TypeSRV:
+ r, err = unpackSRVResource(hdr, msg, off)
+ name = "SRV"
+ }
+ if err != nil {
+ return nil, off, &nestedError{name + " record", err}
+ }
+ if r != nil {
+ return r, off + int(hdr.Length), nil
+ }
+ return nil, off, errors.New("invalid resource type: " + string(hdr.Type+'0'))
+}
+
+// A CNAMEResource is a CNAME Resource record.
+type CNAMEResource struct {
+ ResourceHeader
+
+ CNAME string
+}
+
+func (r *CNAMEResource) realType() Type {
+ return TypeCNAME
+}
+
+func (r *CNAMEResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packName(msg, r.CNAME, compression)
+}
+
+func unpackCNAMEResource(hdr ResourceHeader, msg []byte, off int) (*CNAMEResource, error) {
+ cname, _, err := unpackName(msg, off)
+ if err != nil {
+ return nil, err
+ }
+ return &CNAMEResource{hdr, cname}, nil
+}
+
+// An MXResource is an MX Resource record.
+type MXResource struct {
+ ResourceHeader
+
+ Pref uint16
+ MX string
+}
+
+func (r *MXResource) realType() Type {
+ return TypeMX
+}
+
+func (r *MXResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ oldMsg := msg
+ msg = packUint16(msg, r.Pref)
+ msg, err := packName(msg, r.MX, compression)
+ if err != nil {
+ return oldMsg, &nestedError{"MXResource.MX", err}
+ }
+ return msg, nil
+}
+
+func unpackMXResource(hdr ResourceHeader, msg []byte, off int) (*MXResource, error) {
+ pref, off, err := unpackUint16(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Pref", err}
+ }
+ mx, _, err := unpackName(msg, off)
+ if err != nil {
+ return nil, &nestedError{"MX", err}
+ }
+ return &MXResource{hdr, pref, mx}, nil
+}
+
+// An NSResource is an NS Resource record.
+type NSResource struct {
+ ResourceHeader
+
+ NS string
+}
+
+func (r *NSResource) realType() Type {
+ return TypeNS
+}
+
+func (r *NSResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packName(msg, r.NS, compression)
+}
+
+func unpackNSResource(hdr ResourceHeader, msg []byte, off int) (*NSResource, error) {
+ ns, _, err := unpackName(msg, off)
+ if err != nil {
+ return nil, err
+ }
+ return &NSResource{hdr, ns}, nil
+}
+
+// A PTRResource is a PTR Resource record.
+type PTRResource struct {
+ ResourceHeader
+
+ PTR string
+}
+
+func (r *PTRResource) realType() Type {
+ return TypePTR
+}
+
+func (r *PTRResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packName(msg, r.PTR, compression)
+}
+
+func unpackPTRResource(hdr ResourceHeader, msg []byte, off int) (*PTRResource, error) {
+ ptr, _, err := unpackName(msg, off)
+ if err != nil {
+ return nil, err
+ }
+ return &PTRResource{hdr, ptr}, nil
+}
+
+// An SOAResource is an SOA Resource record.
+type SOAResource struct {
+ ResourceHeader
+
+ NS string
+ MBox string
+ Serial uint32
+ Refresh uint32
+ Retry uint32
+ Expire uint32
+
+ // MinTTL the is the default TTL of Resources records which did not
+ // contain a TTL value and the TTL of negative responses. (RFC 2308
+ // Section 4)
+ MinTTL uint32
+}
+
+func (r *SOAResource) realType() Type {
+ return TypeSOA
+}
+
+func (r *SOAResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ oldMsg := msg
+ msg, err := packName(msg, r.NS, compression)
+ if err != nil {
+ return oldMsg, &nestedError{"SOAResource.NS", err}
+ }
+ msg, err = packName(msg, r.MBox, compression)
+ if err != nil {
+ return oldMsg, &nestedError{"SOAResource.MBox", err}
+ }
+ msg = packUint32(msg, r.Serial)
+ msg = packUint32(msg, r.Refresh)
+ msg = packUint32(msg, r.Retry)
+ msg = packUint32(msg, r.Expire)
+ return packUint32(msg, r.MinTTL), nil
+}
+
+func unpackSOAResource(hdr ResourceHeader, msg []byte, off int) (*SOAResource, error) {
+ ns, off, err := unpackName(msg, off)
+ if err != nil {
+ return nil, &nestedError{"NS", err}
+ }
+ mbox, off, err := unpackName(msg, off)
+ if err != nil {
+ return nil, &nestedError{"MBox", err}
+ }
+ serial, off, err := unpackUint32(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Serial", err}
+ }
+ refresh, off, err := unpackUint32(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Refresh", err}
+ }
+ retry, off, err := unpackUint32(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Retry", err}
+ }
+ expire, off, err := unpackUint32(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Expire", err}
+ }
+ minTTL, _, err := unpackUint32(msg, off)
+ if err != nil {
+ return nil, &nestedError{"MinTTL", err}
+ }
+ return &SOAResource{hdr, ns, mbox, serial, refresh, retry, expire, minTTL}, nil
+}
+
+// A TXTResource is a TXT Resource record.
+type TXTResource struct {
+ ResourceHeader
+
+ Txt string // Not a domain name.
+}
+
+func (r *TXTResource) realType() Type {
+ return TypeTXT
+}
+
+func (r *TXTResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packText(msg, r.Txt), nil
+}
+
+func unpackTXTResource(hdr ResourceHeader, msg []byte, off int) (*TXTResource, error) {
+ var txt string
+ for n := uint16(0); n < hdr.Length; {
+ var t string
+ var err error
+ if t, off, err = unpackText(msg, off); err != nil {
+ return nil, &nestedError{"text", err}
+ }
+ // Check if we got too many bytes.
+ if hdr.Length-n < uint16(len(t))+1 {
+ return nil, errCalcLen
+ }
+ n += uint16(len(t)) + 1
+ txt += t
+ }
+ return &TXTResource{hdr, txt}, nil
+}
+
+// An SRVResource is an SRV Resource record.
+type SRVResource struct {
+ ResourceHeader
+
+ Priority uint16
+ Weight uint16
+ Port uint16
+ Target string // Not compressed as per RFC 2782.
+}
+
+func (r *SRVResource) realType() Type {
+ return TypeSRV
+}
+
+func (r *SRVResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ oldMsg := msg
+ msg = packUint16(msg, r.Priority)
+ msg = packUint16(msg, r.Weight)
+ msg = packUint16(msg, r.Port)
+ msg, err := packName(msg, r.Target, nil)
+ if err != nil {
+ return oldMsg, &nestedError{"SRVResource.Target", err}
+ }
+ return msg, nil
+}
+
+func unpackSRVResource(hdr ResourceHeader, msg []byte, off int) (*SRVResource, error) {
+ priority, off, err := unpackUint16(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Priority", err}
+ }
+ weight, off, err := unpackUint16(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Weight", err}
+ }
+ port, off, err := unpackUint16(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Port", err}
+ }
+ target, _, err := unpackName(msg, off)
+ if err != nil {
+ return nil, &nestedError{"Target", err}
+ }
+ return &SRVResource{hdr, priority, weight, port, target}, nil
+}
+
+// An AResource is an A Resource record.
+type AResource struct {
+ ResourceHeader
+
+ A [4]byte
+}
+
+func (r *AResource) realType() Type {
+ return TypeA
+}
+
+func (r *AResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packBytes(msg, r.A[:]), nil
+}
+
+func unpackAResource(hdr ResourceHeader, msg []byte, off int) (*AResource, error) {
+ var a [4]byte
+ if _, err := unpackBytes(msg, off, a[:]); err != nil {
+ return nil, err
+ }
+ return &AResource{hdr, a}, nil
+}
+
+// An AAAAResource is an AAAA Resource record.
+type AAAAResource struct {
+ ResourceHeader
+
+ AAAA [16]byte
+}
+
+func (r *AAAAResource) realType() Type {
+ return TypeAAAA
+}
+
+func (r *AAAAResource) pack(msg []byte, compression map[string]int) ([]byte, error) {
+ return packBytes(msg, r.AAAA[:]), nil
+}
+
+func unpackAAAAResource(hdr ResourceHeader, msg []byte, off int) (*AAAAResource, error) {
+ var aaaa [16]byte
+ if _, err := unpackBytes(msg, off, aaaa[:]); err != nil {
+ return nil, err
+ }
+ return &AAAAResource{hdr, aaaa}, nil
+}
diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message_test.go b/vendor/golang.org/x/net/dns/dnsmessage/message_test.go
new file mode 100644
index 000000000..46edd7243
--- /dev/null
+++ b/vendor/golang.org/x/net/dns/dnsmessage/message_test.go
@@ -0,0 +1,575 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package dnsmessage
+
+import (
+ "fmt"
+ "net"
+ "reflect"
+ "strings"
+ "testing"
+)
+
+func (m *Message) String() string {
+ s := fmt.Sprintf("Message: %#v\n", &m.Header)
+ if len(m.Questions) > 0 {
+ s += "-- Questions\n"
+ for _, q := range m.Questions {
+ s += fmt.Sprintf("%#v\n", q)
+ }
+ }
+ if len(m.Answers) > 0 {
+ s += "-- Answers\n"
+ for _, a := range m.Answers {
+ s += fmt.Sprintf("%#v\n", a)
+ }
+ }
+ if len(m.Authorities) > 0 {
+ s += "-- Authorities\n"
+ for _, ns := range m.Authorities {
+ s += fmt.Sprintf("%#v\n", ns)
+ }
+ }
+ if len(m.Additionals) > 0 {
+ s += "-- Additionals\n"
+ for _, e := range m.Additionals {
+ s += fmt.Sprintf("%#v\n", e)
+ }
+ }
+ return s
+}
+
+func TestQuestionPackUnpack(t *testing.T) {
+ want := Question{
+ Name: ".",
+ Type: TypeA,
+ Class: ClassINET,
+ }
+ buf, err := want.pack(make([]byte, 1, 50), map[string]int{})
+ if err != nil {
+ t.Fatal("Packing failed:", err)
+ }
+ var p Parser
+ p.msg = buf
+ p.header.questions = 1
+ p.section = sectionQuestions
+ p.off = 1
+ got, err := p.Question()
+ if err != nil {
+ t.Fatalf("Unpacking failed: %v\n%s", err, string(buf[1:]))
+ }
+ if p.off != len(buf) {
+ t.Errorf("Unpacked different amount than packed: got n = %d, want = %d", p.off, len(buf))
+ }
+ if !reflect.DeepEqual(got, want) {
+ t.Errorf("Got = %+v, want = %+v", got, want)
+ }
+}
+
+func TestNamePackUnpack(t *testing.T) {
+ tests := []struct {
+ in string
+ want string
+ err error
+ }{
+ {"", ".", nil},
+ {".", ".", nil},
+ {"google..com", "", errZeroSegLen},
+ {"google.com", "google.com.", nil},
+ {"google..com.", "", errZeroSegLen},
+ {"google.com.", "google.com.", nil},
+ {".google.com.", "", errZeroSegLen},
+ {"www..google.com.", "", errZeroSegLen},
+ {"www.google.com.", "www.google.com.", nil},
+ }
+
+ for _, test := range tests {
+ buf, err := packName(make([]byte, 0, 30), test.in, map[string]int{})
+ if err != test.err {
+ t.Errorf("Packing of %s: got err = %v, want err = %v", test.in, err, test.err)
+ continue
+ }
+ if test.err != nil {
+ continue
+ }
+ got, n, err := unpackName(buf, 0)
+ if err != nil {
+ t.Errorf("Unpacking for %s failed: %v", test.in, err)
+ continue
+ }
+ if n != len(buf) {
+ t.Errorf(
+ "Unpacked different amount than packed for %s: got n = %d, want = %d",
+ test.in,
+ n,
+ len(buf),
+ )
+ }
+ if got != test.want {
+ t.Errorf("Unpacking packing of %s: got = %s, want = %s", test.in, got, test.want)
+ }
+ }
+}
+
+func TestDNSPackUnpack(t *testing.T) {
+ wants := []Message{
+ {
+ Questions: []Question{
+ {
+ Name: ".",
+ Type: TypeAAAA,
+ Class: ClassINET,
+ },
+ },
+ Answers: []Resource{},
+ Authorities: []Resource{},
+ Additionals: []Resource{},
+ },
+ largeTestMsg(),
+ }
+ for i, want := range wants {
+ b, err := want.Pack()
+ if err != nil {
+ t.Fatalf("%d: packing failed: %v", i, err)
+ }
+ var got Message
+ err = got.Unpack(b)
+ if err != nil {
+ t.Fatalf("%d: unpacking failed: %v", i, err)
+ }
+ if !reflect.DeepEqual(got, want) {
+ t.Errorf("%d: got = %+v, want = %+v", i, &got, &want)
+ }
+ }
+}
+
+func TestSkipAll(t *testing.T) {
+ msg := largeTestMsg()
+ buf, err := msg.Pack()
+ if err != nil {
+ t.Fatal("Packing large test message:", err)
+ }
+ var p Parser
+ if _, err := p.Start(buf); err != nil {
+ t.Fatal(err)
+ }
+
+ tests := []struct {
+ name string
+ f func() error
+ }{
+ {"SkipAllQuestions", p.SkipAllQuestions},
+ {"SkipAllAnswers", p.SkipAllAnswers},
+ {"SkipAllAuthorities", p.SkipAllAuthorities},
+ {"SkipAllAdditionals", p.SkipAllAdditionals},
+ }
+ for _, test := range tests {
+ for i := 1; i <= 3; i++ {
+ if err := test.f(); err != nil {
+ t.Errorf("Call #%d to %s(): %v", i, test.name, err)
+ }
+ }
+ }
+}
+
+func TestSkipNotStarted(t *testing.T) {
+ var p Parser
+
+ tests := []struct {
+ name string
+ f func() error
+ }{
+ {"SkipAllQuestions", p.SkipAllQuestions},
+ {"SkipAllAnswers", p.SkipAllAnswers},
+ {"SkipAllAuthorities", p.SkipAllAuthorities},
+ {"SkipAllAdditionals", p.SkipAllAdditionals},
+ }
+ for _, test := range tests {
+ if err := test.f(); err != ErrNotStarted {
+ t.Errorf("Got %s() = %v, want = %v", test.name, err, ErrNotStarted)
+ }
+ }
+}
+
+func TestTooManyRecords(t *testing.T) {
+ const recs = int(^uint16(0)) + 1
+ tests := []struct {
+ name string
+ msg Message
+ want error
+ }{
+ {
+ "Questions",
+ Message{
+ Questions: make([]Question, recs),
+ },
+ errTooManyQuestions,
+ },
+ {
+ "Answers",
+ Message{
+ Answers: make([]Resource, recs),
+ },
+ errTooManyAnswers,
+ },
+ {
+ "Authorities",
+ Message{
+ Authorities: make([]Resource, recs),
+ },
+ errTooManyAuthorities,
+ },
+ {
+ "Additionals",
+ Message{
+ Additionals: make([]Resource, recs),
+ },
+ errTooManyAdditionals,
+ },
+ }
+
+ for _, test := range tests {
+ if _, got := test.msg.Pack(); got != test.want {
+ t.Errorf("Packing %d %s: got = %v, want = %v", recs, test.name, got, test.want)
+ }
+ }
+}
+
+func TestVeryLongTxt(t *testing.T) {
+ want := &TXTResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeTXT,
+ Class: ClassINET,
+ },
+ Txt: loremIpsum,
+ }
+ buf, err := packResource(make([]byte, 0, 8000), want, map[string]int{})
+ if err != nil {
+ t.Fatal("Packing failed:", err)
+ }
+ var hdr ResourceHeader
+ off, err := hdr.unpack(buf, 0)
+ if err != nil {
+ t.Fatal("Unpacking ResourceHeader failed:", err)
+ }
+ got, n, err := unpackResource(buf, off, hdr)
+ if err != nil {
+ t.Fatal("Unpacking failed:", err)
+ }
+ if n != len(buf) {
+ t.Errorf("Unpacked different amount than packed: got n = %d, want = %d", n, len(buf))
+ }
+ if !reflect.DeepEqual(got, want) {
+ t.Errorf("Got = %+v, want = %+v", got, want)
+ }
+}
+
+func ExampleHeaderSearch() {
+ msg := Message{
+ Header: Header{Response: true, Authoritative: true},
+ Questions: []Question{
+ {
+ Name: "foo.bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ {
+ Name: "bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ },
+ Answers: []Resource{
+ &AResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ A: [4]byte{127, 0, 0, 1},
+ },
+ &AResource{
+ ResourceHeader: ResourceHeader{
+ Name: "bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ A: [4]byte{127, 0, 0, 2},
+ },
+ },
+ }
+
+ buf, err := msg.Pack()
+ if err != nil {
+ panic(err)
+ }
+
+ wantName := "bar.example.com."
+
+ var p Parser
+ if _, err := p.Start(buf); err != nil {
+ panic(err)
+ }
+
+ for {
+ q, err := p.Question()
+ if err == ErrSectionDone {
+ break
+ }
+ if err != nil {
+ panic(err)
+ }
+
+ if q.Name != wantName {
+ continue
+ }
+
+ fmt.Println("Found question for name", wantName)
+ if err := p.SkipAllQuestions(); err != nil {
+ panic(err)
+ }
+ break
+ }
+
+ var gotIPs []net.IP
+ for {
+ h, err := p.AnswerHeader()
+ if err == ErrSectionDone {
+ break
+ }
+ if err != nil {
+ panic(err)
+ }
+
+ if (h.Type != TypeA && h.Type != TypeAAAA) || h.Class != ClassINET {
+ continue
+ }
+
+ if !strings.EqualFold(h.Name, wantName) {
+ if err := p.SkipAnswer(); err != nil {
+ panic(err)
+ }
+ continue
+ }
+ a, err := p.Answer()
+ if err != nil {
+ panic(err)
+ }
+
+ switch r := a.(type) {
+ default:
+ panic(fmt.Sprintf("unknown type: %T", r))
+ case *AResource:
+ gotIPs = append(gotIPs, r.A[:])
+ case *AAAAResource:
+ gotIPs = append(gotIPs, r.AAAA[:])
+ }
+ }
+
+ fmt.Printf("Found A/AAAA records for name %s: %v\n", wantName, gotIPs)
+
+ // Output:
+ // Found question for name bar.example.com.
+ // Found A/AAAA records for name bar.example.com.: [127.0.0.2]
+}
+
+func largeTestMsg() Message {
+ return Message{
+ Header: Header{Response: true, Authoritative: true},
+ Questions: []Question{
+ {
+ Name: "foo.bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ },
+ Answers: []Resource{
+ &AResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ A: [4]byte{127, 0, 0, 1},
+ },
+ &AResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeA,
+ Class: ClassINET,
+ },
+ A: [4]byte{127, 0, 0, 2},
+ },
+ },
+ Authorities: []Resource{
+ &NSResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeNS,
+ Class: ClassINET,
+ },
+ NS: "ns1.example.com.",
+ },
+ &NSResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeNS,
+ Class: ClassINET,
+ },
+ NS: "ns2.example.com.",
+ },
+ },
+ Additionals: []Resource{
+ &TXTResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeTXT,
+ Class: ClassINET,
+ },
+ Txt: "So Long, and Thanks for All the Fish",
+ },
+ &TXTResource{
+ ResourceHeader: ResourceHeader{
+ Name: "foo.bar.example.com.",
+ Type: TypeTXT,
+ Class: ClassINET,
+ },
+ Txt: "Hamster Huey and the Gooey Kablooie",
+ },
+ },
+ }
+}
+
+const loremIpsum = `
+Lorem ipsum dolor sit amet, nec enim antiopam id, an ullum choro
+nonumes qui, pro eu debet honestatis mediocritatem. No alia enim eos,
+magna signiferumque ex vis. Mei no aperiri dissentias, cu vel quas
+regione. Malorum quaeque vim ut, eum cu semper aliquid invidunt, ei
+nam ipsum assentior.
+
+Nostrum appellantur usu no, vis ex probatus adipiscing. Cu usu illum
+facilis eleifend. Iusto conceptam complectitur vim id. Tale omnesque
+no usu, ei oblique sadipscing vim. At nullam voluptua usu, mei laudem
+reformidans et. Qui ei eros porro reformidans, ius suas veritus
+torquatos ex. Mea te facer alterum consequat.
+
+Soleat torquatos democritum sed et, no mea congue appareat, facer
+aliquam nec in. Has te ipsum tritani. At justo dicta option nec, movet
+phaedrum ad nam. Ea detracto verterem liberavisse has, delectus
+suscipiantur in mei. Ex nam meliore complectitur. Ut nam omnis
+honestatis quaerendum, ea mea nihil affert detracto, ad vix rebum
+mollis.
+
+Ut epicurei praesent neglegentur pri, prima fuisset intellegebat ad
+vim. An habemus comprehensam usu, at enim dignissim pro. Eam reque
+vivendum adipisci ea. Vel ne odio choro minimum. Sea admodum
+dissentiet ex. Mundi tamquam evertitur ius cu. Homero postea iisque ut
+pro, vel ne saepe senserit consetetur.
+
+Nulla utamur facilisis ius ea, in viderer diceret pertinax eum. Mei no
+enim quodsi facilisi, ex sed aeterno appareat mediocritatem, eum
+sententiae deterruisset ut. At suas timeam euismod cum, offendit
+appareat interpretaris ne vix. Vel ea civibus albucius, ex vim quidam
+accusata intellegebat, noluisse instructior sea id. Nec te nonumes
+habemus appellantur, quis dignissim vituperata eu nam.
+
+At vix apeirian patrioque vituperatoribus, an usu agam assum. Debet
+iisque an mea. Per eu dicant ponderum accommodare. Pri alienum
+placerat senserit an, ne eum ferri abhorreant vituperatoribus. Ut mea
+eligendi disputationi. Ius no tation everti impedit, ei magna quidam
+mediocritatem pri.
+
+Legendos perpetua iracundia ne usu, no ius ullum epicurei intellegam,
+ad modus epicuri lucilius eam. In unum quaerendum usu. Ne diam paulo
+has, ea veri virtute sed. Alia honestatis conclusionemque mea eu, ut
+iudico albucius his.
+
+Usu essent probatus eu, sed omnis dolor delicatissimi ex. No qui augue
+dissentias dissentiet. Laudem recteque no usu, vel an velit noluisse,
+an sed utinam eirmod appetere. Ne mea fuisset inimicus ocurreret. At
+vis dicant abhorreant, utinam forensibus nec ne, mei te docendi
+consequat. Brute inermis persecuti cum id. Ut ipsum munere propriae
+usu, dicit graeco disputando id has.
+
+Eros dolore quaerendum nam ei. Timeam ornatus inciderint pro id. Nec
+torquatos sadipscing ei, ancillae molestie per in. Malis principes duo
+ea, usu liber postulant ei.
+
+Graece timeam voluptatibus eu eam. Alia probatus quo no, ea scripta
+feugiat duo. Congue option meliore ex qui, noster invenire appellantur
+ea vel. Eu exerci legendos vel. Consetetur repudiandae vim ut. Vix an
+probo minimum, et nam illud falli tempor.
+
+Cum dico signiferumque eu. Sed ut regione maiorum, id veritus insolens
+tacimates vix. Eu mel sint tamquam lucilius, duo no oporteat
+tacimates. Atqui augue concludaturque vix ei, id mel utroque menandri.
+
+Ad oratio blandit aliquando pro. Vis et dolorum rationibus
+philosophia, ad cum nulla molestie. Hinc fuisset adversarium eum et,
+ne qui nisl verear saperet, vel te quaestio forensibus. Per odio
+option delenit an. Alii placerat has no, in pri nihil platonem
+cotidieque. Est ut elit copiosae scaevola, debet tollit maluisset sea
+an.
+
+Te sea hinc debet pericula, liber ridens fabulas cu sed, quem mutat
+accusam mea et. Elitr labitur albucius et pri, an labore feugait mel.
+Velit zril melius usu ea. Ad stet putent interpretaris qui. Mel no
+error volumus scripserit. In pro paulo iudico, quo ei dolorem
+verterem, affert fabellas dissentiet ea vix.
+
+Vis quot deserunt te. Error aliquid detraxit eu usu, vis alia eruditi
+salutatus cu. Est nostrud bonorum an, ei usu alii salutatus. Vel at
+nisl primis, eum ex aperiri noluisse reformidans. Ad veri velit
+utroque vis, ex equidem detraxit temporibus has.
+
+Inermis appareat usu ne. Eros placerat periculis mea ad, in dictas
+pericula pro. Errem postulant at usu, ea nec amet ornatus mentitum. Ad
+mazim graeco eum, vel ex percipit volutpat iudicabit, sit ne delicata
+interesset. Mel sapientem prodesset abhorreant et, oblique suscipit
+eam id.
+
+An maluisset disputando mea, vidit mnesarchum pri et. Malis insolens
+inciderint no sea. Ea persius maluisset vix, ne vim appellantur
+instructior, consul quidam definiebas pri id. Cum integre feugiat
+pericula in, ex sed persius similique, mel ne natum dicit percipitur.
+
+Primis discere ne pri, errem putent definitionem at vis. Ei mel dolore
+neglegentur, mei tincidunt percipitur ei. Pro ad simul integre
+rationibus. Eu vel alii honestatis definitiones, mea no nonumy
+reprehendunt.
+
+Dicta appareat legendos est cu. Eu vel congue dicunt omittam, no vix
+adhuc minimum constituam, quot noluisse id mel. Eu quot sale mutat
+duo, ex nisl munere invenire duo. Ne nec ullum utamur. Pro alterum
+debitis nostrum no, ut vel aliquid vivendo.
+
+Aliquip fierent praesent quo ne, id sit audiam recusabo delicatissimi.
+Usu postulant incorrupte cu. At pro dicit tibique intellegam, cibo
+dolore impedit id eam, et aeque feugait assentior has. Quando sensibus
+nec ex. Possit sensibus pri ad, unum mutat periculis cu vix.
+
+Mundi tibique vix te, duo simul partiendo qualisque id, est at vidit
+sonet tempor. No per solet aeterno deseruisse. Petentium salutandi
+definiebas pri cu. Munere vivendum est in. Ei justo congue eligendi
+vis, modus offendit omittantur te mel.
+
+Integre voluptaria in qui, sit habemus tractatos constituam no. Utinam
+melius conceptam est ne, quo in minimum apeirian delicata, ut ius
+porro recusabo. Dicant expetenda vix no, ludus scripserit sed ex, eu
+his modo nostro. Ut etiam sonet his, quodsi inciderint philosophia te
+per. Nullam lobortis eu cum, vix an sonet efficiendi repudiandae. Vis
+ad idque fabellas intellegebat.
+
+Eum commodo senserit conclusionemque ex. Sed forensibus sadipscing ut,
+mei in facer delicata periculis, sea ne hinc putent cetero. Nec ne
+alia corpora invenire, alia prima soleat te cum. Eleifend posidonium
+nam at.
+
+Dolorum indoctum cu quo, ex dolor legendos recteque eam, cu pri zril
+discere. Nec civibus officiis dissentiunt ex, est te liber ludus
+elaboraret. Cum ea fabellas invenire. Ex vim nostrud eripuit
+comprehensam, nam te inermis delectus, saepe inermis senserit.
+`
diff --git a/vendor/golang.org/x/net/http2/client_conn_pool.go b/vendor/golang.org/x/net/http2/client_conn_pool.go
index b13941258..bdf5652b0 100644
--- a/vendor/golang.org/x/net/http2/client_conn_pool.go
+++ b/vendor/golang.org/x/net/http2/client_conn_pool.go
@@ -247,7 +247,7 @@ func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn {
}
// noDialClientConnPool is an implementation of http2.ClientConnPool
-// which never dials. We let the HTTP/1.1 client dial and use its TLS
+// which never dials. We let the HTTP/1.1 client dial and use its TLS
// connection instead.
type noDialClientConnPool struct{ *clientConnPool }
diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go
new file mode 100644
index 000000000..a3067f8de
--- /dev/null
+++ b/vendor/golang.org/x/net/http2/databuffer.go
@@ -0,0 +1,146 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package http2
+
+import (
+ "errors"
+ "fmt"
+ "sync"
+)
+
+// Buffer chunks are allocated from a pool to reduce pressure on GC.
+// The maximum wasted space per dataBuffer is 2x the largest size class,
+// which happens when the dataBuffer has multiple chunks and there is
+// one unread byte in both the first and last chunks. We use a few size
+// classes to minimize overheads for servers that typically receive very
+// small request bodies.
+//
+// TODO: Benchmark to determine if the pools are necessary. The GC may have
+// improved enough that we can instead allocate chunks like this:
+// make([]byte, max(16<<10, expectedBytesRemaining))
+var (
+ dataChunkSizeClasses = []int{
+ 1 << 10,
+ 2 << 10,
+ 4 << 10,
+ 8 << 10,
+ 16 << 10,
+ }
+ dataChunkPools = [...]sync.Pool{
+ {New: func() interface{} { return make([]byte, 1<<10) }},
+ {New: func() interface{} { return make([]byte, 2<<10) }},
+ {New: func() interface{} { return make([]byte, 4<<10) }},
+ {New: func() interface{} { return make([]byte, 8<<10) }},
+ {New: func() interface{} { return make([]byte, 16<<10) }},
+ }
+)
+
+func getDataBufferChunk(size int64) []byte {
+ i := 0
+ for ; i < len(dataChunkSizeClasses)-1; i++ {
+ if size <= int64(dataChunkSizeClasses[i]) {
+ break
+ }
+ }
+ return dataChunkPools[i].Get().([]byte)
+}
+
+func putDataBufferChunk(p []byte) {
+ for i, n := range dataChunkSizeClasses {
+ if len(p) == n {
+ dataChunkPools[i].Put(p)
+ return
+ }
+ }
+ panic(fmt.Sprintf("unexpected buffer len=%v", len(p)))
+}
+
+// dataBuffer is an io.ReadWriter backed by a list of data chunks.
+// Each dataBuffer is used to read DATA frames on a single stream.
+// The buffer is divided into chunks so the server can limit the
+// total memory used by a single connection without limiting the
+// request body size on any single stream.
+type dataBuffer struct {
+ chunks [][]byte
+ r int // next byte to read is chunks[0][r]
+ w int // next byte to write is chunks[len(chunks)-1][w]
+ size int // total buffered bytes
+ expected int64 // we expect at least this many bytes in future Write calls (ignored if <= 0)
+}
+
+var errReadEmpty = errors.New("read from empty dataBuffer")
+
+// Read copies bytes from the buffer into p.
+// It is an error to read when no data is available.
+func (b *dataBuffer) Read(p []byte) (int, error) {
+ if b.size == 0 {
+ return 0, errReadEmpty
+ }
+ var ntotal int
+ for len(p) > 0 && b.size > 0 {
+ readFrom := b.bytesFromFirstChunk()
+ n := copy(p, readFrom)
+ p = p[n:]
+ ntotal += n
+ b.r += n
+ b.size -= n
+ // If the first chunk has been consumed, advance to the next chunk.
+ if b.r == len(b.chunks[0]) {
+ putDataBufferChunk(b.chunks[0])
+ end := len(b.chunks) - 1
+ copy(b.chunks[:end], b.chunks[1:])
+ b.chunks[end] = nil
+ b.chunks = b.chunks[:end]
+ b.r = 0
+ }
+ }
+ return ntotal, nil
+}
+
+func (b *dataBuffer) bytesFromFirstChunk() []byte {
+ if len(b.chunks) == 1 {
+ return b.chunks[0][b.r:b.w]
+ }
+ return b.chunks[0][b.r:]
+}
+
+// Len returns the number of bytes of the unread portion of the buffer.
+func (b *dataBuffer) Len() int {
+ return b.size
+}
+
+// Write appends p to the buffer.
+func (b *dataBuffer) Write(p []byte) (int, error) {
+ ntotal := len(p)
+ for len(p) > 0 {
+ // If the last chunk is empty, allocate a new chunk. Try to allocate
+ // enough to fully copy p plus any additional bytes we expect to
+ // receive. However, this may allocate less than len(p).
+ want := int64(len(p))
+ if b.expected > want {
+ want = b.expected
+ }
+ chunk := b.lastChunkOrAlloc(want)
+ n := copy(chunk[b.w:], p)
+ p = p[n:]
+ b.w += n
+ b.size += n
+ b.expected -= int64(n)
+ }
+ return ntotal, nil
+}
+
+func (b *dataBuffer) lastChunkOrAlloc(want int64) []byte {
+ if len(b.chunks) != 0 {
+ last := b.chunks[len(b.chunks)-1]
+ if b.w < len(last) {
+ return last
+ }
+ }
+ chunk := getDataBufferChunk(want)
+ b.chunks = append(b.chunks, chunk)
+ b.w = 0
+ return chunk
+}
diff --git a/vendor/golang.org/x/net/http2/databuffer_test.go b/vendor/golang.org/x/net/http2/databuffer_test.go
new file mode 100644
index 000000000..ca227b528
--- /dev/null
+++ b/vendor/golang.org/x/net/http2/databuffer_test.go
@@ -0,0 +1,155 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package http2
+
+import (
+ "bytes"
+ "fmt"
+ "reflect"
+ "testing"
+)
+
+func fmtDataChunk(chunk []byte) string {
+ out := ""
+ var last byte
+ var count int
+ for _, c := range chunk {
+ if c != last {
+ if count > 0 {
+ out += fmt.Sprintf(" x %d ", count)
+ count = 0
+ }
+ out += string([]byte{c})
+ last = c
+ }
+ count++
+ }
+ if count > 0 {
+ out += fmt.Sprintf(" x %d", count)
+ }
+ return out
+}
+
+func fmtDataChunks(chunks [][]byte) string {
+ var out string
+ for _, chunk := range chunks {
+ out += fmt.Sprintf("{%q}", fmtDataChunk(chunk))
+ }
+ return out
+}
+
+func testDataBuffer(t *testing.T, wantBytes []byte, setup func(t *testing.T) *dataBuffer) {
+ // Run setup, then read the remaining bytes from the dataBuffer and check
+ // that they match wantBytes. We use different read sizes to check corner
+ // cases in Read.
+ for _, readSize := range []int{1, 2, 1 * 1024, 32 * 1024} {
+ t.Run(fmt.Sprintf("ReadSize=%d", readSize), func(t *testing.T) {
+ b := setup(t)
+ buf := make([]byte, readSize)
+ var gotRead bytes.Buffer
+ for {
+ n, err := b.Read(buf)
+ gotRead.Write(buf[:n])
+ if err == errReadEmpty {
+ break
+ }
+ if err != nil {
+ t.Fatalf("error after %v bytes: %v", gotRead.Len(), err)
+ }
+ }
+ if got, want := gotRead.Bytes(), wantBytes; !bytes.Equal(got, want) {
+ t.Errorf("FinalRead=%q, want %q", fmtDataChunk(got), fmtDataChunk(want))
+ }
+ })
+ }
+}
+
+func TestDataBufferAllocation(t *testing.T) {
+ writes := [][]byte{
+ bytes.Repeat([]byte("a"), 1*1024-1),
+ []byte{'a'},
+ bytes.Repeat([]byte("b"), 4*1024-1),
+ []byte{'b'},
+ bytes.Repeat([]byte("c"), 8*1024-1),
+ []byte{'c'},
+ bytes.Repeat([]byte("d"), 16*1024-1),
+ []byte{'d'},
+ bytes.Repeat([]byte("e"), 32*1024),
+ }
+ var wantRead bytes.Buffer
+ for _, p := range writes {
+ wantRead.Write(p)
+ }
+
+ testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer {
+ b := &dataBuffer{}
+ for _, p := range writes {
+ if n, err := b.Write(p); n != len(p) || err != nil {
+ t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p))
+ }
+ }
+ want := [][]byte{
+ bytes.Repeat([]byte("a"), 1*1024),
+ bytes.Repeat([]byte("b"), 4*1024),
+ bytes.Repeat([]byte("c"), 8*1024),
+ bytes.Repeat([]byte("d"), 16*1024),
+ bytes.Repeat([]byte("e"), 16*1024),
+ bytes.Repeat([]byte("e"), 16*1024),
+ }
+ if !reflect.DeepEqual(b.chunks, want) {
+ t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want))
+ }
+ return b
+ })
+}
+
+func TestDataBufferAllocationWithExpected(t *testing.T) {
+ writes := [][]byte{
+ bytes.Repeat([]byte("a"), 1*1024), // allocates 16KB
+ bytes.Repeat([]byte("b"), 14*1024),
+ bytes.Repeat([]byte("c"), 15*1024), // allocates 16KB more
+ bytes.Repeat([]byte("d"), 2*1024),
+ bytes.Repeat([]byte("e"), 1*1024), // overflows 32KB expectation, allocates just 1KB
+ }
+ var wantRead bytes.Buffer
+ for _, p := range writes {
+ wantRead.Write(p)
+ }
+
+ testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer {
+ b := &dataBuffer{expected: 32 * 1024}
+ for _, p := range writes {
+ if n, err := b.Write(p); n != len(p) || err != nil {
+ t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p))
+ }
+ }
+ want := [][]byte{
+ append(bytes.Repeat([]byte("a"), 1*1024), append(bytes.Repeat([]byte("b"), 14*1024), bytes.Repeat([]byte("c"), 1*1024)...)...),
+ append(bytes.Repeat([]byte("c"), 14*1024), bytes.Repeat([]byte("d"), 2*1024)...),
+ bytes.Repeat([]byte("e"), 1*1024),
+ }
+ if !reflect.DeepEqual(b.chunks, want) {
+ t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want))
+ }
+ return b
+ })
+}
+
+func TestDataBufferWriteAfterPartialRead(t *testing.T) {
+ testDataBuffer(t, []byte("cdxyz"), func(t *testing.T) *dataBuffer {
+ b := &dataBuffer{}
+ if n, err := b.Write([]byte("abcd")); n != 4 || err != nil {
+ t.Fatalf("Write(\"abcd\")=%v,%v want 4,nil", n, err)
+ }
+ p := make([]byte, 2)
+ if n, err := b.Read(p); n != 2 || err != nil || !bytes.Equal(p, []byte("ab")) {
+ t.Fatalf("Read()=%q,%v,%v want \"ab\",2,nil", p, n, err)
+ }
+ if n, err := b.Write([]byte("xyz")); n != 3 || err != nil {
+ t.Fatalf("Write(\"xyz\")=%v,%v want 3,nil", n, err)
+ }
+ return b
+ })
+}
diff --git a/vendor/golang.org/x/net/http2/fixed_buffer.go b/vendor/golang.org/x/net/http2/fixed_buffer.go
deleted file mode 100644
index 47da0f0bf..000000000
--- a/vendor/golang.org/x/net/http2/fixed_buffer.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "errors"
-)
-
-// fixedBuffer is an io.ReadWriter backed by a fixed size buffer.
-// It never allocates, but moves old data as new data is written.
-type fixedBuffer struct {
- buf []byte
- r, w int
-}
-
-var (
- errReadEmpty = errors.New("read from empty fixedBuffer")
- errWriteFull = errors.New("write on full fixedBuffer")
-)
-
-// Read copies bytes from the buffer into p.
-// It is an error to read when no data is available.
-func (b *fixedBuffer) Read(p []byte) (n int, err error) {
- if b.r == b.w {
- return 0, errReadEmpty
- }
- n = copy(p, b.buf[b.r:b.w])
- b.r += n
- if b.r == b.w {
- b.r = 0
- b.w = 0
- }
- return n, nil
-}
-
-// Len returns the number of bytes of the unread portion of the buffer.
-func (b *fixedBuffer) Len() int {
- return b.w - b.r
-}
-
-// Write copies bytes from p into the buffer.
-// It is an error to write more data than the buffer can hold.
-func (b *fixedBuffer) Write(p []byte) (n int, err error) {
- // Slide existing data to beginning.
- if b.r > 0 && len(p) > len(b.buf)-b.w {
- copy(b.buf, b.buf[b.r:b.w])
- b.w -= b.r
- b.r = 0
- }
-
- // Write new data.
- n = copy(b.buf[b.w:], p)
- b.w += n
- if n < len(p) {
- err = errWriteFull
- }
- return n, err
-}
diff --git a/vendor/golang.org/x/net/http2/fixed_buffer_test.go b/vendor/golang.org/x/net/http2/fixed_buffer_test.go
deleted file mode 100644
index f5432f8d8..000000000
--- a/vendor/golang.org/x/net/http2/fixed_buffer_test.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package http2
-
-import (
- "reflect"
- "testing"
-)
-
-var bufferReadTests = []struct {
- buf fixedBuffer
- read, wn int
- werr error
- wp []byte
- wbuf fixedBuffer
-}{
- {
- fixedBuffer{[]byte{'a', 0}, 0, 1},
- 5, 1, nil, []byte{'a'},
- fixedBuffer{[]byte{'a', 0}, 0, 0},
- },
- {
- fixedBuffer{[]byte{0, 'a'}, 1, 2},
- 5, 1, nil, []byte{'a'},
- fixedBuffer{[]byte{0, 'a'}, 0, 0},
- },
- {
- fixedBuffer{[]byte{'a', 'b'}, 0, 2},
- 1, 1, nil, []byte{'a'},
- fixedBuffer{[]byte{'a', 'b'}, 1, 2},
- },
- {
- fixedBuffer{[]byte{}, 0, 0},
- 5, 0, errReadEmpty, []byte{},
- fixedBuffer{[]byte{}, 0, 0},
- },
-}
-
-func TestBufferRead(t *testing.T) {
- for i, tt := range bufferReadTests {
- read := make([]byte, tt.read)
- n, err := tt.buf.Read(read)
- if n != tt.wn {
- t.Errorf("#%d: wn = %d want %d", i, n, tt.wn)
- continue
- }
- if err != tt.werr {
- t.Errorf("#%d: werr = %v want %v", i, err, tt.werr)
- continue
- }
- read = read[:n]
- if !reflect.DeepEqual(read, tt.wp) {
- t.Errorf("#%d: read = %+v want %+v", i, read, tt.wp)
- }
- if !reflect.DeepEqual(tt.buf, tt.wbuf) {
- t.Errorf("#%d: buf = %+v want %+v", i, tt.buf, tt.wbuf)
- }
- }
-}
-
-var bufferWriteTests = []struct {
- buf fixedBuffer
- write, wn int
- werr error
- wbuf fixedBuffer
-}{
- {
- buf: fixedBuffer{
- buf: []byte{},
- },
- wbuf: fixedBuffer{
- buf: []byte{},
- },
- },
- {
- buf: fixedBuffer{
- buf: []byte{1, 'a'},
- },
- write: 1,
- wn: 1,
- wbuf: fixedBuffer{
- buf: []byte{0, 'a'},
- w: 1,
- },
- },
- {
- buf: fixedBuffer{
- buf: []byte{'a', 1},
- r: 1,
- w: 1,
- },
- write: 2,
- wn: 2,
- wbuf: fixedBuffer{
- buf: []byte{0, 0},
- w: 2,
- },
- },
- {
- buf: fixedBuffer{
- buf: []byte{},
- },
- write: 5,
- werr: errWriteFull,
- wbuf: fixedBuffer{
- buf: []byte{},
- },
- },
-}
-
-func TestBufferWrite(t *testing.T) {
- for i, tt := range bufferWriteTests {
- n, err := tt.buf.Write(make([]byte, tt.write))
- if n != tt.wn {
- t.Errorf("#%d: wrote %d bytes; want %d", i, n, tt.wn)
- continue
- }
- if err != tt.werr {
- t.Errorf("#%d: error = %v; want %v", i, err, tt.werr)
- continue
- }
- if !reflect.DeepEqual(tt.buf, tt.wbuf) {
- t.Errorf("#%d: buf = %+v; want %+v", i, tt.buf, tt.wbuf)
- }
- }
-}
diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go
index 358833fed..3b1489072 100644
--- a/vendor/golang.org/x/net/http2/frame.go
+++ b/vendor/golang.org/x/net/http2/frame.go
@@ -122,7 +122,7 @@ var flagName = map[FrameType]map[Flags]string{
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
-type frameParser func(fh FrameHeader, payload []byte) (Frame, error)
+type frameParser func(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error)
var frameParsers = map[FrameType]frameParser{
FrameData: parseDataFrame,
@@ -312,7 +312,7 @@ type Framer struct {
MaxHeaderListSize uint32
// TODO: track which type of frame & with which flags was sent
- // last. Then return an error (unless AllowIllegalWrites) if
+ // last. Then return an error (unless AllowIllegalWrites) if
// we're in the middle of a header block and a
// non-Continuation or Continuation on a different stream is
// attempted to be written.
@@ -323,6 +323,8 @@ type Framer struct {
debugFramerBuf *bytes.Buffer
debugReadLoggerf func(string, ...interface{})
debugWriteLoggerf func(string, ...interface{})
+
+ frameCache *frameCache // nil if frames aren't reused (default)
}
func (fr *Framer) maxHeaderListSize() uint32 {
@@ -398,6 +400,27 @@ const (
maxFrameSize = 1<<24 - 1
)
+// SetReuseFrames allows the Framer to reuse Frames.
+// If called on a Framer, Frames returned by calls to ReadFrame are only
+// valid until the next call to ReadFrame.
+func (fr *Framer) SetReuseFrames() {
+ if fr.frameCache != nil {
+ return
+ }
+ fr.frameCache = &frameCache{}
+}
+
+type frameCache struct {
+ dataFrame DataFrame
+}
+
+func (fc *frameCache) getDataFrame() *DataFrame {
+ if fc == nil {
+ return &DataFrame{}
+ }
+ return &fc.dataFrame
+}
+
// NewFramer returns a Framer that writes frames to w and reads them from r.
func NewFramer(w io.Writer, r io.Reader) *Framer {
fr := &Framer{
@@ -477,7 +500,7 @@ func (fr *Framer) ReadFrame() (Frame, error) {
if _, err := io.ReadFull(fr.r, payload); err != nil {
return nil, err
}
- f, err := typeFrameParser(fh.Type)(fh, payload)
+ f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, payload)
if err != nil {
if ce, ok := err.(connError); ok {
return nil, fr.connError(ce.Code, ce.Reason)
@@ -565,7 +588,7 @@ func (f *DataFrame) Data() []byte {
return f.data
}
-func parseDataFrame(fh FrameHeader, payload []byte) (Frame, error) {
+func parseDataFrame(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
if fh.StreamID == 0 {
// DATA frames MUST be associated with a stream. If a
// DATA frame is received whose stream identifier
@@ -574,9 +597,9 @@ func parseDataFrame(fh FrameHeader, payload []byte) (Frame, error) {
// PROTOCOL_ERROR.
return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"}
}
- f := &DataFrame{
- FrameHeader: fh,
- }
+ f := fc.getDataFrame()
+ f.FrameHeader = fh
+
var padSize byte
if fh.Flags.Has(FlagDataPadded) {
var err error
@@ -600,6 +623,7 @@ var (
errStreamID = errors.New("invalid stream ID")
errDepStreamID = errors.New("invalid dependent stream ID")
errPadLength = errors.New("pad length too large")
+ errPadBytes = errors.New("padding bytes must all be zeros unless AllowIllegalWrites is enabled")
)
func validStreamIDOrZero(streamID uint32) bool {
@@ -623,6 +647,7 @@ func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error {
//
// If pad is nil, the padding bit is not sent.
// The length of pad must not exceed 255 bytes.
+// The bytes of pad must all be zero, unless f.AllowIllegalWrites is set.
//
// It will perform exactly one Write to the underlying Writer.
// It is the caller's responsibility not to violate the maximum frame size
@@ -631,8 +656,18 @@ func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []by
if !validStreamID(streamID) && !f.AllowIllegalWrites {
return errStreamID
}
- if len(pad) > 255 {
- return errPadLength
+ if len(pad) > 0 {
+ if len(pad) > 255 {
+ return errPadLength
+ }
+ if !f.AllowIllegalWrites {
+ for _, b := range pad {
+ if b != 0 {
+ // "Padding octets MUST be set to zero when sending."
+ return errPadBytes
+ }
+ }
+ }
}
var flags Flags
if endStream {
@@ -660,10 +695,10 @@ type SettingsFrame struct {
p []byte
}
-func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseSettingsFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 {
// When this (ACK 0x1) bit is set, the payload of the
- // SETTINGS frame MUST be empty. Receipt of a
+ // SETTINGS frame MUST be empty. Receipt of a
// SETTINGS frame with the ACK flag set and a length
// field value other than 0 MUST be treated as a
// connection error (Section 5.4.1) of type
@@ -672,7 +707,7 @@ func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) {
}
if fh.StreamID != 0 {
// SETTINGS frames always apply to a connection,
- // never a single stream. The stream identifier for a
+ // never a single stream. The stream identifier for a
// SETTINGS frame MUST be zero (0x0). If an endpoint
// receives a SETTINGS frame whose stream identifier
// field is anything other than 0x0, the endpoint MUST
@@ -762,7 +797,7 @@ type PingFrame struct {
func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) }
-func parsePingFrame(fh FrameHeader, payload []byte) (Frame, error) {
+func parsePingFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
if len(payload) != 8 {
return nil, ConnectionError(ErrCodeFrameSize)
}
@@ -802,7 +837,7 @@ func (f *GoAwayFrame) DebugData() []byte {
return f.debugData
}
-func parseGoAwayFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseGoAwayFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
if fh.StreamID != 0 {
return nil, ConnectionError(ErrCodeProtocol)
}
@@ -842,7 +877,7 @@ func (f *UnknownFrame) Payload() []byte {
return f.p
}
-func parseUnknownFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseUnknownFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
return &UnknownFrame{fh, p}, nil
}
@@ -853,7 +888,7 @@ type WindowUpdateFrame struct {
Increment uint32 // never read with high bit set
}
-func parseWindowUpdateFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseWindowUpdateFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
if len(p) != 4 {
return nil, ConnectionError(ErrCodeFrameSize)
}
@@ -918,12 +953,12 @@ func (f *HeadersFrame) HasPriority() bool {
return f.FrameHeader.Flags.Has(FlagHeadersPriority)
}
-func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) {
+func parseHeadersFrame(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) {
hf := &HeadersFrame{
FrameHeader: fh,
}
if fh.StreamID == 0 {
- // HEADERS frames MUST be associated with a stream. If a HEADERS frame
+ // HEADERS frames MUST be associated with a stream. If a HEADERS frame
// is received whose stream identifier field is 0x0, the recipient MUST
// respond with a connection error (Section 5.4.1) of type
// PROTOCOL_ERROR.
@@ -1045,7 +1080,7 @@ type PriorityParam struct {
Exclusive bool
// Weight is the stream's zero-indexed weight. It should be
- // set together with StreamDep, or neither should be set. Per
+ // set together with StreamDep, or neither should be set. Per
// the spec, "Add one to the value to obtain a weight between
// 1 and 256."
Weight uint8
@@ -1055,7 +1090,7 @@ func (p PriorityParam) IsZero() bool {
return p == PriorityParam{}
}
-func parsePriorityFrame(fh FrameHeader, payload []byte) (Frame, error) {
+func parsePriorityFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
if fh.StreamID == 0 {
return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"}
}
@@ -1102,7 +1137,7 @@ type RSTStreamFrame struct {
ErrCode ErrCode
}
-func parseRSTStreamFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseRSTStreamFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
if len(p) != 4 {
return nil, ConnectionError(ErrCodeFrameSize)
}
@@ -1132,7 +1167,7 @@ type ContinuationFrame struct {
headerFragBuf []byte
}
-func parseContinuationFrame(fh FrameHeader, p []byte) (Frame, error) {
+func parseContinuationFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
if fh.StreamID == 0 {
return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"}
}
@@ -1182,7 +1217,7 @@ func (f *PushPromiseFrame) HeadersEnded() bool {
return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders)
}
-func parsePushPromise(fh FrameHeader, p []byte) (_ Frame, err error) {
+func parsePushPromise(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) {
pp := &PushPromiseFrame{
FrameHeader: fh,
}
diff --git a/vendor/golang.org/x/net/http2/frame_test.go b/vendor/golang.org/x/net/http2/frame_test.go
index 7b1933d96..37266bc58 100644
--- a/vendor/golang.org/x/net/http2/frame_test.go
+++ b/vendor/golang.org/x/net/http2/frame_test.go
@@ -141,7 +141,7 @@ func TestWriteDataPadded(t *testing.T) {
streamID: 1,
endStream: false,
data: []byte("foo"),
- pad: []byte("bar"),
+ pad: []byte{0, 0, 0},
wantHeader: FrameHeader{
Type: FrameData,
Flags: FlagDataPadded,
@@ -1096,6 +1096,95 @@ func TestMetaFrameHeader(t *testing.T) {
}
}
+func TestSetReuseFrames(t *testing.T) {
+ fr, buf := testFramer()
+ fr.SetReuseFrames()
+
+ // Check that DataFrames are reused. Note that
+ // SetReuseFrames only currently implements reuse of DataFrames.
+ firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t)
+
+ for i := 0; i < 10; i++ {
+ df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
+ if df != firstDf {
+ t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
+ }
+ }
+
+ for i := 0; i < 10; i++ {
+ df := readAndVerifyDataFrame("", 0, fr, buf, t)
+ if df != firstDf {
+ t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
+ }
+ }
+
+ for i := 0; i < 10; i++ {
+ df := readAndVerifyDataFrame("HHH", 3, fr, buf, t)
+ if df != firstDf {
+ t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
+ }
+ }
+}
+
+func TestSetReuseFramesMoreThanOnce(t *testing.T) {
+ fr, buf := testFramer()
+ fr.SetReuseFrames()
+
+ firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t)
+ fr.SetReuseFrames()
+
+ for i := 0; i < 10; i++ {
+ df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
+ // SetReuseFrames should be idempotent
+ fr.SetReuseFrames()
+ if df != firstDf {
+ t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf)
+ }
+ }
+}
+
+func TestNoSetReuseFrames(t *testing.T) {
+ fr, buf := testFramer()
+ const numNewDataFrames = 10
+ dfSoFar := make([]interface{}, numNewDataFrames)
+
+ // Check that DataFrames are not reused if SetReuseFrames wasn't called.
+ // SetReuseFrames only currently implements reuse of DataFrames.
+ for i := 0; i < numNewDataFrames; i++ {
+ df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t)
+ for _, item := range dfSoFar {
+ if df == item {
+ t.Errorf("Expected Framer to return new DataFrames since SetNoReuseFrames not set.")
+ }
+ }
+ dfSoFar[i] = df
+ }
+}
+
+func readAndVerifyDataFrame(data string, length byte, fr *Framer, buf *bytes.Buffer, t *testing.T) *DataFrame {
+ var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
+ fr.WriteData(streamID, true, []byte(data))
+ wantEnc := "\x00\x00" + string(length) + "\x00\x01\x01\x02\x03\x04" + data
+ if buf.String() != wantEnc {
+ t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc)
+ }
+ f, err := fr.ReadFrame()
+ if err != nil {
+ t.Fatal(err)
+ }
+ df, ok := f.(*DataFrame)
+ if !ok {
+ t.Fatalf("got %T; want *DataFrame", f)
+ }
+ if !bytes.Equal(df.Data(), []byte(data)) {
+ t.Errorf("got %q; want %q", df.Data(), []byte(data))
+ }
+ if f.Header().Flags&1 == 0 {
+ t.Errorf("didn't see END_STREAM flag")
+ }
+ return df
+}
+
func encodeHeaderRaw(t *testing.T, pairs ...string) []byte {
var he hpackEncoder
return he.encodeHeaderRaw(t, pairs...)
diff --git a/vendor/golang.org/x/net/http2/go18.go b/vendor/golang.org/x/net/http2/go18.go
index 633202c39..73cc2381f 100644
--- a/vendor/golang.org/x/net/http2/go18.go
+++ b/vendor/golang.org/x/net/http2/go18.go
@@ -12,7 +12,11 @@ import (
"net/http"
)
-func cloneTLSConfig(c *tls.Config) *tls.Config { return c.Clone() }
+func cloneTLSConfig(c *tls.Config) *tls.Config {
+ c2 := c.Clone()
+ c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264
+ return c2
+}
var _ http.Pusher = (*responseWriter)(nil)
diff --git a/vendor/golang.org/x/net/http2/go18_test.go b/vendor/golang.org/x/net/http2/go18_test.go
index 836550597..30e3b038b 100644
--- a/vendor/golang.org/x/net/http2/go18_test.go
+++ b/vendor/golang.org/x/net/http2/go18_test.go
@@ -7,6 +7,7 @@
package http2
import (
+ "crypto/tls"
"net/http"
"testing"
"time"
@@ -64,3 +65,15 @@ func TestConfigureServerIdleTimeout_Go18(t *testing.T) {
}
}
}
+
+func TestCertClone(t *testing.T) {
+ c := &tls.Config{
+ GetClientCertificate: func(*tls.CertificateRequestInfo) (*tls.Certificate, error) {
+ panic("shouldn't be called")
+ },
+ }
+ c2 := cloneTLSConfig(c)
+ if c2.GetClientCertificate == nil {
+ t.Error("GetClientCertificate is nil")
+ }
+}
diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go
index f9bb03398..54726c2a3 100644
--- a/vendor/golang.org/x/net/http2/hpack/encode.go
+++ b/vendor/golang.org/x/net/http2/hpack/encode.go
@@ -39,13 +39,14 @@ func NewEncoder(w io.Writer) *Encoder {
tableSizeUpdate: false,
w: w,
}
+ e.dynTab.table.init()
e.dynTab.setMaxSize(initialHeaderTableSize)
return e
}
// WriteField encodes f into a single Write to e's underlying Writer.
// This function may also produce bytes for "Header Table Size Update"
-// if necessary. If produced, it is done before encoding f.
+// if necessary. If produced, it is done before encoding f.
func (e *Encoder) WriteField(f HeaderField) error {
e.buf = e.buf[:0]
@@ -88,29 +89,17 @@ func (e *Encoder) WriteField(f HeaderField) error {
// only name matches, i points to that index and nameValueMatch
// becomes false.
func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) {
- for idx, hf := range staticTable {
- if !constantTimeStringCompare(hf.Name, f.Name) {
- continue
- }
- if i == 0 {
- i = uint64(idx + 1)
- }
- if f.Sensitive {
- continue
- }
- if !constantTimeStringCompare(hf.Value, f.Value) {
- continue
- }
- i = uint64(idx + 1)
- nameValueMatch = true
- return
+ i, nameValueMatch = staticTable.search(f)
+ if nameValueMatch {
+ return i, true
}
- j, nameValueMatch := e.dynTab.search(f)
+ j, nameValueMatch := e.dynTab.table.search(f)
if nameValueMatch || (i == 0 && j != 0) {
- i = j + uint64(len(staticTable))
+ return j + uint64(staticTable.len()), nameValueMatch
}
- return
+
+ return i, false
}
// SetMaxDynamicTableSize changes the dynamic header table size to v.
diff --git a/vendor/golang.org/x/net/http2/hpack/encode_test.go b/vendor/golang.org/x/net/http2/hpack/encode_test.go
index 92286f3ba..05f12db9c 100644
--- a/vendor/golang.org/x/net/http2/hpack/encode_test.go
+++ b/vendor/golang.org/x/net/http2/hpack/encode_test.go
@@ -7,6 +7,8 @@ package hpack
import (
"bytes"
"encoding/hex"
+ "fmt"
+ "math/rand"
"reflect"
"strings"
"testing"
@@ -101,17 +103,20 @@ func TestEncoderSearchTable(t *testing.T) {
wantMatch bool
}{
// Name and Value match
- {pair("foo", "bar"), uint64(len(staticTable) + 3), true},
- {pair("blake", "miz"), uint64(len(staticTable) + 2), true},
+ {pair("foo", "bar"), uint64(staticTable.len()) + 3, true},
+ {pair("blake", "miz"), uint64(staticTable.len()) + 2, true},
{pair(":method", "GET"), 2, true},
- // Only name match because Sensitive == true
- {HeaderField{":method", "GET", true}, 2, false},
+ // Only name match because Sensitive == true. This is allowed to match
+ // any ":method" entry. The current implementation uses the last entry
+ // added in newStaticTable.
+ {HeaderField{":method", "GET", true}, 3, false},
// Only Name matches
- {pair("foo", "..."), uint64(len(staticTable) + 3), false},
- {pair("blake", "..."), uint64(len(staticTable) + 2), false},
- {pair(":method", "..."), 2, false},
+ {pair("foo", "..."), uint64(staticTable.len()) + 3, false},
+ {pair("blake", "..."), uint64(staticTable.len()) + 2, false},
+ // As before, this is allowed to match any ":method" entry.
+ {pair(":method", "..."), 3, false},
// None match
{pair("foo-", "bar"), 0, false},
@@ -328,3 +333,54 @@ func TestEncoderSetMaxDynamicTableSizeLimit(t *testing.T) {
func removeSpace(s string) string {
return strings.Replace(s, " ", "", -1)
}
+
+func BenchmarkEncoderSearchTable(b *testing.B) {
+ e := NewEncoder(nil)
+
+ // A sample of possible header fields.
+ // This is not based on any actual data from HTTP/2 traces.
+ var possible []HeaderField
+ for _, f := range staticTable.ents {
+ if f.Value == "" {
+ possible = append(possible, f)
+ continue
+ }
+ // Generate 5 random values, except for cookie and set-cookie,
+ // which we know can have many values in practice.
+ num := 5
+ if f.Name == "cookie" || f.Name == "set-cookie" {
+ num = 25
+ }
+ for i := 0; i < num; i++ {
+ f.Value = fmt.Sprintf("%s-%d", f.Name, i)
+ possible = append(possible, f)
+ }
+ }
+ for k := 0; k < 10; k++ {
+ f := HeaderField{
+ Name: fmt.Sprintf("x-header-%d", k),
+ Sensitive: rand.Int()%2 == 0,
+ }
+ for i := 0; i < 5; i++ {
+ f.Value = fmt.Sprintf("%s-%d", f.Name, i)
+ possible = append(possible, f)
+ }
+ }
+
+ // Add a random sample to the dynamic table. This very loosely simulates
+ // a history of 100 requests with 20 header fields per request.
+ for r := 0; r < 100*20; r++ {
+ f := possible[rand.Int31n(int32(len(possible)))]
+ // Skip if this is in the staticTable verbatim.
+ if _, has := staticTable.search(f); !has {
+ e.dynTab.add(f)
+ }
+ }
+
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ for _, f := range possible {
+ e.searchTable(f)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go
index 135b9f62c..176644acd 100644
--- a/vendor/golang.org/x/net/http2/hpack/hpack.go
+++ b/vendor/golang.org/x/net/http2/hpack/hpack.go
@@ -61,7 +61,7 @@ func (hf HeaderField) String() string {
func (hf HeaderField) Size() uint32 {
// http://http2.github.io/http2-spec/compression.html#rfc.section.4.1
// "The size of the dynamic table is the sum of the size of
- // its entries. The size of an entry is the sum of its name's
+ // its entries. The size of an entry is the sum of its name's
// length in octets (as defined in Section 5.2), its value's
// length in octets (see Section 5.2), plus 32. The size of
// an entry is calculated using the length of the name and
@@ -102,6 +102,7 @@ func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decod
emit: emitFunc,
emitEnabled: true,
}
+ d.dynTab.table.init()
d.dynTab.allowedMaxSize = maxDynamicTableSize
d.dynTab.setMaxSize(maxDynamicTableSize)
return d
@@ -154,12 +155,9 @@ func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) {
}
type dynamicTable struct {
- // ents is the FIFO described at
// http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2
- // The newest (low index) is append at the end, and items are
- // evicted from the front.
- ents []HeaderField
- size uint32
+ table headerFieldTable
+ size uint32 // in bytes
maxSize uint32 // current maxSize
allowedMaxSize uint32 // maxSize may go up to this, inclusive
}
@@ -169,95 +167,45 @@ func (dt *dynamicTable) setMaxSize(v uint32) {
dt.evict()
}
-// TODO: change dynamicTable to be a struct with a slice and a size int field,
-// per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1:
-//
-//
-// Then make add increment the size. maybe the max size should move from Decoder to
-// dynamicTable and add should return an ok bool if there was enough space.
-//
-// Later we'll need a remove operation on dynamicTable.
-
func (dt *dynamicTable) add(f HeaderField) {
- dt.ents = append(dt.ents, f)
+ dt.table.addEntry(f)
dt.size += f.Size()
dt.evict()
}
-// If we're too big, evict old stuff (front of the slice)
+// If we're too big, evict old stuff.
func (dt *dynamicTable) evict() {
- base := dt.ents // keep base pointer of slice
- for dt.size > dt.maxSize {
- dt.size -= dt.ents[0].Size()
- dt.ents = dt.ents[1:]
- }
-
- // Shift slice contents down if we evicted things.
- if len(dt.ents) != len(base) {
- copy(base, dt.ents)
- dt.ents = base[:len(dt.ents)]
+ var n int
+ for dt.size > dt.maxSize && n < dt.table.len() {
+ dt.size -= dt.table.ents[n].Size()
+ n++
}
-}
-
-// constantTimeStringCompare compares string a and b in a constant
-// time manner.
-func constantTimeStringCompare(a, b string) bool {
- if len(a) != len(b) {
- return false
- }
-
- c := byte(0)
-
- for i := 0; i < len(a); i++ {
- c |= a[i] ^ b[i]
- }
-
- return c == 0
-}
-
-// Search searches f in the table. The return value i is 0 if there is
-// no name match. If there is name match or name/value match, i is the
-// index of that entry (1-based). If both name and value match,
-// nameValueMatch becomes true.
-func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) {
- l := len(dt.ents)
- for j := l - 1; j >= 0; j-- {
- ent := dt.ents[j]
- if !constantTimeStringCompare(ent.Name, f.Name) {
- continue
- }
- if i == 0 {
- i = uint64(l - j)
- }
- if f.Sensitive {
- continue
- }
- if !constantTimeStringCompare(ent.Value, f.Value) {
- continue
- }
- i = uint64(l - j)
- nameValueMatch = true
- return
- }
- return
+ dt.table.evictOldest(n)
}
func (d *Decoder) maxTableIndex() int {
- return len(d.dynTab.ents) + len(staticTable)
+ // This should never overflow. RFC 7540 Section 6.5.2 limits the size of
+ // the dynamic table to 2^32 bytes, where each entry will occupy more than
+ // one byte. Further, the staticTable has a fixed, small length.
+ return d.dynTab.table.len() + staticTable.len()
}
func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) {
- if i < 1 {
+ // See Section 2.3.3.
+ if i == 0 {
return
}
+ if i <= uint64(staticTable.len()) {
+ return staticTable.ents[i-1], true
+ }
if i > uint64(d.maxTableIndex()) {
return
}
- if i <= uint64(len(staticTable)) {
- return staticTable[i-1], true
- }
- dents := d.dynTab.ents
- return dents[len(dents)-(int(i)-len(staticTable))], true
+ // In the dynamic table, newer entries have lower indices.
+ // However, dt.ents[0] is the oldest entry. Hence, dt.ents is
+ // the reversed dynamic table.
+ dt := d.dynTab.table
+ return dt.ents[dt.len()-(int(i)-staticTable.len())], true
}
// Decode decodes an entire block.
@@ -307,7 +255,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) {
err = d.parseHeaderFieldRepr()
if err == errNeedMore {
// Extra paranoia, making sure saveBuf won't
- // get too large. All the varint and string
+ // get too large. All the varint and string
// reading code earlier should already catch
// overlong things and return ErrStringLength,
// but keep this as a last resort.
diff --git a/vendor/golang.org/x/net/http2/hpack/hpack_test.go b/vendor/golang.org/x/net/http2/hpack/hpack_test.go
index 4c7b17bfb..c2f8fd102 100644
--- a/vendor/golang.org/x/net/http2/hpack/hpack_test.go
+++ b/vendor/golang.org/x/net/http2/hpack/hpack_test.go
@@ -5,117 +5,16 @@
package hpack
import (
- "bufio"
"bytes"
"encoding/hex"
"fmt"
"math/rand"
"reflect"
- "regexp"
- "strconv"
"strings"
"testing"
"time"
)
-func TestStaticTable(t *testing.T) {
- fromSpec := `
- +-------+-----------------------------+---------------+
- | 1 | :authority | |
- | 2 | :method | GET |
- | 3 | :method | POST |
- | 4 | :path | / |
- | 5 | :path | /index.html |
- | 6 | :scheme | http |
- | 7 | :scheme | https |
- | 8 | :status | 200 |
- | 9 | :status | 204 |
- | 10 | :status | 206 |
- | 11 | :status | 304 |
- | 12 | :status | 400 |
- | 13 | :status | 404 |
- | 14 | :status | 500 |
- | 15 | accept-charset | |
- | 16 | accept-encoding | gzip, deflate |
- | 17 | accept-language | |
- | 18 | accept-ranges | |
- | 19 | accept | |
- | 20 | access-control-allow-origin | |
- | 21 | age | |
- | 22 | allow | |
- | 23 | authorization | |
- | 24 | cache-control | |
- | 25 | content-disposition | |
- | 26 | content-encoding | |
- | 27 | content-language | |
- | 28 | content-length | |
- | 29 | content-location | |
- | 30 | content-range | |
- | 31 | content-type | |
- | 32 | cookie | |
- | 33 | date | |
- | 34 | etag | |
- | 35 | expect | |
- | 36 | expires | |
- | 37 | from | |
- | 38 | host | |
- | 39 | if-match | |
- | 40 | if-modified-since | |
- | 41 | if-none-match | |
- | 42 | if-range | |
- | 43 | if-unmodified-since | |
- | 44 | last-modified | |
- | 45 | link | |
- | 46 | location | |
- | 47 | max-forwards | |
- | 48 | proxy-authenticate | |
- | 49 | proxy-authorization | |
- | 50 | range | |
- | 51 | referer | |
- | 52 | refresh | |
- | 53 | retry-after | |
- | 54 | server | |
- | 55 | set-cookie | |
- | 56 | strict-transport-security | |
- | 57 | transfer-encoding | |
- | 58 | user-agent | |
- | 59 | vary | |
- | 60 | via | |
- | 61 | www-authenticate | |
- +-------+-----------------------------+---------------+
-`
- bs := bufio.NewScanner(strings.NewReader(fromSpec))
- re := regexp.MustCompile(`\| (\d+)\s+\| (\S+)\s*\| (\S(.*\S)?)?\s+\|`)
- for bs.Scan() {
- l := bs.Text()
- if !strings.Contains(l, "|") {
- continue
- }
- m := re.FindStringSubmatch(l)
- if m == nil {
- continue
- }
- i, err := strconv.Atoi(m[1])
- if err != nil {
- t.Errorf("Bogus integer on line %q", l)
- continue
- }
- if i < 1 || i > len(staticTable) {
- t.Errorf("Bogus index %d on line %q", i, l)
- continue
- }
- if got, want := staticTable[i-1].Name, m[2]; got != want {
- t.Errorf("header index %d name = %q; want %q", i, got, want)
- }
- if got, want := staticTable[i-1].Value, m[3]; got != want {
- t.Errorf("header index %d value = %q; want %q", i, got, want)
- }
- }
- if err := bs.Err(); err != nil {
- t.Error(err)
- }
-}
-
func (d *Decoder) mustAt(idx int) HeaderField {
if hf, ok := d.at(uint64(idx)); !ok {
panic(fmt.Sprintf("bogus index %d", idx))
@@ -132,10 +31,10 @@ func TestDynamicTableAt(t *testing.T) {
}
d.dynTab.add(pair("foo", "bar"))
d.dynTab.add(pair("blake", "miz"))
- if got, want := at(len(staticTable)+1), (pair("blake", "miz")); got != want {
+ if got, want := at(staticTable.len()+1), (pair("blake", "miz")); got != want {
t.Errorf("at(dyn 1) = %v; want %v", got, want)
}
- if got, want := at(len(staticTable)+2), (pair("foo", "bar")); got != want {
+ if got, want := at(staticTable.len()+2), (pair("foo", "bar")); got != want {
t.Errorf("at(dyn 2) = %v; want %v", got, want)
}
if got, want := at(3), (pair(":method", "POST")); got != want {
@@ -143,41 +42,6 @@ func TestDynamicTableAt(t *testing.T) {
}
}
-func TestDynamicTableSearch(t *testing.T) {
- dt := dynamicTable{}
- dt.setMaxSize(4096)
-
- dt.add(pair("foo", "bar"))
- dt.add(pair("blake", "miz"))
- dt.add(pair(":method", "GET"))
-
- tests := []struct {
- hf HeaderField
- wantI uint64
- wantMatch bool
- }{
- // Name and Value match
- {pair("foo", "bar"), 3, true},
- {pair(":method", "GET"), 1, true},
-
- // Only name match because of Sensitive == true
- {HeaderField{"blake", "miz", true}, 2, false},
-
- // Only Name matches
- {pair("foo", "..."), 3, false},
- {pair("blake", "..."), 2, false},
- {pair(":method", "..."), 1, false},
-
- // None match
- {pair("foo-", "bar"), 0, false},
- }
- for _, tt := range tests {
- if gotI, gotMatch := dt.search(tt.hf); gotI != tt.wantI || gotMatch != tt.wantMatch {
- t.Errorf("d.search(%+v) = %v, %v; want %v, %v", tt.hf, gotI, gotMatch, tt.wantI, tt.wantMatch)
- }
- }
-}
-
func TestDynamicTableSizeEvict(t *testing.T) {
d := NewDecoder(4096, nil)
if want := uint32(0); d.dynTab.size != want {
@@ -196,7 +60,7 @@ func TestDynamicTableSizeEvict(t *testing.T) {
if want := uint32(6 + 32); d.dynTab.size != want {
t.Fatalf("after setMaxSize, size = %d; want %d", d.dynTab.size, want)
}
- if got, want := d.mustAt(len(staticTable)+1), (pair("foo", "bar")); got != want {
+ if got, want := d.mustAt(staticTable.len()+1), (pair("foo", "bar")); got != want {
t.Errorf("at(dyn 1) = %v; want %v", got, want)
}
add(pair("long", strings.Repeat("x", 500)))
@@ -255,9 +119,9 @@ func TestDecoderDecode(t *testing.T) {
}
func (dt *dynamicTable) reverseCopy() (hf []HeaderField) {
- hf = make([]HeaderField, len(dt.ents))
+ hf = make([]HeaderField, len(dt.table.ents))
for i := range hf {
- hf[i] = dt.ents[len(dt.ents)-1-i]
+ hf[i] = dt.table.ents[len(dt.table.ents)-1-i]
}
return
}
diff --git a/vendor/golang.org/x/net/http2/hpack/tables.go b/vendor/golang.org/x/net/http2/hpack/tables.go
index b9283a023..870159244 100644
--- a/vendor/golang.org/x/net/http2/hpack/tables.go
+++ b/vendor/golang.org/x/net/http2/hpack/tables.go
@@ -4,73 +4,199 @@
package hpack
+import (
+ "fmt"
+)
+
+// headerFieldTable implements a list of HeaderFields.
+// This is used to implement the static and dynamic tables.
+type headerFieldTable struct {
+ // For static tables, entries are never evicted.
+ //
+ // For dynamic tables, entries are evicted from ents[0] and added to the end.
+ // Each entry has a unique id that starts at one and increments for each
+ // entry that is added. This unique id is stable across evictions, meaning
+ // it can be used as a pointer to a specific entry. As in hpack, unique ids
+ // are 1-based. The unique id for ents[k] is k + evictCount + 1.
+ //
+ // Zero is not a valid unique id.
+ //
+ // evictCount should not overflow in any remotely practical situation. In
+ // practice, we will have one dynamic table per HTTP/2 connection. If we
+ // assume a very powerful server that handles 1M QPS per connection and each
+ // request adds (then evicts) 100 entries from the table, it would still take
+ // 2M years for evictCount to overflow.
+ ents []HeaderField
+ evictCount uint64
+
+ // byName maps a HeaderField name to the unique id of the newest entry with
+ // the same name. See above for a definition of "unique id".
+ byName map[string]uint64
+
+ // byNameValue maps a HeaderField name/value pair to the unique id of the newest
+ // entry with the same name and value. See above for a definition of "unique id".
+ byNameValue map[pairNameValue]uint64
+}
+
+type pairNameValue struct {
+ name, value string
+}
+
+func (t *headerFieldTable) init() {
+ t.byName = make(map[string]uint64)
+ t.byNameValue = make(map[pairNameValue]uint64)
+}
+
+// len reports the number of entries in the table.
+func (t *headerFieldTable) len() int {
+ return len(t.ents)
+}
+
+// addEntry adds a new entry.
+func (t *headerFieldTable) addEntry(f HeaderField) {
+ id := uint64(t.len()) + t.evictCount + 1
+ t.byName[f.Name] = id
+ t.byNameValue[pairNameValue{f.Name, f.Value}] = id
+ t.ents = append(t.ents, f)
+}
+
+// evictOldest evicts the n oldest entries in the table.
+func (t *headerFieldTable) evictOldest(n int) {
+ if n > t.len() {
+ panic(fmt.Sprintf("evictOldest(%v) on table with %v entries", n, t.len()))
+ }
+ for k := 0; k < n; k++ {
+ f := t.ents[k]
+ id := t.evictCount + uint64(k) + 1
+ if t.byName[f.Name] == id {
+ t.byName[f.Name] = 0
+ }
+ if p := (pairNameValue{f.Name, f.Value}); t.byNameValue[p] == id {
+ t.byNameValue[p] = 0
+ }
+ }
+ copy(t.ents, t.ents[n:])
+ for k := t.len() - n; k < t.len(); k++ {
+ t.ents[k] = HeaderField{} // so strings can be garbage collected
+ }
+ t.ents = t.ents[:t.len()-n]
+ if t.evictCount+uint64(n) < t.evictCount {
+ panic("evictCount overflow")
+ }
+ t.evictCount += uint64(n)
+}
+
+// search finds f in the table. If there is no match, i is 0.
+// If both name and value match, i is the matched index and nameValueMatch
+// becomes true. If only name matches, i points to that index and
+// nameValueMatch becomes false.
+//
+// The returned index is a 1-based HPACK index. For dynamic tables, HPACK says
+// that index 1 should be the newest entry, but t.ents[0] is the oldest entry,
+// meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic
+// table, the return value i actually refers to the entry t.ents[t.len()-i].
+//
+// All tables are assumed to be a dynamic tables except for the global
+// staticTable pointer.
+//
+// See Section 2.3.3.
+func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) {
+ if !f.Sensitive {
+ if id := t.byNameValue[pairNameValue{f.Name, f.Value}]; id != 0 {
+ return t.idToIndex(id), true
+ }
+ }
+ if id := t.byName[f.Name]; id != 0 {
+ return t.idToIndex(id), false
+ }
+ return 0, false
+}
+
+// idToIndex converts a unique id to an HPACK index.
+// See Section 2.3.3.
+func (t *headerFieldTable) idToIndex(id uint64) uint64 {
+ if id <= t.evictCount {
+ panic(fmt.Sprintf("id (%v) <= evictCount (%v)", id, t.evictCount))
+ }
+ k := id - t.evictCount - 1 // convert id to an index t.ents[k]
+ if t != staticTable {
+ return uint64(t.len()) - k // dynamic table
+ }
+ return k + 1
+}
+
func pair(name, value string) HeaderField {
return HeaderField{Name: name, Value: value}
}
// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B
-var staticTable = [...]HeaderField{
- pair(":authority", ""), // index 1 (1-based)
- pair(":method", "GET"),
- pair(":method", "POST"),
- pair(":path", "/"),
- pair(":path", "/index.html"),
- pair(":scheme", "http"),
- pair(":scheme", "https"),
- pair(":status", "200"),
- pair(":status", "204"),
- pair(":status", "206"),
- pair(":status", "304"),
- pair(":status", "400"),
- pair(":status", "404"),
- pair(":status", "500"),
- pair("accept-charset", ""),
- pair("accept-encoding", "gzip, deflate"),
- pair("accept-language", ""),
- pair("accept-ranges", ""),
- pair("accept", ""),
- pair("access-control-allow-origin", ""),
- pair("age", ""),
- pair("allow", ""),
- pair("authorization", ""),
- pair("cache-control", ""),
- pair("content-disposition", ""),
- pair("content-encoding", ""),
- pair("content-language", ""),
- pair("content-length", ""),
- pair("content-location", ""),
- pair("content-range", ""),
- pair("content-type", ""),
- pair("cookie", ""),
- pair("date", ""),
- pair("etag", ""),
- pair("expect", ""),
- pair("expires", ""),
- pair("from", ""),
- pair("host", ""),
- pair("if-match", ""),
- pair("if-modified-since", ""),
- pair("if-none-match", ""),
- pair("if-range", ""),
- pair("if-unmodified-since", ""),
- pair("last-modified", ""),
- pair("link", ""),
- pair("location", ""),
- pair("max-forwards", ""),
- pair("proxy-authenticate", ""),
- pair("proxy-authorization", ""),
- pair("range", ""),
- pair("referer", ""),
- pair("refresh", ""),
- pair("retry-after", ""),
- pair("server", ""),
- pair("set-cookie", ""),
- pair("strict-transport-security", ""),
- pair("transfer-encoding", ""),
- pair("user-agent", ""),
- pair("vary", ""),
- pair("via", ""),
- pair("www-authenticate", ""),
+var staticTable = newStaticTable()
+
+func newStaticTable() *headerFieldTable {
+ t := &headerFieldTable{}
+ t.init()
+ t.addEntry(pair(":authority", ""))
+ t.addEntry(pair(":method", "GET"))
+ t.addEntry(pair(":method", "POST"))
+ t.addEntry(pair(":path", "/"))
+ t.addEntry(pair(":path", "/index.html"))
+ t.addEntry(pair(":scheme", "http"))
+ t.addEntry(pair(":scheme", "https"))
+ t.addEntry(pair(":status", "200"))
+ t.addEntry(pair(":status", "204"))
+ t.addEntry(pair(":status", "206"))
+ t.addEntry(pair(":status", "304"))
+ t.addEntry(pair(":status", "400"))
+ t.addEntry(pair(":status", "404"))
+ t.addEntry(pair(":status", "500"))
+ t.addEntry(pair("accept-charset", ""))
+ t.addEntry(pair("accept-encoding", "gzip, deflate"))
+ t.addEntry(pair("accept-language", ""))
+ t.addEntry(pair("accept-ranges", ""))
+ t.addEntry(pair("accept", ""))
+ t.addEntry(pair("access-control-allow-origin", ""))
+ t.addEntry(pair("age", ""))
+ t.addEntry(pair("allow", ""))
+ t.addEntry(pair("authorization", ""))
+ t.addEntry(pair("cache-control", ""))
+ t.addEntry(pair("content-disposition", ""))
+ t.addEntry(pair("content-encoding", ""))
+ t.addEntry(pair("content-language", ""))
+ t.addEntry(pair("content-length", ""))
+ t.addEntry(pair("content-location", ""))
+ t.addEntry(pair("content-range", ""))
+ t.addEntry(pair("content-type", ""))
+ t.addEntry(pair("cookie", ""))
+ t.addEntry(pair("date", ""))
+ t.addEntry(pair("etag", ""))
+ t.addEntry(pair("expect", ""))
+ t.addEntry(pair("expires", ""))
+ t.addEntry(pair("from", ""))
+ t.addEntry(pair("host", ""))
+ t.addEntry(pair("if-match", ""))
+ t.addEntry(pair("if-modified-since", ""))
+ t.addEntry(pair("if-none-match", ""))
+ t.addEntry(pair("if-range", ""))
+ t.addEntry(pair("if-unmodified-since", ""))
+ t.addEntry(pair("last-modified", ""))
+ t.addEntry(pair("link", ""))
+ t.addEntry(pair("location", ""))
+ t.addEntry(pair("max-forwards", ""))
+ t.addEntry(pair("proxy-authenticate", ""))
+ t.addEntry(pair("proxy-authorization", ""))
+ t.addEntry(pair("range", ""))
+ t.addEntry(pair("referer", ""))
+ t.addEntry(pair("refresh", ""))
+ t.addEntry(pair("retry-after", ""))
+ t.addEntry(pair("server", ""))
+ t.addEntry(pair("set-cookie", ""))
+ t.addEntry(pair("strict-transport-security", ""))
+ t.addEntry(pair("transfer-encoding", ""))
+ t.addEntry(pair("user-agent", ""))
+ t.addEntry(pair("vary", ""))
+ t.addEntry(pair("via", ""))
+ t.addEntry(pair("www-authenticate", ""))
+ return t
}
var huffmanCodes = [256]uint32{
diff --git a/vendor/golang.org/x/net/http2/hpack/tables_test.go b/vendor/golang.org/x/net/http2/hpack/tables_test.go
new file mode 100644
index 000000000..7f40d9a42
--- /dev/null
+++ b/vendor/golang.org/x/net/http2/hpack/tables_test.go
@@ -0,0 +1,188 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package hpack
+
+import (
+ "bufio"
+ "regexp"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+func TestHeaderFieldTable(t *testing.T) {
+ table := &headerFieldTable{}
+ table.init()
+ table.addEntry(pair("key1", "value1-1"))
+ table.addEntry(pair("key2", "value2-1"))
+ table.addEntry(pair("key1", "value1-2"))
+ table.addEntry(pair("key3", "value3-1"))
+ table.addEntry(pair("key4", "value4-1"))
+ table.addEntry(pair("key2", "value2-2"))
+
+ // Tests will be run twice: once before evicting anything, and
+ // again after evicting the three oldest entries.
+ tests := []struct {
+ f HeaderField
+ beforeWantStaticI uint64
+ beforeWantMatch bool
+ afterWantStaticI uint64
+ afterWantMatch bool
+ }{
+ {HeaderField{"key1", "value1-1", false}, 1, true, 0, false},
+ {HeaderField{"key1", "value1-2", false}, 3, true, 0, false},
+ {HeaderField{"key1", "value1-3", false}, 3, false, 0, false},
+ {HeaderField{"key2", "value2-1", false}, 2, true, 3, false},
+ {HeaderField{"key2", "value2-2", false}, 6, true, 3, true},
+ {HeaderField{"key2", "value2-3", false}, 6, false, 3, false},
+ {HeaderField{"key4", "value4-1", false}, 5, true, 2, true},
+ // Name match only, because sensitive.
+ {HeaderField{"key4", "value4-1", true}, 5, false, 2, false},
+ // Key not found.
+ {HeaderField{"key5", "value5-x", false}, 0, false, 0, false},
+ }
+
+ staticToDynamic := func(i uint64) uint64 {
+ if i == 0 {
+ return 0
+ }
+ return uint64(table.len()) - i + 1 // dynamic is the reversed table
+ }
+
+ searchStatic := func(f HeaderField) (uint64, bool) {
+ old := staticTable
+ staticTable = table
+ defer func() { staticTable = old }()
+ return staticTable.search(f)
+ }
+
+ searchDynamic := func(f HeaderField) (uint64, bool) {
+ return table.search(f)
+ }
+
+ for _, test := range tests {
+ gotI, gotMatch := searchStatic(test.f)
+ if wantI, wantMatch := test.beforeWantStaticI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch {
+ t.Errorf("before evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
+ }
+ gotI, gotMatch = searchDynamic(test.f)
+ wantDynamicI := staticToDynamic(test.beforeWantStaticI)
+ if wantI, wantMatch := wantDynamicI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch {
+ t.Errorf("before evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
+ }
+ }
+
+ table.evictOldest(3)
+
+ for _, test := range tests {
+ gotI, gotMatch := searchStatic(test.f)
+ if wantI, wantMatch := test.afterWantStaticI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch {
+ t.Errorf("after evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
+ }
+ gotI, gotMatch = searchDynamic(test.f)
+ wantDynamicI := staticToDynamic(test.afterWantStaticI)
+ if wantI, wantMatch := wantDynamicI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch {
+ t.Errorf("after evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch)
+ }
+ }
+}
+
+func TestStaticTable(t *testing.T) {
+ fromSpec := `
+ +-------+-----------------------------+---------------+
+ | 1 | :authority | |
+ | 2 | :method | GET |
+ | 3 | :method | POST |
+ | 4 | :path | / |
+ | 5 | :path | /index.html |
+ | 6 | :scheme | http |
+ | 7 | :scheme | https |
+ | 8 | :status | 200 |
+ | 9 | :status | 204 |
+ | 10 | :status | 206 |
+ | 11 | :status | 304 |
+ | 12 | :status | 400 |
+ | 13 | :status | 404 |
+ | 14 | :status | 500 |
+ | 15 | accept-charset | |
+ | 16 | accept-encoding | gzip, deflate |
+ | 17 | accept-language | |
+ | 18 | accept-ranges | |
+ | 19 | accept | |
+ | 20 | access-control-allow-origin | |
+ | 21 | age | |
+ | 22 | allow | |
+ | 23 | authorization | |
+ | 24 | cache-control | |
+ | 25 | content-disposition | |
+ | 26 | content-encoding | |
+ | 27 | content-language | |
+ | 28 | content-length | |
+ | 29 | content-location | |
+ | 30 | content-range | |
+ | 31 | content-type | |
+ | 32 | cookie | |
+ | 33 | date | |
+ | 34 | etag | |
+ | 35 | expect | |
+ | 36 | expires | |
+ | 37 | from | |
+ | 38 | host | |
+ | 39 | if-match | |
+ | 40 | if-modified-since | |
+ | 41 | if-none-match | |
+ | 42 | if-range | |
+ | 43 | if-unmodified-since | |
+ | 44 | last-modified | |
+ | 45 | link | |
+ | 46 | location | |
+ | 47 | max-forwards | |
+ | 48 | proxy-authenticate | |
+ | 49 | proxy-authorization | |
+ | 50 | range | |
+ | 51 | referer | |
+ | 52 | refresh | |
+ | 53 | retry-after | |
+ | 54 | server | |
+ | 55 | set-cookie | |
+ | 56 | strict-transport-security | |
+ | 57 | transfer-encoding | |
+ | 58 | user-agent | |
+ | 59 | vary | |
+ | 60 | via | |
+ | 61 | www-authenticate | |
+ +-------+-----------------------------+---------------+
+`
+ bs := bufio.NewScanner(strings.NewReader(fromSpec))
+ re := regexp.MustCompile(`\| (\d+)\s+\| (\S+)\s*\| (\S(.*\S)?)?\s+\|`)
+ for bs.Scan() {
+ l := bs.Text()
+ if !strings.Contains(l, "|") {
+ continue
+ }
+ m := re.FindStringSubmatch(l)
+ if m == nil {
+ continue
+ }
+ i, err := strconv.Atoi(m[1])
+ if err != nil {
+ t.Errorf("Bogus integer on line %q", l)
+ continue
+ }
+ if i < 1 || i > staticTable.len() {
+ t.Errorf("Bogus index %d on line %q", i, l)
+ continue
+ }
+ if got, want := staticTable.ents[i-1].Name, m[2]; got != want {
+ t.Errorf("header index %d name = %q; want %q", i, got, want)
+ }
+ if got, want := staticTable.ents[i-1].Value, m[3]; got != want {
+ t.Errorf("header index %d value = %q; want %q", i, got, want)
+ }
+ }
+ if err := bs.Err(); err != nil {
+ t.Error(err)
+ }
+}
diff --git a/vendor/golang.org/x/net/http2/pipe.go b/vendor/golang.org/x/net/http2/pipe.go
index 53b7a1daf..914aaf8a7 100644
--- a/vendor/golang.org/x/net/http2/pipe.go
+++ b/vendor/golang.org/x/net/http2/pipe.go
@@ -10,7 +10,7 @@ import (
"sync"
)
-// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
+// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
// io.Pipe except there are no PipeReader/PipeWriter halves, and the
// underlying buffer is an interface. (io.Pipe is always unbuffered)
type pipe struct {
diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go
index 3c6b90ccd..550427dda 100644
--- a/vendor/golang.org/x/net/http2/server.go
+++ b/vendor/golang.org/x/net/http2/server.go
@@ -110,11 +110,38 @@ type Server struct {
// activity for the purposes of IdleTimeout.
IdleTimeout time.Duration
+ // MaxUploadBufferPerConnection is the size of the initial flow
+ // control window for each connections. The HTTP/2 spec does not
+ // allow this to be smaller than 65535 or larger than 2^32-1.
+ // If the value is outside this range, a default value will be
+ // used instead.
+ MaxUploadBufferPerConnection int32
+
+ // MaxUploadBufferPerStream is the size of the initial flow control
+ // window for each stream. The HTTP/2 spec does not allow this to
+ // be larger than 2^32-1. If the value is zero or larger than the
+ // maximum, a default value will be used instead.
+ MaxUploadBufferPerStream int32
+
// NewWriteScheduler constructs a write scheduler for a connection.
// If nil, a default scheduler is chosen.
NewWriteScheduler func() WriteScheduler
}
+func (s *Server) initialConnRecvWindowSize() int32 {
+ if s.MaxUploadBufferPerConnection > initialWindowSize {
+ return s.MaxUploadBufferPerConnection
+ }
+ return 1 << 20
+}
+
+func (s *Server) initialStreamRecvWindowSize() int32 {
+ if s.MaxUploadBufferPerStream > 0 {
+ return s.MaxUploadBufferPerStream
+ }
+ return 1 << 20
+}
+
func (s *Server) maxReadFrameSize() uint32 {
if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize {
return v
@@ -255,27 +282,27 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
defer cancel()
sc := &serverConn{
- srv: s,
- hs: opts.baseConfig(),
- conn: c,
- baseCtx: baseCtx,
- remoteAddrStr: c.RemoteAddr().String(),
- bw: newBufferedWriter(c),
- handler: opts.handler(),
- streams: make(map[uint32]*stream),
- readFrameCh: make(chan readFrameResult),
- wantWriteFrameCh: make(chan FrameWriteRequest, 8),
- wantStartPushCh: make(chan startPushRequest, 8),
- wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync
- bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way
- doneServing: make(chan struct{}),
- clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value"
- advMaxStreams: s.maxConcurrentStreams(),
- initialWindowSize: initialWindowSize,
- maxFrameSize: initialMaxFrameSize,
- headerTableSize: initialHeaderTableSize,
- serveG: newGoroutineLock(),
- pushEnabled: true,
+ srv: s,
+ hs: opts.baseConfig(),
+ conn: c,
+ baseCtx: baseCtx,
+ remoteAddrStr: c.RemoteAddr().String(),
+ bw: newBufferedWriter(c),
+ handler: opts.handler(),
+ streams: make(map[uint32]*stream),
+ readFrameCh: make(chan readFrameResult),
+ wantWriteFrameCh: make(chan FrameWriteRequest, 8),
+ wantStartPushCh: make(chan startPushRequest, 8),
+ wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync
+ bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way
+ doneServing: make(chan struct{}),
+ clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value"
+ advMaxStreams: s.maxConcurrentStreams(),
+ initialStreamSendWindowSize: initialWindowSize,
+ maxFrameSize: initialMaxFrameSize,
+ headerTableSize: initialHeaderTableSize,
+ serveG: newGoroutineLock(),
+ pushEnabled: true,
}
// The net/http package sets the write deadline from the
@@ -294,6 +321,9 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
sc.writeSched = NewRandomWriteScheduler()
}
+ // These start at the RFC-specified defaults. If there is a higher
+ // configured value for inflow, that will be updated when we send a
+ // WINDOW_UPDATE shortly after sending SETTINGS.
sc.flow.add(initialWindowSize)
sc.inflow.add(initialWindowSize)
sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf)
@@ -387,34 +417,34 @@ type serverConn struct {
writeSched WriteScheduler
// Everything following is owned by the serve loop; use serveG.check():
- serveG goroutineLock // used to verify funcs are on serve()
- pushEnabled bool
- sawFirstSettings bool // got the initial SETTINGS frame after the preface
- needToSendSettingsAck bool
- unackedSettings int // how many SETTINGS have we sent without ACKs?
- clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
- advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
- curClientStreams uint32 // number of open streams initiated by the client
- curPushedStreams uint32 // number of open streams initiated by server push
- maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
- maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
- streams map[uint32]*stream
- initialWindowSize int32
- maxFrameSize int32
- headerTableSize uint32
- peerMaxHeaderListSize uint32 // zero means unknown (default)
- canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case
- writingFrame bool // started writing a frame (on serve goroutine or separate)
- writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh
- needsFrameFlush bool // last frame write wasn't a flush
- inGoAway bool // we've started to or sent GOAWAY
- inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop
- needToSendGoAway bool // we need to schedule a GOAWAY frame write
- goAwayCode ErrCode
- shutdownTimerCh <-chan time.Time // nil until used
- shutdownTimer *time.Timer // nil until used
- idleTimer *time.Timer // nil if unused
- idleTimerCh <-chan time.Time // nil if unused
+ serveG goroutineLock // used to verify funcs are on serve()
+ pushEnabled bool
+ sawFirstSettings bool // got the initial SETTINGS frame after the preface
+ needToSendSettingsAck bool
+ unackedSettings int // how many SETTINGS have we sent without ACKs?
+ clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
+ advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
+ curClientStreams uint32 // number of open streams initiated by the client
+ curPushedStreams uint32 // number of open streams initiated by server push
+ maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
+ maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
+ streams map[uint32]*stream
+ initialStreamSendWindowSize int32
+ maxFrameSize int32
+ headerTableSize uint32
+ peerMaxHeaderListSize uint32 // zero means unknown (default)
+ canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case
+ writingFrame bool // started writing a frame (on serve goroutine or separate)
+ writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh
+ needsFrameFlush bool // last frame write wasn't a flush
+ inGoAway bool // we've started to or sent GOAWAY
+ inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop
+ needToSendGoAway bool // we need to schedule a GOAWAY frame write
+ goAwayCode ErrCode
+ shutdownTimerCh <-chan time.Time // nil until used
+ shutdownTimer *time.Timer // nil until used
+ idleTimer *time.Timer // nil if unused
+ idleTimerCh <-chan time.Time // nil if unused
// Owned by the writeFrameAsync goroutine:
headerWriteBuf bytes.Buffer
@@ -463,10 +493,9 @@ type stream struct {
numTrailerValues int64
weight uint8
state streamState
- resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
- gotTrailerHeader bool // HEADER frame for trailers was seen
- wroteHeaders bool // whether we wrote headers (not status 100)
- reqBuf []byte // if non-nil, body pipe buffer to return later at EOF
+ resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
+ gotTrailerHeader bool // HEADER frame for trailers was seen
+ wroteHeaders bool // whether we wrote headers (not status 100)
trailer http.Header // accumulated trailers
reqTrailer http.Header // handler's Request.Trailer
@@ -696,21 +725,23 @@ func (sc *serverConn) serve() {
{SettingMaxFrameSize, sc.srv.maxReadFrameSize()},
{SettingMaxConcurrentStreams, sc.advMaxStreams},
{SettingMaxHeaderListSize, sc.maxHeaderListSize()},
-
- // TODO: more actual settings, notably
- // SettingInitialWindowSize, but then we also
- // want to bump up the conn window size the
- // same amount here right after the settings
+ {SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())},
},
})
sc.unackedSettings++
+ // Each connection starts with intialWindowSize inflow tokens.
+ // If a higher value is configured, we add more tokens.
+ if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 {
+ sc.sendWindowUpdate(nil, int(diff))
+ }
+
if err := sc.readPreface(); err != nil {
sc.condlogf(err, "http2: server: error reading preface from client %v: %v", sc.conn.RemoteAddr(), err)
return
}
// Now that we've got the preface, get us out of the
- // "StateNew" state. We can't go directly to idle, though.
+ // "StateNew" state. We can't go directly to idle, though.
// Active means we read some data and anticipate a request. We'll
// do another Active when we get a HEADERS frame.
sc.setConnState(http.StateActive)
@@ -1395,9 +1426,9 @@ func (sc *serverConn) processSettingInitialWindowSize(val uint32) error {
// adjust the size of all stream flow control windows that it
// maintains by the difference between the new value and the
// old value."
- old := sc.initialWindowSize
- sc.initialWindowSize = int32(val)
- growth := sc.initialWindowSize - old // may be negative
+ old := sc.initialStreamSendWindowSize
+ sc.initialStreamSendWindowSize = int32(val)
+ growth := int32(val) - old // may be negative
for _, st := range sc.streams {
if !st.flow.add(growth) {
// 6.9.2 Initial Flow Control Window Size
@@ -1719,9 +1750,9 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
}
st.cw.Init()
st.flow.conn = &sc.flow // link to conn-level counter
- st.flow.add(sc.initialWindowSize)
- st.inflow.conn = &sc.inflow // link to conn-level counter
- st.inflow.add(initialWindowSize) // TODO: update this when we send a higher initial window size in the initial settings
+ st.flow.add(sc.initialStreamSendWindowSize)
+ st.inflow.conn = &sc.inflow // link to conn-level counter
+ st.inflow.add(sc.srv.initialStreamRecvWindowSize())
sc.streams[id] = st
sc.writeSched.OpenStream(st.id, OpenStreamOptions{PusherID: pusherID})
@@ -1785,16 +1816,14 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res
return nil, nil, err
}
if bodyOpen {
- st.reqBuf = getRequestBodyBuf()
- req.Body.(*requestBody).pipe = &pipe{
- b: &fixedBuffer{buf: st.reqBuf},
- }
-
if vv, ok := rp.header["Content-Length"]; ok {
req.ContentLength, _ = strconv.ParseInt(vv[0], 10, 64)
} else {
req.ContentLength = -1
}
+ req.Body.(*requestBody).pipe = &pipe{
+ b: &dataBuffer{expected: req.ContentLength},
+ }
}
return rw, req, nil
}
@@ -1890,24 +1919,6 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r
return rw, req, nil
}
-var reqBodyCache = make(chan []byte, 8)
-
-func getRequestBodyBuf() []byte {
- select {
- case b := <-reqBodyCache:
- return b
- default:
- return make([]byte, initialWindowSize)
- }
-}
-
-func putRequestBodyBuf(b []byte) {
- select {
- case reqBodyCache <- b:
- default:
- }
-}
-
// Run on its own goroutine.
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
didPanic := true
@@ -2003,12 +2014,6 @@ func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int, err error) {
case <-sc.doneServing:
}
}
- if err == io.EOF {
- if buf := st.reqBuf; buf != nil {
- st.reqBuf = nil // shouldn't matter; field unused by other
- putRequestBodyBuf(buf)
- }
- }
}
func (sc *serverConn) noteBodyRead(st *stream, n int) {
@@ -2103,8 +2108,8 @@ func (b *requestBody) Read(p []byte) (n int, err error) {
return
}
-// responseWriter is the http.ResponseWriter implementation. It's
-// intentionally small (1 pointer wide) to minimize garbage. The
+// responseWriter is the http.ResponseWriter implementation. It's
+// intentionally small (1 pointer wide) to minimize garbage. The
// responseWriterState pointer inside is zeroed at the end of a
// request (in handlerDone) and calls on the responseWriter thereafter
// simply crash (caller's mistake), but the much larger responseWriterState
@@ -2278,7 +2283,7 @@ const TrailerPrefix = "Trailer:"
// says you SHOULD (but not must) predeclare any trailers in the
// header, the official ResponseWriter rules said trailers in Go must
// be predeclared, and then we reuse the same ResponseWriter.Header()
-// map to mean both Headers and Trailers. When it's time to write the
+// map to mean both Headers and Trailers. When it's time to write the
// Trailers, we pick out the fields of Headers that were declared as
// trailers. That worked for a while, until we found the first major
// user of Trailers in the wild: gRPC (using them only over http2),
diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go
index dfa4cff2e..407fafc6d 100644
--- a/vendor/golang.org/x/net/http2/server_test.go
+++ b/vendor/golang.org/x/net/http2/server_test.go
@@ -80,6 +80,7 @@ type serverTesterOpt string
var optOnlyServer = serverTesterOpt("only_server")
var optQuiet = serverTesterOpt("quiet_logging")
+var optFramerReuseFrames = serverTesterOpt("frame_reuse_frames")
func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}) *serverTester {
resetHooks()
@@ -91,7 +92,7 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}
NextProtos: []string{NextProtoTLS},
}
- var onlyServer, quiet bool
+ var onlyServer, quiet, framerReuseFrames bool
h2server := new(Server)
for _, opt := range opts {
switch v := opt.(type) {
@@ -107,6 +108,8 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}
onlyServer = true
case optQuiet:
quiet = true
+ case optFramerReuseFrames:
+ framerReuseFrames = true
}
case func(net.Conn, http.ConnState):
ts.Config.ConnState = v
@@ -149,6 +152,9 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}
}
st.cc = cc
st.fr = NewFramer(cc, cc)
+ if framerReuseFrames {
+ st.fr.SetReuseFrames()
+ }
if !logFrameReads && !logFrameWrites {
st.fr.debugReadLoggerf = func(m string, v ...interface{}) {
m = time.Now().Format("2006-01-02 15:04:05.999999999 ") + strings.TrimPrefix(m, "http2: ") + "\n"
@@ -254,11 +260,52 @@ func (st *serverTester) Close() {
// greet initiates the client's HTTP/2 connection into a state where
// frames may be sent.
func (st *serverTester) greet() {
+ st.greetAndCheckSettings(func(Setting) error { return nil })
+}
+
+func (st *serverTester) greetAndCheckSettings(checkSetting func(s Setting) error) {
st.writePreface()
st.writeInitialSettings()
- st.wantSettings()
+ st.wantSettings().ForeachSetting(checkSetting)
st.writeSettingsAck()
- st.wantSettingsAck()
+
+ // The initial WINDOW_UPDATE and SETTINGS ACK can come in any order.
+ var gotSettingsAck bool
+ var gotWindowUpdate bool
+
+ for i := 0; i < 2; i++ {
+ f, err := st.readFrame()
+ if err != nil {
+ st.t.Fatal(err)
+ }
+ switch f := f.(type) {
+ case *SettingsFrame:
+ if !f.Header().Flags.Has(FlagSettingsAck) {
+ st.t.Fatal("Settings Frame didn't have ACK set")
+ }
+ gotSettingsAck = true
+
+ case *WindowUpdateFrame:
+ if f.FrameHeader.StreamID != 0 {
+ st.t.Fatalf("WindowUpdate StreamID = %d; want 0", f.FrameHeader.StreamID, 0)
+ }
+ incr := uint32((&Server{}).initialConnRecvWindowSize() - initialWindowSize)
+ if f.Increment != incr {
+ st.t.Fatalf("WindowUpdate increment = %d; want %d", f.Increment, incr)
+ }
+ gotWindowUpdate = true
+
+ default:
+ st.t.Fatalf("Wanting a settings ACK or window update, received a %T", f)
+ }
+ }
+
+ if !gotSettingsAck {
+ st.t.Fatalf("Didn't get a settings ACK")
+ }
+ if !gotWindowUpdate {
+ st.t.Fatalf("Didn't get a window update")
+ }
}
func (st *serverTester) writePreface() {
@@ -318,7 +365,7 @@ func (st *serverTester) encodeHeaderRaw(headers ...string) []byte {
}
// encodeHeader encodes headers and returns their HPACK bytes. headers
-// must contain an even number of key/value pairs. There may be
+// must contain an even number of key/value pairs. There may be
// multiple pairs for keys (e.g. "cookie"). The :method, :path, and
// :scheme headers default to GET, / and https. The :authority header
// defaults to st.ts.Listener.Addr().
@@ -578,12 +625,7 @@ func TestServer(t *testing.T) {
server sends in the HTTP/2 connection.
`)
- st.writePreface()
- st.writeInitialSettings()
- st.wantSettings()
- st.writeSettingsAck()
- st.wantSettingsAck()
-
+ st.greet()
st.writeHeaders(HeadersFrameParam{
StreamID: 1, // clients send odd numbers
BlockFragment: st.encodeHeader(),
@@ -656,7 +698,7 @@ func TestServer_Request_Get_PathSlashes(t *testing.T) {
}
// TODO: add a test with EndStream=true on the HEADERS but setting a
-// Content-Length anyway. Should we just omit it and force it to
+// Content-Length anyway. Should we just omit it and force it to
// zero?
func TestServer_Request_Post_NoContentLength_EndStream(t *testing.T) {
@@ -1192,7 +1234,7 @@ func TestServer_Handler_Sends_WindowUpdate_Padding(t *testing.T) {
EndStream: false,
EndHeaders: true,
})
- st.writeDataPadded(1, false, []byte("abcdef"), []byte("1234"))
+ st.writeDataPadded(1, false, []byte("abcdef"), []byte{0, 0, 0, 0})
// Expect to immediately get our 5 bytes of padding back for
// both the connection and stream (4 bytes of padding + 1 byte of length)
@@ -2595,11 +2637,9 @@ func TestServerDoS_MaxHeaderListSize(t *testing.T) {
defer st.Close()
// shake hands
- st.writePreface()
- st.writeInitialSettings()
frameSize := defaultMaxReadFrameSize
var advHeaderListSize *uint32
- st.wantSettings().ForeachSetting(func(s Setting) error {
+ st.greetAndCheckSettings(func(s Setting) error {
switch s.ID {
case SettingMaxFrameSize:
if s.Val < minMaxFrameSize {
@@ -2614,8 +2654,6 @@ func TestServerDoS_MaxHeaderListSize(t *testing.T) {
}
return nil
})
- st.writeSettingsAck()
- st.wantSettingsAck()
if advHeaderListSize == nil {
t.Errorf("server didn't advertise a max header list size")
@@ -2994,6 +3032,89 @@ func BenchmarkServerPosts(b *testing.B) {
}
}
+// Send a stream of messages from server to client in separate data frames.
+// Brings up performance issues seen in long streams.
+// Created to show problem in go issue #18502
+func BenchmarkServerToClientStreamDefaultOptions(b *testing.B) {
+ benchmarkServerToClientStream(b)
+}
+
+// Justification for Change-Id: Iad93420ef6c3918f54249d867098f1dadfa324d8
+// Expect to see memory/alloc reduction by opting in to Frame reuse with the Framer.
+func BenchmarkServerToClientStreamReuseFrames(b *testing.B) {
+ benchmarkServerToClientStream(b, optFramerReuseFrames)
+}
+
+func benchmarkServerToClientStream(b *testing.B, newServerOpts ...interface{}) {
+ defer disableGoroutineTracking()()
+ b.ReportAllocs()
+ const msgLen = 1
+ // default window size
+ const windowSize = 1<<16 - 1
+
+ // next message to send from the server and for the client to expect
+ nextMsg := func(i int) []byte {
+ msg := make([]byte, msgLen)
+ msg[0] = byte(i)
+ if len(msg) != msgLen {
+ panic("invalid test setup msg length")
+ }
+ return msg
+ }
+
+ st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) {
+ // Consume the (empty) body from th peer before replying, otherwise
+ // the server will sometimes (depending on scheduling) send the peer a
+ // a RST_STREAM with the CANCEL error code.
+ if n, err := io.Copy(ioutil.Discard, r.Body); n != 0 || err != nil {
+ b.Errorf("Copy error; got %v, %v; want 0, nil", n, err)
+ }
+ for i := 0; i < b.N; i += 1 {
+ w.Write(nextMsg(i))
+ w.(http.Flusher).Flush()
+ }
+ }, newServerOpts...)
+ defer st.Close()
+ st.greet()
+
+ const id = uint32(1)
+
+ st.writeHeaders(HeadersFrameParam{
+ StreamID: id,
+ BlockFragment: st.encodeHeader(":method", "POST"),
+ EndStream: false,
+ EndHeaders: true,
+ })
+
+ st.writeData(id, true, nil)
+ st.wantHeaders()
+
+ var pendingWindowUpdate = uint32(0)
+
+ for i := 0; i < b.N; i += 1 {
+ expected := nextMsg(i)
+ df := st.wantData()
+ if bytes.Compare(expected, df.data) != 0 {
+ b.Fatalf("Bad message received; want %v; got %v", expected, df.data)
+ }
+ // try to send infrequent but large window updates so they don't overwhelm the test
+ pendingWindowUpdate += uint32(len(df.data))
+ if pendingWindowUpdate >= windowSize/2 {
+ if err := st.fr.WriteWindowUpdate(0, pendingWindowUpdate); err != nil {
+ b.Fatal(err)
+ }
+ if err := st.fr.WriteWindowUpdate(id, pendingWindowUpdate); err != nil {
+ b.Fatal(err)
+ }
+ pendingWindowUpdate = 0
+ }
+ }
+ df := st.wantData()
+ if !df.StreamEnded() {
+ b.Fatalf("DATA didn't have END_STREAM; got %v", df)
+ }
+}
+
// go-fuzz bug, originally reported at https://github.com/bradfitz/http2/issues/53
// Verify we don't hang.
func TestIssue53(t *testing.T) {
diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go
index 0c7e859db..84d042d46 100644
--- a/vendor/golang.org/x/net/http2/transport.go
+++ b/vendor/golang.org/x/net/http2/transport.go
@@ -575,7 +575,7 @@ func (cc *ClientConn) canTakeNewRequestLocked() bool {
cc.nextStreamID < math.MaxInt32
}
-// onIdleTimeout is called from a time.AfterFunc goroutine. It will
+// onIdleTimeout is called from a time.AfterFunc goroutine. It will
// only be called when we're idle, but because we're coming from a new
// goroutine, there could be a new request coming in at the same time,
// so this simply calls the synchronized closeIfIdle to shut down this
@@ -809,8 +809,8 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
// 2xx, however, then assume the server DOES potentially
// want our body (e.g. full-duplex streaming:
// golang.org/issue/13444). If it turns out the server
- // doesn't, they'll RST_STREAM us soon enough. This is a
- // heuristic to avoid adding knobs to Transport. Hopefully
+ // doesn't, they'll RST_STREAM us soon enough. This is a
+ // heuristic to avoid adding knobs to Transport. Hopefully
// we can keep it.
bodyWriter.cancel()
cs.abortRequestBodyWrite(errStopReqBodyWrite)
@@ -1528,8 +1528,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
return res, nil
}
- buf := new(bytes.Buffer) // TODO(bradfitz): recycle this garbage
- cs.bufPipe = pipe{b: buf}
+ cs.bufPipe = pipe{b: &dataBuffer{expected: res.ContentLength}}
cs.bytesRemain = res.ContentLength
res.Body = transportResponseBody{cs}
go cs.awaitRequestCancel(cs.req)
diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go
index 8ef4f3388..7ae8ff787 100644
--- a/vendor/golang.org/x/net/http2/transport_test.go
+++ b/vendor/golang.org/x/net/http2/transport_test.go
@@ -2406,7 +2406,7 @@ func TestTransportReturnsDataPaddingFlowControl(t *testing.T) {
EndStream: false,
BlockFragment: buf.Bytes(),
})
- pad := []byte("12345")
+ pad := make([]byte, 5)
ct.fr.WriteDataPadded(hf.StreamID, false, make([]byte, 5000), pad) // without ending stream
f, err := ct.readNonSettingsFrame()
diff --git a/vendor/golang.org/x/net/internal/netreflect/socket.go b/vendor/golang.org/x/net/internal/netreflect/socket.go
index e82e51c44..1495b65f5 100644
--- a/vendor/golang.org/x/net/internal/netreflect/socket.go
+++ b/vendor/golang.org/x/net/internal/netreflect/socket.go
@@ -2,8 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !go1.9
+
// Package netreflect implements run-time reflection for the
// facilities of net package.
+//
+// This package works only for Go 1.8 or below.
package netreflect
import (
diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_19.go b/vendor/golang.org/x/net/internal/netreflect/socket_19.go
new file mode 100644
index 000000000..74df52e1a
--- /dev/null
+++ b/vendor/golang.org/x/net/internal/netreflect/socket_19.go
@@ -0,0 +1,37 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9
+
+package netreflect
+
+import (
+ "errors"
+ "net"
+)
+
+var (
+ errInvalidType = errors.New("invalid type")
+ errOpNoSupport = errors.New("operation not supported")
+)
+
+// SocketOf returns the socket descriptor of c.
+func SocketOf(c net.Conn) (uintptr, error) {
+ switch c.(type) {
+ case *net.TCPConn, *net.UDPConn, *net.IPConn, *net.UnixConn:
+ return 0, errOpNoSupport
+ default:
+ return 0, errInvalidType
+ }
+}
+
+// PacketSocketOf returns the socket descriptor of c.
+func PacketSocketOf(c net.PacketConn) (uintptr, error) {
+ switch c.(type) {
+ case *net.UDPConn, *net.IPConn, *net.UnixConn:
+ return 0, errOpNoSupport
+ default:
+ return 0, errInvalidType
+ }
+}
diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_posix.go b/vendor/golang.org/x/net/internal/netreflect/socket_posix.go
index df475a2b2..410c0924d 100644
--- a/vendor/golang.org/x/net/internal/netreflect/socket_posix.go
+++ b/vendor/golang.org/x/net/internal/netreflect/socket_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !go1.9
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
package netreflect
diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_stub.go b/vendor/golang.org/x/net/internal/netreflect/socket_stub.go
index 85adb4b7f..17b20c478 100644
--- a/vendor/golang.org/x/net/internal/netreflect/socket_stub.go
+++ b/vendor/golang.org/x/net/internal/netreflect/socket_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !go1.9
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
package netreflect
diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_test.go b/vendor/golang.org/x/net/internal/netreflect/socket_test.go
index 49b97ed54..b3aad0d92 100644
--- a/vendor/golang.org/x/net/internal/netreflect/socket_test.go
+++ b/vendor/golang.org/x/net/internal/netreflect/socket_test.go
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !go1.9
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
+
package netreflect_test
import (
diff --git a/vendor/golang.org/x/net/internal/timeseries/timeseries.go b/vendor/golang.org/x/net/internal/timeseries/timeseries.go
index 1119f3448..685f0e7ea 100644
--- a/vendor/golang.org/x/net/internal/timeseries/timeseries.go
+++ b/vendor/golang.org/x/net/internal/timeseries/timeseries.go
@@ -371,7 +371,7 @@ func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observabl
}
}
- // Failed to find a level that covers the desired range. So just
+ // Failed to find a level that covers the desired range. So just
// extract from the last level, even if it doesn't cover the entire
// desired range.
ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results)
diff --git a/vendor/golang.org/x/net/ipv4/doc.go b/vendor/golang.org/x/net/ipv4/doc.go
index b4ce40fbc..b43935a5a 100644
--- a/vendor/golang.org/x/net/ipv4/doc.go
+++ b/vendor/golang.org/x/net/ipv4/doc.go
@@ -21,7 +21,7 @@
//
// The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections
-// that use the IPv4 transport. When a single TCP connection carrying
+// that use the IPv4 transport. When a single TCP connection carrying
// a data flow of multiple packets needs to indicate the flow is
// important, Conn is used to set the type-of-service field on the
// IPv4 header for each packet.
@@ -56,7 +56,7 @@
//
// The options for multicasting are available for net.UDPConn and
// net.IPconn which are created as network connections that use the
-// IPv4 transport. A few network facilities must be prepared before
+// IPv4 transport. A few network facilities must be prepared before
// you begin multicasting, at a minimum joining network interfaces and
// multicast groups.
//
@@ -80,7 +80,7 @@
// defer c.Close()
//
// Second, the application joins multicast groups, starts listening to
-// the groups on the specified network interfaces. Note that the
+// the groups on the specified network interfaces. Note that the
// service port for transport layer protocol does not matter with this
// operation as joining groups affects only network and link layer
// protocols, such as IPv4 and Ethernet.
@@ -94,7 +94,7 @@
// }
//
// The application might set per packet control message transmissions
-// between the protocol stack within the kernel. When the application
+// between the protocol stack within the kernel. When the application
// needs a destination address on an incoming packet,
// SetControlMessage of PacketConn is used to enable control message
// transmissions.
@@ -145,7 +145,7 @@
// More multicasting
//
// An application that uses PacketConn or RawConn may join multiple
-// multicast groups. For example, a UDP listener with port 1024 might
+// multicast groups. For example, a UDP listener with port 1024 might
// join two different groups across over two different network
// interfaces by using:
//
@@ -166,7 +166,7 @@
// }
//
// It is possible for multiple UDP listeners that listen on the same
-// UDP port to join the same multicast group. The net package will
+// UDP port to join the same multicast group. The net package will
// provide a socket that listens to a wildcard address with reusable
// UDP port when an appropriate multicast address prefix is passed to
// the net.ListenPacket or net.ListenUDP.
diff --git a/vendor/golang.org/x/net/ipv4/endpoint.go b/vendor/golang.org/x/net/ipv4/endpoint.go
index 01c4e399b..8f7e07ac4 100644
--- a/vendor/golang.org/x/net/ipv4/endpoint.go
+++ b/vendor/golang.org/x/net/ipv4/endpoint.go
@@ -38,8 +38,8 @@ func NewConn(c net.Conn) *Conn {
}
// A PacketConn represents a packet network endpoint that uses the
-// IPv4 transport. It is used to control several IP-level socket
-// options including multicasting. It also provides datagram based
+// IPv4 transport. It is used to control several IP-level socket
+// options including multicasting. It also provides datagram based
// network I/O methods specific to the IPv4 and higher layer protocols
// such as UDP.
type PacketConn struct {
@@ -118,8 +118,8 @@ func NewPacketConn(c net.PacketConn) *PacketConn {
}
// A RawConn represents a packet network endpoint that uses the IPv4
-// transport. It is used to control several IP-level socket options
-// including IPv4 header manipulation. It also provides datagram
+// transport. It is used to control several IP-level socket options
+// including IPv4 header manipulation. It also provides datagram
// based network I/O methods specific to the IPv4 and higher layer
// protocols that handle IPv4 datagram directly such as OSPF, GRE.
type RawConn struct {
diff --git a/vendor/golang.org/x/net/ipv4/go19_test.go b/vendor/golang.org/x/net/ipv4/go19_test.go
new file mode 100644
index 000000000..82a27b113
--- /dev/null
+++ b/vendor/golang.org/x/net/ipv4/go19_test.go
@@ -0,0 +1,11 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9
+
+package ipv4
+
+func init() {
+ disableTests = true
+}
diff --git a/vendor/golang.org/x/net/ipv4/ipv4_test.go b/vendor/golang.org/x/net/ipv4/ipv4_test.go
new file mode 100644
index 000000000..917299283
--- /dev/null
+++ b/vendor/golang.org/x/net/ipv4/ipv4_test.go
@@ -0,0 +1,22 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ipv4
+
+import (
+ "fmt"
+ "os"
+ "testing"
+)
+
+var disableTests = false
+
+func TestMain(m *testing.M) {
+ if disableTests {
+ fmt.Fprintf(os.Stderr, "ipv4 tests disabled in Go 1.9 until netreflect is fixed. (Issue 19051)\n")
+ os.Exit(0)
+ }
+ // call flag.Parse() here if TestMain uses flags
+ os.Exit(m.Run())
+}
diff --git a/vendor/golang.org/x/net/ipv4/packet.go b/vendor/golang.org/x/net/ipv4/packet.go
index 7f3bf4898..d43723ca9 100644
--- a/vendor/golang.org/x/net/ipv4/packet.go
+++ b/vendor/golang.org/x/net/ipv4/packet.go
@@ -21,7 +21,7 @@ type packetHandler struct {
func (c *packetHandler) ok() bool { return c != nil && c.c != nil }
// ReadFrom reads an IPv4 datagram from the endpoint c, copying the
-// datagram into b. It returns the received datagram as the IPv4
+// datagram into b. It returns the received datagram as the IPv4
// header h, the payload p and the control message cm.
func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
if !c.ok() {
@@ -57,9 +57,9 @@ func slicePacket(b []byte) (h, p []byte, err error) {
}
// WriteTo writes an IPv4 datagram through the endpoint c, copying the
-// datagram from the IPv4 header h and the payload p. The control
+// datagram from the IPv4 header h and the payload p. The control
// message cm allows the datagram path and the outgoing interface to be
-// specified. Currently only Darwin and Linux support this. The cm
+// specified. Currently only Darwin and Linux support this. The cm
// may be nil if control of the outgoing datagram is not required.
//
// The IPv4 header h must contain appropriate fields that include:
diff --git a/vendor/golang.org/x/net/ipv4/payload_cmsg.go b/vendor/golang.org/x/net/ipv4/payload_cmsg.go
index 9bcde8f9a..5e6e55c20 100644
--- a/vendor/golang.org/x/net/ipv4/payload_cmsg.go
+++ b/vendor/golang.org/x/net/ipv4/payload_cmsg.go
@@ -12,7 +12,7 @@ import (
)
// ReadFrom reads a payload of the received IPv4 datagram, from the
-// endpoint c, copying the payload into b. It returns the number of
+// endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address
// src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
@@ -53,10 +53,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
}
// WriteTo writes a payload of the IPv4 datagram, to the destination
-// address dst through the endpoint c, copying the payload from b. It
-// returns the number of bytes written. The control message cm allows
+// address dst through the endpoint c, copying the payload from b. It
+// returns the number of bytes written. The control message cm allows
// the datagram path and the outgoing interface to be specified.
-// Currently only Darwin and Linux support this. The cm may be nil if
+// Currently only Darwin and Linux support this. The cm may be nil if
// control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() {
diff --git a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go
index 6f1b402f7..6f9d5b0ef 100644
--- a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go
+++ b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go
@@ -12,7 +12,7 @@ import (
)
// ReadFrom reads a payload of the received IPv4 datagram, from the
-// endpoint c, copying the payload into b. It returns the number of
+// endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address
// src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
@@ -26,10 +26,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
}
// WriteTo writes a payload of the IPv4 datagram, to the destination
-// address dst through the endpoint c, copying the payload from b. It
-// returns the number of bytes written. The control message cm allows
+// address dst through the endpoint c, copying the payload from b. It
+// returns the number of bytes written. The control message cm allows
// the datagram path and the outgoing interface to be specified.
-// Currently only Darwin and Linux support this. The cm may be nil if
+// Currently only Darwin and Linux support this. The cm may be nil if
// control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() {
diff --git a/vendor/golang.org/x/net/ipv6/control.go b/vendor/golang.org/x/net/ipv6/control.go
index 56303f08d..674628d3f 100644
--- a/vendor/golang.org/x/net/ipv6/control.go
+++ b/vendor/golang.org/x/net/ipv6/control.go
@@ -11,7 +11,7 @@ import (
)
// Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the
-// former still support RFC 2292 only. Please be aware that almost
+// former still support RFC 2292 only. Please be aware that almost
// all protocol implementations prohibit using a combination of RFC
// 2292 and RFC 3542 for some practical reasons.
diff --git a/vendor/golang.org/x/net/ipv6/dgramopt_posix.go b/vendor/golang.org/x/net/ipv6/dgramopt_posix.go
index 571430848..a448cbaa5 100644
--- a/vendor/golang.org/x/net/ipv6/dgramopt_posix.go
+++ b/vendor/golang.org/x/net/ipv6/dgramopt_posix.go
@@ -227,7 +227,7 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source
}
// Checksum reports whether the kernel will compute, store or verify a
-// checksum for both incoming and outgoing packets. If on is true, it
+// checksum for both incoming and outgoing packets. If on is true, it
// returns an offset in bytes into the data of where the checksum
// field is located.
func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
@@ -248,7 +248,7 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
return true, offset, nil
}
-// SetChecksum enables the kernel checksum processing. If on is ture,
+// SetChecksum enables the kernel checksum processing. If on is ture,
// the offset should be an offset in bytes into the data of where the
// checksum field is located.
func (c *dgramOpt) SetChecksum(on bool, offset int) error {
diff --git a/vendor/golang.org/x/net/ipv6/dgramopt_stub.go b/vendor/golang.org/x/net/ipv6/dgramopt_stub.go
index bc3290ad8..82b0686ae 100644
--- a/vendor/golang.org/x/net/ipv6/dgramopt_stub.go
+++ b/vendor/golang.org/x/net/ipv6/dgramopt_stub.go
@@ -94,14 +94,14 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source
}
// Checksum reports whether the kernel will compute, store or verify a
-// checksum for both incoming and outgoing packets. If on is true, it
+// checksum for both incoming and outgoing packets. If on is true, it
// returns an offset in bytes into the data of where the checksum
// field is located.
func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
return false, 0, errOpNoSupport
}
-// SetChecksum enables the kernel checksum processing. If on is ture,
+// SetChecksum enables the kernel checksum processing. If on is ture,
// the offset should be an offset in bytes into the data of where the
// checksum field is located.
func (c *dgramOpt) SetChecksum(on bool, offset int) error {
diff --git a/vendor/golang.org/x/net/ipv6/doc.go b/vendor/golang.org/x/net/ipv6/doc.go
index 88383e915..eaa24c580 100644
--- a/vendor/golang.org/x/net/ipv6/doc.go
+++ b/vendor/golang.org/x/net/ipv6/doc.go
@@ -22,7 +22,7 @@
//
// The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections
-// that use the IPv6 transport. When a single TCP connection carrying
+// that use the IPv6 transport. When a single TCP connection carrying
// a data flow of multiple packets needs to indicate the flow is
// important, Conn is used to set the traffic class field on the IPv6
// header for each packet.
@@ -57,7 +57,7 @@
//
// The options for multicasting are available for net.UDPConn and
// net.IPconn which are created as network connections that use the
-// IPv6 transport. A few network facilities must be prepared before
+// IPv6 transport. A few network facilities must be prepared before
// you begin multicasting, at a minimum joining network interfaces and
// multicast groups.
//
@@ -81,7 +81,7 @@
// defer c.Close()
//
// Second, the application joins multicast groups, starts listening to
-// the groups on the specified network interfaces. Note that the
+// the groups on the specified network interfaces. Note that the
// service port for transport layer protocol does not matter with this
// operation as joining groups affects only network and link layer
// protocols, such as IPv6 and Ethernet.
@@ -95,7 +95,7 @@
// }
//
// The application might set per packet control message transmissions
-// between the protocol stack within the kernel. When the application
+// between the protocol stack within the kernel. When the application
// needs a destination address on an incoming packet,
// SetControlMessage of PacketConn is used to enable control message
// transmissions.
@@ -144,7 +144,7 @@
// More multicasting
//
// An application that uses PacketConn may join multiple multicast
-// groups. For example, a UDP listener with port 1024 might join two
+// groups. For example, a UDP listener with port 1024 might join two
// different groups across over two different network interfaces by
// using:
//
@@ -165,7 +165,7 @@
// }
//
// It is possible for multiple UDP listeners that listen on the same
-// UDP port to join the same multicast group. The net package will
+// UDP port to join the same multicast group. The net package will
// provide a socket that listens to a wildcard address with reusable
// UDP port when an appropriate multicast address prefix is passed to
// the net.ListenPacket or net.ListenUDP.
diff --git a/vendor/golang.org/x/net/ipv6/endpoint.go b/vendor/golang.org/x/net/ipv6/endpoint.go
index f6a68ab41..ce0b0ce27 100644
--- a/vendor/golang.org/x/net/ipv6/endpoint.go
+++ b/vendor/golang.org/x/net/ipv6/endpoint.go
@@ -55,8 +55,8 @@ func NewConn(c net.Conn) *Conn {
}
// A PacketConn represents a packet network endpoint that uses IPv6
-// transport. It is used to control several IP-level socket options
-// including IPv6 header manipulation. It also provides datagram
+// transport. It is used to control several IP-level socket options
+// including IPv6 header manipulation. It also provides datagram
// based network I/O methods specific to the IPv6 and higher layer
// protocols such as OSPF, GRE, and UDP.
type PacketConn struct {
diff --git a/vendor/golang.org/x/net/ipv6/go19_test.go b/vendor/golang.org/x/net/ipv6/go19_test.go
new file mode 100644
index 000000000..c7cb057d2
--- /dev/null
+++ b/vendor/golang.org/x/net/ipv6/go19_test.go
@@ -0,0 +1,11 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.9
+
+package ipv6
+
+func init() {
+ disableTests = true
+}
diff --git a/vendor/golang.org/x/net/ipv6/ipv6_test.go b/vendor/golang.org/x/net/ipv6/ipv6_test.go
new file mode 100644
index 000000000..8d2d23542
--- /dev/null
+++ b/vendor/golang.org/x/net/ipv6/ipv6_test.go
@@ -0,0 +1,22 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ipv6
+
+import (
+ "fmt"
+ "os"
+ "testing"
+)
+
+var disableTests = false
+
+func TestMain(m *testing.M) {
+ if disableTests {
+ fmt.Fprintf(os.Stderr, "ipv6 tests disabled in Go 1.9 until netreflect is fixed (Issue 19051)\n")
+ os.Exit(0)
+ }
+ // call flag.Parse() here if TestMain uses flags
+ os.Exit(m.Run())
+}
diff --git a/vendor/golang.org/x/net/ipv6/payload_cmsg.go b/vendor/golang.org/x/net/ipv6/payload_cmsg.go
index 3a33585ef..e853c8059 100644
--- a/vendor/golang.org/x/net/ipv6/payload_cmsg.go
+++ b/vendor/golang.org/x/net/ipv6/payload_cmsg.go
@@ -12,7 +12,7 @@ import (
)
// ReadFrom reads a payload of the received IPv6 datagram, from the
-// endpoint c, copying the payload into b. It returns the number of
+// endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address
// src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
@@ -43,9 +43,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
}
// WriteTo writes a payload of the IPv6 datagram, to the destination
-// address dst through the endpoint c, copying the payload from b. It
-// returns the number of bytes written. The control message cm allows
-// the IPv6 header fields and the datagram path to be specified. The
+// address dst through the endpoint c, copying the payload from b. It
+// returns the number of bytes written. The control message cm allows
+// the IPv6 header fields and the datagram path to be specified. The
// cm may be nil if control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() {
diff --git a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go
index 9731cba43..99a43542b 100644
--- a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go
+++ b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go
@@ -12,7 +12,7 @@ import (
)
// ReadFrom reads a payload of the received IPv6 datagram, from the
-// endpoint c, copying the payload into b. It returns the number of
+// endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address
// src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
@@ -26,9 +26,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
}
// WriteTo writes a payload of the IPv6 datagram, to the destination
-// address dst through the endpoint c, copying the payload from b. It
-// returns the number of bytes written. The control message cm allows
-// the IPv6 header fields and the datagram path to be specified. The
+// address dst through the endpoint c, copying the payload from b. It
+// returns the number of bytes written. The control message cm allows
+// the IPv6 header fields and the datagram path to be specified. The
// cm may be nil if control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() {
diff --git a/vendor/golang.org/x/net/lif/address.go b/vendor/golang.org/x/net/lif/address.go
index f9b34aed0..afb957fd8 100644
--- a/vendor/golang.org/x/net/lif/address.go
+++ b/vendor/golang.org/x/net/lif/address.go
@@ -67,7 +67,7 @@ func Addrs(af int, name string) ([]Addr, error) {
continue
}
sa := (*sockaddrStorage)(unsafe.Pointer(&lifr.Lifru[0]))
- l := int(littleEndian.Uint32(lifr.Lifru1[:4]))
+ l := int(nativeEndian.Uint32(lifr.Lifru1[:4]))
if l == 0 {
continue
}
@@ -77,7 +77,7 @@ func Addrs(af int, name string) ([]Addr, error) {
copy(a.IP[:], lifr.Lifru[4:8])
as = append(as, a)
case sysAF_INET6:
- a := &Inet6Addr{PrefixLen: l, ZoneID: int(littleEndian.Uint32(lifr.Lifru[24:28]))}
+ a := &Inet6Addr{PrefixLen: l, ZoneID: int(nativeEndian.Uint32(lifr.Lifru[24:28]))}
copy(a.IP[:], lifr.Lifru[8:24])
as = append(as, a)
}
diff --git a/vendor/golang.org/x/net/lif/binary.go b/vendor/golang.org/x/net/lif/binary.go
index aade9eafa..738a94f42 100644
--- a/vendor/golang.org/x/net/lif/binary.go
+++ b/vendor/golang.org/x/net/lif/binary.go
@@ -12,7 +12,10 @@ package lif
// library. Therefore the package set used in the package must be the
// same as net package.
-var littleEndian binaryLittleEndian
+var (
+ littleEndian binaryLittleEndian
+ bigEndian binaryBigEndian
+)
type binaryByteOrder interface {
Uint16([]byte) uint16
@@ -66,3 +69,47 @@ func (binaryLittleEndian) PutUint64(b []byte, v uint64) {
b[6] = byte(v >> 48)
b[7] = byte(v >> 56)
}
+
+type binaryBigEndian struct{}
+
+func (binaryBigEndian) Uint16(b []byte) uint16 {
+ _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
+ return uint16(b[1]) | uint16(b[0])<<8
+}
+
+func (binaryBigEndian) PutUint16(b []byte, v uint16) {
+ _ = b[1] // early bounds check to guarantee safety of writes below
+ b[0] = byte(v >> 8)
+ b[1] = byte(v)
+}
+
+func (binaryBigEndian) Uint32(b []byte) uint32 {
+ _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
+ return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
+}
+
+func (binaryBigEndian) PutUint32(b []byte, v uint32) {
+ _ = b[3] // early bounds check to guarantee safety of writes below
+ b[0] = byte(v >> 24)
+ b[1] = byte(v >> 16)
+ b[2] = byte(v >> 8)
+ b[3] = byte(v)
+}
+
+func (binaryBigEndian) Uint64(b []byte) uint64 {
+ _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
+ return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
+ uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
+}
+
+func (binaryBigEndian) PutUint64(b []byte, v uint64) {
+ _ = b[7] // early bounds check to guarantee safety of writes below
+ b[0] = byte(v >> 56)
+ b[1] = byte(v >> 48)
+ b[2] = byte(v >> 40)
+ b[3] = byte(v >> 32)
+ b[4] = byte(v >> 24)
+ b[5] = byte(v >> 16)
+ b[6] = byte(v >> 8)
+ b[7] = byte(v)
+}
diff --git a/vendor/golang.org/x/net/lif/link.go b/vendor/golang.org/x/net/lif/link.go
index 76fa6c687..fce6b2147 100644
--- a/vendor/golang.org/x/net/lif/link.go
+++ b/vendor/golang.org/x/net/lif/link.go
@@ -31,15 +31,15 @@ func (ll *Link) fetch(s uintptr) {
}
ioc := int64(sysSIOCGLIFINDEX)
if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil {
- ll.Index = int(littleEndian.Uint32(lifr.Lifru[:4]))
+ ll.Index = int(nativeEndian.Uint32(lifr.Lifru[:4]))
}
ioc = int64(sysSIOCGLIFFLAGS)
if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil {
- ll.Flags = int(littleEndian.Uint64(lifr.Lifru[:8]))
+ ll.Flags = int(nativeEndian.Uint64(lifr.Lifru[:8]))
}
ioc = int64(sysSIOCGLIFMTU)
if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil {
- ll.MTU = int(littleEndian.Uint32(lifr.Lifru[:4]))
+ ll.MTU = int(nativeEndian.Uint32(lifr.Lifru[:4]))
}
switch ll.Type {
case sysIFT_IPV4, sysIFT_IPV6, sysIFT_6TO4:
@@ -84,7 +84,11 @@ func links(eps []endpoint, name string) ([]Link, error) {
b := make([]byte, lifn.Count*sizeofLifreq)
lifc.Family = uint16(ep.af)
lifc.Len = lifn.Count * sizeofLifreq
- littleEndian.PutUint64(lifc.Lifcu[:], uint64(uintptr(unsafe.Pointer(&b[0]))))
+ if len(lifc.Lifcu) == 8 {
+ nativeEndian.PutUint64(lifc.Lifcu[:], uint64(uintptr(unsafe.Pointer(&b[0]))))
+ } else {
+ nativeEndian.PutUint32(lifc.Lifcu[:], uint32(uintptr(unsafe.Pointer(&b[0]))))
+ }
ioc = int64(sysSIOCGLIFCONF)
if err := ioctl(ep.s, uintptr(ioc), unsafe.Pointer(&lifc)); err != nil {
continue
diff --git a/vendor/golang.org/x/net/lif/sys.go b/vendor/golang.org/x/net/lif/sys.go
new file mode 100644
index 000000000..c896041b7
--- /dev/null
+++ b/vendor/golang.org/x/net/lif/sys.go
@@ -0,0 +1,21 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build solaris
+
+package lif
+
+import "unsafe"
+
+var nativeEndian binaryByteOrder
+
+func init() {
+ i := uint32(1)
+ b := (*[4]byte)(unsafe.Pointer(&i))
+ if b[0] == 1 {
+ nativeEndian = littleEndian
+ } else {
+ nativeEndian = bigEndian
+ }
+}
diff --git a/vendor/golang.org/x/net/lif/sys_solaris_amd64.s b/vendor/golang.org/x/net/lif/sys_solaris_amd64.s
index 1ebca3739..39d76af79 100644
--- a/vendor/golang.org/x/net/lif/sys_solaris_amd64.s
+++ b/vendor/golang.org/x/net/lif/sys_solaris_amd64.s
@@ -6,6 +6,3 @@
TEXT ·sysvicall6(SB),NOSPLIT,$0-88
JMP syscall·sysvicall6(SB)
-
-TEXT ·keepAlive(SB),NOSPLIT,$0
- RET
diff --git a/vendor/golang.org/x/net/lif/syscall.go b/vendor/golang.org/x/net/lif/syscall.go
index 5fe073620..aadab2e14 100644
--- a/vendor/golang.org/x/net/lif/syscall.go
+++ b/vendor/golang.org/x/net/lif/syscall.go
@@ -19,13 +19,8 @@ var procIoctl uintptr
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
-// TODO: replace with runtime.KeepAlive when available
-//go:noescape
-func keepAlive(p unsafe.Pointer)
-
func ioctl(s, ioc uintptr, arg unsafe.Pointer) error {
_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0)
- keepAlive(arg)
if errno != 0 {
return error(errno)
}
diff --git a/vendor/golang.org/x/net/proxy/socks5.go b/vendor/golang.org/x/net/proxy/socks5.go
index 9b9628239..973f57f19 100644
--- a/vendor/golang.org/x/net/proxy/socks5.go
+++ b/vendor/golang.org/x/net/proxy/socks5.go
@@ -72,24 +72,28 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
if err != nil {
return nil, err
}
- closeConn := &conn
- defer func() {
- if closeConn != nil {
- (*closeConn).Close()
- }
- }()
+ if err := s.connect(conn, addr); err != nil {
+ conn.Close()
+ return nil, err
+ }
+ return conn, nil
+}
- host, portStr, err := net.SplitHostPort(addr)
+// connect takes an existing connection to a socks5 proxy server,
+// and commands the server to extend that connection to target,
+// which must be a canonical address with a host and port.
+func (s *socks5) connect(conn net.Conn, target string) error {
+ host, portStr, err := net.SplitHostPort(target)
if err != nil {
- return nil, err
+ return err
}
port, err := strconv.Atoi(portStr)
if err != nil {
- return nil, errors.New("proxy: failed to parse port number: " + portStr)
+ return errors.New("proxy: failed to parse port number: " + portStr)
}
if port < 1 || port > 0xffff {
- return nil, errors.New("proxy: port number out of range: " + portStr)
+ return errors.New("proxy: port number out of range: " + portStr)
}
// the size here is just an estimate
@@ -103,17 +107,17 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
}
if _, err := conn.Write(buf); err != nil {
- return nil, errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
- return nil, errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
if buf[0] != 5 {
- return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0])))
+ return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0])))
}
if buf[1] == 0xff {
- return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication")
+ return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication")
}
if buf[1] == socks5AuthPassword {
@@ -125,15 +129,15 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
buf = append(buf, s.password...)
if _, err := conn.Write(buf); err != nil {
- return nil, errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
- return nil, errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
if buf[1] != 0 {
- return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password")
+ return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password")
}
}
@@ -150,7 +154,7 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
buf = append(buf, ip...)
} else {
if len(host) > 255 {
- return nil, errors.New("proxy: destination hostname too long: " + host)
+ return errors.New("proxy: destination hostname too long: " + host)
}
buf = append(buf, socks5Domain)
buf = append(buf, byte(len(host)))
@@ -159,11 +163,11 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
buf = append(buf, byte(port>>8), byte(port))
if _, err := conn.Write(buf); err != nil {
- return nil, errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
if _, err := io.ReadFull(conn, buf[:4]); err != nil {
- return nil, errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
failure := "unknown error"
@@ -172,7 +176,7 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
}
if len(failure) > 0 {
- return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure)
+ return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure)
}
bytesToDiscard := 0
@@ -184,11 +188,11 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
case socks5Domain:
_, err := io.ReadFull(conn, buf[:1])
if err != nil {
- return nil, errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
bytesToDiscard = int(buf[0])
default:
- return nil, errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr)
+ return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr)
}
if cap(buf) < bytesToDiscard {
@@ -197,14 +201,13 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
buf = buf[:bytesToDiscard]
}
if _, err := io.ReadFull(conn, buf); err != nil {
- return nil, errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
// Also need to discard the port number
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
- return nil, errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error())
+ return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error())
}
- closeConn = nil
- return conn, nil
+ return nil
}
diff --git a/vendor/golang.org/x/net/publicsuffix/table.go b/vendor/golang.org/x/net/publicsuffix/table.go
index bf20c036b..5db1e6986 100644
--- a/vendor/golang.org/x/net/publicsuffix/table.go
+++ b/vendor/golang.org/x/net/publicsuffix/table.go
@@ -2,7 +2,7 @@
package publicsuffix
-const version = "publicsuffix.org's public_suffix_list.dat, git revision 915565885d0fbd25caf7d8b339cd3478f558da94 (2016-10-19T08:16:09Z)"
+const version = "publicsuffix.org's public_suffix_list.dat, git revision 45a2bf8ef3e22000fbe4bfa5f9252db41d777001 (2017-01-18T01:04:06Z)"
const (
nodesBitsChildren = 9
@@ -23,446 +23,447 @@ const (
)
// numTLD is the number of top level domains.
-const numTLD = 1553
+const numTLD = 1554
// Text is the combined text of all labels.
-const text = "biellaakesvuemieleccebieszczadygeyachimatainaircraftraeumtgerade" +
- "alstahaugesunderseaportsinfolldalaskanittedallasalleasinglesango" +
- "ppdalinzaintuitateshinanomachintaifun-dnsaliaskimitsubatamicable" +
- "-modembetsukuinuyamanouchikuhokuryugasakitaurayasudabievatmallor" +
- "cadaquesanjotateyamabifukagawalmartatsunobihorologyuzhno-sakhali" +
- "nskaszubybikedagestangebilbaogakievenesannaninomiyakonojoshkar-o" +
- "lawabillustrationirasakinvestmentsannohelplfinancialipetskatowic" +
- "ebiobirdartcenterprisesakikuchikuseikarugapartmentsanokatsushika" +
- "beeldengeluidunloppacificasinore-og-uvdalivornobirkenesoddtangen" +
- "ovarabirthplacebjarkoybjerkreimdbalatinorddalillyonagoyastronomy" +
- "asustor-elvdalwaysdatabaseballangenoamishirasatochigiessenebakke" +
- "shibechambagriculturennebudapest-a-la-masionativeamericanantique" +
- "s3-ap-northeast-2bjugnieznordlandunsantabarbarablockbusternidupo" +
- "ntariobloombergbauernrtattoolsztynsettlersantacruzsantafedextras" +
- "pace-to-rentalstomakomaibarabloxcmsanukis-a-candidatebluedaplier" +
- "neustarhubalestrandabergamoarekeymachineues3-us-west-1bmoattachm" +
- "entsaotomeloyalistjordalshalsenishiazais-a-catererbmsapodhalewis" +
- "millerbmweirbnpparibaselburgloppenzaogashimadachicagoboatsapporo" +
- "bnrwfarmsteadurbanamexhibitionishigotsukisosakitagawabomloanswat" +
- "ch-and-clockerbondurhamburgmbhartiffanybonnishiharabookingminaka" +
- "michiharabootsaratovalleaostatoilomzaporizhzheguris-a-celticsfan" +
- "ishiizunazukis-a-chefarsundvrcambridgestonewyorkshirecreationish" +
- "ikatakayamatsuzakis-a-conservativefsncfdvrdnsiskinkyotobetsumida" +
- "tlanticateringebudejjuedischesapeakebayernurembergmodenakanotodd" +
- "enishikatsuragithubusercontentaxihuanishikawazukanazawaboschaeff" +
- "lerdalorenskogmxfinitybostikatsuyamaseratis-a-cpadoval-daostaval" +
- "leybostonakijinsekikogentingrimstadwgripebotanicalgardenishimera" +
- "botanicgardenishinomiyashironobotanybouncemerckmsdnipropetrovskl" +
- "eppalmspringsakerbounty-fullensakerrypropertiesardegnamsosnowiec" +
- "atholicheltenham-radio-openair-traffic-controlleyboutiquebecngri" +
- "wataraidyndns-ipamperedchefashionishinoomotegovtgorybozentsujiie" +
- "bradescorporationishinoshimatta-varjjatjeldsundyndns-mailotenkaw" +
- "abrandywinevalleybrasiliabresciabrindisibenikebristolgaulardalot" +
- "tebritishcolumbialowiezaganquannefrankfurtjmaxxxjaworznowtvalled" +
- "-aostavangerbroadcastleclerchelyabinskypescaravantaabroadwaybrok" +
- "e-itjometlifeinsurancebrokerbronnoysundyndns-office-on-the-webca" +
- "mpobassociatesardiniabrothermesaverdeatnuorockartuzybrowsersafet" +
- "ymarketsarlottokorozawabrumunddalouvreitjxn--0trq7p7nnishiokoppe" +
- "gardyndns-picsarpsborgroks-thisayamanashiibaghdadultkmaxxn--11b4" +
- "c3dyndns-remotegildeskalmykiabrunelblagdenesnaaseralingenkainana" +
- "ejrietisalatinabenoboribetsucksarufutsunomiyawakasaikaitakoelnis" +
- "hitosashimizunaminamiashigarabrusselsasayamabruxellesaseboknowsi" +
- "tallowiczest-le-patrondheimperiabryanskodjeepostfoldnavyatkakami" +
- "gaharabrynewhampshirebungoonordreisa-geekaufenishiwakis-a-cubicl" +
- "e-slavellinotteroybuskerudinewhollandyndns-servercellikes-piedmo" +
- "ntblancomeeresaskatchewanggouvicenzabuzenissandnessjoenissayokos" +
- "hibahikariwanumatakazakis-a-democratmpanamabuzzgradyndns-weberli" +
- "ncolnissedalucaniabwhalingrondarbzhitomirkutskydivingrongacomput" +
- "erhistoryofscience-fictioncomsecuritytacticschulezajskddielddanu" +
- "orrikuzentakatajirissagamiharacondoshichinohealth-carereformitak" +
- "eharaconferenceconstructionconsuladoharuhrconsultanthropologycon" +
- "sultingvollutskfhappoumuenchencontactoyotomiyazakis-a-geekgalaxy" +
- "contemporaryarteducationalchikugojomedio-campidano-mediocampidan" +
- "omediocontractorskenconventureshinodesashibetsuikinderoycookingc" +
- "hannelveruminamibosogndaluxembourgujolstercoolkuszippodlasiellak" +
- "asamatsudovre-eikercoopencraftoyotsukaidownloadcopenhagencyclope" +
- "dichernovtsykkylvenetogakushimotoganewmexicoldwarmiamiastalowa-w" +
- "oladbrokesassaris-a-designerimarumorimachidacorsicagliaridagawal" +
- "tercorvettenrightathomegoodschwarzgwangjuifminamidaitomangotemba" +
- "ixadacosenzamamibuilderschmidtre-gauldaluxurycostumedizinhistori" +
- "scheschweizjcbnluzerncouchpotatofriesciencecentersciencehistoryc" +
- "ouncilvivano-frankivskhabarovskhakassiacouponscientistockholmest" +
- "randcoursescjohnsoncq-acranbrookuwanalyticscotlandcreditcardcred" +
- "itunioncremonashorokanaiecrewiiheyaizuwakamatsubushikusakadogawa" +
- "cricketrzyncrimeacrotonewspapercrownprovidercrsvparaglidingulenc" +
- "ruisescrapper-sitecryptonomichigangwoncuisinellajollamericanexpr" +
- "essexyculturalcentertainmentoyouracuneocupcakecxn--1ctwolominama" +
- "takkofuefukihabororostrowwlkpmgunmarnardalcymruovatoystre-slidre" +
- "ttozawacyonabarussiacyouthdfcbankzlguovdageaidnufcfanfieldfiguer" +
- "estaurantozsdefilateliafilminamiechizenfinalfinancefineartservef" +
- "tparisor-fronfinlandfinnoyfirebaseapparliamentranbyfirenzefirest" +
- "onexus-east-1firmdaleirfjordfishingolffanservegame-serverisignfi" +
- "tjarqhachiojiyahikobeatservehalflifestylefitnessettlementrani-an" +
- "dria-barletta-trani-andriafjalerflesbergflickragerotikamakurazak" +
- "irkeneservehttparmaflightservehumourflirumansionserveirchiryukyu" +
- "ragifuchukotkakegawassamukawataricohdavvenjargausdaluccapitalone" +
- "wjerseyflogintogurafloraflorencefloridafloristanohatakaharulvikh" +
- "arkovalledaostavernflorokunohealthcareerserveminecraftraniandria" +
- "barlettatraniandriaflowerservemp3utilitiesquarezzoologicalvinkle" +
- "in-addrammenuernbergdyniabogadocscbggfareastcoastaldefence-burgj" +
- "emnes3-ap-northeast-1kappleaseating-organicbcg12000emmafanconaga" +
- "wakayamadridvagsoyericsson-aptibleangaviikadenaamesjevuemielno-i" +
- "p6flynnhubalsfjordiscountysnes3-us-west-2fndfoodnetworkshoppingf" +
- "or-ourfor-someetnedalfor-theaterforexrothruheredstoneforgotdnser" +
- "vep2parocherkasyzrankoshigayaltaijis-a-greenforli-cesena-forlice" +
- "senaforlikescandyndns-at-workinggrouparservepicservequakeforsale" +
- "irvikhersonforsandasuoloftranoyfortmissoulan-udefenseljordfortwo" +
- "rthachirogatakamoriokamikitayamatotakadaforuminamifuranofosneser" +
- "vesarcasmatartanddesignfotaruis-a-gurunzenfoxfordegreefreeboxost" +
- "rowiechitachinakagawatchandclockazimierz-dolnyfreemasonryfreibur" +
- "gfreightcmwildlifedjejuegoshikiminokamoenairlinedre-eikerfreseni" +
- "uscountryestateofdelawaredumbrellanbibaidarfribourgfriuli-v-giul" +
- "iafriuli-ve-giuliafriuli-vegiuliafriuli-venezia-giuliafriuli-ven" +
- "eziagiuliafriuli-vgiuliafriuliv-giuliafriulive-giuliafriulivegiu" +
- "liafriulivenezia-giuliafriuliveneziagiuliafriulivgiuliafrlfrogan" +
- "servicesettsurgeonshalloffamemergencyberlevagangaviikanonjis-a-h" +
- "ard-workerfrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azpartis-a" +
- "-hunterfrom-capebretonamiasakuchinotsuchiurakawarszawashingtondc" +
- "lkhmelnitskiyamasfjordenfrom-collectionfrom-ctransportransurlfro" +
- "m-dchitosetogitsuldalucernefrom-dell-ogliastrakhanawafrom-flande" +
- "rsevastopolefrom-gafrom-higashiagatsumagoirminamiiselectrapaniim" +
- "imatakatoris-a-knightpointtokamachippubetsubetsugaruslivinghisto" +
- "ryfrom-iafrom-idfrom-ilfrom-incheonfrom-ksevenassisicilyfrom-kyo" +
- "wariasahikawafrom-lancashireggio-calabriafrom-manxn--1qqw23afrom" +
- "-mdfrom-meguromskoguchikuzenfrom-microsoftbankhmelnytskyivallee-" +
- "aosteroyfrom-mnfrom-mochizukirovogradoyfrom-msewilliamhillfrom-m" +
- "tnfrom-nchloefrom-ndfrom-nefrom-nhktravelchannelfrom-njcpartners" +
- "franziskanerdpolicefrom-nminamiizukamitondabayashiogamagoriziafr" +
- "om-nvalleeaosteigenfrom-nyfrom-ohkurafrom-oketohmaorivnefrom-orf" +
- "rom-paderbornfrom-pratohnoshoooshikamaishimofusartshangrilangeva" +
- "grarboretumbriafrom-ris-a-landscaperugiafrom-schoenbrunnfrom-sdf" +
- "rom-tnfrom-txn--2m4a15efrom-utazuerichardlillehammerfest-mon-blo" +
- "gueurovisionfrom-vaksdalfrom-vtravelersinsurancefrom-wafrom-wiel" +
- "unnerfrom-wvanylvenicefrom-wyfrosinonefrostalbansharis-a-lawyerf" +
- "royahabadajozoraholtalenvironmentalconservationfstavropolitienda" +
- "fujiiderafujikawaguchikonefujiminohtawaramotoineppubolognakaniik" +
- "awatanagurafujinomiyadafujiokayamapartsharpartyfujisatoshonairpo" +
- "rtland-4-salernogatagajobojis-a-liberalfujisawafujishiroishidaka" +
- "biratoridellogliastraderfujitsurugashimamateramodalenfujixeroxn-" +
- "-30rr7yfujiyoshidafukayabeardubaiduckdnshomebuiltrdfukuchiyamada" +
- "fukudominichocolatemasekazofukuis-a-libertarianfukumitsubishigak" +
- "iryuohadanoshiroomurafukuokazakisarazurewebsiteshikagamiishibuka" +
- "wafukuroishikarikaturindalfukusakishiwadafukuyamagatakahashimama" +
- "kisofukushimarburgfunabashiriuchinadafunagatakahatakaishimoichin" +
- "osekigaharafunahashikamiamakusatsumasendaisennangonohejis-a-linu" +
- "x-useranishiaritabashikaoizumizakitchenfundaciofuoiskujukuriyama" +
- "rcheapasadenaklodzkodairafuosskoczowinbaltimore-og-romsdalimited" +
- "iscoveryonaguniversityoriikashibatakashimarylhurstjohnaval-d-aos" +
- "ta-valleyukibestadishakotankashiharaukraanghkepnord-frontierepai" +
- "rbusantiquest-a-la-maisondre-landebusinessebyklefrakkestadds3-ap" +
- "-southeast-2furnitureggio-emilia-romagnakanojohanamakinoharafuru" +
- "biraquarellebesbyglandfurudonostiafurukawairtelecityeatshawaiiji" +
- "marugame-hostingfusodegaurafussaintlouis-a-anarchistoireggiocala" +
- "briafutabayamaguchinomigawafutboldlygoingnowhere-for-moregontrai" +
- "lroadfuttsurugiminamimakis-a-llamarylandfuturemailingfvgfyis-a-m" +
- "usicianfylkesbiblackfridayfyresdalhannanmokuizumodernhannovarese" +
- "rveblogspotrentino-a-adigehanyuzenhapmirhareidsbergenharstadharv" +
- "estcelebrationhasamarahasaminami-alpssells-itrentino-aadigehashb" +
- "anghasudahasura-appassenger-associationhasviklabudhabikinokawaba" +
- "rthaebaruminamiminowahatogayahoohatoyamazakitahiroshimarriottren" +
- "tino-alto-adigehatsukaichikaiseis-a-painteractivegarsheis-a-pats" +
- "fanhattfjelldalhayashimamotobuildinghazuminobusellsyourhomeipavi" +
- "ancargodaddyndns-at-homednshimonosekikawahboehringerikehelsinkit" +
- "akamiizumisanofidelitysvardollshimosuwalkis-a-personaltrainerhem" +
- "bygdsforbundhemneshimotsukehemsedalhepforgeherokussldheroyhgtvsh" +
- "imotsumahigashichichibungotakadatinghigashihiroshimanehigashiizu" +
- "mozakitakatakanezawahigashikagawahigashikagurasoedahigashikawaki" +
- "taaikitakyushuaiahigashikurumeiwamarshallstatebankmpspbamblebtim" +
- "netz-2higashimatsushimarinehigashimatsuyamakitaakitadaitoigawahi" +
- "gashimurayamalatvuopmidoris-a-photographerokuappfizerhigashinaru" +
- "sembokukitamidsundhigashinehigashiomihachimanchesterhigashiosaka" +
- "sayamamotorcycleshinichinanhigashishirakawamatakaokamikoaniikapp" +
- "ugliahigashisumiyoshikawaminamiaikitamotosumitakaginankokubunjis" +
- "-a-playerhigashitsunotogawahigashiurausukitanakagusukumoduminami" +
- "ogunicomcastresistancehigashiyamatokoriyamanakakogawahigashiyodo" +
- "gawahigashiyoshinogaris-a-republicancerresearchaeologicalifornia" +
- "hiraizumisatohobby-sitehirakatashinagawahiranairtraffichofunator" +
- "ientexpressatxn--1ck2e1balsanagochihayaakasakawaharavennagasakik" +
- "onaikawachinaganoharamcoalaheadjudaicaaarborteaches-yogasawaraci" +
- "ngroks-theatreemersongdalenviknakamuratakahamannortonsbergladelm" +
- "enhorstackspacekitagataiwanairguardigitalimanowarudaugustowadaeg" +
- "ubs3-ap-southeast-1hirarahiratsukagawahirayaitakarazukamiminersh" +
- "injournalismailillesandefjordhistorichouseshinjukumanohitachiomi" +
- "yaginowaniihamatamakawajimaritimodellinghitachiotagooglecodespot" +
- "rentino-altoadigehitoyoshimifunehitradinghjartdalhjelmelandholec" +
- "kobierzyceholidayhomelinuxn--32vp30hagakhanamigawahomesecurityma" +
- "ceratakasagoperaunitextileitungsenhomesecuritypccwindmillhomesen" +
- "seminehomeunixn--3bst00minamisanrikubetsupplyhondahoneywellbeing" +
- "zonehongorgehonjyoitakasakitashiobarahornindalhorseoulminamitane" +
- "hortendofinternetrentino-s-tirollagrigentomologyhoteleshinkamigo" +
- "toyohashimototalhotmailhoyangerhoylandetroitskokonoehumanitieshi" +
- "nshinotsurgeryhurdalhurumajis-a-rockstarachowicehyllestadhyogori" +
- "s-a-socialistmeindianapolis-a-bloggerhyugawarahyundaiwafunehzcho" +
- "nanbugattipschlesischesaudajgorajlchoshibuyachiyodavvesiidazaifu" +
- "daigodoesntexistanbullensvanguardyndns-wikindleikangerjlljmpharm" +
- "acienshiojirishirifujiedajnjelenia-gorajoyentrentino-sued-tirolj" +
- "oyokaichibahcavuotnagaraumalselvendrelljpmorganjpnchoyodobashich" +
- "ikashukujitawarajprshioyamemorialjuniperjurkristiansundkrodshera" +
- "dkrokstadelvaldaostarnbergkryminamiyamashirokawanabelgorodeokuma" +
- "torinokumejimassa-carrara-massacarraramassabunkyonanaoshimageand" +
- "soundandvisionkumenanyokkaichirurgiens-dentistes-en-francekunisa" +
- "kis-an-artistcgroupgfoggiakunitachiarailwaykunitomigusukumamotoy" +
- "amasoykunneppulawykunstsammlungkunstunddesignkuokgrouphdkureisen" +
- "kurgankurobelaudibleborkdalkurogimilitarykuroisoftwarendalenugku" +
- "romatsunais-an-engineeringkurotakikawasakis-an-entertainerkursko" +
- "mmunalforbundkushirogawakustanais-bykusupplieshiranukaniepcekutc" +
- "hanelkutnokuzbassnillfjordkuzumakis-certifiedogawarabikomaezakir" +
- "unorthwesternmutualkvafjordkvalsundkvamfamberkeleykvanangenkvine" +
- "sdalkvinnheradkviteseidskogkvitsoykwpspjelkavikommunemitourismol" +
- "anciamitoyoakemiuramiyazumiyotamanomjondalenmlbfanmonmouthagebos" +
- "tadmonstermonticellombardiamondshiraois-into-carshintomikasahara" +
- "montrealestatefarmequipmentrentino-suedtirolmonza-brianzaporizhz" +
- "hiamonza-e-della-brianzapposhiraokanmakiyokawaramonzabrianzaptok" +
- "yotangotpantheonsitemonzaebrianzaramonzaedellabrianzamoparachuti" +
- "ngmordoviajessheiminanomoriyamatsunomoriyoshiokamitsuemormoneymo" +
- "royamatsusakahoginozawaonsenmortgagemoscowindowshiratakahagivest" +
- "bytomaritimekeepingmoseushistorymosjoenmoskeneshishikuis-into-ca" +
- "rtoonshinyoshitomiokaneyamaxunusualpersonmosshisognemosvikomorot" +
- "sukamisunagawamoviemovistargardmtpchristmasakikugawatchesauherad" +
- "yndns-workisboringrossetouchijiwadeloittevadsoccertificationissh" +
- "ingugemtranakatsugawamuenstermugithubcloudusercontentrentinoa-ad" +
- "igemuikamogawamukochikushinonsenergymulhouservebeermunakatanemun" +
- "cieszynmuosattemuphiladelphiaareadmyblogsitemurmanskomvuxn--3ds4" +
- "43gmurotorcraftrentinoaadigemusashimurayamatsushigemusashinohara" +
- "museetrentinoalto-adigemuseumverenigingmutsuzawamutuellevangermy" +
- "dissentrentinoaltoadigemydrobofagemydshisuifuelmyeffectrentinos-" +
- "tirolmyfritzwinnershitaramamyftphilatelymykolaivarggatrentinosti" +
- "rolmymediapchromedicaltanissettaishinomakimobetsuliguriamyokoham" +
- "amatsudamypepsonyoursidedyn-o-saurecipesaro-urbino-pesarourbinop" +
- "esaromamurogawawioshizukuishimogosenmypetshizuokannamiharumyphot" +
- "oshibahccavuotnagareyamalvikongsbergmypsxn--3e0b707emysecurityca" +
- "merakermyshopblockshoujis-into-gamessinashikiwakunigamihamadamyt" +
- "is-a-bookkeepermincommbankomonomyvnchryslerpictetrentinosud-tiro" +
- "lpictureshowtimeteorapphoenixn--3oq18vl8pn36apiemontepilotshrira" +
- "mlidlugolekagaminogiftsienaplesigdalpimientaketomisatomskongsvin" +
- "gerpinkoninjamisonpioneerpippuphonefosshowapiszpittsburghofastly" +
- "piwatepizzapkonskowolayangroupharmacyshirahamatonbetsurgutsiracu" +
- "saitoshimaplanetariuminnesotaketakatsukis-foundationplantationpl" +
- "antsilkonsulatrobeepilepsydneyplatformintelligenceplaystationpla" +
- "zaplchungbukazunoplombardyndns-blogdnsimbirskonyvelolplumbingopm" +
- "npodzonepohlpoivronpokerpokrovskooris-a-techietis-a-soxfanpolkow" +
- "icepoltavalle-aostarostwodzislawitdkopervikomforbananarepublicar" +
- "toonartdecoffeedbackplaneappalacemreviewskrakoweddinglassassinat" +
- "ionalheritagematsubarakawagoeu-1pomorzeszowithgoogleapisa-hockey" +
- "nutrentinosudtirolpordenonepornporsangerporsanguideltajimicrolig" +
- "htingporsgrunnanpoznanpraxis-a-bruinsfanprdpreservationpresidiop" +
- "rgmrprimelhusgardenprincipeprivatizehealthinsuranceprochowicepro" +
- "ductionsimple-urlprofauskedsmokorsetagayasells-for-ulsandoyprogr" +
- "essivegasiaprojectrentinosued-tirolpromombetsurfbsbxn--1lqs03npr" +
- "opertyprotectionprotonetrentinosuedtirolprudentialpruszkowithyou" +
- "tubeneventoeidsvollprzeworskogptplusterptzpvtrentoyonakagyokutoy" +
- "akokamishihoronobeokaminoyamatsuris-leetrentino-stirolpwchungnam" +
- "dalseidfjordynnsavannahgapzqldqponqslgbtrevisohughesirdalquicksy" +
- "teslingqvchurchaseljeffersoniyodogawastoragestordalstorenburgsto" +
- "rfjordstpetersburgstreamsterdamnserverbaniastudiostudyndns-homef" +
- "tpaccessnoasakakinokiastuff-4-salestufftoread-booksnesnzstuttgar" +
- "trogstadsurreysusakis-not-certifieducatorahimeshimakanegasakinko" +
- "bayashikshacknethnologysusonosuzakanrasuzukanumazurysuzukis-save" +
- "dunetbankolobrzegersundsvalbardudinkakudamatsuesveiosvelvikoseis" +
- "-a-therapistoiasvizzeraswedenswidnicarrierswiebodzindianmarketin" +
- "gswiftcoveronaritakurashikis-slickomaganeswinoujscienceandhistor" +
- "yswisshikis-uberleetrentino-sud-tirolturystykarasjohkamiokaminok" +
- "awanishiaizubangetuscanytushuissier-justicetuvalle-daostatichuva" +
- "shiatuxfamilyversicherungvestfoldvestnesolutionslupskoryolasitev" +
- "estre-slidreamhostersomavestre-totennishiawakuravestvagoyvevelst" +
- "advibo-valentiavibovalentiavideovillaskoyabearalvahkijobserverda" +
- "lvdalcesomnarashinovinnicartiervinnytsiavipsinaapphotographysiov" +
- "irginiavirtualvirtueeldomeindustriesteambulancevirtuelvisakegawa" +
- "vistaprinternationalfirearmsooviterboltromsakatakinouevivoldavla" +
- "dikavkazanvladimirvladivostokaizukarasuyamazoevlogoipiagetmyiphi" +
- "lipsyvolkenkundenvolkswagentsopotritonvologdanskoshunantokonameg" +
- "atakasugais-an-accountantshinshirovolvolgogradvolyngdalvoronezhy" +
- "tomyrvossevangenvotevotingvotoyonezawavrnworldworse-thanggliding" +
- "wowiwatsukiyonowruzhgorodoywritesthisblogsytewroclawloclawekostr" +
- "omahachijorpelandwtcirclegnicafederationwtfbx-oslodingenwuozuwww" +
- "mflabsor-odalwzmiuwajimaxn--4gq48lf9jeonnamerikawauexn--4it168dx" +
- "n--4it797kotohiradomainsurehabmerxn--4pvxsor-varangerxn--54b7fta" +
- "0ccitichernigovernmentoyookanzakiyosatokigawaxn--55qw42gxn--55qx" +
- "5dxn--5js045dxn--5rtp49civilaviationxn--5rtq34kotouraxn--5su34j9" +
- "36bgsgxn--5tzm5gxn--6btw5axn--6frz82gxn--6orx2rxn--6qq986b3xlxn-" +
- "-7t0a264civilisationxn--80adxhksorfoldxn--80ao21axn--80aqecdr1ax" +
- "n--80asehdbarclaycardsakuraibigawaurskog-holandroverhalla-spezia" +
- "grocerybnikahokutobishimaizurubtsovskiervaapsteiermarkariyakumol" +
- "dev-myqnapcloudcontrolappagefrontappagespeedmobilizerobiraeropor" +
- "talabamagasakishimabarackmaze12xn--80aswgxn--80audnedalnxn--8ltr" +
- "62kouhokutamakis-an-actorxn--8pvr4uxn--8y0a063axn--90a3academyac" +
- "tivedirectoryazannakadomari-elasticbeanstalkounosunndalxn--90ais" +
- "hobaraomoriguchiharahkkeravjudygarlandxn--90azhaibarakitahatakan" +
- "abeautydalxn--9dbhblg6dietcimmobilienxn--9dbq2axn--9et52uxn--9kr" +
- "t00axn--andy-iraxn--aroport-byanagawaxn--asky-iraxn--aurskog-hla" +
- "nd-jnbarclaysakyotanabellunordkappgafanpachigasakidsmynasushioba" +
- "ragusaarlandiskstationavigationavuotnakayamatsuuraustevollavagis" +
- "kebinagisochildrensgardenaturalhistorymuseumcenterepbodyndns-fre" +
- "ebox-oskolegokasells-for-less3-eu-central-1xn--avery-yuasakuhokk" +
- "aidontexisteingeekouyamashikis-an-actresshintokushimaxn--b-5gaxn" +
- "--b4w605ferdxn--bck1b9a5dre4civilizationxn--bdddj-mrabdxn--beara" +
- "lvhki-y4axn--berlevg-jxaxn--bhcavuotna-s4axn--bhccavuotna-k7axn-" +
- "-bidr-5nachikatsuuraxn--bievt-0qa2xn--bjarky-fyanaizuxn--bjddar-" +
- "ptamayufuettertdasnetzxn--blt-elabourxn--bmlo-graingerxn--bod-2n" +
- "aroyxn--brnny-wuaccident-investigationjukudoyamagadancebetsukuba" +
- "bia-goracleaningatlantabusebastopologyeonggiehtavuoatnadexeterim" +
- "o-i-ranagahamaroygardendoftheinternetflixilovecollegefantasyleag" +
- "uernseyxn--brnnysund-m8accident-preventionlineat-urlxn--brum-voa" +
- "gatromsojavald-aostaplesokanoyakagexn--btsfjord-9zaxn--c1avgxn--" +
- "c2br7gxn--c3s14misasaguris-into-animelbournexn--cck2b3barefootba" +
- "llooningliwiceventsalangenayoroddaustinnaturalsciencesnaturelles" +
- "3-eu-west-1xn--cg4bkis-very-badaddjamalborkangerxn--ciqpnxn--clc" +
- "hc0ea0b2g2a9gcdn77-sslattumisawaxn--comunicaes-v6a2oxn--correios" +
- "-e-telecomunicaes-ghc29axn--czr694bargainstitutelemarkashiwaraus" +
- "traliaisondriodejaneirochestereportarantours3-external-1xn--czrs" +
- "0trusteexn--czru2dxn--czrw28barreauctionflfanfshostrodawaraustrh" +
- "eimatunduhrennesoyokotebinorilskarlsoyokozebizenakamagayachts3-e" +
- "xternal-2xn--d1acj3barrel-of-knowledgeologyukuhashimojibmditchyo" +
- "uripalanakhodkanagawauthordalandroidgcahcesuolocalhistoryggeelvi" +
- "nckarmoyomitanobninskarpaczeladz-1xn--d1alfaromeoxn--d1atrvbarce" +
- "lonagasukeu-2xn--d5qv7z876civilwarmanagementoyosatoyokawaxn--dav" +
- "venjrga-y4axn--djrs72d6uyxn--djty4kouzushimashikokuchuoxn--dnna-" +
- "grajewolterskluwerxn--drbak-wuaxn--dyry-iraxn--e1a4claimsaves-th" +
- "e-whalessandria-trani-barletta-andriatranibarlettaandriaxn--eckv" +
- "dtc9dxn--efvn9sorreisahayakawakamiichikawamisatottoris-lostre-to" +
- "teneis-a-studentalxn--efvy88hair-surveillancexn--ehqz56nxn--elqq" +
- "16hakatanotaireshimokawaxn--estv75gxn--eveni-0qa01gaxn--f6qx53ax" +
- "n--fct429kozagawaxn--fhbeiarnxn--finny-yuaxn--fiq228c5hsortlandx" +
- "n--fiq64barrell-of-knowledgeometre-experts-comptablesalondonetsk" +
- "ashiwazakiyosemiteverbankasukabedzin-the-bandaioiraseeklogesuran" +
- "certmgretachikawakkanaibetsubamericanfamilydscloudcontrolledekaf" +
- "jordivtasvuodnagatorogersaltdalimoliserniautomotivecodynaliascol" +
- "i-picenoipirangamvikaruizawamusementaobaokinawashirosatochiokino" +
- "shimakeupowiathletajimabariakembuchikumagayagawakuyabukihokumako" +
- "gengerdalipayekaterinburgjerdrumckinseyokosukareliance164xn--fiq" +
- "s8sorumisakis-gonexn--fiqz9southcarolinazawaxn--fjord-lraxn--fjq" +
- "720axn--fl-ziaxn--flor-jraxn--flw351exn--fpcrj9c3dxn--frde-grand" +
- "rapidsouthwestfalenxn--frna-woaraisaijosoyrovigorlicexn--frya-hr" +
- "axn--fzc2c9e2clickchristiansburgroundhandlingroznyxn--fzys8d69uv" +
- "gmailxn--g2xx48clinichernihivanovosibirskautokeinoxn--gckr3f0fbx" +
- "ostrolekaluganskharkivgucciprianiigataitogliattirescrappingushik" +
- "amifuranosegawaxn--gecrj9cliniquenoharaxn--ggaviika-8ya47hakodat" +
- "exn--gildeskl-g0axn--givuotna-8yandexn--3pxu8kosugexn--gjvik-wua" +
- "xn--gk3at1exn--gls-elacaixaxn--gmq050is-very-evillagexn--gmqw5ax" +
- "n--h-2failxn--h1aeghakonexn--h2brj9clintonoshoesavonamsskoganeis" +
- "-a-doctorayxn--hbmer-xqaxn--hcesuolo-7ya35bashkiriautoscanadaeje" +
- "onbukarumaifarmerseinextdirectargets-itargivingjesdalavangenatur" +
- "bruksgymnaturhistorisches3-fips-us-gov-west-1xn--hery-iraxn--hge" +
- "bostad-g3axn--hmmrfeasta-s4acctrysiljan-mayenxn--hnefoss-q1axn--" +
- "hobl-iraxn--holtlen-hxaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn" +
- "--hylandet-54axn--i1b6b1a6a2exn--imr513nxn--indery-fyaotsurnadal" +
- "xn--io0a7is-very-goodhandsonxn--j1aefermobilyxn--j1amhakubankhva" +
- "olbia-tempio-olbiatempioolbialystokkemerovodkagoshimalopolskanla" +
- "ndxn--j6w193gxn--jlq61u9w7basilicataniaveroykeniwaizumiotsukumiy" +
- "amazonawsabaerobaticketsaritsynologyeongnamegawakeisenbahnatuurw" +
- "etenschappenaumburgjovikasaokamisatokashikiwienaustdalazioceanog" +
- "raphics3-sa-east-1xn--jlster-byaroslavlaanderenxn--jrpeland-54ax" +
- "n--jvr189misconfusedxn--k7yn95exn--karmy-yuaxn--kbrq7oxn--kcrx77" +
- "d1x4axn--kfjord-iuaxn--klbu-woaxn--klt787dxn--kltp7dxn--kltx9axn" +
- "--klty5xn--42c2d9axn--koluokta-7ya57hakuis-a-nascarfanxn--kprw13" +
- "dxn--kpry57dxn--kpu716ferraraxn--kput3is-very-nicexn--krager-gya" +
- "sakaiminatoyonoxn--kranghke-b0axn--krdsherad-m8axn--krehamn-dxax" +
- "n--krjohka-hwab49jetztrentino-sudtirolxn--ksnes-uuaxn--kvfjord-n" +
- "xaxn--kvitsy-fyasugis-very-sweetpepperxn--kvnangen-k0axn--l-1fai" +
- "rwindsowaxn--l1accentureklamborghiniizaxn--laheadju-7yasuokarate" +
- "xn--langevg-jxaxn--lcvr32dxn--ldingen-q1axn--leagaviika-52basket" +
- "ballfinanzgoravocatanzarowebhopocznoceanographiquehimeji234xn--l" +
- "esund-huaxn--lgbbat1ad8jevnakershuscultureggioemiliaromagnakasat" +
- "sunais-a-teacherkassymantechnologyxn--lgrd-poacoachampionshiphop" +
- "tobamagazinebraskaunjargallupinbatodayurihonjournalisteinkjerusa" +
- "lembroideryusuharavoues3-us-gov-west-1xn--lhppi-xqaxn--linds-pra" +
- "mericanartulansokndalxn--lns-qlanxesspreadbettingxn--loabt-0qaxn" +
- "--lrdal-sraxn--lrenskog-54axn--lt-liaclothingrpanasonichernivtsi" +
- "ciliaxn--lten-granexn--lury-iraxn--mely-iraxn--merker-kuaxn--mgb" +
- "2ddespydebergxn--mgb9awbferrarittogoldpoint2thisamitsukexn--mgba" +
- "3a3ejtunesolarssonxn--mgba3a4f16axn--mgba3a4franamizuholdingsmil" +
- "eksvikozakis-an-anarchistoricalsocietyumenxn--mgba7c0bbn0axn--mg" +
- "baakc7dvferreroticanonoichinomiyakexn--mgbaam7a8hakusandiegoodye" +
- "arthadselfipassagenshellaspeziaxn--mgbab2bdxn--mgbai9a5eva00bats" +
- "fjordivttasvuotnaharimaniwakuratexascolipicenord-aurdalpha-myqna" +
- "pcloudappspotagerhcloudfunctionsalvadordalibabaikaliszczytnord-o" +
- "dalindasdaburyatiaarpaleomutashinaiinetarnobrzegyptianhlfanhsalz" +
- "burglobalashovhachinohedmarkasumigaurawa-mazowszexboxenapponazur" +
- "e-mobilevje-og-hornnesamegawaxasnesoddenmarkhangelskjervoyagemol" +
- "ogicallyngenglanddnskingjerstadotsuruokamchatkameokameyamashinat" +
- "sukigatakamatsukawaetnagaivuotnagaokakyotambabydgoszczecinemagen" +
- "tositelekommunikationthewifiat-band-campaniamallamaintenanceobih" +
- "irosakikamijimattelefonicarbonia-iglesias-carboniaiglesiascarbon" +
- "iabruzzoologyeongbuk-uralsk12xn--mgbai9azgqp6jewelryxn--mgbayh7g" +
- "paduaxn--mgbb9fbpobanazawaxn--mgbbh1a71exn--mgbc0a9azcgxn--mgbca" +
- "7dzdoxn--mgberp4a5d4a87gxn--mgberp4a5d4arxn--mgbi4ecexposedxn--m" +
- "gbpl2fhskpnxn--mgbqly7c0a67fbcloudnsdojoetsuwanouchikujogaszkola" +
- "hppiacenzakopanerairforcexn--mgbqly7cvafredrikstadtverranzanxn--" +
- "mgbt3dhdxn--mgbtf8flatangerxn--mgbtx2bauhausposts-and-telecommun" +
- "icationsnasadodgeorgeorgiaxn--mgbx4cd0abbottunkosherbrookegawaxn" +
- "--mix082fetsundxn--mix891fgxn--1lqs71dxn--mjndalen-64axn--mk0axi" +
- "nfinitis-with-thebandoomdnsfor-better-thandaxn--mk1bu44cnsaxoxn-" +
- "-mkru45isleofmandalxn--mlatvuopmi-s4axn--mli-tlapyatigorskppspie" +
- "gelxn--mlselv-iuaxn--moreke-juaxn--mori-qsakuragawaxn--mosjen-ey" +
- "atominamiawajikissmarterthanyoustkarasjokomakiyosumycdn77-secure" +
- "chtrainingxn--mot-tlaquilancasterxn--mre-og-romsdal-qqbbcasadela" +
- "monedatsunanjoburglobodoes-itvedestrandiyusuisserveexchangexn--m" +
- "sy-ula0haldenxn--mtta-vrjjat-k7afamilycompanycntoyotaris-a-finan" +
- "cialadvisor-aurdalukowhoswhokksundynv6xn--muost-0qaxn--mxtq1mish" +
- "imatsumaebashimodatexn--ngbc5azdxn--ngbe9e0axn--ngbrxn--45brj9ci" +
- "rcus-2xn--nit225krasnodarxn--nmesjevuemie-tcbajddarchaeologyxn--" +
- "nnx388axn--nodexn--nqv7fs00emaxn--nry-yla5gxn--ntso0iqx3axn--nts" +
- "q17gxn--nttery-byaeservecounterstrikexn--nvuotna-hwaxn--nyqy26ax" +
- "n--o1achattanooganorfolkebiblegallocus-1xn--o3cw4halsaitamatsuku" +
- "ris-a-nurservebbshimokitayamaxn--od0algxn--od0aq3bbtarumizusawax" +
- "n--ogbpf8flekkefjordxn--oppegrd-ixaxn--ostery-fyatsukaratsuginam" +
- "ikatagamihoboleslawiecolonialwilliamsburgruexn--osyro-wuaxn--p1a" +
- "cfhvalerxn--p1aiwchoseirouterxn--pbt977coloradoplateaudioxn--pgb" +
- "s0dhlxn--porsgu-sta26fidonnakaiwamizawaxn--pssu33lxn--pssy2uxn--" +
- "q9jyb4columbusheyxn--qcka1pmcdonaldsrlxn--qqqt11missilelxn--qxam" +
- "urskjakdnepropetrovskiptveterinairealtorlandxn--rady-iraxn--rdal" +
- "-poaxn--rde-ularvikrasnoyarskomitamamuraxn--rdy-0nabarixn--renne" +
- "sy-v1axn--rhkkervju-01aflakstadaokagakibichuoxn--rholt-mragowood" +
- "sidexn--rhqv96gxn--rht27zxn--rht3dxn--rht61exn--risa-5narusawaxn" +
- "--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmskog-byatsushiroxn--" +
- "rny31hammarfeastafricapetownnews-stagingxn--rovu88bbvacationsupd" +
- "atelevisionikiitatebayashijonawatexn--rros-granvindafjordxn--rsk" +
- "og-uuaxn--rst-0narutomobellevuelosangelesjaguarchitecturealtychy" +
- "attorneyagawalbrzycharternopilawalesundxn--rsta-francaiseharaxn-" +
- "-ryken-vuaxn--ryrvik-byawaraxn--s-1faitheguardianxn--s9brj9commu" +
- "nitysfjordyroyrvikinguitarsbschokoladenxn--sandnessjen-ogbizhevs" +
- "kredirectmeldalxn--sandy-yuaxn--seral-lraxn--ses554gxn--sgne-gra" +
- "tangenxn--skierv-utazaskvolloabathsbcomobaraxn--skjervy-v1axn--s" +
- "kjk-soaxn--sknit-yqaxn--sknland-fxaxn--slat-5narviikananporovnox" +
- "n--slt-elabbvieeexn--smla-hraxn--smna-gratis-a-bulls-fanxn--snas" +
- "e-nraxn--sndre-land-0cbremangerxn--snes-poaxn--snsa-roaxn--sr-au" +
- "rdal-l8axn--sr-fron-q1axn--sr-odal-q1axn--sr-varanger-ggbentleyu" +
- "uconnectatamotorsamnangerxn--srfold-byawatahamaxn--srreisa-q1axn" +
- "--srum-grazxn--stfold-9xaxn--stjrdal-s1axn--stjrdalshalsen-sqbep" +
- "publishproxyzgorzeleccolognewportlligatewayuzawaxn--stre-toten-z" +
- "cbsrtroandinosaurlandesmolenskosaigawaxn--t60b56axn--tckweatherc" +
- "hannelxn--tiq49xqyjewishartgalleryxn--tjme-hraxn--tn0agrinet-fre" +
- "aksrvaroyxn--tnsberg-q1axn--tor131oxn--trany-yuaxn--trgstad-r1ax" +
- "n--trna-woaxn--troms-zuaxn--tysvr-vraxn--uc0atvdonskoshimizumaki" +
- "zunokunimilanoxn--uc0ay4axn--uist22hamurakamigoriginshimonitayan" +
- "agitlaborxn--uisz3gxn--unjrga-rtambovenneslaskerrylogisticsologn" +
- "exn--unup4yxn--uuwu58axn--vads-jraxn--vard-jraxn--vegrshei-c0axn" +
- "--vermgensberater-ctberndnpalermomasvuotnakatombetsupportatarsta" +
- "nikkoebenhavnikolaevennodessaikiraxn--vermgensberatung-pwbeskidy" +
- "nathomedepotenzachpomorskienikonantanangerxn--vestvgy-ixa6oxn--v" +
- "g-yiabcn-north-1xn--vgan-qoaxn--vgsy-qoa0jfkomatsushimashikexn--" +
- "vgu402comparemarkerryhotelscholarshipschooluroyxn--vhquversaille" +
- "solundbeckosakaerodromegalsacechirealminamiuonumasudaxn--vler-qo" +
- "axn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861bestbuysh" +
- "ousesamsclubindalindesnesamsunglogowegroweibolzanordre-landrange" +
- "dalinkasuyakutiaxn--w4r85el8fhu5dnraxn--w4rs40lxn--wcvs22dxn--wg" +
- "bh1compute-1xn--wgbl6axn--xhq521betainaboxfusejnynysagaeroclubme" +
- "decincinnationwidealerxn--xkc2al3hye2axn--xkc2dl3a5ee0hangoutsys" +
- "temscloudfrontdoorxn--y9a3aquariumisugitokuyamatsumotofukexn--ye" +
- "r-znarvikristiansandcatshirakoenigxn--yfro4i67oxn--ygarden-p1axn" +
- "--ygbi2ammxn--45q11citadeliveryokamikawanehonbetsurutaharaxn--ys" +
- "tre-slidre-ujbieigersundrivelandrobaknoluoktaikicks-assedicaseih" +
- "ichisobetsuitaipeiheijiiyamanobeauxartsandcraftsandvikcoromantov" +
- "alle-d-aostathellexusdecorativeartsanfranciscofreakunemurorangei" +
- "seiyoichiropracticasertairaxn--zbx025dxn--zf0ao64axn--zf0avxn--4" +
- "gbriminingxn--zfr164bielawallonieruchomoscienceandindustryninohe" +
- "kinannestadrudmurtiaxperiaxz"
+const text = "bikedagestangeorgeorgiaxagrocerybnikahokutobishimaizuruhreportar" +
+ "nobrzegyptianaturalhistorymuseumcentereviewskrakoweddinggfarmers" +
+ "einexus-2bilbaogakievenesalangenikiiyamanouchikuhokuryugasakitau" +
+ "rayasudabillustrationikkoebenhavnikolaevennodessagamiharabiomuta" +
+ "shinainfinitintuitattoolsztynsettlersalondonetskarpaczeladzjcbre" +
+ "mangerbirdartcenterprisesakikuchikuseikarugapartmentsaltdalimoli" +
+ "serniabirkenesoddtangenovaravennagasukeverbankaruizawabirthplace" +
+ "vje-og-hornnesalvadordalibabajddarchaeologyusuisserveexchangebja" +
+ "rkoyuufcfanikonantanangerbjerkreimbalsanagochihayaakasakawaharau" +
+ "malopolskanlandds3-us-west-1bjugninohekinannestadrangedalindasda" +
+ "burblockbusternidray-dnsupdaterbloombergbauerninomiyakonojosoyro" +
+ "rosalzburgjovikarumaifarmsteadraydnsamegawabloxcmsamnangerblueda" +
+ "ncebmoattachmentsamsclubindalindesnesamsungladell-ogliastraderbm" +
+ "sandvikcoromantovalle-d-aostatic-accessanfranciscofreakunemurora" +
+ "ngeiseiyoichiropracticasinordre-landrivelandrobaknoluoktabuseekl" +
+ "ogesurancertmgretachikawakkanaibetsubamericanfamilydscloudcontro" +
+ "lledekafjordrudunsangoppdalivornobmweirbnpparibaselburglassassin" +
+ "ationalheritagematsubarakawagoebnrwfarsundupontariobonnirasakinu" +
+ "yamashinashikitchenishiazainvestmentsanjournalismailillesandefjo" +
+ "rdurbanamexhibitionishigobookingliwicebootsannanishiharaboschaef" +
+ "flerdalomzaporizhzhegurinzais-a-bulls-fanishiizunazukis-a-candid" +
+ "atebostikasaokamiminersannohelplfinancialorenskoglobalashovhachi" +
+ "nohedmarkashibatakasakiyokawarabostonakijinsekikogentinglobodoes" +
+ "-itvedestrandurhamburglogowhalingloppenzaogashimadachicagoboatsa" +
+ "nokashiharabotanicalgardenishikatakayamatta-varjjataxihuanishika" +
+ "tsuragithubusercontentgoryuzawabotanicgardenishikawazukamitondab" +
+ "ayashiogamagoriziabotanybouncemerckmsdnipropetrovskjakdnepropetr" +
+ "ovskiervaapsteiermarkashiwarabounty-fullensakerrypropertiesantab" +
+ "arbaraboutiquebecngmbhartiffanybozentsujiiebradescorporationishi" +
+ "merabrandywinevalleybrasiliabresciabrindisibenikebristoloslocalh" +
+ "istoryggeelvinckashiwazakiyosatokashikiyosemitebritishcolumbialo" +
+ "wiezachpomorskienishinomiyashironobroadcastlefrakkestadvrcambrid" +
+ "gestonextdirectjeldsundvrdnsantacruzsantafedextraspacekitagataji" +
+ "rittogoldpoint2thisamitsukebroadwaybroke-itjmaxxxboxenapponazure" +
+ "-mobilebrokerbronnoysundwgminakamichiharabrothermesaverdeatnurem" +
+ "bergmodellingmxfinitybrowsersafetymarketsanukis-a-catererbrumund" +
+ "dalotenkawabrunelasticbeanstalkasukabedzin-the-bandaikawachinaga" +
+ "noharamcoalaskanittedallasalleasinglest-mon-blogueurovisionthewi" +
+ "fiat-band-campaniabrusselsaotomemergencyberlevagangaviikanonjis-" +
+ "a-celticsfanishinoomotegobruxellesapodlasiellakasamatsudovre-eik" +
+ "erbryanskjervoyagebrynewhampshirebungoonordlandyndns-at-workingg" +
+ "roupalacebuskerudinewjerseybuzenishinoshimattelefonicarbonia-igl" +
+ "esias-carboniaiglesiascarboniabuzzlgrimstadyndns-blogdnsapporobw" +
+ "hoswhokksundyndns-freebox-ostrowiecateringebuilderschmidtre-gaul" +
+ "dalottebzhitomirumalselvendrellottokonamegatakasugais-a-chefashi" +
+ "onishiokoppegardyndns-homednsardegnamsskoganeis-a-conservativefs" +
+ "nillfjordyndns-ipaleocondoshichinohealth-carereformitakeharaconf" +
+ "erenceconstructionconsuladoesntexistanbullensvanguardyndns-wikin" +
+ "dlegokasells-for-lessaudaconsultanthropologyconsultingvolluxuryc" +
+ "ontactoyookanmakiwakunigamifunecontemporaryarteducationalchikugo" +
+ "doharuovatoyosatoyakokonoecontractorskenconventureshinodesashibe" +
+ "tsuikinderoycookingchannelblagdenesnaaseralingenkainanaejrietisa" +
+ "latinabenonichernihivanovodkagoshimalvikasumigaurawa-mazowszexjc" +
+ "palermomahachijorpelandyndns-mailouvreisenishitosashimizunaminam" +
+ "iashigaracoolkuszkoladbrokesauheradyndns-workisboringrpamperedch" +
+ "efastlylbaltimore-og-romsdalwaysdatabaseballangenoamishirasatoch" +
+ "igiessenebakkeshibechambagriculturennebudejjudygarlandigitalavan" +
+ "genavigationavuotnaklodzkodairamusementarumizusawabruzzoologyeon" +
+ "gbuk12cooperaunitemasekatsushikabeeldengeluidyndns1copenhagencyc" +
+ "lopedichernivtsiciliacorsicagliarightathomeftpanamacorvettenriku" +
+ "zentakataitogliattiresavannahgacosenzaganquannakadomaritimekeepi" +
+ "ngatlantaijis-a-financialadvisor-aurdaluzerncosidnsfor-better-th" +
+ "anawawildlifedjeffersoncostumedio-campidano-mediocampidanomedioc" +
+ "ouchpotatofriesaves-the-whalessandria-trani-barletta-andriatrani" +
+ "barlettaandriacouncilvivano-frankivskatsuyamasfjordencouponsavon" +
+ "aplesaxocoursesbschokoladencq-acranbrookuwanalyticscholarshipsch" +
+ "oolcreditcardynnschulezajskydivingruecreditunioncremonashorokana" +
+ "iecrewilliamhillcricketrzyncrimeastcoastaldefencecrotonewyorkshi" +
+ "recipesaro-urbino-pesarourbinopesaromasvuotnaharimamurogawacrown" +
+ "providercrsvpanasonichernovtsykkylvenetogakushimotoganewportllig" +
+ "atjxn--0trq7p7nnishiwakis-a-cpadoval-daostavalleycruiseschwarzgw" +
+ "angjuegoshikiminokamoenairtraffichiryukyuragifuchungbukasuyaltak" +
+ "ashimaseratis-a-cubicle-slavellinowtvalleaostatoilowiczest-le-pa" +
+ "trondheimmobilienissandnessjoenissayokoshibahikariwanumatakazaki" +
+ "s-a-democratkmaxxn--11b4c3dyndns-office-on-the-webcampobassociat" +
+ "esardiniacryptonomichigangwoncuisinellahppiacenzakopanerairguard" +
+ "ynv6culturalcentertainmentoyotaris-a-geekgalaxycuneocupcakecxn--" +
+ "1ctwolominamatakkokaminokawanishiaizubangecymrussiacyonabarulsan" +
+ "doycyouthdfcbankaufenfiguerestaurantoyotomiyazakis-a-greenfilate" +
+ "liafilminamiawajikis-a-guruslivinghistoryfinalfinancefineartscie" +
+ "ntistoragefinlandfinnoyfirebaseapparliamentoyotsukaidownloadfire" +
+ "nzefirestonefirmdaleirfjordfishingolffanscjohnsonfitjarqhachioji" +
+ "yahikobeatscotlandfitnessettlementoyourafjalerflesbergushikamifu" +
+ "ranoshiroomuraflickragerotikakamigaharaflightscrapper-siteflirfl" +
+ "ogintogurafloraflorencefloridavvesiidazaifudaigojomedizinhistori" +
+ "schescrappingxn--1lqs71dfloristanohatakahamaniwakuratexascolipic" +
+ "enord-aurdalipayflorogerserveftparmaflowerservegame-serversaille" +
+ "servehalflifestyleflynnhubambleclercartoonartdecoldwarmiamibugat" +
+ "tipschlesisches3-us-west-2fndfoodnetworkshoppingfor-ourfor-somee" +
+ "thnologyfor-theaterforexrothruherecreationforgotdnservehttparoch" +
+ "erkasyno-dservehumourforli-cesena-forlicesenaforlikescandynamic-" +
+ "dnserveirchitachinakagawatchandclockaszubyforsaleirvikazoforsand" +
+ "asuoloftoystre-slidrettozawafortmissoulair-traffic-controlleyfor" +
+ "tworthachirogatakahatakaishimogosenforuminamibosogndalfosneserve" +
+ "minecraftozsdev-myqnapcloudcontrolappspotagerfotaruis-a-hard-wor" +
+ "kerfoxfordedyn-ip24freeboxoservemp3utilitiesquarezzoologicalvink" +
+ "lein-addrammenuernbergdyniabogadocscbnl-o-g-i-nativeamericananti" +
+ "ques3-ap-northeast-1kappchizippodhaleangaviikadenadexeterepbodyn" +
+ "athomebuilt3l3p0rtargets-itargiving12000emmafanconagawakayamadri" +
+ "dvagsoyericssonyoursidealerimo-i-ranaamesjevuemielno-ip6freemaso" +
+ "nryfreiburgfreightcminamidaitomangotsukisosakitagawafreseniuscou" +
+ "ntryestateofdelawaredstonefribourgfriuli-v-giuliafriuli-ve-giuli" +
+ "afriuli-vegiuliafriuli-venezia-giuliafriuli-veneziagiuliafriuli-" +
+ "vgiuliafriuliv-giuliafriulive-giuliafriulivegiuliafriulivenezia-" +
+ "giuliafriuliveneziagiuliafriulivgiuliafrlfroganservep2parservepi" +
+ "cservequakefrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azwinbana" +
+ "narepublicasadelamonedatsunanjoburgjerstadotsuruokakegawasnesodd" +
+ "enmarkhangelskiptveterinairealtychyattorneyagawalmartatamotors3-" +
+ "ap-south-1from-capebretonamiastapleservesarcasmatartanddesignfro" +
+ "m-collectionfrom-ctrani-andria-barletta-trani-andriafrom-dchitos" +
+ "etogitsuldalucaniafrom-defenseljordfrom-flanderservicesettsurgeo" +
+ "nshalloffamemorialfrom-gausdalfrom-higashiagatsumagoizumizakiraf" +
+ "rom-iafrom-idfrom-ilfrom-incheonfrom-ksevastopolefrom-kyowariasa" +
+ "hikawafrom-lajollamericanexpressexyfrom-mannortonsbergfrom-mdfro" +
+ "m-megurokunohealthcareersevenassisicilyfrom-midoris-a-hunterfrom" +
+ "-mnfrom-mochizukirkenesewindmillfrom-msfranziskanerdpolicefrom-m" +
+ "tnfrom-nchloefrom-ndfrom-nefrom-nhktraniandriabarlettatraniandri" +
+ "afrom-njelenia-gorafrom-nminamiechizenfrom-nvalled-aostavangerfr" +
+ "om-nyfrom-ohkurafrom-oketohmansionshangrilanciafrom-orfrom-pader" +
+ "bornfrom-pratohnoshoooshikamaishimodatextileitungsenfrom-ris-a-k" +
+ "nightpointtokaizukameokameyamatotakadafrom-schoenbrunnfrom-sdfro" +
+ "m-tnfrom-txn--1qqw23afrom-utazuerichardlillehammerfeste-ipartis-" +
+ "a-landscaperfrom-vaksdalfrom-vtranoyfrom-wafrom-wielunnerfrom-wv" +
+ "alledaostavernfrom-wyfrosinonefrostalowa-wolawafroyahababyglandf" +
+ "stcgroupartnersharis-a-lawyerfujiiderafujikawaguchikonefujiminoh" +
+ "tawaramotoineppubolognakanotoddenfujinomiyadafujiokayamanxn--2m4" +
+ "a15efujisatoshonairportland-4-salernoboribetsucksharpartshawaiij" +
+ "imarugame-hostrodawarafujisawafujishiroishidakabiratoridegreefuj" +
+ "itsurugashimamateramodalenfujixeroxn--30rr7yfujiyoshidafukayabea" +
+ "rdubaiduckdnshellaspeziafukuchiyamadafukudominichocolatelevision" +
+ "issedaluccapitalonewmexicoffeedbackplaneapplinzis-a-designerimar" +
+ "umorimachidafukuis-a-liberalfukumitsubishigakirovogradoyfukuokaz" +
+ "akiryuohadanotaireshimojis-a-libertarianfukuroishikarikaturindal" +
+ "fukusakisarazurewebsiteshikagamiishibukawafukuyamagatakaharustka" +
+ "noyakagefunabashiriuchinadafunagatakahashimamakishiwadafunahashi" +
+ "kamiamakusatsumasendaisennangonohejis-a-linux-useranishiaritabas" +
+ "hijonawatefundaciofuoiskujukuriyamaoris-a-llamarylandfuosskoczow" +
+ "indowshimokawafurnituredumbrellanbibaidarfurubiraquarelleborkang" +
+ "erfurudonostiaarpartyfurukawairtelecityeatshimokitayamafusodegau" +
+ "rafussaikisofukushimapasadenamsosnowiechofunatorientexpressarluc" +
+ "ernefutabayamaguchinomigawafutboldlygoingnowhere-for-moregontrai" +
+ "lroadfuttsurugimperiafuturehostingfuturemailingfvgfyis-a-musicia" +
+ "nfylkesbiblackfridayfyresdalhangglidinghangoutsystemscloudfrontd" +
+ "oorhannanmokuizumodenakasatsunais-a-painteractivegarsheis-a-pats" +
+ "fanhannotteroyhanyuzenhapmirhareidsbergenharstadharvestcelebrati" +
+ "onhasamarnardalhasaminami-alpssells-itransportransurlhashbanghas" +
+ "udahasura-appassenger-associationhasvikazunohatogayahoohatoyamaz" +
+ "akitahiroshimarriottrapaniimimatakatoris-a-personaltrainerhatsuk" +
+ "aichikaiseis-a-photographerokuappaviancargodaddynaliascoli-picen" +
+ "oipirangamvikddielddanuorrissagaeroclubmedecincinnationwidealsta" +
+ "haugesunderseaportsinfolldalabamagasakishimabarackmazehattfjelld" +
+ "alhayashimamotobungotakadapliernewhollandhazuminobusellsyourhome" +
+ "goodshimotsumahboehringerikehelsinkitakamiizumisanofidelitysvard" +
+ "ollshinichinanhembygdsforbundhemneshinjournalistjohnhemsedalhepf" +
+ "orgeherokussldheroyhgtvallee-aosteroyhigashichichibunkyonanaoshi" +
+ "mageandsoundandvisionhigashihiroshimanehigashiizumozakitakatakam" +
+ "oriokalmykiahigashikagawahigashikagurasoedahigashikawakitaaikita" +
+ "kyushuaiahigashikurumeiwamarshallstatebankfhappouhigashimatsushi" +
+ "maritimodernhigashimatsuyamakitaakitadaitoigawahigashimurayamamo" +
+ "torcycleshinjukumanohigashinarusembokukitamidsundhigashinehigash" +
+ "iomihachimanchesterhigashiosakasayamanakakogawahigashishirakawam" +
+ "atakanabeautydalhigashisumiyoshikawaminamiaikitamotosumitakagild" +
+ "eskaliszhigashitsunowruzhgorodeohigashiurausukitanakagusukumodum" +
+ "inamiiselectravelchannelhigashiyamatokoriyamanashifteditchyourip" +
+ "fizerhigashiyodogawahigashiyoshinogaris-a-playerhiraizumisatohob" +
+ "by-sitehirakatashinagawahiranais-a-republicancerresearchaeologic" +
+ "aliforniahirarahiratsukagawahirayaitakanezawahistorichouseshinka" +
+ "migotoyohashimotoshimahitachiomiyaginankokubunjis-a-rockstaracho" +
+ "wicehitachiotagooglecodespotravelersinsurancehitraeumtgeradeloit" +
+ "tevadsoccertificationhjartdalhjelmelandholeckobierzyceholidayhom" +
+ "eipgfoggiahomelinkhakassiahomelinuxn--32vp30haebaruminamifuranoh" +
+ "omeofficehomesecuritymaceratakaokaluganskodjejuifminamiizukamiok" +
+ "amikitayamatsuris-a-socialistmein-vigorgehomesecuritypccwinnersh" +
+ "inshinotsurgeryhomesenseminehomeunixn--3bst00minamimakis-a-soxfa" +
+ "nhondahoneywellbeingzonehongopocznosegawahonjyoitakarazukamakura" +
+ "zakitashiobarahornindalhorseoulminamiminowahortendofinternet-dns" +
+ "hinshirohospitalhoteleshintokushimahotmailhoyangerhoylandetroits" +
+ "kolelhumanitieshintomikasaharahurdalhurumajis-a-studentalhyllest" +
+ "adhyogoris-a-teacherkassymantechnologyhyugawarahyundaiwafunehzch" +
+ "onanbuildingripescaravantaajlchoyodobashichikashukujitawarajlljm" +
+ "pharmacienshirakofuefukihaboromskoguchikuzenjnjeonnamerikawauejo" +
+ "yokaichibahcavuotnagaranzannefrankfurtrentino-alto-adigejpmorgan" +
+ "jpnjprshiranukamogawajuniperjurkoshunantokigawakosugekotohiradom" +
+ "ainsureggiocalabriakotourakouhokutamakis-an-artisteinkjerusalemb" +
+ "roiderykounosupplieshiraokanagawakouyamashikokuchuokouzushimasoy" +
+ "kozagawakozakis-an-engineeringkpnkppspdnshiratakahagivestbytomar" +
+ "idagawassamukawataricohdatingkrasnodarkredirectmeldalkristiansan" +
+ "dcatshishikuis-an-entertainerkristiansundkrodsheradkrokstadelval" +
+ "daostarostwodzislawioshisognekryminamisanrikubetsupportrentino-a" +
+ "ltoadigekumatorinokumejimasudakumenanyokkaichirurgiens-dentistes" +
+ "-en-francekunisakis-bykunitachiarailwaykunitomigusukumamotoyamas" +
+ "sa-carrara-massacarraramassabusinessebyklegallocus-1kunneppulawy" +
+ "kunstsammlungkunstunddesignkuokgrouphdkureggioemiliaromagnakayam" +
+ "atsumaebashikshacknetrentino-s-tirollagrigentomologyeonggiehtavu" +
+ "oatnagaivuotnagaokakyotambabia-goracleaningkurgankurobelaudibleb" +
+ "timnetzkurogimilanokuroisoftwarendalenugkuromatsunais-certifiedo" +
+ "gawarabikomaezakirunorthwesternmutualkurotakikawasakis-foundatio" +
+ "nkushirogawakusupplykutchanelkutnokuzumakis-gonekvafjordkvalsund" +
+ "kvamfamberkeleykvanangenkvinesdalkvinnheradkviteseidskogkvitsoyk" +
+ "wpspiegelkzmissilevangermisugitokorozawamitourismolancastermitoy" +
+ "oakemiuramiyazumiyotamanomjondalenmlbfanmonmouthagebostadmonster" +
+ "monticellombardiamondshisuifuelveruminamitanemontrealestatefarme" +
+ "quipmentrentino-stirolmonza-brianzaporizhzhiamonza-e-della-brian" +
+ "zapposhitaramamonzabrianzaptokuyamatsusakahoginowaniihamatamakaw" +
+ "ajimarburgmonzaebrianzaramonzaedellabrianzamoparachutingmordovia" +
+ "jessheiminamiuonumatsumotofukemoriyamatsushigemoriyoshimilitarym" +
+ "ormoneymoroyamatsuuramortgagemoscowitdkmpspbarcelonagasakijobser" +
+ "verisignieznord-odalaziobihirosakikamijimassnasaarlandd-dnshome-" +
+ "webservercellikes-piedmontblancomeeres3-ap-southeast-1moseushist" +
+ "orymosjoenmoskeneshizukuishimofusaitamatsukuris-into-gamessinats" +
+ "ukigatakasagotembaixadamosshizuokananporovigotpantheonsitemosvik" +
+ "nx-serveronakatsugawamoteginozawaonsenmoviemovistargardmtpchrist" +
+ "masakikugawatchesarufutsunomiyawakasaikaitakoelniyodogawamtranby" +
+ "muenstermugithubcloudusercontentrentino-sud-tirolmuikamisatokama" +
+ "chippubetsubetsugarumukochikushinonsenergymulhouservebeermunakat" +
+ "anemuncieszynmuosattemuphiladelphiaareadmyblogsitemurmanskolobrz" +
+ "egersundmurotorcraftrentino-sudtirolmusashimurayamatsuzakis-leet" +
+ "rdmusashinoharamuseetrentino-sued-tirolmuseumverenigingmutsuzawa" +
+ "mutuellewismillermy-vigorlicemy-wanggouvicenzamyactivedirectorym" +
+ "yasustor-elvdalmycdn77-securechtrainingmydissentrentino-suedtiro" +
+ "lmydrobofagemydshoujis-lostre-toteneis-a-techietis-a-therapistoi" +
+ "amyeffectrentinoa-adigemyfirewallonieruchomoscienceandindustrynm" +
+ "yfritzmyftpaccesshowamyfusionmyhome-serverrankoshigayamelhusgard" +
+ "enmykolaivaolbia-tempio-olbiatempioolbialystokkepnogiftshowtimet" +
+ "eorapphilatelymymediapchromedicaltanissettairamyokohamamatsudamy" +
+ "pepsongdalenviknakanojohanamakinoharamypetshriramlidlugolekagami" +
+ "nogatagajobojis-not-certifieducatorahimeshimakanegasakinkobayash" +
+ "ikaoirminamiogunicomcastresistancemyphotoshibahccavuotnagareyama" +
+ "lborkdalvdalcesienarashinomypsxn--3e0b707emysecuritycamerakermys" +
+ "hopblocksigdalmyvnchryslerpictetrentinoaadigepicturesimple-urlpi" +
+ "emontepilotsirdalpimientaketomisatolgapinkomakiyosunndalpioneerp" +
+ "ippuphoenixn--3oq18vl8pn36apiszpittsburghofauskedsmokorsetagayas" +
+ "ells-for-ulvikautokeinopiwatepizzapkomatsushimashikizunokunimiho" +
+ "boleslawiechristiansburgriwataraidyndns-picsarpsborgroks-thisaya" +
+ "manobeokakudamatsueplanetariuminamiyamashirokawanabellevuelosang" +
+ "elesjaguarchitecturealtorlandplantationplantslingplatforminanopl" +
+ "aystationplazaplchungnamdalseidfjordyndns-remotewdyndns-serverda" +
+ "luroyplombardynamisches-dnslupskomforbarclaycards3-website-ap-no" +
+ "rtheast-1plumbingopmnpodzonepohlpoivronpokerpokrovskommunalforbu" +
+ "ndpolitiendapolkowicepoltavalle-aostathellexusdecorativeartsnoas" +
+ "aitomobellunorddalpomorzeszowithgoogleapisa-hockeynutsiracusakat" +
+ "akinouepordenonepornporsangerporsanguidelmenhorstalbansokanazawa" +
+ "porsgrunnanpoznanpraxis-a-bookkeeperugiaprdpreservationpresidiop" +
+ "rgmrprimeloyalistockholmestrandprincipeprivatizehealthinsurancep" +
+ "rochowiceproductionsokndalprofbsbxn--1lqs03nprogressivegasiaproj" +
+ "ectrentinoalto-adigepromombetsurfbx-ostrowwlkpmgulenpropertyprot" +
+ "ectionprotonetrentinoaltoadigeprudentialpruszkowithyoutubentleyp" +
+ "rzeworskogptplusterpvtrentinos-tirolpwchurchaseljeepostfoldnavyp" +
+ "zqldqponqslgbtrentinostirolquicksytesolarssonqvcirclegnicafedera" +
+ "tionstufftoread-booksnesolundbeckommunestuttgartrentoyokawasusak" +
+ "is-slickharkovalleeaosteigensusonosuzakaneyamazoesuzukaniepcesuz" +
+ "ukis-uberleetrentino-a-adigesvalbardunloppacificircustomersveios" +
+ "velvikomvuxn--3ds443gsvizzeraswedenswidnicarrierswiebodzindianap" +
+ "olis-a-bloggerswiftcoversicherungswinoujscienceandhistoryswisshi" +
+ "kis-very-badaddjamisonsynology-dsolutionsolognetuscanytushuissie" +
+ "r-justicetuvalle-daostaticsootuxfamilyvenneslaskerrylogisticsopo" +
+ "trentinosud-tirolvestfoldvestnesor-odalvestre-slidreamhostersor-" +
+ "varangervestre-totennishiawakuravestvagoyvevelstadvibo-valentiav" +
+ "ibovalentiavideovillaskoyabearalvahkihokumakogengerdalpha-myqnap" +
+ "cloudapplebesbydgoszczecinemakeupowiathletajimabariakembuchikuma" +
+ "gayagawakuyabukicks-assedicitadeliveryvinnicartiervinnytsiavipsi" +
+ "naapphonefossilkomaganevirginiavirtualvirtueeldomeindianmarketin" +
+ "gvirtuelvisakegawavistaprinternationalfirearmsorfoldviterboltroa" +
+ "ndinosaurepaircraftrevisohughesomavivoldavlaanderenvladikavkazim" +
+ "ierz-dolnyvladimirvlogoiphotographysiovolkswagentsorreisahayakaw" +
+ "akamiichikawamisatotalvologdanskongsvingervolvolkenkundenvolyngd" +
+ "alvossevangenvotevotingvotoyonakagyokutoursortlandworldworse-tha" +
+ "ndawowiwatsukiyonowritesthisblogsytewroclawloclawekoninjavald-ao" +
+ "starnbergwtciticatholicheltenham-radio-opencraftranagatorodoywtf" +
+ "bxosciencecentersciencehistorywuozuwwwmflabsorumincommbanklabudh" +
+ "abikinokawabarthagakhanamigawawzmiuwajimaxn--4gq48lf9jetztrentin" +
+ "o-aadigexn--4it168dxn--4it797konsulatrobeepilepsydneyxn--4pvxsou" +
+ "thcarolinazawaxn--54b7fta0ccivilizationxn--55qw42gxn--55qx5dxn--" +
+ "5js045dxn--5rtp49civilwarmanagementmpalmspringsakerxn--5rtq34kon" +
+ "yvelolxn--5su34j936bgsgxn--5tzm5gxn--6btw5axn--6frz82gxn--6orx2r" +
+ "xn--6qq986b3xlxn--7t0a264claimsasayamaxn--80adxhksouthwestfalenx" +
+ "n--80ao21axn--80aqecdr1axn--80asehdbarefootballooningjesdalillyo" +
+ "mbondiscountysnes3-website-ap-southeast-2xn--80aswgxn--80audneda" +
+ "lnxn--8ltr62kooris-an-actorxn--8pvr4uxn--8y0a063axn--90a3academy" +
+ "-firewall-gatewayxn--90aishobaraomoriguchiharahkkeravjuedischesa" +
+ "peakebayernrtrogstadxn--90azhytomyrxn--9dbhblg6dietcimdbargainst" +
+ "itutelemarkaratsuginamikatagamiharuconnectatarantottoribestadisc" +
+ "overyomitanobirastronomy-gatewayokosukanzakiwienaturalsciencesna" +
+ "turelles3-ap-southeast-2xn--9dbq2axn--9et52uxn--9krt00axn--andy-" +
+ "iraxn--aroport-byanaizuxn--asky-iraxn--aurskog-hland-jnbarreauct" +
+ "ionayorovnobninskarelianceu-1xn--avery-yuasakuhokkaidontexistein" +
+ "geekopervikhmelnitskiyamashikexn--b-5gaxn--b4w605ferdxn--bck1b9a" +
+ "5dre4clickatowicexn--bdddj-mrabdxn--bearalvhki-y4axn--berlevg-jx" +
+ "axn--bhcavuotna-s4axn--bhccavuotna-k7axn--bidr-5nachikatsuuraxn-" +
+ "-bievt-0qa2xn--bjarky-fyandexn--3pxu8konskowolayangroupharmacysh" +
+ "iraois-an-accountantshinyoshitomiokamitsuexn--bjddar-ptamayufuet" +
+ "tertdasnetzxn--blt-elabourxn--bmlo-graingerxn--bod-2naroyxn--brn" +
+ "ny-wuaccident-investigation-aptibleaseating-organicbcn-north-1xn" +
+ "--brnnysund-m8accident-prevention-webhopenairbusantiquest-a-la-m" +
+ "aisondre-landebudapest-a-la-masionionjukudoyamagazineat-urlxn--b" +
+ "rum-voagatromsakakinokiaxn--btsfjord-9zaxn--c1avgxn--c2br7gxn--c" +
+ "3s14mintelligencexn--cck2b3barrel-of-knowledgemologicallyngenvir" +
+ "onmentalconservationflfanfshostrolekamisunagawaugustowadaegubs3-" +
+ "ca-central-1xn--cg4bkis-very-evillagexn--ciqpnxn--clchc0ea0b2g2a" +
+ "9gcdn77-sslattumisakis-into-carshioyanagawaxn--comunicaes-v6a2ox" +
+ "n--correios-e-telecomunicaes-ghc29axn--czr694barrell-of-knowledg" +
+ "eologyonagoyaukraanghkeymachineustarhubalestrandabergamoareke164" +
+ "xn--czrs0tromsojaworznoxn--czru2dxn--czrw28bashkiriaurskog-holan" +
+ "droverhalla-speziaeroportalaheadjudaicaaarborteaches-yogasawarac" +
+ "ingroks-theatree12xn--d1acj3basilicataniaustevollarvikarasjokara" +
+ "suyamarylhurstjordalshalsenaturbruksgymnaturhistorisches3-eu-cen" +
+ "tral-1xn--d1alfaromeoxn--d1atrusteexn--d5qv7z876clinichernigover" +
+ "nmentjometlifeinsurancexn--davvenjrga-y4axn--djrs72d6uyxn--djty4" +
+ "koryokamikawanehonbetsurutaharaxn--dnna-grajewolterskluwerxn--dr" +
+ "bak-wuaxn--dyry-iraxn--e1a4cliniquenoharaxn--eckvdtc9dxn--efvn9s" +
+ "owaxn--efvy88haibarakitahatakamatsukawaxn--ehqz56nxn--elqq16hair" +
+ "-surveillancexn--estv75gxn--eveni-0qa01gaxn--f6qx53axn--fct429ko" +
+ "saigawaxn--fhbeiarnxn--finny-yuaxn--fiq228c5hspjelkavikomonoxn--" +
+ "fiq64basketballfinanzgoraustinnatuurwetenschappenaumburgjemnes3-" +
+ "eu-west-1xn--fiqs8spreadbettingxn--fiqz9spydebergxn--fjord-lraxn" +
+ "--fjq720axn--fl-ziaxn--flor-jraxn--flw351exn--fpcrj9c3dxn--frde-" +
+ "grandrapidsrlxn--frna-woaraisaijotrvarggatritonxn--frya-hraxn--f" +
+ "zc2c9e2clintonoshoesaseboknowsitallutskypexn--fzys8d69uvgmailxn-" +
+ "-g2xx48clothingrondarxn--gckr3f0fermobilyxn--gecrj9cloudnsdojoet" +
+ "suwanouchikujogaszczytnore-og-uvdaluxembourgrongaxn--ggaviika-8y" +
+ "a47hakatanotogawaxn--gildeskl-g0axn--givuotna-8yaotsurreyxn--gjv" +
+ "ik-wuaxn--gk3at1exn--gls-elacaixaxn--gmq050is-very-goodhandsonxn" +
+ "--gmqw5axn--h-2failxn--h1aeghakodatexn--h2brj9cnsaskatchewanxn--" +
+ "hbmer-xqaxn--hcesuolo-7ya35batodayonaguniversityoriikariyakumold" +
+ "eltaiwanairlinedre-eikerxn--hery-iraxn--hgebostad-g3axn--hmmrfea" +
+ "sta-s4acctrysiljan-mayenxn--hnefoss-q1axn--hobl-iraxn--holtlen-h" +
+ "xaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn--hylandet-54axn--i1b" +
+ "6b1a6a2exn--imr513nxn--indery-fyasakaiminatoyonezawaxn--io0a7is-" +
+ "very-nicexn--j1aeferraraxn--j1amhakonexn--j6w193gxn--jlq61u9w7ba" +
+ "tsfjordishakotankarlsoyoshiokarasjohkamikoaniikappugliaustraliai" +
+ "sondriodejaneirochesterhcloudfunctions3-external-1xn--jlster-bya" +
+ "sugis-very-sweetpepperxn--jrpeland-54axn--jvr189misasaguris-into" +
+ "-cartoonshirahamatonbetsurnadalxn--k7yn95exn--karmy-yuaxn--kbrq7" +
+ "oxn--kcrx77d1x4axn--kfjord-iuaxn--klbu-woaxn--klt787dxn--kltp7dx" +
+ "n--kltx9axn--klty5xn--42c2d9axn--koluokta-7ya57hakubadajozorahol" +
+ "taleniwaizumiotsukumiyamazonawsabaerobaticketshimonosekikawaxn--" +
+ "kprw13dxn--kpry57dxn--kpu716ferrarivnexn--kput3is-with-thebandoo" +
+ "mdnsiskinkyotobetsumidatlantichoseiroumuenchenisshingugexn--krag" +
+ "er-gyasuokanraxn--kranghke-b0axn--krdsherad-m8axn--krehamn-dxaxn" +
+ "--krjohka-hwab49jevnakershuscultureggio-emilia-romagnakatombetsu" +
+ "my-routerxn--ksnes-uuaxn--kvfjord-nxaxn--kvitsy-fyatomitamamurax" +
+ "n--kvnangen-k0axn--l-1fairwindsrtrentinosudtirolxn--l1accenturek" +
+ "lamborghiniizaxn--laheadju-7yatsukanumazuryxn--langevg-jxaxn--lc" +
+ "vr32dxn--ldingen-q1axn--leagaviika-52bauhausposts-and-telecommun" +
+ "icationsncfdivtasvuodnakaiwamizawaustrheimatunduhrennesoyokotebi" +
+ "nagisochildrensgardenaustdalavagiskebinorfolkebibleikangerxn--le" +
+ "sund-huaxn--lgbbat1ad8jewelryxn--lgrd-poacoachampionshiphoptobam" +
+ "agentositelekommunikationlinebraskaunjargallupinbbcaseihichisobe" +
+ "tsuitainairforceoceanographics3-website-eu-west-1xn--lhppi-xqaxn" +
+ "--linds-pramericanartulangevagrarboretumbriamallamaintenancechir" +
+ "ealminnesotaketakatsukis-into-animelbournexn--lns-qlansrvareserv" +
+ "eblogspotrentinosued-tirolxn--loabt-0qaxn--lrdal-sraxn--lrenskog" +
+ "-54axn--lt-liacntoyonoxn--lten-granexn--lury-iraxn--mely-iraxn--" +
+ "merker-kuaxn--mgb2ddestordalxn--mgb9awbferreroticanonoichinomiya" +
+ "kexn--mgba3a3ejtunesomnaritakurashikis-savedunetbankharkivguccip" +
+ "rianiigataishinomakimobetsuliguriaxn--mgba3a4f16axn--mgba3a4fran" +
+ "amizuholdingsmileksvikosakaerodromegalsacebetsukubankhmelnytskyi" +
+ "vanylvenicexn--mgba7c0bbn0axn--mgbaakc7dvfetsundynvpnxn--mgbaam7" +
+ "a8hakuis-a-nascarfanxn--mgbab2bdxn--mgbai9a5eva00bbtateshinanoma" +
+ "chintaifun-dnsaliaskimitsubatamicable-modembetsukuibigawauthorda" +
+ "landroiddnskingjerdrumckinseyokozebizenakaniikawatanaguraetnagah" +
+ "amaroygardendoftheinternetflixilovecollegefantasyleaguernseyboml" +
+ "oans3-ap-northeast-2xn--mgbai9azgqp6jewishartgalleryxn--mgbayh7g" +
+ "padualstackspace-to-rentalstomakomaibaraxn--mgbb9fbpobanazawaxn-" +
+ "-mgbbh1a71exn--mgbc0a9azcgxn--mgbca7dzdoxn--mgberp4a5d4a87gxn--m" +
+ "gberp4a5d4arxn--mgbi4ecexposedxn--mgbpl2fhskleppiagetmyiphilipsy" +
+ "nology-diskstationxn--mgbqly7c0a67fbcolonialwilliamsburgrossetou" +
+ "chijiwadellogliastradingroundhandlingroznyxn--mgbqly7cvafredriks" +
+ "tadtvstoreitrentinosuedtirolxn--mgbt3dhdxn--mgbtf8flatangerxn--m" +
+ "gbtx2bbvacationswatch-and-clockerxn--mgbx4cd0abbottunkongsbergxn" +
+ "--mix082fgunmarcheaparisor-fronxn--mix891fhvalerxn--mjndalen-64a" +
+ "xn--mk0axindustriesteambulancexn--mk1bu44coloradoplateaudioxn--m" +
+ "kru45isleofmandalxn--mlatvuopmi-s4axn--mli-tlanxesstorfjordxn--m" +
+ "lselv-iuaxn--moreke-juaxn--mori-qsakuragawaxn--mosjen-eyatsushir" +
+ "oxn--mot-tlapyxn--mre-og-romsdal-qqbeppublishproxyzgorzeleccolog" +
+ "newspaperxn--msy-ula0hakusandiegoodyearthadselfipassagenshimonit" +
+ "ayanagitlaborxn--mtta-vrjjat-k7afamilycompanycolumbusheyxn--muos" +
+ "t-0qaxn--mxtq1misawaxn--ngbc5azdxn--ngbe9e0axn--ngbrxn--45brj9ci" +
+ "vilaviationxn--nit225koseis-an-actresshiojirishirifujiedaxn--nme" +
+ "sjevuemie-tcbalatinord-frontierxn--nnx388axn--nodexn--nqv7fs00em" +
+ "axn--nry-yla5gxn--ntso0iqx3axn--ntsq17gxn--nttery-byaeservecount" +
+ "erstrikexn--nvuotna-hwaxn--nyqy26axn--o1achattanooganordreisa-ge" +
+ "ekosherbrookegawaxn--o3cw4haldenxn--od0algxn--od0aq3bernuorockar" +
+ "tuzyukibmdivttasvuotnakamagayachts3-website-sa-east-1xn--ogbpf8f" +
+ "lekkefjordxn--oppegrd-ixaxn--ostery-fyawaraxn--osyro-wuaxn--p1ac" +
+ "fidonnakamuratajimicrolightinguovdageaidnunzenxn--p1aissmarterth" +
+ "anyouxn--pbt977communitysfjordyndns-weberlincolnxn--pgbs0dhlxn--" +
+ "porsgu-sta26fieldyroyrvikinguitarschweizparaglidingujolsterxn--p" +
+ "ssu33lxn--pssy2uxn--q9jyb4comobaraxn--qcka1pmcdonaldstpetersburg" +
+ "xn--qqqt11misconfusedxn--qxamuneuestreamsterdamnserverbaniaxn--r" +
+ "ady-iraxn--rdal-poaxn--rde-ulaquilancashirehabmerxn--rdy-0nabari" +
+ "wchoshibuyachiyodavvenjargaulardalukowiiheyaizuwakamatsubushikus" +
+ "akadogawaxn--rennesy-v1axn--rhkkervju-01aflakstadaokagakibichuox" +
+ "n--rholt-mragowoodsidexn--rhqv96gxn--rht27zxn--rht3dxn--rht61exn" +
+ "--risa-5narusawaxn--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmsk" +
+ "og-byawatahamaxn--rny31halsaintlouis-a-anarchistoireggio-calabri" +
+ "axn--rovu88beskidyn-vpncasertaipeiheijiinetnedalimanowarudautomo" +
+ "tivecodyn-o-saurlandes3-fips-us-gov-west-1xn--rros-granvindafjor" +
+ "dxn--rskog-uuaxn--rst-0narutokyotangovturystykannamihamadaxn--rs" +
+ "ta-francaiseharaxn--ryken-vuaxn--ryrvik-byaxn--s-1faitheguardian" +
+ "xn--s9brj9comparemarkerryhotelsassaris-a-doctorayxn--sandnessjen" +
+ "-ogbizxn--sandy-yuaxn--seral-lraxn--ses554gxn--sgne-gratangenxn-" +
+ "-skierv-utazaskvolloabathsbcompute-1xn--skjervy-v1axn--skjk-soax" +
+ "n--sknit-yqaxn--sknland-fxaxn--slat-5narviikamishihoronobeauxart" +
+ "sandcraftstudioxn--slt-elabbvieeexn--smla-hraxn--smna-gratis-a-b" +
+ "ruinsfanxn--snase-nraxn--sndre-land-0cbstudyndns-at-homedepotenz" +
+ "amamicrosoftbankomorotsukaminoyamaxunusualpersonxn--snes-poaxn--" +
+ "snsa-roaxn--sr-aurdal-l8axn--sr-fron-q1axn--sr-odal-q1axn--sr-va" +
+ "ranger-ggbestbuyshouses3-website-us-east-1xn--srfold-byaxn--srre" +
+ "isa-q1axn--srum-grazxn--stfold-9xaxn--stjrdal-s1axn--stjrdalshal" +
+ "sen-sqbetainaboxfusejnynysadodgeometre-experts-comptables3-websi" +
+ "te-us-west-1xn--stre-toten-zcbieigersundiyukuhashimoichinosekiga" +
+ "harautoscanadaejeonbukaratehimeji234xn--t60b56axn--tckweathercha" +
+ "nnelxn--tiq49xqyjfkhersonxn--tjme-hraxn--tn0agrinet-freakstuff-4" +
+ "-salexn--tnsberg-q1axn--tor131oxn--trany-yuaxn--trgstad-r1axn--t" +
+ "rna-woaxn--troms-zuaxn--tysvr-vraxn--uc0atvaroyxn--uc0ay4axn--ui" +
+ "st22hammarfeastafricapetownnews-stagingxn--uisz3gxn--unjrga-rtao" +
+ "baokinawashirosatochiokinoshimalatvuopmiasakuchinotsuchiurakawal" +
+ "brzycharternopilawalesundxn--unup4yxn--uuwu58axn--vads-jraxn--va" +
+ "rd-jraxn--vegrshei-c0axn--vermgensberater-ctbielawalterxn--vermg" +
+ "ensberatung-pwbiellaakesvuemielecceu-2xn--vestvgy-ixa6oxn--vg-yi" +
+ "abcgxn--vgan-qoaxn--vgsy-qoa0jgoraxn--vgu402computerhistoryofsci" +
+ "ence-fictionxn--vhquvbarclays3-website-ap-southeast-1xn--vler-qo" +
+ "axn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861bieszczad" +
+ "ygeyachimataikikonaioirasebastopologyeongnamegawakeisenbahnhlfan" +
+ "hs3-website-us-west-2xn--w4r85el8fhu5dnraxn--w4rs40lxn--wcvs22dx" +
+ "n--wgbh1comsecuritytacticsatxn--1ck2e1balsfjordgcahcesuolodingen" +
+ "aval-d-aosta-valleyolasitemrxn--wgbl6axn--xhq521bievatmallorcada" +
+ "quesakuraiitatebayashiibaghdadultateyamaveroykenglanddnss3-sa-ea" +
+ "st-1xn--xkc2al3hye2axn--xkc2dl3a5ee0hamurakamigoriginshimosuwalk" +
+ "is-a-nurservebbshimotsukexn--y9a3aquariumishimatsunoxn--yer-znar" +
+ "vikoshimizumakis-an-anarchistoricalsocietyxn--yfro4i67oxn--ygard" +
+ "en-p1axn--ygbi2ammxn--45q11civilisationxn--ystre-slidre-ujbifuka" +
+ "gawarszawashingtondclkarmoyurihonjoyentatsunoceanographiquevents" +
+ "akyotanabeneventoeidsvollimitednpagefrontappagespeedmobilizerodd" +
+ "avocatanzarowegroweibolzanordkappgafanpachigasakidsmynasushiobar" +
+ "agusarts3-us-east-2xn--zbx025dxn--zf0ao64axn--zf0avxn--4gbrimini" +
+ "ngxn--zfr164bihorologyusuharavoues3-us-gov-west-1xperiaxz"
// nodes is the list of nodes. Each node is represented as a uint32, which
// encodes the node's children, wildcard bit and node type (as an index into
@@ -482,8141 +483,8127 @@ const text = "biellaakesvuemieleccebieszczadygeyachimatainaircraftraeumtgerade"
// [15 bits] text index
// [ 6 bits] text length
var nodes = [...]uint32{
- 0x29e943,
- 0x364444,
- 0x28af46,
- 0x371983,
- 0x371986,
- 0x394246,
- 0x3a4103,
- 0x202f04,
- 0x24f607,
- 0x28ab88,
- 0x1a00882,
- 0x309dc7,
- 0x3533c9,
- 0x2fb3ca,
- 0x2fb3cb,
- 0x22fe43,
- 0x28cac6,
- 0x2352c5,
- 0x1e00702,
- 0x211ac4,
- 0x2c7a83,
- 0x226bc5,
- 0x2200d42,
- 0x2a0f43,
- 0x2707e44,
- 0x368485,
- 0x2a00c42,
- 0x3797ce,
- 0x24a483,
- 0x38b406,
- 0x2e04642,
- 0x2a5907,
- 0x237d46,
- 0x3200a42,
- 0x2ae043,
- 0x2ae044,
- 0x280f86,
- 0x36f448,
- 0x283a46,
- 0x386144,
- 0x3601002,
- 0x326a09,
- 0x363a07,
- 0x3351c6,
- 0x355049,
- 0x293988,
- 0x367104,
- 0x3a6606,
- 0x20e306,
- 0x3a02e02,
- 0x241d0f,
- 0x33174e,
- 0x212484,
- 0x2bb945,
- 0x202e05,
- 0x2ea589,
- 0x23e889,
- 0x325747,
- 0x221646,
- 0x26b083,
- 0x3e056c2,
- 0x346fc3,
- 0x207a4a,
- 0x211e83,
- 0x250585,
- 0x2040c2,
- 0x2830c9,
- 0x4204802,
- 0x209084,
- 0x29e486,
- 0x284b45,
- 0x34c904,
- 0x4a74a04,
- 0x204803,
- 0x234304,
- 0x4e01842,
- 0x364184,
- 0x52e41c4,
- 0x22410a,
- 0x56009c2,
- 0x334307,
- 0x38e008,
- 0x6201182,
- 0x322847,
- 0x2b7344,
- 0x2b7347,
- 0x383d05,
- 0x370a47,
- 0x325506,
- 0x332a44,
- 0x340c85,
- 0x28df47,
- 0x72046c2,
- 0x349183,
- 0x218782,
- 0x366703,
- 0x76108c2,
- 0x2798c5,
- 0x7a02d42,
- 0x368ac4,
- 0x277785,
- 0x2123c7,
- 0x2ddc0e,
- 0x330a44,
- 0x244744,
- 0x20ca03,
- 0x326ec9,
- 0x30528b,
- 0x30e148,
- 0x31cd88,
- 0x320888,
- 0x20a588,
- 0x354e8a,
- 0x370947,
- 0x217906,
- 0x7e9c3c2,
- 0x377d83,
- 0x380c43,
- 0x38bc84,
- 0x250ac3,
- 0x3a4143,
- 0x1713b02,
- 0x8203182,
- 0x2484c5,
- 0x30c046,
- 0x2c9bc4,
- 0x396e07,
- 0x22eec6,
- 0x280304,
- 0x3a7dc7,
- 0x203183,
- 0x86bdb82,
- 0x8a4f882,
- 0x8e13702,
- 0x213706,
+ 0x32f983,
+ 0x28a344,
+ 0x30e286,
+ 0x371b43,
+ 0x371b46,
+ 0x394646,
+ 0x3a5003,
+ 0x367844,
+ 0x260687,
+ 0x30dec8,
+ 0x1a04cc2,
+ 0x316e47,
+ 0x355d89,
+ 0x32228a,
+ 0x32228b,
+ 0x22eec3,
+ 0x28fac6,
+ 0x2327c5,
+ 0x1e04e02,
+ 0x217c04,
+ 0x2a90c3,
+ 0x3ac705,
+ 0x2203942,
+ 0x329e03,
+ 0x26957c4,
+ 0x368e05,
+ 0x2a10182,
+ 0x3787ce,
+ 0x253343,
+ 0x3a03c6,
+ 0x2e00142,
+ 0x30e407,
+ 0x23ae46,
+ 0x3200c42,
+ 0x22a343,
+ 0x254b04,
+ 0x325a86,
+ 0x35c208,
+ 0x28a706,
+ 0x21ad04,
+ 0x3601442,
+ 0x332309,
+ 0x207587,
+ 0x256286,
+ 0x339309,
+ 0x29d788,
+ 0x328d44,
+ 0x364906,
+ 0x36b606,
+ 0x3a02942,
+ 0x27144f,
+ 0x20f94e,
+ 0x2131c4,
+ 0x2c6085,
+ 0x367745,
+ 0x385989,
+ 0x241a89,
+ 0x368047,
+ 0x23c9c6,
+ 0x273a43,
+ 0x3e02342,
+ 0x2df283,
+ 0x205aca,
+ 0x221d83,
+ 0x303145,
+ 0x289c02,
+ 0x289c09,
+ 0x4200f82,
+ 0x203d84,
+ 0x2250c6,
+ 0x2eb205,
+ 0x34cbc4,
+ 0x4a04c04,
+ 0x205283,
+ 0x231ac4,
+ 0x4e02e02,
+ 0x209f04,
+ 0x52f4e04,
+ 0x24ae0a,
+ 0x5601342,
+ 0x303907,
+ 0x26b8c8,
+ 0x6202f82,
+ 0x31cf07,
+ 0x2c2e04,
+ 0x2c2e07,
+ 0x373d85,
+ 0x357a47,
+ 0x367e06,
+ 0x2e8384,
+ 0x39c0c5,
+ 0x294847,
+ 0x7206cc2,
+ 0x34f703,
+ 0x200582,
+ 0x200583,
+ 0x76125c2,
+ 0x221ec5,
+ 0x7a02302,
+ 0x27bd84,
+ 0x2810c5,
+ 0x213107,
+ 0x269f0e,
+ 0x224bc4,
+ 0x206a84,
+ 0x211503,
+ 0x2ceac9,
+ 0x2ed94b,
+ 0x3a6548,
+ 0x3148c8,
+ 0x318dc8,
+ 0x237908,
+ 0x33914a,
+ 0x357947,
+ 0x318146,
+ 0x7ea4fc2,
+ 0x35bc03,
+ 0x366c43,
+ 0x371144,
+ 0x3a5043,
+ 0x324cc3,
+ 0x171f542,
+ 0x8203682,
+ 0x252185,
+ 0x2a11c6,
+ 0x2d6d44,
+ 0x2f6e07,
+ 0x382986,
+ 0x319dc4,
+ 0x398247,
+ 0x20f7c3,
+ 0x86c8902,
+ 0x8b124c2,
+ 0x8e1c502,
+ 0x21c506,
0x9200002,
- 0x37f645,
- 0x315043,
- 0x205244,
- 0x2dbe44,
- 0x2dbe45,
- 0x207043,
- 0x9723ac3,
- 0x9a093c2,
- 0x2873c5,
- 0x2873cb,
- 0x22d086,
- 0x20cbcb,
- 0x26ff44,
- 0x20d189,
- 0x20ed44,
- 0x9e0fd82,
- 0x210c83,
- 0x211183,
- 0x1611302,
- 0x23c343,
- 0x21130a,
- 0xa211d42,
- 0x211d45,
- 0x28ea8a,
- 0x2cd704,
- 0x212d43,
- 0x213384,
- 0x213cc3,
- 0x213cc4,
- 0x213cc7,
- 0x214245,
- 0x218dc5,
- 0x219586,
- 0x21a0c6,
- 0x21aa43,
- 0x21dc48,
- 0x258e83,
- 0xa615802,
- 0x21f008,
- 0x21580b,
- 0x222d08,
- 0x223586,
- 0x224547,
- 0x229748,
- 0xb279a82,
- 0xb693f02,
- 0x20b608,
- 0x2ad0c7,
- 0x23b405,
- 0x23b408,
- 0x281888,
- 0x2ada03,
- 0x22eac4,
- 0x38bcc2,
- 0xba2f482,
- 0xbe051c2,
- 0xc62f802,
- 0x22f803,
- 0xca02ec2,
- 0x202ec3,
- 0x2fe704,
- 0x21abc3,
- 0x3670c4,
- 0x24edcb,
+ 0x359b85,
+ 0x320a83,
+ 0x200004,
+ 0x2ee344,
+ 0x2ee345,
+ 0x203e43,
+ 0x9768883,
+ 0x9a07f42,
+ 0x28e245,
+ 0x28e24b,
+ 0x2d0686,
+ 0x20a0cb,
+ 0x225b04,
+ 0x20a7c9,
+ 0x20be84,
+ 0x9e0c0c2,
+ 0x20cf83,
+ 0x210843,
+ 0x1600802,
+ 0x260903,
+ 0x2109ca,
+ 0xa211cc2,
+ 0x217e85,
+ 0x2983ca,
+ 0x2dc184,
+ 0x369f03,
+ 0x315044,
+ 0x213643,
+ 0x213644,
+ 0x213647,
+ 0x213985,
+ 0x213e05,
+ 0x2150c6,
+ 0x2167c6,
+ 0x2182c3,
+ 0x21c188,
+ 0x221c43,
+ 0xa601082,
+ 0x21cac8,
+ 0x21ff0b,
+ 0x2216c8,
+ 0x2221c6,
+ 0x222a47,
+ 0x226488,
+ 0xb2413c2,
+ 0xb6c2fc2,
+ 0x326388,
+ 0x257ec7,
+ 0x22bac5,
+ 0x22bac8,
+ 0x2bf708,
+ 0x3871c3,
+ 0x22a784,
+ 0x371182,
+ 0xba2af82,
+ 0xbe5ba02,
+ 0xc62c1c2,
+ 0x22c1c3,
+ 0xca0e542,
+ 0x367803,
+ 0x2f8e04,
+ 0x218443,
+ 0x328d04,
+ 0x25fe4b,
+ 0x21fe43,
+ 0x2e4d06,
+ 0x226284,
+ 0x2a5a8e,
+ 0x361c05,
+ 0x3a04c8,
+ 0x282247,
+ 0x28224a,
+ 0x229d03,
+ 0x2b3447,
+ 0x2edb05,
+ 0x22ea44,
+ 0x272486,
+ 0x272487,
+ 0x32b704,
+ 0x304ac7,
+ 0x26a244,
+ 0x35bc84,
+ 0x35bc86,
+ 0x386904,
+ 0x20e546,
+ 0x223c83,
+ 0x22b888,
+ 0x30c3c8,
+ 0x24e2c3,
+ 0x2608c3,
+ 0x204f04,
+ 0x395943,
+ 0xce0d882,
+ 0xd2db442,
+ 0x20c043,
+ 0x201806,
+ 0x35c383,
+ 0x28bfc4,
+ 0xd6081c2,
+ 0x2081c3,
+ 0x358243,
+ 0x219942,
+ 0xda02ac2,
+ 0x2c55c6,
+ 0x2334c7,
+ 0x2f7a85,
+ 0x37da44,
+ 0x3723c5,
+ 0x367007,
+ 0x274205,
+ 0x2d3e89,
+ 0x2e0586,
+ 0x2e5488,
+ 0x2f7986,
+ 0xde0db42,
+ 0x362f48,
+ 0x2f8bc6,
+ 0x20db45,
+ 0x304687,
+ 0x30c2c4,
+ 0x30c2c5,
+ 0x28a8c4,
+ 0x28a8c8,
+ 0xe20a182,
+ 0xe60c502,
+ 0x313646,
+ 0x2c28c8,
+ 0x31f145,
+ 0x332c06,
+ 0x3356c8,
+ 0x33e1c8,
+ 0xea0fd45,
+ 0xee0c504,
+ 0x2958c7,
+ 0xf20bbc2,
+ 0xf61c402,
+ 0x1060d1c2,
+ 0x35aa45,
+ 0x2a8505,
+ 0x282606,
+ 0x3698c7,
+ 0x376ec7,
+ 0x10ed0783,
+ 0x2e3447,
+ 0x30dc88,
+ 0x3823c9,
+ 0x378987,
+ 0x390287,
+ 0x3a5b08,
+ 0x3aa206,
+ 0x22e546,
+ 0x22f18c,
+ 0x230b0a,
+ 0x230fc7,
+ 0x23268b,
+ 0x233307,
+ 0x23330e,
+ 0x236244,
+ 0x23a184,
+ 0x23b547,
+ 0x264f47,
+ 0x240d46,
+ 0x240d47,
+ 0x241207,
+ 0x18a20802,
+ 0x2420c6,
+ 0x2420ca,
+ 0x24294b,
+ 0x243407,
+ 0x244ec5,
+ 0x245203,
+ 0x246c46,
+ 0x246c47,
+ 0x241c43,
+ 0x18e38702,
+ 0x24b74a,
+ 0x19356fc2,
+ 0x196acdc2,
+ 0x19a4cec2,
+ 0x19e26982,
+ 0x24da85,
+ 0x24e0c4,
+ 0x1a604d02,
+ 0x209f85,
+ 0x294ac3,
+ 0x20bf85,
+ 0x237804,
+ 0x20a684,
+ 0x2ba5c6,
+ 0x26a546,
+ 0x28e443,
+ 0x3b1484,
+ 0x209383,
+ 0x1aa03b02,
+ 0x263544,
+ 0x263546,
+ 0x295e45,
+ 0x27fdc6,
+ 0x304788,
+ 0x20cb44,
+ 0x2a8e88,
+ 0x343fc5,
+ 0x24a108,
+ 0x2b1cc6,
+ 0x2bddc7,
+ 0x26cdc4,
+ 0x26cdc6,
+ 0x25e303,
+ 0x382e43,
+ 0x2c9388,
+ 0x318bc4,
+ 0x238d47,
+ 0x220246,
+ 0x2dad89,
+ 0x315108,
+ 0x319f08,
+ 0x349184,
+ 0x39b9c3,
+ 0x23e342,
+ 0x1ba34682,
+ 0x1be16102,
+ 0x3b2783,
+ 0x1c204a42,
+ 0x2607c4,
+ 0x390a46,
+ 0x39a6c5,
+ 0x2a4383,
+ 0x232004,
+ 0x2b6f47,
+ 0x26aa43,
+ 0x250d08,
+ 0x20e8c5,
+ 0x370083,
+ 0x281045,
+ 0x281184,
+ 0x2fb8c6,
+ 0x210384,
+ 0x211a46,
+ 0x213046,
+ 0x263004,
+ 0x21fd83,
+ 0x2225c3,
+ 0x1c604e42,
+ 0x377905,
+ 0x222e03,
+ 0x1ca1c3c2,
+ 0x22f143,
+ 0x210085,
+ 0x231b83,
+ 0x231b89,
+ 0x1ce07d02,
+ 0x1d601142,
+ 0x28d9c5,
+ 0x21a746,
+ 0x2d6906,
+ 0x2b94c8,
+ 0x2b94cb,
+ 0x20538b,
+ 0x2f7c85,
+ 0x2e1045,
+ 0x2c9fc9,
+ 0x1600742,
+ 0x2631c8,
+ 0x206044,
+ 0x1de001c2,
+ 0x25fa83,
+ 0x1e665106,
+ 0x20f088,
+ 0x1ea04782,
+ 0x233ec8,
+ 0x1ee01742,
+ 0x225c4a,
+ 0x1f2d0e43,
+ 0x3b1e86,
+ 0x206988,
+ 0x207d48,
+ 0x39a9c6,
+ 0x36d5c7,
+ 0x271647,
+ 0x220b0a,
+ 0x2dc204,
+ 0x3423c4,
+ 0x355589,
+ 0x1fb8fc85,
+ 0x20fb46,
+ 0x208203,
+ 0x251944,
+ 0x201e44,
+ 0x201e47,
+ 0x22cec7,
+ 0x237044,
+ 0x220a45,
+ 0x2826c8,
+ 0x350707,
+ 0x3619c7,
+ 0x1fe041c2,
+ 0x226004,
+ 0x298cc8,
+ 0x381004,
+ 0x24f0c4,
+ 0x24fa45,
+ 0x24fb87,
+ 0x215809,
+ 0x2505c4,
+ 0x2510c9,
+ 0x251308,
+ 0x2516c4,
+ 0x2516c7,
+ 0x20251c43,
+ 0x252487,
+ 0x16101c2,
+ 0x179d442,
+ 0x253386,
+ 0x2539c7,
+ 0x253e84,
+ 0x255607,
+ 0x256907,
+ 0x257483,
+ 0x2abc02,
+ 0x229c02,
+ 0x258743,
+ 0x258744,
+ 0x25874b,
+ 0x3149c8,
+ 0x25f184,
+ 0x2594c5,
+ 0x25ba87,
+ 0x25d8c5,
+ 0x2c4dca,
+ 0x25f0c3,
+ 0x2060da42,
+ 0x22b484,
+ 0x264d09,
+ 0x268983,
+ 0x268a47,
+ 0x28ee89,
+ 0x37b5c8,
+ 0x2d8483,
+ 0x27ff47,
+ 0x280689,
+ 0x2316c3,
+ 0x288284,
+ 0x289389,
+ 0x28c6c6,
+ 0x28dc83,
+ 0x2023c2,
+ 0x24ca43,
+ 0x36ab47,
+ 0x2bfa85,
+ 0x35ba06,
+ 0x256bc4,
+ 0x2d1d45,
+ 0x205a83,
+ 0x218506,
+ 0x20a9c2,
+ 0x391084,
+ 0x22ad02,
+ 0x22ad03,
+ 0x20a00182,
+ 0x29b083,
+ 0x216c44,
+ 0x216c47,
+ 0x200306,
+ 0x201e02,
+ 0x20e01dc2,
+ 0x21e184,
+ 0x2123b882,
+ 0x21600502,
+ 0x2dfcc4,
+ 0x2dfcc5,
+ 0x2b9cc5,
+ 0x262746,
+ 0x21a0ca82,
+ 0x20ca85,
+ 0x210d85,
+ 0x225883,
+ 0x215c06,
+ 0x216dc5,
+ 0x21c482,
+ 0x33de05,
+ 0x21c484,
+ 0x2230c3,
+ 0x223303,
+ 0x21e097c2,
+ 0x294a47,
+ 0x221144,
+ 0x221149,
+ 0x251844,
+ 0x228903,
+ 0x341cc9,
+ 0x3777c8,
+ 0x2a8384,
+ 0x2a8386,
+ 0x210503,
+ 0x259b43,
+ 0x332ec3,
+ 0x222ebc02,
+ 0x30eb82,
+ 0x22600642,
+ 0x3238c8,
+ 0x35c588,
+ 0x394d86,
+ 0x24ed45,
+ 0x2b32c5,
+ 0x200647,
+ 0x228fc5,
+ 0x2630c2,
+ 0x22a9a502,
+ 0x1614502,
+ 0x38fe08,
+ 0x362e85,
+ 0x351d04,
+ 0x2f18c5,
+ 0x3836c7,
+ 0x24f5c4,
+ 0x246f82,
+ 0x22e01182,
+ 0x336f04,
+ 0x2173c7,
+ 0x28e9c7,
+ 0x357a04,
+ 0x298383,
+ 0x24e204,
+ 0x24e208,
+ 0x22e886,
+ 0x27230a,
+ 0x2156c4,
+ 0x298708,
+ 0x259784,
+ 0x222b46,
+ 0x29a4c4,
+ 0x35ad46,
+ 0x221409,
+ 0x25b287,
+ 0x234483,
+ 0x23274842,
+ 0x274843,
+ 0x20c2c2,
+ 0x23651b02,
+ 0x2f0b06,
+ 0x364148,
+ 0x2a9d87,
+ 0x395d09,
+ 0x297f09,
+ 0x2ab245,
+ 0x2ad3c9,
+ 0x2ae045,
+ 0x2ae189,
+ 0x2af5c5,
+ 0x2b0208,
+ 0x27f284,
+ 0x23a8d6c7,
+ 0x294403,
+ 0x2b0407,
+ 0x390646,
+ 0x2b08c7,
+ 0x2a6d45,
+ 0x2a7f83,
+ 0x23e00dc2,
+ 0x392604,
+ 0x2423b8c2,
+ 0x264403,
+ 0x24618d82,
+ 0x307646,
+ 0x26b845,
+ 0x2b2bc7,
+ 0x37f183,
+ 0x324c44,
+ 0x2138c3,
+ 0x2386c3,
+ 0x24a0a3c2,
+ 0x25201a02,
+ 0x394744,
+ 0x2abbc3,
+ 0x38c985,
+ 0x226d85,
+ 0x25602282,
+ 0x25e00bc2,
+ 0x280286,
+ 0x318d04,
+ 0x2491c4,
+ 0x2491ca,
+ 0x26601d42,
+ 0x37324a,
+ 0x204148,
+ 0x26a964c4,
+ 0x201d43,
+ 0x25ff43,
+ 0x318f09,
+ 0x2a8909,
+ 0x2b7046,
+ 0x26e04303,
+ 0x328145,
+ 0x30664d,
+ 0x204306,
+ 0x21268b,
+ 0x27203482,
+ 0x295048,
+ 0x27e1c282,
+ 0x282051c2,
+ 0x37aa85,
+ 0x28600b02,
+ 0x2a3147,
+ 0x212b87,
+ 0x201503,
+ 0x22f848,
+ 0x28a02f02,
+ 0x202f04,
+ 0x217043,
+ 0x38d045,
+ 0x386fc3,
+ 0x2eb106,
+ 0x30bdc4,
+ 0x204ec3,
+ 0x234f83,
+ 0x28e07042,
+ 0x2f7c04,
+ 0x30ed45,
+ 0x35a587,
+ 0x27dbc3,
+ 0x2b36c3,
+ 0x2b3ec3,
+ 0x1621ac2,
+ 0x2b3f83,
+ 0x2b4b03,
+ 0x2920ae42,
+ 0x2cee84,
+ 0x26a746,
+ 0x33c7c3,
+ 0x2b4f83,
+ 0x296b5e02,
+ 0x2b5e08,
+ 0x2b60c4,
+ 0x2470c6,
+ 0x2b6547,
+ 0x24e3c6,
+ 0x295304,
+ 0x37200082,
+ 0x39050b,
+ 0x2ffbce,
+ 0x21bb0f,
+ 0x29da43,
+ 0x37a4ca02,
+ 0x166b142,
+ 0x37e02442,
+ 0x29c243,
+ 0x2472c3,
+ 0x233106,
+ 0x22ff46,
+ 0x212307,
+ 0x31aa84,
+ 0x3821a882,
+ 0x3860ec02,
+ 0x2d4ac5,
+ 0x2e88c7,
+ 0x37e046,
+ 0x38a82882,
+ 0x2f5b04,
+ 0x2b9783,
+ 0x38e01b02,
+ 0x39352883,
+ 0x2ba984,
+ 0x2c06c9,
+ 0x16c6fc2,
+ 0x39642682,
+ 0x351245,
+ 0x39ac7242,
+ 0x39e02682,
+ 0x341687,
+ 0x2364c9,
+ 0x35600b,
+ 0x271405,
+ 0x2c7c89,
+ 0x276a46,
+ 0x2d06c7,
+ 0x3a2092c4,
+ 0x32ef49,
+ 0x374b07,
+ 0x2255c7,
+ 0x234003,
+ 0x37b386,
+ 0x30f887,
+ 0x265383,
+ 0x27c5c6,
+ 0x3aa022c2,
+ 0x3ae31e02,
+ 0x220443,
+ 0x324845,
+ 0x257747,
+ 0x21fac6,
+ 0x2bfa05,
+ 0x230044,
+ 0x2efa45,
+ 0x2f8284,
+ 0x3b205e82,
+ 0x349f07,
+ 0x2e1c44,
+ 0x23e244,
+ 0x33328d,
+ 0x257249,
+ 0x381588,
+ 0x25ac04,
+ 0x314e85,
+ 0x3b2607,
+ 0x205e84,
+ 0x382a47,
+ 0x20c705,
+ 0x3b6aa384,
+ 0x36dec5,
+ 0x267644,
+ 0x24f706,
+ 0x3696c5,
+ 0x3ba24742,
+ 0x369fc4,
+ 0x369fc5,
+ 0x3716c6,
+ 0x2bfb45,
+ 0x25c104,
+ 0x3120c3,
+ 0x204986,
+ 0x22c085,
+ 0x22c785,
+ 0x3697c4,
0x215743,
- 0x2d2f86,
- 0x223f84,
- 0x29b84e,
- 0x360445,
- 0x38b508,
- 0x24bd87,
- 0x24bd8a,
- 0x222a83,
- 0x222a87,
- 0x305445,
- 0x231c84,
- 0x24d886,
- 0x24d887,
- 0x2beb44,
- 0x2f6607,
- 0x377e04,
- 0x3afe84,
- 0x3afe86,
- 0x267544,
- 0x208606,
- 0x210ac3,
- 0x217188,
- 0x21cfc8,
- 0x244703,
- 0x23c303,
- 0x395544,
- 0x39a003,
- 0xce00482,
- 0xd304e82,
- 0x2004c3,
- 0x2072c6,
- 0x369e83,
- 0x263584,
- 0xd616942,
- 0x244c43,
- 0x216943,
- 0x21b182,
- 0xda008c2,
- 0x2b9fc6,
- 0x235fc7,
- 0x2e9345,
- 0x367a44,
- 0x27e045,
- 0x2026c7,
- 0x26a205,
- 0x2c6889,
- 0x2cf2c6,
- 0x2d48c8,
- 0x2e9246,
- 0xde06c02,
- 0x33b648,
- 0x2fe4c6,
- 0x3b1a45,
- 0x3ae4c7,
- 0x301084,
- 0x301085,
- 0x283c04,
- 0x283c08,
- 0xe20cc82,
- 0xe6131c2,
- 0x329cc6,
- 0x318208,
- 0x339345,
- 0x33a3c6,
- 0x33c648,
- 0x35b948,
- 0xeac8945,
- 0xefa8204,
- 0x3aae87,
- 0xf20e802,
- 0xf61dec2,
- 0x10a16582,
- 0x357b85,
- 0x2a3e05,
- 0x2de246,
- 0x319b87,
- 0x399547,
- 0x1122d183,
- 0x29a147,
- 0x2d4488,
- 0x38fec9,
- 0x379987,
- 0x3a5187,
- 0x22fe88,
- 0x230686,
- 0x231786,
- 0x2323cc,
- 0x232f4a,
- 0x233787,
- 0x23518b,
- 0x235e07,
- 0x235e0e,
- 0x236a84,
- 0x2374c4,
- 0x239b07,
- 0x25b087,
- 0x23d9c6,
- 0x23d9c7,
- 0x23e107,
- 0x14600bc2,
- 0x23ec86,
- 0x23ec8a,
- 0x23ef0b,
- 0x240007,
- 0x2407c5,
- 0x240b03,
- 0x240fc6,
- 0x240fc7,
- 0x230a83,
- 0x14a0b382,
- 0x24198a,
- 0x14f54502,
- 0x152a6c02,
- 0x15642b82,
- 0x15a37e42,
- 0x243a85,
- 0x244504,
- 0x16200682,
- 0x364205,
- 0x226b83,
- 0x317c85,
- 0x20a484,
- 0x20ec44,
- 0x291786,
- 0x378106,
- 0x2875c3,
- 0x261f84,
- 0x281e43,
- 0x16600f82,
- 0x200f84,
- 0x3ab406,
- 0x200f85,
- 0x258c06,
- 0x3ae5c8,
- 0x263804,
- 0x2c7848,
- 0x2e0c45,
- 0x22e708,
- 0x32c306,
- 0x2b49c7,
- 0x239504,
- 0x239506,
- 0x307003,
- 0x384083,
- 0x2be608,
- 0x30c584,
- 0x2a0887,
- 0x30a106,
- 0x30a109,
- 0x252448,
- 0x27efc8,
- 0x280444,
- 0x378983,
- 0x22aa02,
- 0x16ab1d82,
- 0x16e2cf42,
- 0x3a1603,
- 0x17219c42,
- 0x24f744,
- 0x3400c6,
- 0x371305,
- 0x23fe83,
- 0x232884,
- 0x300447,
- 0x367783,
- 0x2379c8,
- 0x3af5c5,
- 0x36fc43,
- 0x277705,
+ 0x21574c,
+ 0x3be8d002,
+ 0x3c2045c2,
+ 0x3c605d82,
+ 0x205d83,
+ 0x205d84,
+ 0x3ca032c2,
+ 0x2f9648,
+ 0x35bac5,
+ 0x33f884,
+ 0x230e46,
+ 0x3ce073c2,
+ 0x3d20fc42,
+ 0x3d600c02,
+ 0x321e85,
+ 0x262ec6,
+ 0x20b484,
+ 0x325fc6,
+ 0x3036c6,
+ 0x202983,
+ 0x3db1164a,
+ 0x264785,
+ 0x28b4c3,
+ 0x223886,
+ 0x305e09,
+ 0x223887,
+ 0x293308,
+ 0x29d649,
+ 0x248108,
+ 0x229a46,
+ 0x208843,
+ 0x3de017c2,
+ 0x384b03,
+ 0x384b09,
+ 0x368548,
+ 0x3e2513c2,
+ 0x3e601f02,
+ 0x22d603,
+ 0x2e0405,
+ 0x258f44,
+ 0x35e849,
+ 0x226784,
+ 0x26f288,
+ 0x205c03,
+ 0x2602c4,
+ 0x2784c3,
+ 0x21a788,
+ 0x3331c7,
+ 0x3ea0f302,
+ 0x2432c2,
+ 0x257d85,
+ 0x3960c9,
+ 0x20fbc3,
+ 0x281ac4,
+ 0x328104,
+ 0x219e03,
+ 0x28380a,
+ 0x3ef73102,
+ 0x3f2c0202,
+ 0x2c8883,
+ 0x374fc3,
+ 0x1649202,
+ 0x262a43,
+ 0x3f60bcc2,
+ 0x3fa05f02,
+ 0x3fe22044,
+ 0x222046,
+ 0x33e8c6,
0x277844,
- 0x208306,
- 0x20c804,
- 0x20cf06,
- 0x212306,
- 0x2512c4,
- 0x215683,
- 0x21a883,
- 0x1767e402,
- 0x360fc5,
- 0x215dc3,
- 0x17a00442,
- 0x232383,
- 0x331e85,
- 0x2343c3,
- 0x2343c9,
- 0x17e08042,
- 0x18614b42,
- 0x286b45,
- 0x21ba46,
- 0x29f387,
- 0x2c9786,
- 0x2b83c8,
- 0x2b83cb,
- 0x20730b,
- 0x22aac5,
- 0x2d02c5,
- 0x2bf489,
- 0x1600ec2,
- 0x251488,
- 0x20ce04,
- 0x18e00202,
- 0x24ea03,
- 0x1965b246,
- 0x330e88,
- 0x19a031c2,
- 0x228108,
- 0x19e00d82,
- 0x27008a,
- 0x20f043,
- 0x31d346,
- 0x330448,
- 0x378cc8,
- 0x32f8c6,
- 0x36dd07,
- 0x241f07,
- 0x20de8a,
- 0x2cd784,
- 0x33f184,
- 0x352f49,
- 0x38f8c5,
- 0x2f31c6,
- 0x2138c3,
- 0x247984,
- 0x212104,
- 0x3412c7,
- 0x21e687,
- 0x2d7e84,
- 0x20ddc5,
- 0x2de308,
- 0x35d607,
- 0x360207,
- 0x1a206ac2,
- 0x369684,
- 0x28f388,
- 0x384544,
- 0x2455c4,
- 0x2459c5,
- 0x245b07,
- 0x206ac9,
- 0x246684,
- 0x246e89,
- 0x247348,
- 0x247704,
- 0x247707,
- 0x1a647f83,
- 0x248a47,
- 0x16475c2,
- 0x17a4a82,
- 0x249a06,
- 0x24a4c7,
- 0x24a904,
- 0x24c9c7,
- 0x24e4c7,
- 0x252083,
- 0x23aa82,
- 0x201682,
- 0x252b03,
- 0x252b04,
- 0x252b0b,
- 0x31ce88,
- 0x258b44,
- 0x253805,
- 0x255e47,
- 0x257a05,
- 0x2d9a8a,
- 0x258a83,
- 0x1aa21842,
- 0x258d84,
- 0x25ae49,
- 0x25edc3,
- 0x25ee87,
- 0x3ac249,
- 0x280d08,
- 0x200c83,
- 0x276607,
- 0x276d49,
- 0x202883,
- 0x27d9c4,
- 0x282309,
- 0x2856c6,
- 0x286e03,
- 0x2038c2,
- 0x233e83,
- 0x39b6c7,
- 0x37f785,
- 0x3585c6,
- 0x247b84,
- 0x2d37c5,
- 0x207a03,
- 0x21ac86,
- 0x20d382,
- 0x390e04,
- 0x227982,
- 0x2db883,
- 0x1ae007c2,
- 0x244a43,
- 0x21a544,
- 0x21a547,
- 0x3713c6,
- 0x2499c2,
- 0x1b22d642,
- 0x325e44,
- 0x1b626b02,
- 0x1ba0acc2,
- 0x2d6484,
- 0x2d6485,
- 0x2c3e85,
- 0x341a46,
- 0x1be01e02,
- 0x29fe45,
- 0x2ded05,
- 0x201e03,
- 0x3650c6,
- 0x378445,
- 0x213682,
- 0x33a005,
- 0x213684,
- 0x217c43,
- 0x219343,
- 0x1c20c502,
- 0x28e147,
- 0x35d884,
- 0x35d889,
- 0x247884,
- 0x22b603,
- 0x346449,
- 0x360e88,
- 0x2a3c84,
- 0x2a3c86,
- 0x201f83,
- 0x212883,
- 0x21eb03,
- 0x1c6e1102,
- 0x2e9182,
- 0x1ca0b2c2,
- 0x316b88,
- 0x34afc8,
- 0x394986,
- 0x2549c5,
- 0x21a905,
- 0x306007,
- 0x255805,
- 0x21c2c2,
- 0x1ce61e82,
- 0x1614b82,
- 0x38fa48,
- 0x33b585,
- 0x2c8084,
- 0x2e0b85,
- 0x390507,
- 0x258884,
- 0x23a882,
- 0x1d204c42,
- 0x32c704,
- 0x213507,
- 0x3abd87,
- 0x370a04,
- 0x28ea43,
- 0x244644,
- 0x244648,
- 0x231ac6,
- 0x24d70a,
- 0x206984,
- 0x28edc8,
- 0x253ac4,
- 0x224646,
- 0x290e84,
- 0x357e86,
- 0x35db49,
- 0x259187,
- 0x33a683,
- 0x1d605e82,
- 0x26a843,
- 0x20ff82,
- 0x1da04d42,
- 0x2dfe86,
- 0x35ed48,
- 0x2a5287,
- 0x3a30c9,
- 0x23a4c9,
- 0x2a5c85,
- 0x2a6e49,
- 0x2a7b45,
- 0x2a7c89,
- 0x2a8b85,
- 0x284244,
- 0x1de84247,
- 0x2957c3,
- 0x2a9c07,
- 0x3a5546,
- 0x2aa407,
- 0x2a2945,
- 0x2aba83,
- 0x1e232a02,
- 0x392844,
- 0x1e63a3c2,
- 0x25a183,
- 0x1ea0f1c2,
- 0x2e8b86,
- 0x38df85,
- 0x2acb87,
- 0x324d83,
- 0x250a44,
- 0x206f83,
- 0x20b343,
- 0x1ee082c2,
- 0x1f600042,
- 0x394344,
- 0x23aa43,
- 0x364885,
- 0x25fcc5,
- 0x1fa05602,
- 0x20200942,
- 0x276946,
- 0x209744,
- 0x30c6c4,
- 0x30c6ca,
- 0x20a00a82,
- 0x2f768a,
- 0x372fc8,
- 0x20e01604,
- 0x201d83,
- 0x216c03,
- 0x3209c9,
- 0x223349,
- 0x300546,
- 0x21202243,
- 0x2da985,
- 0x2f81cd,
- 0x202246,
- 0x2065cb,
- 0x21606382,
- 0x333208,
- 0x21a0bf02,
- 0x21e00b42,
- 0x2af285,
- 0x222074c2,
- 0x264c47,
- 0x2a2247,
- 0x2103c3,
- 0x2ae348,
- 0x22601982,
- 0x203a04,
- 0x3786c3,
- 0x332c05,
- 0x3833c3,
- 0x38da46,
- 0x31b204,
- 0x23c2c3,
- 0x26ad83,
- 0x22a095c2,
- 0x22aa44,
- 0x351445,
- 0x36bb47,
- 0x274643,
- 0x2ad803,
- 0x2aed83,
- 0x1621a82,
- 0x2aee43,
- 0x2af643,
- 0x22e04282,
- 0x2f5d44,
- 0x378306,
- 0x204283,
- 0x2af9c3,
- 0x232b09c2,
- 0x2b09c8,
- 0x2b1404,
- 0x25a546,
- 0x2b1847,
- 0x22ba06,
- 0x230d44,
- 0x30e001c2,
- 0x3a540b,
- 0x39fb4e,
- 0x21c80f,
- 0x233383,
- 0x31633e42,
- 0x1604ec2,
- 0x31a02b82,
- 0x227683,
- 0x202b83,
- 0x235c06,
- 0x2aea46,
- 0x27d807,
- 0x34aa44,
- 0x31e1bb82,
- 0x32229e82,
- 0x228e45,
- 0x3a4ac7,
- 0x371b86,
- 0x326436c2,
- 0x2436c4,
- 0x36e203,
- 0x32a09682,
- 0x32f508c3,
- 0x391004,
- 0x2b6b49,
- 0x16bc882,
- 0x33216c82,
- 0x216c85,
- 0x33644802,
- 0x33a00102,
- 0x33e507,
- 0x239049,
- 0x35364b,
- 0x241cc5,
- 0x377609,
- 0x2bcfc6,
- 0x22d0c7,
- 0x33e0c744,
- 0x305ac9,
- 0x35a787,
- 0x201b47,
- 0x209883,
- 0x209886,
- 0x2da2c7,
- 0x206003,
- 0x271e46,
- 0x34605642,
- 0x34a34642,
- 0x21fa43,
- 0x250645,
- 0x222547,
- 0x281b86,
- 0x37f705,
- 0x311244,
- 0x3b1405,
- 0x2e8904,
- 0x34e02102,
- 0x3210c7,
- 0x2d6044,
- 0x223244,
- 0x22324d,
- 0x248809,
- 0x2e0f48,
- 0x22cd04,
- 0x209b05,
- 0x27ee47,
- 0x332784,
- 0x22ef87,
- 0x3a8405,
- 0x353a9084,
- 0x2fa005,
- 0x25da84,
- 0x265d46,
- 0x319985,
- 0x35636b42,
- 0x212e04,
- 0x212e05,
- 0x213206,
- 0x37f845,
- 0x256584,
- 0x2dbc83,
- 0x32fd86,
- 0x220f45,
- 0x225285,
- 0x319a84,
- 0x206a03,
- 0x206a0c,
- 0x35a86002,
- 0x35e01042,
- 0x3620b402,
- 0x332683,
- 0x332684,
- 0x366061c2,
- 0x3a6088,
- 0x358685,
- 0x236604,
- 0x23b9c6,
- 0x36a0a242,
- 0x36e09bc2,
- 0x37200982,
- 0x2d8845,
- 0x251186,
- 0x341204,
- 0x2814c6,
- 0x3340c6,
- 0x203483,
- 0x3772788a,
- 0x23ad85,
+ 0x2474c3,
+ 0x39bc83,
+ 0x235143,
+ 0x242cc6,
+ 0x2ce085,
+ 0x2c8e47,
+ 0x2d0589,
+ 0x2ccac5,
+ 0x2cdfc6,
+ 0x2ce548,
+ 0x2ce746,
+ 0x245bc4,
+ 0x29ef8b,
+ 0x2d3983,
+ 0x2d3985,
+ 0x2d3ac8,
+ 0x226302,
+ 0x341982,
+ 0x4024db02,
+ 0x4060b602,
+ 0x21a8c3,
+ 0x40a73fc2,
+ 0x273fc3,
+ 0x2d3dc4,
+ 0x2d4e43,
+ 0x41201682,
+ 0x41601686,
+ 0x2c47c6,
+ 0x2da008,
+ 0x41a95242,
+ 0x41e10882,
+ 0x42223342,
+ 0x4265e402,
+ 0x42a14202,
+ 0x42e01302,
+ 0x234103,
+ 0x261c05,
+ 0x32d1c6,
+ 0x43213184,
+ 0x295c4a,
+ 0x201306,
+ 0x2f7ec4,
+ 0x269ec3,
+ 0x43e0c002,
+ 0x202082,
+ 0x231743,
+ 0x44204ac3,
+ 0x362b47,
+ 0x3695c7,
+ 0x45a58847,
+ 0x32d747,
+ 0x228543,
+ 0x2977ca,
+ 0x377004,
+ 0x220144,
+ 0x22014a,
+ 0x202085,
+ 0x45e04182,
+ 0x3294c3,
+ 0x462002c2,
+ 0x2104c3,
0x274803,
- 0x225046,
- 0x2efe09,
- 0x225047,
- 0x28bd48,
- 0x293849,
- 0x219888,
- 0x36a346,
- 0x20b203,
- 0x37a9a1c2,
- 0x3856c3,
- 0x3856c9,
- 0x3357c8,
- 0x37e09782,
- 0x38206742,
- 0x2348c3,
- 0x2cf145,
- 0x253304,
- 0x31c8c9,
- 0x25f6c4,
- 0x2b1648,
- 0x206743,
- 0x24f244,
- 0x326b83,
- 0x21ba88,
- 0x223187,
- 0x38643742,
- 0x269d42,
- 0x238c45,
- 0x268849,
- 0x211003,
- 0x278184,
- 0x2da944,
- 0x202c03,
- 0x278cca,
- 0x38b72e82,
- 0x38e12dc2,
- 0x2bdb03,
- 0x3751c3,
- 0x164f202,
- 0x250d03,
- 0x39250042,
- 0x39603042,
- 0x39b07b04,
- 0x366086,
- 0x3469c6,
- 0x276b84,
- 0x25a943,
- 0x27be43,
- 0x2e4983,
- 0x23f286,
- 0x2c2e45,
- 0x2be0c7,
- 0x22cf89,
- 0x2c1d45,
- 0x2c2d86,
- 0x2c3708,
- 0x2c3906,
- 0x238744,
- 0x29718b,
- 0x2c6383,
- 0x2c6385,
- 0x2c64c8,
- 0x21e442,
- 0x33e802,
- 0x39e43b02,
- 0x3a20e842,
- 0x21bbc3,
- 0x3a600e02,
- 0x269fc3,
- 0x2c67c4,
- 0x2c8183,
- 0x3ae25682,
- 0x3b2cc5c6,
- 0x2bb346,
- 0x2ccc08,
- 0x3b6cad42,
- 0x3ba111c2,
- 0x3be19382,
- 0x3c209f82,
- 0x3c614882,
- 0x3ca00ac2,
- 0x228343,
- 0x318d45,
- 0x209c86,
- 0x3ce12444,
- 0x3ab20a,
- 0x310606,
- 0x22ad04,
- 0x27e943,
- 0x3da06bc2,
- 0x205902,
- 0x24dbc3,
- 0x3de38483,
- 0x2ee087,
- 0x319887,
- 0x3f252c07,
- 0x20f007,
- 0x215a43,
- 0x22c6ca,
- 0x240584,
- 0x341504,
- 0x34150a,
- 0x247045,
- 0x3f601642,
- 0x24d483,
- 0x3fa01dc2,
- 0x201f43,
- 0x26a803,
- 0x40201942,
- 0x29a0c4,
- 0x220a84,
- 0x3a36c5,
- 0x2d7205,
- 0x22da06,
- 0x22dd86,
- 0x40608382,
- 0x40a025c2,
- 0x2eb445,
- 0x2bb052,
- 0x29fbc6,
- 0x21ce83,
- 0x2fd346,
- 0x221d85,
- 0x1611342,
- 0x48e0d502,
- 0x2ed8c3,
- 0x212043,
- 0x265603,
- 0x49203382,
- 0x379ac3,
- 0x49602182,
- 0x204a03,
- 0x2f5d88,
- 0x223b43,
- 0x223b46,
- 0x333a07,
- 0x2d84c6,
- 0x2d84cb,
- 0x22ac47,
- 0x392644,
- 0x49e02602,
- 0x3a6505,
- 0x215a03,
- 0x22fd83,
- 0x31aa03,
- 0x31aa06,
- 0x2d038a,
- 0x26d703,
- 0x21d5c4,
- 0x318146,
- 0x3b1e46,
- 0x4a2264c3,
- 0x250907,
- 0x29cf8d,
- 0x39eb87,
- 0x296ec5,
- 0x237806,
- 0x220f83,
- 0x4bb65303,
- 0x4be07a82,
- 0x307604,
- 0x21e3cc,
- 0x35bb89,
- 0x36f307,
- 0x246045,
- 0x255904,
- 0x26ae08,
- 0x274885,
- 0x274a85,
- 0x3612c9,
- 0x335283,
- 0x2a6b84,
- 0x4c206d42,
- 0x206d43,
- 0x4c690942,
- 0x295bc6,
- 0x16b5482,
- 0x4ca95782,
- 0x2d8748,
- 0x2b6d43,
- 0x2f9f47,
- 0x2d7785,
- 0x295785,
- 0x2f6c4b,
- 0x2d1f06,
- 0x2f6e46,
- 0x2f9d06,
- 0x226284,
- 0x2d4ac6,
- 0x2d5048,
- 0x234b03,
- 0x252ec3,
- 0x252ec4,
- 0x2d70c4,
- 0x2d7487,
- 0x2d8185,
- 0x4ced82c2,
- 0x4d206a42,
- 0x209285,
- 0x2990c4,
- 0x2dac8b,
- 0x2dbd48,
- 0x2e6804,
- 0x243702,
- 0x4da80b82,
- 0x2b0c03,
- 0x2dc204,
- 0x2dc4c5,
- 0x272d87,
- 0x2e06c4,
- 0x22ab04,
- 0x4de07442,
- 0x359f49,
- 0x2e1585,
- 0x241f85,
- 0x2e2105,
- 0x4e21bd03,
- 0x2e2f44,
- 0x2e2f4b,
- 0x2e3444,
- 0x2e3ecb,
- 0x2e48c5,
- 0x21c94a,
- 0x2e4f88,
- 0x2e518a,
- 0x2e5a03,
- 0x2e5a0a,
- 0x4e626402,
- 0x4ea41542,
- 0x265903,
- 0x4eee7d82,
- 0x2e7d83,
- 0x4f35d142,
- 0x4f7157c2,
- 0x2e8784,
- 0x21dd86,
- 0x281205,
- 0x2e91c3,
- 0x29ef06,
- 0x21d445,
- 0x21e104,
- 0x4fa08782,
- 0x2ca784,
- 0x2bf10a,
- 0x386847,
- 0x38ddc6,
- 0x2d0847,
- 0x21e503,
- 0x253b48,
- 0x25b5cb,
- 0x300645,
- 0x2b6e85,
- 0x2b6e86,
- 0x225904,
- 0x335b88,
- 0x20b4c3,
- 0x20e204,
- 0x20e207,
- 0x280ec6,
- 0x321746,
- 0x29b68a,
- 0x244fc4,
- 0x244fca,
- 0x2de886,
- 0x2de887,
- 0x253887,
- 0x26f884,
- 0x26f889,
- 0x24b7c5,
- 0x23a30b,
- 0x26ddc3,
- 0x20d0c3,
- 0x21a943,
- 0x231e84,
- 0x4fe04b42,
- 0x254186,
- 0x2ab805,
- 0x2b2dc5,
- 0x3324c6,
- 0x279384,
- 0x502013c2,
- 0x240b44,
- 0x50607982,
- 0x232984,
- 0x227783,
- 0x50a12082,
- 0x349f83,
- 0x24ae86,
- 0x50e01bc2,
- 0x30f108,
- 0x224ec4,
- 0x224ec6,
- 0x305546,
- 0x255f04,
- 0x32fd05,
- 0x3a8108,
- 0x3a8607,
- 0x3b0bc7,
- 0x3b0bcf,
- 0x28f286,
- 0x210d03,
- 0x210d04,
- 0x2251c4,
- 0x229103,
- 0x224784,
- 0x373e44,
- 0x51226442,
- 0x287303,
- 0x390683,
- 0x51617642,
- 0x222a43,
- 0x24f803,
- 0x218e4a,
- 0x23b5c7,
- 0x3a568c,
- 0x3a5946,
- 0x230ac6,
- 0x23a6c7,
- 0x2302c7,
- 0x23e289,
- 0x21f144,
- 0x23ea84,
- 0x51a0a442,
- 0x51e01402,
- 0x29ba46,
- 0x250704,
- 0x376e86,
- 0x230748,
- 0x330cc4,
- 0x264c86,
- 0x2c9745,
- 0x25f008,
- 0x207503,
- 0x266a45,
- 0x269b43,
- 0x242083,
- 0x242084,
- 0x26afc3,
- 0x522e1202,
- 0x52602482,
- 0x26dc89,
- 0x274985,
- 0x283dc4,
- 0x3614c5,
- 0x210804,
- 0x2ed107,
- 0x33fac5,
- 0x252dc4,
- 0x252dc8,
- 0x2d3486,
- 0x2d5204,
- 0x2d5208,
- 0x2d5e87,
- 0x52a015c2,
- 0x2da0c4,
- 0x2d3904,
- 0x201d47,
- 0x52e41384,
- 0x22dc82,
- 0x53201882,
- 0x202b43,
- 0x216b84,
- 0x222903,
- 0x222905,
- 0x5362c082,
- 0x2e9085,
- 0x210fc2,
- 0x376445,
- 0x35ef05,
- 0x53a168c2,
- 0x2168c4,
- 0x53e08d82,
- 0x2c7b06,
- 0x2ac106,
- 0x268988,
- 0x2b7b88,
- 0x2e8b04,
- 0x35e245,
- 0x2f39c9,
- 0x29f484,
- 0x2d0344,
- 0x2513c3,
- 0x5420dfc5,
- 0x374f07,
- 0x2881c4,
- 0x35a90d,
- 0x35b202,
- 0x3858c3,
- 0x39a083,
- 0x54601082,
- 0x3886c5,
- 0x31b447,
- 0x20f0c4,
- 0x20f0c7,
- 0x293a49,
- 0x2bf249,
- 0x214687,
- 0x24fa83,
- 0x2b52c8,
- 0x23dd09,
- 0x2e9947,
- 0x2e9cc5,
- 0x2ea486,
- 0x2eaac6,
- 0x2eac45,
- 0x248905,
- 0x54a01282,
- 0x228685,
- 0x2b9988,
- 0x2a79c6,
- 0x3a1c87,
- 0x2e4b04,
- 0x2ab1c7,
- 0x2edd06,
- 0x54e00242,
- 0x212f06,
- 0x2f004a,
- 0x2f1045,
- 0x552d29c2,
- 0x55638282,
- 0x2da606,
- 0x3574c8,
- 0x55babf47,
- 0x55e00602,
- 0x20a503,
- 0x3b0306,
- 0x30aa04,
- 0x3338c6,
- 0x341746,
- 0x3971ca,
- 0x3a1e05,
- 0x20d586,
- 0x218743,
- 0x218744,
- 0x207282,
- 0x2fe483,
- 0x56253e82,
- 0x2dd843,
- 0x2f7904,
- 0x2dca04,
- 0x35760a,
- 0x245483,
- 0x283b08,
- 0x36a40a,
- 0x278447,
- 0x2f4846,
- 0x2c79c4,
- 0x22abc2,
- 0x200e42,
- 0x56609202,
- 0x244603,
- 0x253647,
- 0x29f1c7,
- 0x38f98b,
- 0x3643c4,
- 0x349447,
- 0x272e86,
- 0x213807,
- 0x2ad204,
- 0x33bb85,
- 0x2a96c5,
- 0x56a10442,
- 0x221a46,
- 0x2259c3,
- 0x226cc2,
- 0x226cc6,
- 0x56e0d942,
- 0x57203e42,
- 0x203e45,
- 0x57624982,
- 0x57a06ec2,
- 0x358845,
- 0x2c0f45,
- 0x20d645,
- 0x264183,
- 0x340185,
- 0x2d1fc7,
- 0x2aa2c5,
- 0x3219c5,
- 0x38b604,
- 0x379bc6,
- 0x243c84,
- 0x57e00cc2,
- 0x276485,
- 0x2a4887,
- 0x377088,
- 0x26a8c6,
- 0x26a8cd,
- 0x270789,
- 0x270792,
- 0x322045,
- 0x326e03,
- 0x58a019c2,
- 0x2e6004,
- 0x2022c3,
- 0x35e145,
- 0x2f2605,
- 0x58e21e42,
- 0x290f03,
- 0x59242d42,
- 0x59694082,
- 0x59a18882,
- 0x346e05,
- 0x2a1003,
- 0x397008,
- 0x59e011c2,
- 0x5a203282,
- 0x29a086,
- 0x27f30a,
- 0x204983,
- 0x256503,
- 0x2f3c43,
- 0x5ae06202,
- 0x692033c2,
- 0x69a04cc2,
- 0x203dc2,
- 0x38bd09,
- 0x2bbcc4,
- 0x2ae648,
- 0x69ee9202,
- 0x6a205882,
- 0x2e4105,
- 0x2355c8,
- 0x247d88,
- 0x2f334c,
- 0x23a183,
- 0x25d442,
- 0x6a62d742,
- 0x2c21c6,
- 0x2f56c5,
- 0x30f5c3,
- 0x3903c6,
- 0x2f5806,
- 0x22fc43,
- 0x2f6a03,
- 0x2f6fc6,
- 0x2f7d84,
- 0x270186,
- 0x2c6545,
- 0x2f800a,
- 0x23d184,
- 0x2f8d84,
- 0x34b94a,
- 0x6aa6cd42,
- 0x347a45,
- 0x2fa44a,
- 0x2fb885,
- 0x2fc404,
- 0x2fc506,
- 0x2fc684,
- 0x366dc6,
- 0x6ae00282,
- 0x38d706,
- 0x38e7c5,
- 0x204707,
- 0x239f46,
- 0x22d584,
- 0x22d587,
- 0x3277c6,
- 0x212f45,
- 0x2c6c87,
- 0x39ae07,
- 0x39ae0e,
- 0x223ec6,
- 0x22ee45,
- 0x279a07,
- 0x2deb83,
- 0x2deb87,
- 0x3a8a05,
- 0x211204,
- 0x2120c2,
- 0x37a547,
- 0x34aac4,
- 0x2ae9c4,
- 0x269bcb,
- 0x2201c3,
- 0x2c3a47,
- 0x2201c4,
- 0x2ce307,
- 0x238943,
- 0x32914d,
- 0x388f08,
- 0x252cc4,
- 0x252cc5,
- 0x2fca45,
- 0x2fd003,
- 0x6b224dc2,
- 0x2fe443,
- 0x2fea03,
- 0x365c44,
- 0x276e45,
- 0x2193c7,
- 0x2187c6,
- 0x372f83,
- 0x226e0b,
- 0x29d34b,
- 0x267c4b,
- 0x276f4a,
- 0x2a734b,
- 0x2cae0b,
- 0x2d2a0c,
- 0x2d5711,
- 0x33d90a,
- 0x34e1cb,
- 0x37bd0b,
- 0x3ae28a,
- 0x3b2eca,
- 0x2ff60d,
- 0x300d4e,
- 0x301b4b,
- 0x301e0a,
- 0x302d51,
- 0x30318a,
- 0x30368b,
- 0x303bce,
- 0x30450c,
- 0x30498b,
- 0x304c4e,
- 0x304fcc,
- 0x3087ca,
- 0x3098cc,
- 0x6b709bca,
- 0x30adc9,
- 0x30c94a,
- 0x30cbca,
- 0x30ce4b,
- 0x312f8e,
- 0x313311,
- 0x31bcc9,
- 0x31bf0a,
- 0x31cb0b,
- 0x31e2ca,
- 0x31ee56,
- 0x32060b,
- 0x321e0a,
- 0x32220a,
- 0x32424b,
- 0x326889,
- 0x329ac9,
- 0x32ae0d,
- 0x32c48b,
- 0x32d60b,
- 0x32dfcb,
- 0x32e449,
- 0x32ea8e,
- 0x32efca,
- 0x335e4a,
- 0x33648a,
- 0x336e4b,
- 0x33768b,
- 0x33794d,
- 0x33904d,
- 0x339c90,
- 0x33a14b,
- 0x33ac8c,
- 0x33c3cb,
- 0x33e00b,
- 0x33f64b,
- 0x34490b,
- 0x34538f,
- 0x34574b,
- 0x34600a,
- 0x346709,
- 0x346b49,
- 0x34808b,
- 0x34834e,
- 0x34bfcb,
- 0x34cd8f,
- 0x34ed8b,
- 0x34f04b,
- 0x34f30b,
- 0x34f74a,
- 0x353249,
- 0x35624f,
- 0x35ce4c,
- 0x35d34c,
- 0x35de0e,
- 0x35e48f,
- 0x35e84e,
- 0x35fa90,
- 0x35fe8f,
- 0x3608ce,
- 0x3617cc,
- 0x361ad2,
- 0x36b751,
- 0x36bd0e,
- 0x36c14e,
+ 0x46a00842,
+ 0x2e33c4,
+ 0x21db44,
+ 0x208285,
+ 0x30bd05,
+ 0x249406,
+ 0x249786,
+ 0x46e09282,
+ 0x47201002,
+ 0x3274c5,
+ 0x2c44d2,
+ 0x271ac6,
+ 0x248803,
+ 0x2a2486,
+ 0x248805,
+ 0x1610a02,
+ 0x4f611802,
+ 0x3522c3,
+ 0x211803,
+ 0x278203,
+ 0x4fa11f82,
+ 0x378ac3,
+ 0x4fe14602,
+ 0x200a83,
+ 0x2ceec8,
+ 0x24a843,
+ 0x24a846,
+ 0x3a1087,
+ 0x321b06,
+ 0x321b0b,
+ 0x2f7e07,
+ 0x392404,
+ 0x50603ec2,
+ 0x364805,
+ 0x50a04a83,
+ 0x239f83,
+ 0x326805,
+ 0x35b5c3,
+ 0x35b5c6,
+ 0x26334a,
+ 0x2774c3,
+ 0x23ad04,
+ 0x2c2806,
+ 0x20df46,
+ 0x50e00383,
+ 0x324b07,
+ 0x28bb8d,
+ 0x3adbc7,
+ 0x2a0685,
+ 0x250b46,
+ 0x22c0c3,
+ 0x52a15e43,
+ 0x52e04c82,
+ 0x3b2804,
+ 0x236d8c,
+ 0x245309,
+ 0x24bcc7,
+ 0x3724c5,
+ 0x268d84,
+ 0x27c1c8,
+ 0x27ed05,
+ 0x5328a405,
+ 0x377c09,
+ 0x256343,
+ 0x2acd44,
+ 0x53617902,
+ 0x21aac3,
+ 0x53a99f82,
+ 0x2a3fc6,
+ 0x16aa082,
+ 0x53e943c2,
+ 0x321d88,
+ 0x2c08c3,
+ 0x36de07,
+ 0x305105,
+ 0x2943c5,
+ 0x30860b,
+ 0x2e3906,
+ 0x308806,
+ 0x36dbc6,
+ 0x268f84,
+ 0x2e5686,
+ 0x2e5b48,
+ 0x23e943,
+ 0x23cf83,
+ 0x23cf84,
+ 0x2e6984,
+ 0x2e6e07,
+ 0x2e8745,
+ 0x542e8882,
+ 0x54606ec2,
+ 0x206ec5,
+ 0x2a4a84,
+ 0x2ebf8b,
+ 0x2ee248,
+ 0x2f7304,
+ 0x290602,
+ 0x54eb6042,
+ 0x38c543,
+ 0x2ee704,
+ 0x2ee9c5,
+ 0x2ef087,
+ 0x2f1404,
+ 0x2f7cc4,
+ 0x552054c2,
+ 0x35d209,
+ 0x2f2445,
+ 0x2716c5,
+ 0x2f3105,
+ 0x5561aa03,
+ 0x2f4244,
+ 0x2f424b,
+ 0x2f4684,
+ 0x2f4b0b,
+ 0x2f5505,
+ 0x21bc4a,
+ 0x2f5d08,
+ 0x2f5f0a,
+ 0x2f6783,
+ 0x2f678a,
+ 0x55a1b282,
+ 0x55e01202,
+ 0x26a103,
+ 0x562f7902,
+ 0x2f7903,
+ 0x5673aa42,
+ 0x56b21202,
+ 0x2f8104,
+ 0x21c2c6,
+ 0x325d05,
+ 0x2f8b43,
+ 0x32ff46,
+ 0x30c845,
+ 0x2e9784,
+ 0x56e00e02,
+ 0x2d7904,
+ 0x2c9c4a,
+ 0x2eb487,
+ 0x26b686,
+ 0x244007,
+ 0x236ec3,
+ 0x265488,
+ 0x28954b,
+ 0x386a45,
+ 0x235905,
+ 0x235906,
+ 0x370204,
+ 0x31d488,
+ 0x215a83,
+ 0x2b5984,
+ 0x36b507,
+ 0x307206,
+ 0x200e06,
+ 0x2a58ca,
+ 0x24e684,
+ 0x24e68a,
+ 0x57201946,
+ 0x201947,
+ 0x259547,
+ 0x279804,
+ 0x279809,
+ 0x2ba485,
+ 0x23b80b,
+ 0x2769c3,
+ 0x211c03,
+ 0x2a3f43,
+ 0x22ec44,
+ 0x57600682,
+ 0x259f06,
+ 0x2a7d05,
+ 0x2a26c5,
+ 0x2564c6,
+ 0x2531c4,
+ 0x57a01f82,
+ 0x245244,
+ 0x57e00d42,
+ 0x200d44,
+ 0x224303,
+ 0x58211842,
+ 0x3398c3,
+ 0x2478c6,
+ 0x58602602,
+ 0x2cfb88,
+ 0x223704,
+ 0x223706,
+ 0x375846,
+ 0x25bb44,
+ 0x204905,
+ 0x20c408,
+ 0x20c907,
+ 0x20d007,
+ 0x20d00f,
+ 0x298bc6,
+ 0x227843,
+ 0x227844,
+ 0x28be84,
+ 0x210e83,
+ 0x222c84,
+ 0x241104,
+ 0x58a36b82,
+ 0x28e183,
+ 0x241383,
+ 0x58e0c4c2,
+ 0x22a543,
+ 0x260883,
+ 0x213e8a,
+ 0x22bc87,
+ 0x241c8c,
+ 0x241f46,
+ 0x242406,
+ 0x246dc7,
+ 0x592ddb07,
+ 0x251a09,
+ 0x21cc04,
+ 0x252284,
+ 0x59609f42,
+ 0x59a01702,
+ 0x2a5c86,
+ 0x324904,
+ 0x2db5c6,
+ 0x2ab348,
+ 0x20eec4,
+ 0x2a3186,
+ 0x2d68c5,
+ 0x26ebc8,
+ 0x205583,
+ 0x272605,
+ 0x273583,
+ 0x2717c3,
+ 0x2717c4,
+ 0x273983,
+ 0x59edeec2,
+ 0x5a200b42,
+ 0x276889,
+ 0x27ec05,
+ 0x27ee04,
+ 0x281305,
+ 0x212504,
+ 0x2c1247,
+ 0x33d3c5,
+ 0x258a04,
+ 0x258a08,
+ 0x2dc3c6,
+ 0x2de404,
+ 0x2dfdc8,
+ 0x2e1a87,
+ 0x5a60e5c2,
+ 0x305304,
+ 0x210f44,
+ 0x2257c7,
+ 0x5aa53d84,
+ 0x249682,
+ 0x5ae01ac2,
+ 0x21b083,
+ 0x351144,
+ 0x242643,
+ 0x33d945,
+ 0x5b21de42,
+ 0x2ebb05,
+ 0x212bc2,
+ 0x381dc5,
+ 0x364305,
+ 0x5b60c842,
+ 0x3581c4,
+ 0x5ba06342,
+ 0x2a9146,
+ 0x2ac506,
+ 0x396208,
+ 0x2c3608,
+ 0x3075c4,
+ 0x2f8905,
+ 0x2fe809,
+ 0x2e10c4,
+ 0x263304,
+ 0x20aec3,
+ 0x5be20c45,
+ 0x2c7087,
+ 0x25e944,
+ 0x33a48d,
+ 0x33c282,
+ 0x33c283,
+ 0x355783,
+ 0x5c200202,
+ 0x388b45,
+ 0x26c747,
+ 0x2a7e04,
+ 0x32d807,
+ 0x29d849,
+ 0x2c9d89,
+ 0x248ac7,
+ 0x243843,
+ 0x27c008,
+ 0x2f33c9,
+ 0x2500c7,
+ 0x370145,
+ 0x385886,
+ 0x394246,
+ 0x3959c5,
+ 0x257345,
+ 0x5c603102,
+ 0x27eb05,
+ 0x2b8308,
+ 0x2c5386,
+ 0x2bcc07,
+ 0x2f5744,
+ 0x2ad207,
+ 0x2faf46,
+ 0x5ca2fb02,
+ 0x3713c6,
+ 0x2fd38a,
+ 0x2fde45,
+ 0x5cee4742,
+ 0x5d245702,
+ 0x30fbc6,
+ 0x2b25c8,
+ 0x5d68eb87,
+ 0x5da04602,
+ 0x20edc3,
+ 0x38c706,
+ 0x2246c4,
+ 0x3a0f46,
+ 0x262446,
+ 0x26bd0a,
+ 0x319a45,
+ 0x204446,
+ 0x218c83,
+ 0x218c84,
+ 0x205302,
+ 0x30c283,
+ 0x5de05dc2,
+ 0x2ce903,
+ 0x3734c4,
+ 0x2b2704,
+ 0x2b270a,
+ 0x229b03,
+ 0x28a7c8,
+ 0x229b0a,
+ 0x23a407,
+ 0x301446,
+ 0x2a9004,
+ 0x296e42,
+ 0x219542,
+ 0x5e206e42,
+ 0x24e1c3,
+ 0x259307,
+ 0x330207,
+ 0x38fd4b,
+ 0x28a2c4,
+ 0x34f9c7,
+ 0x2ef186,
+ 0x21c607,
+ 0x258004,
+ 0x23c445,
+ 0x2c17c5,
+ 0x5e620382,
+ 0x221a86,
+ 0x246043,
+ 0x24a2c2,
+ 0x24a2c6,
+ 0x5ea04802,
+ 0x5ee05bc2,
+ 0x3abd45,
+ 0x5f222e82,
+ 0x5f600a42,
+ 0x343745,
+ 0x38e6c5,
+ 0x204505,
+ 0x270ac3,
+ 0x390b05,
+ 0x2e39c7,
+ 0x309445,
+ 0x30a985,
+ 0x3a05c4,
+ 0x24c646,
+ 0x25c1c4,
+ 0x5fa03382,
+ 0x6060ce05,
+ 0x36f447,
+ 0x2db7c8,
+ 0x2a32c6,
+ 0x2a32cd,
+ 0x2a86c9,
+ 0x2a86d2,
+ 0x332705,
+ 0x33c843,
+ 0x60a044c2,
+ 0x2f6d84,
+ 0x204383,
+ 0x3623c5,
+ 0x2fed85,
+ 0x60e17082,
+ 0x3700c3,
+ 0x6124d082,
+ 0x616c3142,
+ 0x61a18dc2,
+ 0x364c05,
+ 0x329ec3,
+ 0x319888,
+ 0x61e02d82,
+ 0x62206902,
+ 0x2e3386,
+ 0x34398a,
+ 0x272243,
+ 0x25c083,
+ 0x2ed703,
+ 0x62e016c2,
+ 0x71211fc2,
+ 0x71a19682,
+ 0x206602,
+ 0x3711c9,
+ 0x2c6404,
+ 0x22fb48,
+ 0x71ef8b82,
+ 0x72202502,
+ 0x2f4d45,
+ 0x232ac8,
+ 0x2cf008,
+ 0x2fd54c,
+ 0x23bd83,
+ 0x267002,
+ 0x726019c2,
+ 0x2ccf46,
+ 0x3022c5,
+ 0x239103,
+ 0x383586,
+ 0x302406,
+ 0x21e2c3,
+ 0x304ec3,
+ 0x3055c6,
+ 0x306204,
+ 0x225d46,
+ 0x2d3b45,
+ 0x30648a,
+ 0x240544,
+ 0x307884,
+ 0x307a4a,
+ 0x72a037c2,
+ 0x234605,
+ 0x30898a,
+ 0x309a85,
+ 0x30a344,
+ 0x30a446,
+ 0x30a5c4,
+ 0x228306,
+ 0x72e39342,
+ 0x2eadc6,
+ 0x3a2445,
+ 0x26bb87,
+ 0x3a3c46,
+ 0x246fc4,
+ 0x2da807,
+ 0x311586,
+ 0x25b5c5,
+ 0x2d4287,
+ 0x39cd87,
+ 0x39cd8e,
+ 0x24abc6,
+ 0x382905,
+ 0x285407,
+ 0x201c43,
+ 0x201c47,
+ 0x3b3445,
+ 0x2108c4,
+ 0x211882,
+ 0x22afc7,
+ 0x31ab04,
+ 0x22fec4,
+ 0x24314b,
+ 0x21d283,
+ 0x288fc7,
+ 0x21d284,
+ 0x2ace07,
+ 0x2824c3,
+ 0x334b4d,
+ 0x389388,
+ 0x228e04,
+ 0x258905,
+ 0x30ac85,
+ 0x30b0c3,
+ 0x73201a82,
+ 0x30c243,
+ 0x30cf43,
+ 0x221c04,
+ 0x280785,
+ 0x223387,
+ 0x218d06,
+ 0x373203,
+ 0x24a40b,
+ 0x3aa70b,
+ 0x27928b,
+ 0x28088a,
+ 0x2ad8cb,
+ 0x2fc28b,
+ 0x2e478c,
+ 0x2e7291,
+ 0x32170a,
+ 0x34e48b,
+ 0x379d0b,
+ 0x3b048a,
+ 0x3b4cca,
+ 0x30ea4d,
+ 0x31038e,
+ 0x3109cb,
+ 0x310c8a,
+ 0x312191,
+ 0x3125ca,
+ 0x312acb,
+ 0x31300e,
+ 0x31398c,
+ 0x313fcb,
+ 0x31428e,
+ 0x31460c,
+ 0x315a4a,
+ 0x31694c,
+ 0x73716c4a,
+ 0x317449,
+ 0x31b60a,
+ 0x31b88a,
+ 0x31bb0b,
+ 0x31e9ce,
+ 0x31ed51,
+ 0x327a09,
+ 0x327c4a,
+ 0x32844b,
+ 0x32a30a,
+ 0x32ab96,
+ 0x32c8cb,
+ 0x32e00a,
+ 0x32e5ca,
+ 0x33048b,
+ 0x332189,
+ 0x3354c9,
+ 0x335a4d,
+ 0x3360cb,
+ 0x33734b,
+ 0x337d0b,
+ 0x3381c9,
+ 0x33880e,
+ 0x338f0a,
+ 0x33a24a,
+ 0x33a7ca,
+ 0x33af8b,
+ 0x33b7cb,
+ 0x33ba8d,
+ 0x33cecd,
+ 0x33da90,
+ 0x33df4b,
+ 0x33e54c,
+ 0x33ea4b,
+ 0x34118b,
+ 0x34290b,
+ 0x3463cb,
+ 0x346e4f,
+ 0x34720b,
+ 0x347d0a,
+ 0x348249,
+ 0x348609,
+ 0x34898b,
+ 0x348c4e,
+ 0x34b98b,
+ 0x34d04f,
+ 0x34ff0b,
+ 0x3501cb,
+ 0x35048b,
+ 0x35098a,
+ 0x355c09,
+ 0x35a20f,
+ 0x36128c,
+ 0x36170c,
+ 0x36208e,
+ 0x36388f,
+ 0x363c4e,
+ 0x3652d0,
+ 0x3656cf,
+ 0x365d4e,
+ 0x36650c,
+ 0x366812,
+ 0x36a511,
+ 0x36ad0e,
+ 0x36ba0e,
+ 0x36bf4e,
+ 0x36c2cf,
0x36c68e,
- 0x36ca0f,
- 0x36cdce,
- 0x36d153,
- 0x36d611,
- 0x36da4e,
- 0x36decc,
- 0x36e2d3,
- 0x36f650,
- 0x36ff0c,
- 0x37020c,
- 0x3706cb,
- 0x37168e,
+ 0x36ca13,
+ 0x36ced1,
+ 0x36d30e,
+ 0x36d78c,
+ 0x36e493,
+ 0x36fa90,
+ 0x37070c,
+ 0x370a0c,
+ 0x370ecb,
+ 0x37184e,
0x371f8b,
- 0x3723cb,
- 0x373b0c,
- 0x37acca,
- 0x37b50c,
- 0x37b80c,
- 0x37bb09,
- 0x37cf0b,
- 0x37d1c8,
- 0x37d3c9,
- 0x37d3cf,
- 0x37ed0b,
- 0x37fa0a,
- 0x380fcc,
- 0x382e49,
- 0x383208,
- 0x38374b,
- 0x383e4b,
- 0x384c8a,
- 0x384f0b,
- 0x38544c,
- 0x385e08,
- 0x38910b,
- 0x38ba0b,
- 0x38fc4b,
- 0x391a4b,
- 0x39a98b,
- 0x39ac49,
- 0x39b18d,
- 0x3a004a,
- 0x3a0f97,
- 0x3a2898,
- 0x3a5bc9,
+ 0x3727cb,
+ 0x37378c,
+ 0x37914a,
+ 0x37950c,
+ 0x37980c,
+ 0x379b09,
+ 0x37b7cb,
+ 0x37ba88,
+ 0x37bc89,
+ 0x37bc8f,
+ 0x37d5cb,
+ 0x37e44a,
+ 0x37fd4c,
+ 0x380e09,
+ 0x381b88,
+ 0x38214b,
+ 0x382c0b,
+ 0x38418a,
+ 0x38440b,
+ 0x38488c,
+ 0x385548,
+ 0x38958b,
+ 0x38c04b,
+ 0x39000b,
+ 0x39180b,
+ 0x39c90b,
+ 0x39cbc9,
+ 0x39d10d,
+ 0x3a264a,
+ 0x3a3597,
+ 0x3a3dd8,
+ 0x3a6309,
0x3a7b4b,
- 0x3a9414,
- 0x3a990b,
- 0x3a9e8a,
- 0x3aa30a,
- 0x3aa58b,
- 0x3ab590,
- 0x3ab991,
- 0x3ac48a,
- 0x3ad88d,
- 0x3adf8d,
- 0x3b328b,
- 0x3b4506,
- 0x221b43,
- 0x6bb99283,
- 0x323dc6,
- 0x28b6c5,
- 0x2c55c7,
- 0x33d7c6,
- 0x1617982,
- 0x2b0d49,
- 0x29ed04,
- 0x2cfe48,
- 0x242743,
- 0x2e5f47,
- 0x230902,
- 0x2acbc3,
- 0x6be006c2,
- 0x2c0586,
- 0x2c17c4,
- 0x307c84,
- 0x236c43,
- 0x236c45,
- 0x6c6ff382,
- 0x6caa8004,
- 0x26f7c7,
- 0x16ce2c2,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x2025c3,
- 0x200882,
- 0x880c8,
- 0x216582,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x317416,
- 0x31a5d3,
- 0x3492c9,
- 0x3aad88,
- 0x3a6389,
- 0x2fa5c6,
- 0x32c750,
- 0x21d6d3,
- 0x200b08,
- 0x25aa47,
- 0x274ec7,
- 0x29cb4a,
- 0x2f7989,
- 0x3336c9,
- 0x28a70b,
- 0x325506,
- 0x31cf8a,
- 0x223586,
- 0x29e903,
- 0x28e085,
- 0x217188,
- 0x2c7bcd,
- 0x357c4c,
- 0x38e487,
- 0x3025cd,
- 0x3a8204,
- 0x23214a,
- 0x232a8a,
- 0x232f4a,
- 0x21d9c7,
- 0x23cfc7,
- 0x23f644,
- 0x239506,
- 0x3258c4,
- 0x2ec848,
- 0x25f709,
- 0x2b83c6,
- 0x2b83c8,
- 0x2423cd,
- 0x2bf489,
- 0x378cc8,
- 0x241f07,
- 0x2fe78a,
- 0x24a4c6,
- 0x25a047,
- 0x2cdac4,
- 0x240d07,
- 0x30130a,
- 0x3397ce,
- 0x255805,
- 0x2fcd4b,
- 0x277a09,
- 0x223349,
- 0x2a2087,
- 0x358b0a,
- 0x201c87,
- 0x39fc89,
- 0x358108,
- 0x369c4b,
- 0x2cf145,
- 0x2e0e0a,
- 0x2a37c9,
- 0x30f54a,
- 0x2c1dcb,
- 0x240c0b,
- 0x28a495,
- 0x2d5d45,
- 0x241f85,
- 0x2e2f4a,
- 0x215cca,
- 0x310c47,
- 0x220683,
- 0x29b9c8,
- 0x2cb14a,
- 0x224ec6,
- 0x23db49,
- 0x25f008,
- 0x2d5204,
- 0x22fb09,
- 0x2b7b88,
- 0x32c247,
- 0x276486,
- 0x2a4887,
- 0x28fd87,
- 0x23f085,
- 0x25564c,
- 0x252cc5,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x22d183,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x22d183,
- 0x238483,
- 0x223b43,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x216582,
- 0x201a42,
- 0x233182,
- 0x201982,
- 0x204c02,
- 0x293d42,
- 0x462d183,
- 0x2343c3,
- 0x211cc3,
- 0x21eb03,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x20b443,
- 0x880c8,
- 0x335d44,
- 0x24f007,
- 0x251fc3,
- 0x231404,
- 0x214bc3,
- 0x282343,
- 0x21eb03,
- 0x16e747,
- 0x200882,
- 0x123ac3,
- 0x5a16582,
- 0x86a0d,
- 0x233182,
- 0x1604,
- 0x201502,
- 0x5e01508,
- 0xe26c4,
- 0x880c8,
- 0x140de82,
- 0x14fa2c6,
- 0x230983,
- 0x316403,
- 0x662d183,
- 0x232144,
- 0x6a343c3,
- 0x6e1eb03,
- 0x2082c2,
- 0x201604,
- 0x238483,
- 0x212ec3,
- 0x202282,
- 0x2264c3,
- 0x21ed42,
- 0x2e86c3,
- 0x201bc2,
- 0x29c743,
- 0x22d743,
- 0x204702,
- 0x880c8,
- 0x230983,
- 0x212ec3,
- 0x202282,
- 0x2e86c3,
- 0x201bc2,
- 0x29c743,
- 0x22d743,
- 0x204702,
- 0x2e86c3,
- 0x201bc2,
- 0x29c743,
- 0x22d743,
- 0x204702,
- 0x22d183,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x202002,
- 0x21bd03,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x238483,
- 0x2264c3,
- 0x2e9cc5,
- 0x221e42,
- 0x200882,
- 0x880c8,
- 0x1462d48,
- 0x21eb03,
- 0x225b41,
- 0x20fd41,
- 0x20c401,
- 0x20c041,
- 0x226fc1,
- 0x26f541,
- 0x252041,
- 0x225c41,
- 0x2d5901,
- 0x2ff8c1,
+ 0x3a9554,
+ 0x3a9a4b,
+ 0x3a9fca,
+ 0x3ab70a,
+ 0x3ab98b,
+ 0x3ad110,
+ 0x3ad511,
+ 0x3ae64a,
+ 0x3afa8d,
+ 0x3b018d,
+ 0x3b508b,
+ 0x3b5c46,
+ 0x221b83,
+ 0x73b76c03,
+ 0x37f706,
+ 0x292c85,
+ 0x396787,
+ 0x3215c6,
+ 0x1639f02,
+ 0x2b3809,
+ 0x32fd44,
+ 0x2e0bc8,
+ 0x24e103,
+ 0x2f6cc7,
+ 0x241b82,
+ 0x2b2c03,
+ 0x73e06c82,
+ 0x2cb006,
+ 0x2cc544,
+ 0x3b2e84,
+ 0x2616c3,
+ 0x2616c5,
+ 0x746c7282,
+ 0x74aae504,
+ 0x279747,
+ 0x1669e02,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x20abc3,
+ 0x204cc2,
+ 0x15f048,
+ 0x20d1c2,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x324156,
+ 0x325393,
+ 0x34f849,
+ 0x2957c8,
+ 0x364689,
+ 0x308b06,
+ 0x336f50,
+ 0x25c9d3,
+ 0x3072c8,
+ 0x344207,
+ 0x27e407,
+ 0x2475ca,
+ 0x373549,
+ 0x239789,
+ 0x29258b,
+ 0x367e06,
+ 0x314aca,
+ 0x2221c6,
+ 0x32f943,
+ 0x294985,
+ 0x22b888,
+ 0x2a920d,
+ 0x35ab0c,
+ 0x3a2107,
+ 0x379f8d,
+ 0x20c504,
+ 0x22ef0a,
+ 0x23064a,
+ 0x230b0a,
+ 0x20fe87,
+ 0x240387,
+ 0x243084,
+ 0x26cdc6,
+ 0x3aab84,
+ 0x2e26c8,
+ 0x2267c9,
+ 0x2b94c6,
+ 0x2b94c8,
+ 0x24c34d,
+ 0x2c9fc9,
+ 0x207d48,
+ 0x271647,
+ 0x2f8e8a,
+ 0x2539c6,
+ 0x2642c7,
+ 0x2c96c4,
+ 0x28e807,
+ 0x332eca,
+ 0x36f5ce,
+ 0x228fc5,
+ 0x28e70b,
+ 0x262089,
+ 0x2a8909,
+ 0x2129c7,
+ 0x29998a,
+ 0x225707,
+ 0x2ffd09,
+ 0x326b48,
+ 0x35dc4b,
+ 0x2e0405,
+ 0x38144a,
+ 0x223109,
+ 0x23908a,
+ 0x2ccb4b,
+ 0x383a0b,
+ 0x292315,
+ 0x2e6185,
+ 0x2716c5,
+ 0x2f424a,
+ 0x25980a,
+ 0x261e07,
+ 0x21d743,
+ 0x2a5c08,
+ 0x2d828a,
+ 0x223706,
+ 0x24ff09,
+ 0x26ebc8,
+ 0x2de404,
+ 0x242649,
+ 0x2c3608,
+ 0x2b1c07,
+ 0x20ce06,
+ 0x36f447,
+ 0x293cc7,
+ 0x242ac5,
+ 0x228e0c,
+ 0x258905,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x2d0783,
+ 0x204ac3,
+ 0x24a843,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x20d1c2,
+ 0x2000c2,
+ 0x230d42,
+ 0x202f02,
+ 0x202382,
+ 0x261e82,
+ 0x46d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x332ec3,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x201383,
+ 0x15f048,
+ 0x32df04,
+ 0x260087,
+ 0x263d43,
+ 0x37aa84,
+ 0x214543,
+ 0x212a43,
+ 0x332ec3,
+ 0x13ecc7,
+ 0x204cc2,
+ 0x168883,
+ 0x5a0d1c2,
+ 0x8d54d,
+ 0x8d88d,
+ 0x230d42,
+ 0x964c4,
+ 0x200382,
+ 0x5e963c8,
+ 0xf39c4,
+ 0x15f048,
+ 0x14020c2,
+ 0x1509cc6,
+ 0x20e443,
+ 0x26ae03,
+ 0x66d0783,
+ 0x22ef04,
+ 0x6a31b83,
+ 0x6f32ec3,
+ 0x20a3c2,
+ 0x2964c4,
+ 0x204ac3,
+ 0x2fc883,
+ 0x201882,
+ 0x200383,
+ 0x21c802,
+ 0x2f8043,
+ 0x202602,
+ 0x203f83,
+ 0x26ec83,
+ 0x206d02,
+ 0x15f048,
+ 0x20e443,
+ 0x2fc883,
+ 0x201882,
+ 0x2f8043,
+ 0x202602,
+ 0x203f83,
+ 0x26ec83,
+ 0x206d02,
+ 0x2f8043,
+ 0x202602,
+ 0x203f83,
+ 0x26ec83,
+ 0x206d02,
+ 0x2d0783,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x210582,
+ 0x21aa03,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204ac3,
+ 0x200383,
+ 0x370145,
+ 0x217082,
+ 0x204cc2,
+ 0x15f048,
+ 0x1491b48,
+ 0x332ec3,
+ 0x2461c1,
+ 0x2096c1,
+ 0x202201,
+ 0x209441,
+ 0x24a5c1,
+ 0x27e081,
+ 0x24c0c1,
+ 0x2462c1,
+ 0x2e7481,
+ 0x30ed01,
0x200141,
0x200001,
- 0x880c8,
- 0x200481,
- 0x200741,
- 0x200081,
- 0x200c81,
- 0x2007c1,
- 0x200901,
- 0x200041,
- 0x204281,
- 0x2001c1,
+ 0x15f048,
+ 0x200701,
+ 0x200101,
0x2000c1,
- 0x200341,
- 0x200ac1,
- 0x201501,
- 0x2014c1,
- 0x204101,
- 0x200b81,
+ 0x201e41,
+ 0x200181,
+ 0x200941,
+ 0x200041,
+ 0x204ec1,
+ 0x200081,
+ 0x201481,
+ 0x200c01,
+ 0x2002c1,
+ 0x200381,
+ 0x200e81,
+ 0x21c2c1,
+ 0x2003c1,
+ 0x200201,
0x200241,
0x200a01,
- 0x2002c1,
- 0x200281,
- 0x204701,
- 0x20dec1,
- 0x200781,
- 0x200641,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x201502,
- 0x2264c3,
- 0x16e747,
- 0x131ac7,
- 0x1e1c6,
- 0x1736ca,
- 0x85c48,
- 0x53188,
- 0x53547,
- 0x50d06,
- 0xce6c5,
- 0x51f05,
- 0x161186,
- 0x155646,
- 0x224104,
- 0x322707,
- 0x880c8,
- 0x22d684,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x21eb03,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x221e42,
- 0x2be043,
- 0x2f5003,
- 0x20b283,
- 0x202e02,
- 0x248083,
- 0x204803,
- 0x206e83,
+ 0x2019c1,
+ 0x201a81,
+ 0x2005c1,
+ 0x2007c1,
+ 0x200cc1,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x200382,
+ 0x200383,
+ 0x13ecc7,
+ 0xfcc7,
+ 0x28b86,
+ 0x3dcca,
+ 0x8cc48,
+ 0x58dc8,
+ 0x59207,
+ 0x62a46,
+ 0xde185,
+ 0x63c85,
+ 0x177ac6,
+ 0x125886,
+ 0x24ae04,
+ 0x31cdc7,
+ 0x15f048,
+ 0x2da904,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x332ec3,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x217082,
+ 0x2c8dc3,
+ 0x21fd43,
+ 0x200603,
+ 0x202942,
+ 0x251d43,
+ 0x205283,
+ 0x21e743,
0x200001,
- 0x207043,
- 0x26ff44,
- 0x324dc3,
- 0x30c683,
- 0x21dec3,
- 0x379b43,
- 0xaa2d183,
- 0x2374c4,
- 0x21de83,
- 0x232383,
- 0x2343c3,
- 0x234103,
- 0x208143,
- 0x2a3ec3,
- 0x30c603,
- 0x228103,
- 0x212103,
- 0x24c1c4,
- 0x23aa82,
- 0x252a43,
- 0x2585c3,
- 0x272bc3,
- 0x250b43,
- 0x24f8c3,
- 0x21eb03,
- 0x2db983,
- 0x220883,
- 0x201603,
- 0x210483,
- 0x2f2903,
- 0xaefe5c3,
- 0x385d43,
- 0x200983,
- 0x2348c3,
- 0x211003,
- 0x21e442,
- 0x286fc3,
- 0x238483,
- 0x16025c3,
- 0x217e83,
- 0x21da43,
- 0x29af43,
- 0x2264c3,
- 0x30e803,
- 0x21bd03,
- 0x2ad283,
- 0x2f6a83,
- 0x2e8883,
- 0x21d445,
- 0x215cc3,
- 0x2e88c3,
- 0x39c083,
- 0x218744,
- 0x25b343,
- 0x22e8c3,
- 0x277c03,
- 0x20b443,
- 0x221e42,
- 0x23a183,
- 0x2f9b84,
- 0x2ae9c4,
- 0x244843,
- 0x880c8,
- 0x882,
- 0x1002,
- 0x2e02,
- 0x1482,
- 0x2d42,
- 0x4c2,
- 0x44682,
- 0x202,
+ 0x203e43,
+ 0x225b04,
+ 0x37f1c3,
+ 0x318cc3,
+ 0x21c403,
+ 0x360383,
+ 0xaad0783,
+ 0x23a184,
+ 0x21c3c3,
+ 0x22f143,
+ 0x231b83,
+ 0x2318c3,
+ 0x23a943,
+ 0x2a85c3,
+ 0x318c43,
+ 0x233ec3,
+ 0x201e43,
+ 0x253f84,
+ 0x2abc02,
+ 0x258683,
+ 0x25eb43,
+ 0x27bfc3,
+ 0x262883,
+ 0x201dc3,
+ 0x332ec3,
+ 0x208803,
+ 0x209e43,
+ 0x204143,
+ 0x210203,
+ 0x2ff083,
+ 0xae30043,
+ 0x2b1083,
+ 0x2113c3,
+ 0x22d603,
+ 0x20fbc3,
+ 0x226302,
+ 0x201683,
+ 0x204ac3,
+ 0x160abc3,
+ 0x27d643,
+ 0x20ff03,
+ 0x216ec3,
+ 0x200383,
+ 0x3b37c3,
+ 0x21aa03,
+ 0x241f03,
+ 0x304f43,
+ 0x2f8203,
+ 0x30c845,
+ 0x2202c3,
+ 0x2f8243,
+ 0x35ed83,
+ 0x218c84,
+ 0x265203,
+ 0x311883,
+ 0x2d8fc3,
+ 0x201383,
+ 0x217082,
+ 0x23bd83,
+ 0x308484,
+ 0x22fec4,
+ 0x22a843,
+ 0x15f048,
+ 0x4cc2,
+ 0x1442,
+ 0x2942,
+ 0x5ac2,
+ 0x2302,
+ 0x702,
+ 0x4e242,
+ 0x1c2,
+ 0x8a42,
+ 0xc02,
+ 0xf302,
+ 0xb602,
+ 0x73fc2,
+ 0x4c82,
+ 0x61e82,
+ 0x17902,
+ 0x3cf82,
+ 0x54c2,
+ 0x18b82,
+ 0xfc2,
+ 0x682,
+ 0x1bb82,
0x1f82,
- 0x982,
- 0x43742,
- 0xe842,
- 0xe02,
- 0x7a82,
- 0x93d42,
- 0x6d42,
- 0x26282,
- 0x7442,
- 0x1f882,
- 0x8b02,
- 0x4b42,
- 0x1c882,
- 0x13c2,
- 0x17642,
- 0x1402,
- 0xdfc2,
- 0x6ec2,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x2264c3,
- 0xc22d183,
- 0x21eb03,
- 0x211003,
- 0x223b42,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x6c2,
- 0x202f02,
- 0x223f42,
- 0x880c8,
- 0x16582,
- 0x235f82,
- 0x203142,
- 0x23e682,
- 0x201642,
- 0x208382,
- 0x51f05,
- 0x2029c2,
- 0x202282,
- 0x203382,
- 0x205d02,
- 0x206d42,
- 0x385542,
+ 0xc4c2,
+ 0x1702,
+ 0x20c42,
+ 0xa42,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x200383,
+ 0xc2d0783,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x20dc42,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x6c82,
+ 0x2031c2,
+ 0x24ac42,
+ 0x15f048,
+ 0xd1c2,
+ 0x233482,
+ 0x208842,
+ 0x22f942,
+ 0x204182,
+ 0x209282,
+ 0x63c85,
+ 0x204702,
0x201882,
- 0x227642,
- 0x16e747,
- 0x119d4d,
- 0xeafc9,
- 0x47b8b,
- 0xd1e88,
- 0x13bc89,
- 0x21eb03,
- 0x880c8,
- 0x880c8,
- 0x53e06,
- 0x200882,
- 0x224104,
- 0x216582,
- 0x22d183,
- 0x201a42,
- 0x2343c3,
- 0x201f82,
- 0x22d684,
- 0x202243,
- 0x209782,
- 0x238483,
- 0x201502,
- 0x2264c3,
- 0x241f86,
- 0x30d40f,
- 0x6fef43,
- 0x880c8,
- 0x216582,
- 0x211cc3,
- 0x21eb03,
- 0x211003,
- 0x1568ecb,
- 0x16e747,
- 0x216582,
- 0x22d183,
- 0x21eb03,
- 0x238483,
- 0x200882,
- 0x201102,
- 0x2093c2,
- 0xfa2d183,
- 0x23e4c2,
- 0x2343c3,
- 0x2475c2,
- 0x227982,
- 0x21eb03,
- 0x21c2c2,
- 0x301dc2,
- 0x2a7fc2,
- 0x201142,
- 0x289f82,
- 0x206982,
+ 0x211f82,
+ 0x2034c2,
+ 0x217902,
+ 0x384982,
+ 0x201ac2,
+ 0x245742,
+ 0x13ecc7,
+ 0x169a8d,
+ 0xde209,
+ 0x56bcb,
+ 0xe3888,
+ 0x55109,
+ 0x332ec3,
+ 0x15f048,
+ 0x15f048,
+ 0x59b46,
+ 0x204cc2,
+ 0x24ae04,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x2000c2,
+ 0x231b83,
+ 0x208a42,
+ 0x2da904,
+ 0x204303,
+ 0x2513c2,
+ 0x204ac3,
+ 0x200382,
+ 0x200383,
+ 0x2716c6,
+ 0x31c0cf,
+ 0x70d8c3,
+ 0x15f048,
+ 0x20d1c2,
+ 0x2135c3,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x155afcb,
+ 0xde548,
+ 0x14ff507,
+ 0x13ecc7,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x332ec3,
+ 0x204ac3,
+ 0x204cc2,
0x200902,
- 0x205e82,
- 0x26a242,
- 0x204d42,
- 0x2ad802,
- 0x230cc2,
- 0x225a02,
- 0x228f02,
- 0x211003,
- 0x203042,
- 0x238483,
- 0x2425c2,
- 0x267c02,
- 0x2264c3,
- 0x248102,
- 0x217642,
- 0x20a442,
- 0x202482,
- 0x2168c2,
- 0x2d29c2,
- 0x210442,
- 0x242d42,
- 0x221bc2,
- 0x301e0a,
- 0x34600a,
- 0x38074a,
- 0x3b4682,
- 0x20d802,
- 0x23c282,
- 0xff49009,
- 0x103a418a,
- 0x1042fe87,
- 0xc002,
- 0x1a418a,
- 0x245dc4,
- 0x10e2d183,
- 0x2343c3,
- 0x247344,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x215cc3,
- 0x223ec3,
- 0x880c8,
- 0x1450c84,
- 0x50505,
- 0x4e80a,
- 0x109842,
- 0x18b406,
- 0x162d51,
- 0x11749009,
- 0x163187,
- 0x4802,
- 0x1aa80a,
- 0xdb7c7,
- 0x880c8,
- 0xfd948,
- 0xe707,
- 0x1281c44b,
- 0x15802,
- 0x1a6707,
- 0x1b1a4a,
- 0x10728f,
- 0x131b4f,
- 0x1dec2,
- 0x16582,
- 0xa3e08,
- 0xea70a,
- 0x167408,
+ 0x207f42,
+ 0xfad0783,
+ 0x2416c2,
+ 0x231b83,
+ 0x2101c2,
+ 0x22ad02,
+ 0x332ec3,
+ 0x2630c2,
+ 0x255302,
+ 0x2ae4c2,
+ 0x203742,
+ 0x291e02,
+ 0x209902,
+ 0x200b82,
+ 0x274842,
+ 0x258142,
+ 0x251b02,
+ 0x2b36c2,
+ 0x242602,
+ 0x246082,
+ 0x263c42,
+ 0x20fbc3,
+ 0x205f02,
+ 0x204ac3,
+ 0x231302,
+ 0x27de02,
+ 0x200383,
+ 0x251dc2,
+ 0x20c4c2,
+ 0x209f42,
+ 0x200b42,
+ 0x20c842,
+ 0x2e4742,
+ 0x220382,
+ 0x24d082,
+ 0x234f42,
+ 0x310c8a,
+ 0x347d0a,
+ 0x37e80a,
+ 0x3b5dc2,
+ 0x2046c2,
+ 0x204e82,
+ 0xff4f589,
+ 0x10324d0a,
+ 0x15926c7,
+ 0x1410c43,
+ 0x243d0,
+ 0x9402,
+ 0x24fe44,
+ 0x10ad0783,
+ 0x231b83,
+ 0x251304,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x2202c3,
+ 0x24abc3,
+ 0x15f048,
+ 0x14629c4,
+ 0x614c5,
+ 0x5f88a,
+ 0x1168c2,
+ 0x1a03c6,
+ 0x102d11,
+ 0x1134f589,
+ 0x61548,
+ 0x82a08,
+ 0x5e887,
0xf82,
- 0x10700f,
- 0x124e4b,
- 0x2988,
- 0x16e847,
- 0x16a8a,
- 0xae14b,
- 0x112089,
- 0x173507,
- 0xf424c,
- 0x10ec87,
- 0xd060a,
- 0x132d48,
- 0x8e28e,
- 0x553ce,
- 0xdb60b,
- 0x110d8b,
- 0xead0b,
- 0x1e1c9,
- 0x1fb8b,
- 0x2398d,
- 0x260cb,
- 0x2708d,
- 0x2c90d,
- 0x2ec8a,
- 0xae80b,
- 0xc6fcb,
- 0xe82c5,
- 0x10a710,
- 0x8128f,
- 0xb74f,
- 0x2a24d,
- 0x6fd50,
- 0xd82,
- 0x12fa2488,
- 0x131948,
- 0x132e4bc5,
- 0x4668b,
- 0x52088,
- 0x110f4a,
- 0x58d89,
- 0x60587,
- 0x608c7,
- 0x60a87,
- 0x611c7,
- 0x629c7,
- 0x62f47,
- 0x636c7,
- 0x63d47,
- 0x64307,
- 0x644c7,
- 0x66087,
- 0x66247,
- 0x66407,
- 0x665c7,
- 0x668c7,
- 0x66e07,
- 0x67a47,
- 0x67f07,
- 0x68707,
- 0x69207,
- 0x693c7,
- 0x699c7,
- 0x69e87,
- 0x6a087,
- 0x6a347,
- 0x6a507,
- 0x6a6c7,
- 0x6ac07,
- 0x6b4c7,
- 0x6bf87,
- 0x6c687,
- 0x6c947,
- 0x6ce07,
- 0x6cfc7,
- 0x6d347,
- 0x6e3c7,
- 0x6ea07,
- 0x6ee07,
- 0x6efc7,
- 0x6f187,
- 0x6f5c7,
- 0x70307,
- 0x70607,
- 0x70c07,
- 0x70dc7,
- 0x71147,
- 0x71587,
- 0xd382,
- 0x33d8a,
- 0xf9dc7,
- 0x134c87cb,
- 0x14c87d6,
- 0x18351,
- 0xdfb8a,
- 0xa3c8a,
- 0x53e06,
- 0xc114b,
- 0xb2c2,
- 0x31ad1,
- 0x959c9,
- 0x90ac9,
- 0x5e82,
- 0x9c34a,
- 0xa5449,
- 0xa5c8f,
- 0xa688e,
- 0xa7188,
- 0xf1c2,
- 0x169a89,
- 0x8498e,
- 0xac64c,
- 0xd400f,
- 0x194a8e,
- 0x1098c,
- 0x15309,
- 0x16451,
- 0x19a48,
- 0x2bd52,
- 0x2e5cd,
- 0x393cd,
- 0x13ff8b,
- 0x179d95,
- 0x33c49,
- 0x5488a,
- 0x58749,
- 0x5fe90,
- 0x60f0b,
- 0x6e54f,
- 0x71d0b,
- 0x756cc,
- 0x787d0,
- 0x8660a,
- 0x86e8d,
- 0x14ea0e,
- 0x18004a,
- 0x8c7cc,
- 0x8fa54,
- 0x95651,
- 0x98f8b,
- 0x9b54f,
- 0xab6cd,
- 0xabfce,
- 0x12c10c,
- 0x15710c,
- 0xdc8cb,
- 0xeef8e,
- 0xfb250,
- 0x10938b,
- 0x11270d,
- 0x15f28f,
- 0xb504c,
- 0xb824e,
- 0xb8a51,
- 0xba84c,
- 0x1362c7,
- 0x11c60d,
- 0xbe94c,
- 0xc4d90,
- 0xd35cd,
- 0xe7847,
- 0xec4d0,
- 0xf0688,
- 0xf124b,
- 0x17318f,
- 0x2b848,
- 0xdfd8d,
- 0x1763d0,
- 0x13aaf9c6,
- 0xb0bc3,
- 0x9682,
- 0x2cd09,
- 0x551ca,
- 0xf9bc6,
- 0x13cd5389,
- 0x124c3,
- 0x109f11,
- 0x9f89,
- 0xcd5c7,
- 0x10710b,
- 0xd2d10,
- 0xd31cc,
- 0xd47c5,
- 0x11ab08,
- 0x19be4a,
- 0x122b07,
- 0x25c2,
- 0x5160a,
- 0x1694c9,
- 0xa62ca,
- 0x1abe8f,
- 0x4084b,
- 0x10760c,
- 0x1078d2,
- 0xb5485,
- 0x15d98a,
- 0x142e1fc5,
- 0x19900c,
- 0x1157c3,
- 0x185542,
- 0xe8e4a,
- 0x108548,
- 0x163407,
- 0x4b42,
- 0x7982,
- 0x1bc2,
- 0x129e10,
- 0x1402,
- 0x3074f,
- 0x161186,
- 0x1113ce,
- 0xe3a4b,
- 0x180248,
- 0xc9a89,
- 0x17e4d2,
- 0x178b8d,
- 0x45e88,
- 0x47a49,
- 0x485cd,
- 0x4a189,
- 0x4a64b,
- 0x4ac08,
- 0x4e648,
- 0x53f48,
- 0x559c9,
- 0x55bca,
- 0x57f4c,
- 0xe31ca,
- 0xf6ac7,
- 0xdfcd,
- 0xeb88b,
- 0x9eb0c,
- 0x18b610,
- 0x3282,
- 0xc570d,
- 0x6202,
- 0x33c2,
- 0xf6a0a,
- 0xdfa8a,
- 0xe5e4b,
- 0xc718c,
- 0xfd6ce,
- 0x165d0d,
- 0xf3dc8,
- 0x6c2,
- 0x11a0c0ce,
- 0x11c2fe87,
- 0x121aa0c9,
- 0x11583,
- 0x127117cc,
- 0xc002,
- 0x50111,
- 0xc011,
- 0xa1091,
- 0x81ed1,
- 0x11170f,
- 0x11dfcc,
- 0x121acd,
- 0x123f0d,
- 0x142615,
- 0x14b18c,
- 0x159590,
- 0xfa8c,
- 0x5274c,
- 0x47109,
- 0xc002,
- 0x501ce,
- 0xc0ce,
- 0xa114e,
- 0x81f8e,
- 0x1117cc,
- 0x11e089,
- 0x14b249,
- 0x14280d,
- 0xfb49,
- 0x52809,
- 0x1267c3,
- 0x940c3,
- 0xc002,
- 0x162d45,
- 0x1aa804,
- 0xdf704,
- 0x127244,
- 0x17f904,
- 0x17c084,
- 0x163184,
- 0x144bdc3,
- 0x140de83,
- 0x19fd04,
- 0x1573dc3,
- 0xd82,
- 0x165d03,
- 0x200882,
- 0x216582,
- 0x201a42,
- 0x206ac2,
- 0x201f82,
- 0x201502,
- 0x201bc2,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201603,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x238483,
- 0x2264c3,
- 0x1d003,
- 0x21eb03,
- 0x200882,
- 0x323ac3,
- 0x15e2d183,
- 0x330d47,
- 0x21eb03,
- 0x332683,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x24690a,
- 0x241f85,
- 0x21bd03,
- 0x203e42,
- 0x880c8,
- 0x880c8,
- 0x16582,
- 0x113682,
- 0x1a6845,
- 0x880c8,
- 0x2d183,
- 0x77947,
- 0x1161cf,
- 0xf9c44,
- 0x11220a,
- 0xac287,
- 0xf78a,
- 0x93e8a,
- 0xa660a,
- 0xf9bc6,
- 0x27ca,
- 0xccd,
- 0x123ac3,
- 0x880c8,
- 0x16582,
- 0x47344,
- 0x67683,
- 0xe9cc5,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x204803,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x290c83,
- 0x223ec3,
- 0x204803,
- 0x224104,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x232dc3,
- 0x22d183,
- 0x2343c3,
- 0x206ac3,
- 0x211cc3,
- 0x21eb03,
- 0x201604,
- 0x36b683,
- 0x2348c3,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x21bd03,
- 0x3b0343,
- 0x1822d183,
- 0x2343c3,
- 0x244d43,
- 0x21eb03,
- 0x275803,
- 0x2348c3,
- 0x2264c3,
- 0x207443,
- 0x27f5c4,
- 0x880c8,
- 0x18a2d183,
- 0x2343c3,
- 0x2a7243,
- 0x21eb03,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x220703,
- 0x880c8,
- 0x1922d183,
- 0x2343c3,
- 0x211cc3,
- 0x2025c3,
- 0x2264c3,
- 0x880c8,
- 0x142fe87,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x16e747,
- 0x176c84,
- 0x1462d48,
- 0xa7dcd,
- 0x3256c5,
- 0x880c8,
- 0x742,
- 0x35bc3,
- 0xe6786,
- 0x307e48,
- 0x3afd07,
- 0x224104,
- 0x355346,
- 0x359446,
- 0x880c8,
- 0x301043,
- 0x20b149,
- 0x2b46d5,
- 0xb46df,
- 0x22d183,
- 0x32f8d2,
- 0xfea86,
- 0x13af45,
- 0x110f4a,
- 0x58d89,
- 0x32f68f,
- 0x22d684,
- 0x331145,
- 0x2f26d0,
- 0x3aaf87,
- 0x2025c3,
- 0x32d208,
- 0x2aeeca,
- 0x2014c4,
- 0x2e1a03,
- 0x241f86,
- 0x203e42,
- 0x38660b,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x2e6a83,
- 0x216582,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x332683,
- 0x203043,
- 0x2264c3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x238483,
- 0x2264c3,
- 0x200882,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x224104,
- 0x22d183,
- 0x2343c3,
- 0x307b04,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x220883,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x251283,
- 0x2efc3,
- 0x132683,
- 0x238483,
- 0x2264c3,
- 0x301e0a,
- 0x31ec09,
- 0x33e6cb,
- 0x33ed4a,
- 0x34600a,
- 0x3543cb,
- 0x372d8a,
- 0x37acca,
- 0x38074a,
- 0x3809cb,
- 0x39bb89,
- 0x39d94a,
- 0x39e38b,
- 0x3a9bcb,
- 0x3b2c8a,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x37549,
- 0x880c8,
- 0x22d183,
- 0x260584,
- 0x214a02,
- 0x212444,
- 0x226bc5,
- 0x204803,
- 0x224104,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x247344,
- 0x22d684,
- 0x201604,
- 0x2348c3,
- 0x238483,
- 0x2264c3,
- 0x28fb85,
- 0x232dc3,
- 0x21bd03,
- 0x25b743,
- 0x252dc4,
- 0x250bc4,
- 0x26dfc5,
- 0x880c8,
- 0x2f88c4,
- 0x208606,
- 0x283c04,
- 0x216582,
- 0x360307,
- 0x249c07,
- 0x2455c4,
- 0x257a05,
- 0x2d37c5,
- 0x2a9c05,
- 0x201604,
- 0x318348,
- 0x36ed86,
- 0x2dbb08,
- 0x236f45,
- 0x2cf145,
- 0x240584,
- 0x2264c3,
- 0x2e26c4,
- 0x353586,
- 0x242083,
- 0x252dc4,
- 0x262c45,
- 0x2cfbc4,
- 0x365b84,
- 0x203e42,
- 0x245206,
- 0x392446,
- 0x2f56c5,
- 0x200882,
- 0x323ac3,
- 0x1f216582,
- 0x2358c4,
- 0x201f82,
- 0x211003,
- 0x209f82,
- 0x238483,
- 0x201502,
- 0x217643,
- 0x223ec3,
- 0x880c8,
- 0x880c8,
- 0x21eb03,
- 0x200882,
- 0x1fe16582,
- 0x21eb03,
- 0x266383,
- 0x36b683,
- 0x31f984,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x200882,
- 0x20616582,
- 0x22d183,
- 0x238483,
- 0x2264c3,
- 0x4b42,
- 0x2019c2,
- 0x221e42,
- 0x332683,
- 0x2db083,
- 0x200882,
- 0x880c8,
- 0x16e747,
- 0x216582,
- 0x2343c3,
- 0x247344,
- 0x208f43,
- 0x21eb03,
- 0x220883,
- 0x211003,
- 0x238483,
- 0x21ab43,
- 0x2264c3,
- 0x220683,
- 0x1244d3,
- 0x12f214,
- 0x16e747,
- 0x15686,
- 0x1e1c6,
- 0x52fc7,
- 0x9f049,
- 0x2654a,
- 0x85b0d,
- 0x119a4c,
- 0x29e8a,
- 0x51f05,
- 0x18bec8,
- 0x161186,
- 0x155646,
- 0x200d82,
- 0xde40c,
- 0x1aa9c7,
- 0x24d11,
- 0x22d183,
- 0xd0585,
- 0x1b4284,
- 0x18346,
- 0x19f046,
- 0x8a24a,
- 0xacec3,
- 0x9f005,
- 0xce83,
- 0xc120c,
- 0xe5408,
- 0x1ad408,
- 0xa0288,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x200882,
- 0x216582,
- 0x21eb03,
- 0x2082c2,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x35e48f,
- 0x35e84e,
- 0x880c8,
- 0x22d183,
- 0x429c7,
- 0x2343c3,
- 0x21eb03,
- 0x202243,
- 0x238483,
- 0x2264c3,
- 0x220003,
- 0x36b047,
- 0x204642,
- 0x2a9849,
- 0x201002,
- 0x32a10b,
- 0x28c14a,
- 0x2a4209,
- 0x201902,
- 0x250e06,
- 0x248f95,
- 0x32a255,
- 0x24de93,
- 0x32a7d3,
- 0x2056c2,
- 0x214605,
- 0x27ff4c,
- 0x219e0b,
- 0x269005,
- 0x201482,
- 0x2040c2,
- 0x377506,
- 0x204802,
- 0x24eb06,
- 0x332ecd,
- 0x36288c,
- 0x30a784,
- 0x2009c2,
- 0x219f02,
- 0x22c108,
- 0x202d42,
- 0x29d5c6,
- 0x3345c4,
- 0x249155,
- 0x24e013,
- 0x20a583,
- 0x34868a,
- 0x30e547,
- 0x2e6089,
- 0x20f507,
- 0x24f882,
+ 0x19a18a,
+ 0x2ac47,
+ 0x15f048,
+ 0x10b708,
+ 0xbac7,
+ 0x16c1b74b,
+ 0x1082,
+ 0x15de87,
+ 0xdb4a,
+ 0x5e58f,
+ 0xfd4f,
+ 0x1c402,
+ 0xd1c2,
+ 0xa8508,
+ 0x185b0a,
+ 0x1681c8,
+ 0x3b02,
+ 0x5e30f,
+ 0xa3d4b,
+ 0x1672c8,
+ 0x13edc7,
+ 0x15104a,
+ 0x2f64b,
+ 0x11dd09,
+ 0x150f47,
+ 0x100c4c,
+ 0x1b3c47,
+ 0x18d18a,
+ 0x94b88,
+ 0x195a8e,
+ 0x28b8e,
+ 0x2aa8b,
+ 0x2b2cb,
+ 0x2d3cb,
+ 0x2e209,
+ 0x3558b,
+ 0x4a68d,
+ 0xe984b,
+ 0xec8cd,
+ 0xecc4d,
+ 0x18274a,
+ 0x2fd0b,
+ 0x3688b,
+ 0x42305,
+ 0x14243d0,
+ 0x125d8f,
+ 0x1264cf,
+ 0x48dcd,
+ 0x25910,
+ 0x1742,
+ 0x17203988,
+ 0xfb48,
+ 0x176f4745,
+ 0x505cb,
+ 0x117050,
+ 0x57488,
+ 0x2b48a,
+ 0x5f4c9,
+ 0x695c7,
+ 0x69907,
+ 0x69ac7,
+ 0x6c287,
+ 0x6d307,
+ 0x6dd07,
+ 0x6e487,
+ 0x6e8c7,
+ 0x6f487,
+ 0x6f787,
+ 0x6ffc7,
+ 0x70187,
+ 0x70347,
+ 0x70507,
+ 0x70807,
+ 0x70c47,
+ 0x718c7,
+ 0x71d87,
+ 0x729c7,
+ 0x72f07,
+ 0x730c7,
+ 0x73807,
+ 0x73e87,
+ 0x74087,
+ 0x74347,
+ 0x74507,
+ 0x746c7,
+ 0x75047,
+ 0x754c7,
+ 0x75987,
+ 0x76147,
+ 0x76407,
+ 0x76bc7,
+ 0x76d87,
+ 0x77107,
+ 0x77d07,
+ 0x78987,
+ 0x78d87,
+ 0x78f47,
+ 0x79107,
+ 0x79547,
+ 0x7a307,
+ 0x7a607,
+ 0x7a907,
+ 0x7aac7,
+ 0x7ae47,
+ 0x7b387,
+ 0xa9c2,
+ 0x4c94a,
+ 0x16dc87,
+ 0x178d528b,
+ 0x14d5296,
+ 0x19151,
+ 0xf080a,
+ 0xa838a,
+ 0x59b46,
+ 0xd2acb,
+ 0x642,
+ 0x2e891,
+ 0x94609,
+ 0x9a109,
+ 0x74842,
+ 0xa4f4a,
+ 0xaa689,
+ 0xab24f,
+ 0xaca4e,
+ 0xad708,
+ 0x18d82,
+ 0x15da89,
+ 0x18b88e,
+ 0xfd08c,
+ 0xf254f,
+ 0x146ce,
+ 0x23b4c,
+ 0x2ccc9,
+ 0x2db51,
+ 0x465c8,
+ 0x482d2,
+ 0x49fcd,
+ 0x82bcd,
+ 0x19090b,
+ 0x3d2d5,
+ 0x4c809,
+ 0x4ec0a,
+ 0x4f489,
+ 0x5ecd0,
+ 0x72c4b,
+ 0x79f4f,
+ 0x7c48b,
+ 0x8340c,
+ 0x84610,
+ 0x8894a,
+ 0x8dd0d,
+ 0x16618e,
+ 0x1ae00a,
+ 0x8f7cc,
+ 0x93994,
+ 0x94291,
+ 0xa494b,
+ 0xa578f,
+ 0xa7bcd,
+ 0xac3ce,
+ 0xb1acc,
+ 0xb220c,
+ 0xdc90b,
+ 0xdcc0e,
+ 0x122110,
+ 0x11640b,
+ 0x17a64d,
+ 0x1af38f,
+ 0xb798c,
+ 0xb934e,
+ 0xbb311,
+ 0xc3ccc,
+ 0xc5a47,
+ 0x15e58d,
+ 0x12b50c,
+ 0x14be50,
+ 0xd1b4d,
+ 0xd8e47,
+ 0xe2350,
+ 0xfa008,
+ 0xfb08b,
+ 0x150bcf,
+ 0x17de88,
+ 0xf0a0d,
+ 0x181d50,
+ 0x17fb1846,
+ 0xb6003,
+ 0x1b02,
+ 0xd0309,
+ 0x5ac0a,
+ 0x1084c6,
+ 0x180dff49,
+ 0x13203,
+ 0xdab91,
+ 0xdafc9,
+ 0xdc047,
+ 0x5e40b,
+ 0xe4a90,
+ 0xe4f4c,
+ 0xe5385,
+ 0x126cc8,
+ 0x19dc0a,
+ 0x129607,
+ 0x1002,
+ 0x12464a,
+ 0x25e49,
+ 0x3a20a,
+ 0x8eacf,
+ 0x44f4b,
+ 0x1b280c,
+ 0x1b2ad2,
+ 0xaa085,
+ 0x2124a,
+ 0x186f2fc5,
+ 0x17698c,
+ 0x121203,
+ 0x184982,
+ 0xf86ca,
+ 0x96b88,
+ 0xeca88,
+ 0x14a587,
+ 0xd42,
+ 0x2602,
+ 0x3f390,
+ 0x1702,
+ 0x1aa2cf,
+ 0x177ac6,
+ 0x301ce,
+ 0xe7fcb,
+ 0x1ae208,
+ 0xd6c09,
+ 0x17cd92,
+ 0x7c0d,
+ 0x56608,
+ 0x56a89,
+ 0x5700d,
+ 0x59c89,
+ 0x5a28b,
+ 0x5b088,
+ 0x5f6c8,
+ 0x68bc8,
+ 0x68e49,
+ 0x6904a,
+ 0x6c8cc,
+ 0xe5d0a,
+ 0x104f87,
+ 0x16b2cd,
+ 0xf910b,
+ 0x12fb4c,
+ 0x1a05d0,
+ 0x6902,
+ 0x1968cd,
+ 0x16c2,
+ 0x11fc2,
+ 0x104eca,
+ 0xf070a,
+ 0xf6bcb,
+ 0x36a4c,
+ 0x10b48e,
+ 0x21ccd,
+ 0x1ab488,
+ 0x6c82,
+ 0x1166118e,
+ 0x11f6a18e,
+ 0x1266c00a,
+ 0x12ed0a0e,
+ 0x137156ce,
+ 0x13f2a00c,
+ 0x15926c7,
+ 0x15926c9,
+ 0x1410c43,
+ 0x14731e8c,
+ 0x14f3a009,
+ 0x1409402,
+ 0x610d1,
+ 0x16a0d1,
+ 0x6bf4d,
+ 0xd0951,
+ 0x11b1d1,
+ 0x129f4f,
+ 0x131dcf,
+ 0x139f4c,
+ 0x14a94d,
+ 0x18d555,
+ 0x1ace0c,
+ 0x1b41cc,
+ 0x1b5850,
+ 0x940c,
+ 0x5838c,
+ 0xedc19,
+ 0x1a6719,
+ 0x115419,
+ 0x15c754,
+ 0x17f854,
+ 0x198594,
+ 0x19ae14,
+ 0x1a9054,
+ 0x1577fb09,
+ 0x15d98849,
+ 0x167b4289,
+ 0x11b6b089,
+ 0x9402,
+ 0x1236b089,
+ 0x9402,
+ 0xedc0a,
+ 0x9402,
+ 0x12b6b089,
+ 0x9402,
+ 0xedc0a,
+ 0x9402,
+ 0x1336b089,
+ 0x9402,
+ 0x13b6b089,
+ 0x9402,
+ 0x1436b089,
+ 0x9402,
+ 0xedc0a,
+ 0x9402,
+ 0x14b6b089,
+ 0x9402,
+ 0xedc0a,
+ 0x9402,
+ 0x1536b089,
+ 0x9402,
+ 0x15b6b089,
+ 0x9402,
+ 0x1636b089,
+ 0x9402,
+ 0x16b6b089,
+ 0x9402,
+ 0xedc0a,
+ 0x9402,
+ 0x102d05,
+ 0x19a184,
+ 0x11d644,
+ 0x1a4884,
+ 0xbfc04,
+ 0x2144,
+ 0x5e884,
+ 0x1482283,
+ 0x1420183,
+ 0xffd84,
+ 0x1542b83,
+ 0x1742,
+ 0x21cc3,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x2000c2,
+ 0x2041c2,
+ 0x208a42,
+ 0x200382,
+ 0x202602,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204143,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x204ac3,
+ 0x200383,
+ 0x3b943,
+ 0x332ec3,
+ 0x204cc2,
+ 0x368883,
+ 0x1a2d0783,
+ 0x20ef47,
+ 0x332ec3,
+ 0x205d83,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x25084a,
+ 0x2716c5,
+ 0x21aa03,
+ 0x205bc2,
+ 0x15f048,
+ 0x15f048,
+ 0xd1c2,
+ 0x11f0c2,
+ 0x15dfc5,
+ 0x15f048,
+ 0xd0783,
+ 0x1ae3db07,
+ 0xcfd46,
+ 0x1b1acd05,
+ 0xcfe07,
+ 0xa54a,
+ 0xa408,
+ 0xb747,
+ 0x5f2c8,
+ 0x18c407,
+ 0xed30f,
+ 0x3ab07,
+ 0x165bc6,
+ 0x117050,
+ 0x122f0f,
+ 0x108544,
+ 0x1b4cfece,
+ 0xafd0c,
+ 0x11de8a,
+ 0xac687,
+ 0x12d54a,
+ 0x60989,
+ 0xc2f4a,
+ 0x77a8a,
+ 0x1084c6,
+ 0xac74a,
+ 0x11a58a,
+ 0x154009,
+ 0xda448,
+ 0xda746,
+ 0xde74d,
+ 0xb9905,
+ 0x5a107,
+ 0x16df94,
+ 0xfe58b,
+ 0x16710a,
+ 0xa8bcd,
+ 0x28b83,
+ 0x28b83,
+ 0x28b86,
+ 0x28b83,
+ 0x168883,
+ 0x15f048,
+ 0xd1c2,
+ 0x51304,
+ 0x8cdc3,
+ 0x170145,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x205283,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x29a2c3,
+ 0x24abc3,
+ 0x205283,
+ 0x24ae04,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x209103,
+ 0x2d0783,
+ 0x231b83,
+ 0x2041c3,
+ 0x2135c3,
+ 0x332ec3,
+ 0x2964c4,
+ 0x23a0c3,
+ 0x22d603,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0x38c743,
+ 0x1d2d0783,
+ 0x231b83,
+ 0x2c3ec3,
+ 0x332ec3,
+ 0x2075c3,
+ 0x22d603,
+ 0x200383,
+ 0x2054c3,
+ 0x343c44,
+ 0x15f048,
+ 0x1dad0783,
+ 0x231b83,
+ 0x2ad7c3,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x21d7c3,
+ 0x15f048,
+ 0x1e2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x20abc3,
+ 0x200383,
+ 0x15f048,
+ 0x15926c7,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x13ecc7,
+ 0x16e1cb,
+ 0xdb3c4,
+ 0xb9905,
+ 0x1491b48,
+ 0xae2cd,
+ 0x1f68a405,
+ 0x192c4,
+ 0x1a5c3,
+ 0x367fc5,
+ 0x15f048,
+ 0x1d202,
+ 0x2803,
+ 0xf7286,
+ 0x32f448,
+ 0x304507,
+ 0x24ae04,
+ 0x3b3006,
+ 0x3b5706,
+ 0x15f048,
+ 0x310683,
+ 0x2384c9,
+ 0x2bdad5,
+ 0xbdadf,
+ 0x2d0783,
+ 0x39a9d2,
+ 0xf5806,
+ 0x10cfc5,
+ 0x2b48a,
+ 0x5f4c9,
+ 0x39a78f,
+ 0x2da904,
+ 0x20f345,
+ 0x2fee50,
+ 0x2959c7,
+ 0x20abc3,
+ 0x2842c8,
+ 0x1257c6,
+ 0x2b400a,
+ 0x200e84,
+ 0x2f2a03,
+ 0x2716c6,
+ 0x205bc2,
+ 0x26b44b,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x2f74c3,
+ 0x20d1c2,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x205d83,
+ 0x223103,
+ 0x200383,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x204ac3,
+ 0x200383,
+ 0x204cc2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x24ae04,
+ 0x2d0783,
+ 0x231b83,
+ 0x222044,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x209e43,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x262fc3,
+ 0x1e303,
+ 0x5d83,
+ 0x204ac3,
+ 0x200383,
+ 0x310c8a,
+ 0x32a949,
+ 0x34184b,
+ 0x341f8a,
+ 0x347d0a,
+ 0x356e8b,
+ 0x37300a,
+ 0x37914a,
+ 0x37e80a,
+ 0x37ea8b,
+ 0x39d949,
+ 0x39f84a,
+ 0x39fbcb,
+ 0x3a9d0b,
+ 0x3b4a8a,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x10c9c9,
+ 0x15f048,
+ 0x2d0783,
+ 0x2695c4,
+ 0x200c82,
+ 0x213184,
+ 0x3ac705,
+ 0x205283,
+ 0x24ae04,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x251304,
+ 0x2da904,
+ 0x2964c4,
+ 0x22d603,
+ 0x204ac3,
+ 0x200383,
+ 0x293ac5,
+ 0x209103,
+ 0x21aa03,
+ 0x22c6c3,
+ 0x258a04,
+ 0x262904,
+ 0x35d705,
+ 0x15f048,
+ 0x306e44,
+ 0x20e546,
+ 0x28a8c4,
+ 0x20d1c2,
+ 0x361ac7,
+ 0x253587,
+ 0x24f0c4,
+ 0x25d8c5,
+ 0x2d1d45,
+ 0x2b0405,
+ 0x2964c4,
+ 0x23cfc8,
+ 0x33f306,
+ 0x311f48,
+ 0x227b05,
+ 0x2e0405,
+ 0x377004,
+ 0x200383,
+ 0x2f39c4,
+ 0x355f46,
+ 0x2717c3,
+ 0x258a04,
+ 0x291a45,
+ 0x363644,
+ 0x234e84,
+ 0x205bc2,
+ 0x25e206,
+ 0x392206,
+ 0x3022c5,
+ 0x204cc2,
+ 0x368883,
+ 0x24e0d1c2,
+ 0x232dc4,
+ 0x208a42,
+ 0x20fbc3,
+ 0x25e402,
+ 0x204ac3,
+ 0x200382,
+ 0x213e83,
+ 0x24abc3,
+ 0x15f048,
+ 0x15f048,
+ 0x332ec3,
+ 0x204cc2,
+ 0x25a0d1c2,
+ 0x332ec3,
+ 0x2702c3,
+ 0x23a0c3,
+ 0x32bc44,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x204cc2,
+ 0x2620d1c2,
+ 0x2d0783,
+ 0x204ac3,
+ 0x200383,
+ 0x682,
+ 0x2044c2,
+ 0x217082,
+ 0x205d83,
+ 0x2ec383,
+ 0x204cc2,
+ 0x15f048,
+ 0x13ecc7,
+ 0x20d1c2,
+ 0x231b83,
+ 0x251304,
+ 0x202743,
+ 0x332ec3,
+ 0x209e43,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x2183c3,
+ 0x200383,
+ 0x21d743,
+ 0x1286d3,
+ 0x12cb54,
+ 0x13ecc7,
+ 0x1fd86,
+ 0x5ae0b,
+ 0x28b86,
+ 0x58c07,
+ 0x130089,
+ 0xe9cca,
+ 0x8cb0d,
+ 0x16978c,
+ 0x13d64a,
+ 0x63c85,
+ 0xa588,
+ 0x177ac6,
+ 0x125886,
+ 0x201742,
+ 0x827cc,
+ 0x19a347,
+ 0x23551,
+ 0x2d0783,
+ 0x5f245,
+ 0x102c4,
+ 0x274341c6,
+ 0x19146,
+ 0x178146,
+ 0x920ca,
+ 0xb2f03,
+ 0x27a5c984,
+ 0x130045,
+ 0xa383,
+ 0xd2b8c,
+ 0xf6188,
+ 0xbaf48,
+ 0xa3bc9,
+ 0x20c48,
+ 0x141dd06,
+ 0xfbc88,
+ 0x5e884,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x332ec3,
+ 0x20a3c2,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x36388f,
+ 0x363c4e,
+ 0x15f048,
+ 0x2d0783,
+ 0x4cd07,
+ 0x231b83,
+ 0x332ec3,
+ 0x204303,
+ 0x204ac3,
+ 0x200383,
+ 0x21d0c3,
+ 0x239c47,
+ 0x200142,
+ 0x2c1949,
+ 0x201442,
+ 0x23f68b,
+ 0x2b5b8a,
+ 0x2bcfc9,
+ 0x200282,
+ 0x262b46,
+ 0x26d615,
+ 0x23f7d5,
+ 0x274a13,
+ 0x23fd53,
+ 0x202342,
+ 0x20d605,
+ 0x3ab1cc,
+ 0x24698b,
+ 0x29a745,
+ 0x205ac2,
+ 0x289c02,
+ 0x386746,
+ 0x200f82,
+ 0x25fb86,
+ 0x294d0d,
+ 0x255dcc,
+ 0x224444,
+ 0x201342,
+ 0x203782,
+ 0x248688,
+ 0x202302,
+ 0x208886,
+ 0x303bc4,
+ 0x26d7d5,
+ 0x274b93,
+ 0x210b83,
+ 0x33070a,
+ 0x2f0187,
+ 0x3b2209,
+ 0x32dc47,
+ 0x3124c2,
0x200002,
- 0x200006,
- 0x202f42,
- 0x880c8,
- 0x211302,
- 0x211d42,
- 0x273cc7,
- 0x3a8ac7,
- 0x21ed05,
- 0x215802,
- 0x220647,
- 0x220808,
- 0x279a82,
- 0x293f02,
- 0x22f802,
- 0x202ec2,
- 0x239c48,
- 0x21abc3,
- 0x267848,
- 0x2cf4cd,
- 0x215743,
- 0x369908,
- 0x234a4f,
- 0x234e0e,
- 0x223f8a,
- 0x36a611,
- 0x36aa90,
- 0x2b348d,
- 0x2b37cc,
- 0x3b2447,
- 0x348807,
- 0x355409,
- 0x23c302,
- 0x2004c2,
- 0x254c8c,
- 0x254f8b,
- 0x2008c2,
- 0x2dca86,
- 0x206c02,
- 0x2131c2,
- 0x21dec2,
- 0x216582,
- 0x392904,
- 0x23b147,
+ 0x3a4386,
+ 0x20a0c2,
+ 0x15f048,
+ 0x200802,
+ 0x211cc2,
+ 0x27d407,
+ 0x3b3507,
+ 0x21c7c5,
+ 0x201082,
+ 0x21d707,
+ 0x21d8c8,
+ 0x2413c2,
+ 0x2c2fc2,
+ 0x22c1c2,
+ 0x20e542,
+ 0x23b688,
+ 0x218443,
+ 0x2b72c8,
+ 0x2e078d,
+ 0x21fe43,
+ 0x226288,
+ 0x23e88f,
+ 0x23ec4e,
+ 0x24ac8a,
+ 0x229d11,
+ 0x22a190,
+ 0x2bf0cd,
+ 0x2bf40c,
+ 0x38c5c7,
+ 0x330887,
+ 0x3b30c9,
+ 0x204f02,
+ 0x200702,
+ 0x25a6cc,
+ 0x25a9cb,
+ 0x202ac2,
+ 0x2dcac6,
+ 0x20db42,
+ 0x20c502,
+ 0x21c402,
+ 0x20d1c2,
+ 0x384684,
+ 0x23c7c7,
+ 0x220802,
+ 0x242c07,
+ 0x243c47,
+ 0x2271c2,
+ 0x20e482,
+ 0x24cbc5,
+ 0x204d02,
+ 0x20cb4e,
+ 0x36f1cd,
+ 0x231b83,
+ 0x353a0e,
+ 0x2c0b8d,
+ 0x3ab643,
+ 0x201842,
+ 0x206744,
+ 0x208182,
+ 0x220a42,
+ 0x33e805,
+ 0x348447,
+ 0x372202,
+ 0x2041c2,
+ 0x250f07,
+ 0x2543c8,
+ 0x2abc02,
+ 0x2aa106,
+ 0x25a54c,
+ 0x25a88b,
+ 0x20da42,
+ 0x26588f,
+ 0x265c50,
+ 0x26604f,
+ 0x266415,
+ 0x266954,
+ 0x266e4e,
+ 0x2671ce,
+ 0x26754f,
+ 0x26790e,
+ 0x267c94,
+ 0x268193,
+ 0x26864d,
+ 0x27b549,
+ 0x28dbc3,
+ 0x200182,
+ 0x237b85,
+ 0x206506,
+ 0x208a42,
+ 0x21a2c7,
+ 0x332ec3,
+ 0x200642,
+ 0x36edc8,
+ 0x229f51,
+ 0x22a390,
0x200bc2,
- 0x23f1c7,
- 0x240447,
- 0x214ec2,
- 0x230542,
- 0x242885,
- 0x200682,
- 0x26380e,
- 0x27620d,
- 0x2343c3,
- 0x28268e,
- 0x356b8d,
- 0x2de803,
- 0x2058c2,
- 0x27cac4,
- 0x2446c2,
- 0x20ddc2,
- 0x346905,
- 0x34f587,
- 0x372642,
- 0x206ac2,
- 0x246cc7,
- 0x24c608,
- 0x23aa82,
- 0x2b5506,
- 0x254b0c,
- 0x254e4b,
- 0x221842,
- 0x25bccf,
- 0x25c090,
- 0x25c48f,
- 0x25c855,
- 0x25cd94,
- 0x25d28e,
- 0x25d60e,
- 0x25d98f,
- 0x25dd4e,
- 0x25e0d4,
- 0x25e5d3,
- 0x25ea8d,
- 0x271749,
- 0x286d43,
- 0x2007c2,
- 0x20a805,
- 0x208f46,
- 0x201f82,
- 0x26bdc7,
- 0x21eb03,
- 0x20b2c2,
- 0x2c7448,
- 0x36a851,
- 0x36ac90,
- 0x200942,
- 0x22a647,
- 0x2074c2,
- 0x3328c7,
- 0x209682,
- 0x305dc9,
- 0x3774c7,
- 0x3615c8,
- 0x228246,
- 0x2daf83,
- 0x34ad45,
- 0x234642,
- 0x200402,
- 0x200405,
- 0x399485,
- 0x202102,
- 0x24a503,
- 0x2cfc47,
- 0x208a07,
- 0x203f42,
- 0x2fec04,
- 0x214803,
- 0x2be489,
- 0x2db488,
- 0x20b402,
- 0x2061c2,
- 0x22f2c7,
- 0x24bcc5,
- 0x2a5f88,
- 0x3b0e87,
- 0x2047c3,
- 0x27df86,
- 0x2b330d,
- 0x2b368c,
- 0x276a06,
- 0x203142,
- 0x29a1c2,
- 0x206742,
- 0x2348cf,
- 0x234cce,
- 0x2d3847,
- 0x200342,
- 0x39e205,
- 0x39e206,
- 0x250042,
- 0x203042,
- 0x217c86,
- 0x2a9a83,
- 0x332806,
- 0x2bfb05,
- 0x2bfb0d,
- 0x2c00d5,
- 0x2c0c0c,
- 0x2c150d,
- 0x2c18d2,
- 0x20e842,
+ 0x28d387,
+ 0x200b02,
+ 0x205fc7,
+ 0x201b02,
+ 0x32f249,
+ 0x386707,
+ 0x281408,
+ 0x234006,
+ 0x2cf4c3,
+ 0x2cf4c5,
+ 0x231e02,
+ 0x204842,
+ 0x3a4785,
+ 0x376e05,
+ 0x205e82,
+ 0x245f43,
+ 0x3636c7,
+ 0x210687,
+ 0x204982,
+ 0x3aae04,
+ 0x214183,
+ 0x2c9209,
+ 0x2ed188,
+ 0x205d82,
+ 0x2032c2,
+ 0x26e2c7,
+ 0x282185,
+ 0x2ab548,
+ 0x20d2c7,
+ 0x216143,
+ 0x372306,
+ 0x2bef4d,
+ 0x2bf2cc,
+ 0x280346,
+ 0x208842,
+ 0x2017c2,
+ 0x201f02,
+ 0x23e70f,
+ 0x23eb0e,
+ 0x2d1dc7,
+ 0x203cc2,
+ 0x2c3345,
+ 0x2c3346,
+ 0x20bcc2,
+ 0x205f02,
+ 0x28f406,
+ 0x205f03,
+ 0x205f06,
+ 0x2ca585,
+ 0x2ca58d,
+ 0x2cab55,
+ 0x2cb38c,
+ 0x2cc28d,
+ 0x2cc652,
+ 0x20b602,
+ 0x273fc2,
+ 0x201302,
+ 0x240fc6,
+ 0x2fcf46,
+ 0x201002,
+ 0x206586,
+ 0x211f82,
+ 0x37edc5,
+ 0x202382,
+ 0x20cc89,
+ 0x2df2cc,
+ 0x2df60b,
+ 0x200382,
+ 0x255688,
+ 0x213a02,
+ 0x204c82,
+ 0x246746,
+ 0x36b005,
+ 0x235007,
+ 0x2567c5,
+ 0x294805,
+ 0x24cd82,
+ 0x20a642,
+ 0x217902,
+ 0x2f2847,
+ 0x24410d,
+ 0x24448c,
+ 0x2b3387,
+ 0x2aa082,
+ 0x23cf82,
+ 0x24ba48,
+ 0x2d0488,
+ 0x2e5f88,
+ 0x2f09c4,
+ 0x2dce87,
+ 0x2ee483,
+ 0x2b6042,
+ 0x200e82,
+ 0x2f11c9,
+ 0x395e87,
+ 0x2054c2,
+ 0x277245,
+ 0x201202,
+ 0x26a102,
+ 0x349c43,
+ 0x349c46,
+ 0x2f74c2,
+ 0x2f7fc2,
+ 0x201402,
+ 0x3b3fc6,
+ 0x206687,
+ 0x207842,
0x200e02,
- 0x200ac2,
- 0x2d6646,
- 0x2ac506,
- 0x2025c2,
- 0x208fc6,
+ 0x38bc8f,
+ 0x35384d,
+ 0x2b714e,
+ 0x2c0a0c,
+ 0x2003c2,
+ 0x205502,
+ 0x233e45,
+ 0x3b4e86,
+ 0x201ec2,
+ 0x200fc2,
+ 0x200682,
+ 0x20d244,
+ 0x2e0604,
+ 0x2d29c6,
+ 0x202602,
+ 0x27e787,
+ 0x22d703,
+ 0x22d708,
+ 0x24b048,
+ 0x390787,
+ 0x240ec6,
+ 0x20e5c2,
+ 0x23b383,
+ 0x23b387,
+ 0x272846,
+ 0x2e4385,
+ 0x2f0d48,
+ 0x206342,
+ 0x34a007,
+ 0x220c42,
+ 0x33c282,
+ 0x203b82,
+ 0x2dbe09,
+ 0x22fb02,
+ 0x200242,
+ 0x240183,
+ 0x319ac7,
+ 0x2018c2,
+ 0x2df44c,
+ 0x2df74b,
+ 0x2803c6,
+ 0x20a2c5,
+ 0x222e82,
+ 0x200a42,
+ 0x2bd306,
+ 0x235b83,
+ 0x39c147,
+ 0x23bb02,
0x203382,
- 0x2249c5,
- 0x204c02,
- 0x263949,
- 0x34700c,
- 0x34734b,
- 0x201502,
- 0x24ca48,
- 0x2042c2,
- 0x207a82,
- 0x219bc6,
- 0x36c005,
- 0x3a1687,
- 0x24a385,
- 0x28df05,
- 0x242a42,
- 0x202042,
- 0x206d42,
- 0x26e847,
- 0x2d094d,
- 0x2d0ccc,
- 0x2229c7,
- 0x2b5482,
- 0x226282,
- 0x36f088,
- 0x22ce88,
- 0x2d5b48,
- 0x2dfd44,
- 0x2ef207,
- 0x2dbf83,
- 0x280b82,
- 0x2014c2,
- 0x2e0489,
- 0x3a3247,
- 0x207442,
- 0x26d485,
- 0x241542,
- 0x22ff42,
- 0x297fc3,
- 0x297fc6,
- 0x2e6a82,
- 0x2e8642,
- 0x200c02,
- 0x30f006,
- 0x29dc87,
- 0x200b82,
- 0x208782,
- 0x26768f,
- 0x2824cd,
- 0x284d8e,
- 0x356a0c,
- 0x20d342,
- 0x207482,
- 0x228085,
- 0x3b3086,
- 0x212182,
- 0x208b02,
+ 0x26d495,
+ 0x23f995,
+ 0x2748d3,
+ 0x23fed3,
+ 0x2934c7,
+ 0x2b5948,
+ 0x2fb310,
+ 0x30ee4f,
+ 0x2b5953,
+ 0x2bcd92,
+ 0x2c1510,
+ 0x2ca1cf,
+ 0x2d57d2,
+ 0x2d84d1,
+ 0x2d9513,
+ 0x2dbbd2,
+ 0x2dd20f,
+ 0x2e57ce,
+ 0x2f5092,
+ 0x2f6351,
+ 0x2f754f,
+ 0x2f834e,
+ 0x300011,
+ 0x355810,
+ 0x35f212,
+ 0x3702d1,
+ 0x2f9bc6,
+ 0x307487,
+ 0x373387,
0x204b42,
- 0x282844,
- 0x2cf344,
- 0x338a86,
- 0x201bc2,
- 0x275247,
- 0x214343,
- 0x21cb88,
- 0x224348,
- 0x239247,
- 0x33fbc6,
- 0x2015c2,
- 0x239bc3,
- 0x35bf87,
- 0x266c86,
- 0x2d6585,
- 0x2d8e88,
- 0x208d82,
- 0x3211c7,
- 0x20dfc2,
- 0x35b202,
- 0x20ad82,
- 0x2bf8c9,
- 0x200242,
- 0x200a02,
- 0x222c43,
- 0x321887,
- 0x201a02,
- 0x34718c,
- 0x34748b,
- 0x276a86,
- 0x20cdc5,
- 0x224982,
- 0x206ec2,
- 0x2b3006,
- 0x229083,
- 0x340d07,
- 0x246002,
- 0x200cc2,
- 0x248e15,
- 0x32a415,
- 0x24dd53,
- 0x32a953,
- 0x264dc7,
- 0x288288,
- 0x288290,
- 0x289b0f,
- 0x28bf13,
- 0x2a3fd2,
- 0x2a9410,
- 0x2e79cf,
- 0x2f14d2,
- 0x351551,
- 0x2afb13,
- 0x2bf692,
- 0x2c8d0f,
- 0x2cb38e,
- 0x2cc152,
- 0x2cd191,
- 0x2cdd8f,
- 0x2ced4e,
- 0x2d4c11,
- 0x2e0090,
- 0x2e4452,
- 0x2e55d1,
- 0x2e6b06,
- 0x2e89c7,
- 0x2f77c7,
- 0x201582,
- 0x27a485,
- 0x2f2447,
- 0x221e42,
- 0x203c42,
- 0x22c605,
- 0x221303,
- 0x26e246,
- 0x2d0b0d,
- 0x2d0e4c,
- 0x203dc2,
- 0x27fdcb,
- 0x219cca,
- 0x31b28a,
- 0x2b22c9,
- 0x2dd20b,
- 0x3b0fcd,
- 0x2f2b4c,
- 0x2144ca,
- 0x221e8c,
- 0x24d10b,
- 0x268e4c,
- 0x26c10b,
- 0x346f83,
- 0x287e86,
- 0x326e82,
- 0x2e9202,
- 0x208943,
- 0x205882,
- 0x205883,
- 0x238406,
- 0x25ca07,
- 0x271406,
- 0x2ea8c8,
- 0x22cb88,
- 0x2f0206,
- 0x22d742,
- 0x2f508d,
- 0x2f53cc,
- 0x22d747,
- 0x2f8787,
- 0x2156c2,
- 0x21bf02,
- 0x21eb82,
- 0x24b982,
- 0x216582,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x200882,
- 0x200702,
- 0x2368c545,
- 0x23a03985,
- 0x23f0b146,
- 0x880c8,
- 0x242b0185,
- 0x216582,
- 0x201a42,
- 0x24755c45,
- 0x24a786c5,
- 0x24e79547,
- 0x2527b109,
- 0x2564b084,
- 0x201f82,
- 0x20b2c2,
- 0x25a43785,
- 0x25e8bb89,
- 0x26311f08,
- 0x266abe45,
- 0x26b0bc07,
- 0x26e18948,
- 0x272d8045,
- 0x27604606,
- 0x27b47b09,
- 0x27f25348,
- 0x282b8888,
- 0x2869310a,
- 0x28a48444,
- 0x28ec9405,
- 0x292b5dc8,
- 0x29616c85,
- 0x21ac42,
- 0x29a00343,
- 0x29ea2f86,
- 0x2a233a88,
- 0x2a69e2c6,
- 0x2aa9ddc8,
- 0x2ae09c86,
- 0x2b2f6284,
- 0x205902,
- 0x2b73b7c7,
- 0x2baa8444,
- 0x2be746c7,
- 0x2c333a07,
- 0x201502,
- 0x2c696ec5,
- 0x2ca31504,
- 0x2cf7fd07,
- 0x2d211e47,
- 0x2d67c906,
- 0x2da29585,
- 0x2de91bc7,
- 0x2e2d1a48,
- 0x2e60ab87,
- 0x2eb12b09,
- 0x2eec0f45,
- 0x2f32bb87,
- 0x2f68b886,
- 0x2fa51008,
- 0x225a4d,
- 0x242bc9,
- 0x2e4ccb,
- 0x3726cb,
- 0x26f30b,
- 0x2a564b,
- 0x2ffd0b,
- 0x2fffcb,
- 0x300849,
- 0x30208b,
- 0x30234b,
- 0x30290b,
- 0x30340a,
- 0x30394a,
- 0x303f4c,
- 0x308e0b,
- 0x30964a,
- 0x31c18a,
- 0x32734e,
- 0x3282ce,
- 0x32864a,
- 0x32b14a,
- 0x32cb4b,
- 0x32ce0b,
- 0x32dd0b,
- 0x34c50b,
- 0x34cb0a,
- 0x34d7cb,
- 0x34da8a,
- 0x34dd0a,
- 0x34df8a,
- 0x373f4b,
- 0x37c18b,
- 0x37dace,
- 0x37de4b,
- 0x3849cb,
- 0x38598b,
- 0x3893ca,
- 0x389649,
- 0x38988a,
- 0x38af0a,
- 0x39c60b,
- 0x39e64b,
- 0x39f24a,
- 0x3a02cb,
- 0x3a4f0b,
- 0x3b26cb,
- 0x2fe7ab48,
- 0x30285289,
- 0x30626809,
- 0x30acfe48,
- 0x338805,
- 0x203443,
- 0x204204,
- 0x327145,
- 0x24adc6,
- 0x259145,
- 0x284404,
- 0x26bcc8,
- 0x3739c5,
- 0x28d904,
- 0x3b3f87,
- 0x2996ca,
- 0x3605ca,
- 0x336947,
- 0x203347,
- 0x2f10c7,
- 0x362607,
- 0x2b9d05,
- 0x306d46,
- 0x2fb0c7,
- 0x3a2784,
- 0x376b06,
- 0x376a06,
- 0x3a3745,
- 0x280584,
- 0x2d3d46,
- 0x298387,
- 0x225d46,
- 0x2c7ec7,
- 0x28d6c3,
- 0x268446,
- 0x2328c5,
- 0x279647,
- 0x266fca,
- 0x263204,
- 0x2180c8,
- 0x2fb649,
- 0x2ce487,
- 0x3aed06,
- 0x29f988,
- 0x306409,
- 0x2e6244,
- 0x35d804,
- 0x2f9685,
- 0x2fadc8,
- 0x2bd1c7,
- 0x2aa009,
- 0x327c48,
- 0x2fc706,
- 0x379bc6,
- 0x2943c8,
- 0x375fc6,
- 0x203985,
- 0x27c9c6,
- 0x274bc8,
- 0x2347c6,
- 0x25708b,
- 0x233406,
- 0x295d4d,
- 0x358a45,
- 0x2a8306,
- 0x218a05,
- 0x297c89,
- 0x2f1d07,
- 0x382048,
- 0x2db2c6,
- 0x294ac9,
- 0x3a6246,
- 0x266f45,
- 0x29c1c6,
- 0x2a8e86,
- 0x2c2909,
- 0x306206,
- 0x279247,
- 0x33cf05,
- 0x205703,
- 0x257205,
- 0x296007,
- 0x323446,
- 0x358949,
- 0x30b146,
- 0x27cc06,
- 0x365389,
- 0x27c3c9,
- 0x29ca07,
- 0x369fc8,
- 0x39ee89,
- 0x27a108,
- 0x31f686,
- 0x2cc9c5,
- 0x30a44a,
- 0x27cc86,
- 0x330bc6,
- 0x2a3145,
- 0x24d588,
- 0x206847,
- 0x2318ca,
- 0x247786,
- 0x243005,
- 0x2a0e06,
- 0x265b47,
- 0x3aebc7,
- 0x2bacc5,
- 0x267105,
- 0x2acf46,
- 0x383446,
- 0x2ad886,
- 0x328cc4,
- 0x27b489,
- 0x286146,
- 0x2a5a0a,
- 0x214048,
- 0x32b888,
- 0x3605ca,
- 0x202145,
- 0x2982c5,
- 0x323c48,
- 0x2c9188,
- 0x320d47,
- 0x265146,
- 0x315308,
- 0x202b87,
- 0x279788,
- 0x35f146,
- 0x27dd08,
- 0x2b3b86,
- 0x2370c7,
- 0x295506,
- 0x2d3d46,
- 0x23628a,
- 0x392986,
- 0x2cc9c9,
- 0x2b0486,
- 0x2d238a,
- 0x2f6289,
- 0x2f0306,
- 0x37c504,
- 0x20a8cd,
- 0x285507,
- 0x317906,
- 0x2b8745,
- 0x3a62c5,
- 0x305546,
- 0x26d9c9,
- 0x3ad5c7,
- 0x275cc6,
- 0x2cd946,
- 0x284489,
- 0x212a44,
- 0x228dc4,
- 0x204308,
- 0x2387c6,
- 0x26d548,
- 0x2d6b88,
- 0x203ac7,
- 0x200849,
- 0x2ada87,
- 0x2b004a,
- 0x22decf,
- 0x2377ca,
- 0x227e85,
- 0x274e05,
- 0x216005,
+ 0x284e05,
+ 0x2febc7,
+ 0x217082,
+ 0x203142,
+ 0x2293c5,
+ 0x21ee43,
+ 0x35d986,
+ 0x2442cd,
+ 0x24460c,
+ 0x206602,
+ 0x3ab04b,
+ 0x24684a,
+ 0x30be4a,
+ 0x2bbf49,
+ 0x2ef68b,
+ 0x20d40d,
+ 0x2ff2cc,
+ 0x24890a,
+ 0x275b0c,
+ 0x27afcb,
+ 0x29a58c,
+ 0x2fa34b,
+ 0x2df243,
+ 0x35ee06,
+ 0x3a6502,
+ 0x2f8b82,
+ 0x2db2c3,
+ 0x202502,
+ 0x202503,
+ 0x245886,
+ 0x2665c7,
+ 0x365146,
+ 0x385cc8,
+ 0x2d0188,
+ 0x2d3186,
+ 0x2019c2,
+ 0x301c8d,
+ 0x301fcc,
+ 0x2da9c7,
+ 0x306d07,
+ 0x21fdc2,
+ 0x21ac02,
+ 0x23b302,
+ 0x254782,
+ 0x20d1c2,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x204cc2,
+ 0x204e02,
+ 0x29a94005,
+ 0x29e02e85,
+ 0x2a3177c6,
+ 0x15f048,
+ 0x2a6b5145,
+ 0x20d1c2,
+ 0x2000c2,
+ 0x2ab9c685,
+ 0x2ae83305,
+ 0x2b283e07,
+ 0x2b68b309,
+ 0x2ba47ac4,
+ 0x208a42,
+ 0x200642,
+ 0x2bf72245,
+ 0x2c293149,
+ 0x2c71db88,
+ 0x2cab2085,
+ 0x2cf363c7,
+ 0x2d219b08,
+ 0x2d6e8605,
+ 0x2da5b4c6,
+ 0x2de346c9,
+ 0x2e2b8648,
+ 0x2e6c4b48,
+ 0x2ea9cf0a,
+ 0x2ee52104,
+ 0x2f2d6585,
+ 0x2f6becc8,
+ 0x2fb51245,
+ 0x2184c2,
+ 0x2fe63b83,
+ 0x302a7786,
+ 0x3064ea48,
+ 0x30a24f06,
+ 0x30ecec88,
+ 0x3132d1c6,
+ 0x316e4444,
+ 0x202082,
+ 0x31b630c7,
+ 0x31eaeb84,
+ 0x3227dc47,
+ 0x327a1087,
+ 0x200382,
+ 0x32aa0685,
+ 0x32e03bc4,
+ 0x332d1807,
+ 0x3362adc7,
+ 0x33a87406,
+ 0x33e36085,
+ 0x3429b807,
+ 0x346d2688,
+ 0x34a37f07,
+ 0x34eb0689,
+ 0x3538e6c5,
+ 0x35719c07,
+ 0x35a92e46,
+ 0x35e62d48,
+ 0x2460cd,
+ 0x24cf09,
+ 0x2f484b,
+ 0x25534b,
+ 0x27de4b,
+ 0x2aa88b,
+ 0x30f20b,
+ 0x30f4cb,
+ 0x30fd49,
+ 0x310f0b,
+ 0x3111cb,
+ 0x311ccb,
+ 0x31284a,
+ 0x312d8a,
+ 0x31338c,
+ 0x31608b,
+ 0x3166ca,
+ 0x327eca,
+ 0x3328ce,
+ 0x333a4e,
+ 0x333dca,
+ 0x335d8a,
+ 0x3369cb,
+ 0x336c8b,
+ 0x337a4b,
+ 0x34c7cb,
+ 0x34cdca,
+ 0x34da8b,
+ 0x34dd4a,
+ 0x34dfca,
+ 0x34e24a,
+ 0x373ecb,
+ 0x37a2cb,
+ 0x37c38e,
+ 0x37c70b,
+ 0x383ecb,
+ 0x38500b,
+ 0x38984a,
+ 0x389ac9,
+ 0x389d0a,
+ 0x38b38a,
+ 0x39e50b,
+ 0x39fe8b,
+ 0x3a09ca,
+ 0x3a28cb,
+ 0x3a588b,
+ 0x3b44cb,
+ 0x36285b88,
+ 0x3668c289,
+ 0x36aa3a49,
+ 0x36ee0bc8,
+ 0x33c685,
+ 0x202943,
+ 0x212944,
+ 0x206885,
+ 0x247806,
+ 0x25b245,
+ 0x28adc4,
+ 0x21a1c8,
+ 0x30af85,
+ 0x297a44,
+ 0x209907,
+ 0x2a280a,
+ 0x361d8a,
+ 0x3101c7,
+ 0x211f47,
+ 0x2fdec7,
+ 0x255b47,
+ 0x2fad45,
+ 0x343d06,
+ 0x22cb47,
+ 0x26fec4,
+ 0x2e6b46,
+ 0x2e6a46,
+ 0x208305,
+ 0x3492c4,
+ 0x38ec86,
+ 0x2a1647,
+ 0x22d046,
+ 0x351b47,
+ 0x26a783,
+ 0x2b4846,
+ 0x232045,
+ 0x283f07,
+ 0x270e0a,
+ 0x26dfc4,
+ 0x218ec8,
+ 0x2affc9,
+ 0x2cb147,
+ 0x334646,
+ 0x255908,
+ 0x200a49,
+ 0x3b23c4,
+ 0x2210c4,
+ 0x278285,
+ 0x22c848,
+ 0x2c7f47,
+ 0x2a7109,
+ 0x2f9cc8,
+ 0x347a86,
+ 0x24c646,
+ 0x29de88,
+ 0x354c46,
+ 0x202e85,
+ 0x2874c6,
+ 0x27e108,
+ 0x254b86,
+ 0x25d14b,
+ 0x29dac6,
+ 0x29f50d,
+ 0x3b1785,
+ 0x2aea46,
+ 0x20f505,
+ 0x349909,
+ 0x2abe87,
+ 0x3195c8,
+ 0x292986,
+ 0x29e709,
+ 0x364546,
+ 0x270d85,
+ 0x2a4dc6,
+ 0x2c99c6,
+ 0x2cdb89,
+ 0x200846,
+ 0x253087,
+ 0x277885,
+ 0x202383,
+ 0x25d2c5,
+ 0x29f7c7,
+ 0x358e06,
+ 0x3b1689,
+ 0x3177c6,
+ 0x287706,
+ 0x215ec9,
+ 0x286ec9,
+ 0x2a5607,
+ 0x2cf688,
+ 0x377f89,
+ 0x284a88,
+ 0x379386,
+ 0x2d9dc5,
+ 0x23cb4a,
+ 0x287786,
+ 0x3a8506,
+ 0x2cbbc5,
+ 0x272188,
+ 0x215587,
+ 0x22e68a,
+ 0x251746,
+ 0x24d345,
+ 0x329cc6,
+ 0x2d6347,
0x334507,
- 0x277283,
- 0x36a1c8,
- 0x334d86,
- 0x334e89,
- 0x2c6a06,
- 0x2c2747,
- 0x294889,
- 0x381f48,
- 0x2a3207,
- 0x2fee83,
- 0x338885,
- 0x3b2005,
- 0x328b0b,
- 0x216d44,
- 0x2c5044,
- 0x273486,
- 0x2ff447,
- 0x39794a,
- 0x245807,
- 0x3b0407,
- 0x2786c5,
- 0x205285,
- 0x2196c9,
- 0x2d3d46,
- 0x24568d,
- 0x358045,
- 0x2a2d43,
- 0x205d03,
- 0x349205,
- 0x350005,
- 0x29f988,
- 0x276707,
- 0x228b46,
- 0x29a646,
- 0x22d905,
- 0x234687,
- 0x2035c7,
- 0x36ec47,
- 0x2c948a,
- 0x268508,
- 0x328cc4,
- 0x2ade47,
- 0x277cc7,
- 0x32d086,
- 0x264607,
- 0x2b2a08,
- 0x226708,
- 0x26b786,
- 0x367f08,
- 0x2c32c4,
- 0x2fb0c6,
- 0x3a9146,
- 0x2c0a86,
- 0x349c06,
- 0x29abc4,
- 0x3626c6,
- 0x2b76c6,
- 0x293606,
- 0x2293c6,
- 0x205bc6,
- 0x2b2846,
- 0x228a48,
- 0x39de08,
- 0x2c9cc8,
- 0x259348,
- 0x323bc6,
- 0x210785,
- 0x275386,
- 0x2abec5,
- 0x388807,
- 0x28ae45,
- 0x213d43,
- 0x364605,
- 0x22fd84,
- 0x205d05,
- 0x210143,
- 0x39a7c7,
- 0x31c448,
- 0x2c7f86,
- 0x2c514d,
- 0x274dc6,
- 0x292b85,
- 0x2afd43,
- 0x2b5789,
- 0x212bc6,
- 0x231246,
- 0x29c2c4,
- 0x237747,
- 0x235b06,
- 0x243245,
- 0x216ec3,
- 0x378a44,
- 0x277e86,
- 0x2b15c4,
- 0x30d748,
- 0x324a89,
- 0x2f2209,
- 0x29c0ca,
- 0x23f88d,
- 0x29da47,
- 0x330a46,
- 0x20ec44,
- 0x27b109,
- 0x283588,
- 0x285106,
- 0x263bc6,
- 0x264607,
- 0x2c3c06,
- 0x21b606,
- 0x38c346,
- 0x333a8a,
- 0x218948,
- 0x22bc45,
- 0x27d649,
- 0x279c8a,
- 0x2c54c8,
- 0x2979c8,
- 0x292108,
- 0x2a864c,
- 0x2dc7c5,
- 0x29a8c8,
- 0x39e106,
- 0x2d1d06,
- 0x37af07,
- 0x245705,
- 0x27cb45,
- 0x2f20c9,
- 0x212747,
- 0x2b2ec5,
- 0x21e9c7,
- 0x205d03,
- 0x2bd705,
- 0x366548,
- 0x2d1687,
- 0x297889,
- 0x2d7985,
- 0x2f4504,
- 0x2a1788,
- 0x2cf787,
- 0x2a33c8,
- 0x2740c8,
- 0x32c005,
- 0x334c86,
- 0x257706,
- 0x2e7649,
- 0x315b87,
- 0x2ac986,
- 0x30e947,
- 0x217d43,
- 0x24b084,
- 0x298c45,
- 0x2ae0c4,
- 0x236844,
- 0x27adc7,
- 0x3affc7,
- 0x239a04,
- 0x2976d0,
- 0x3056c7,
- 0x205285,
- 0x22ae8c,
- 0x2018c4,
- 0x2bee08,
- 0x236fc9,
- 0x2ffb86,
- 0x2a03c8,
- 0x25a7c4,
- 0x25a7c8,
- 0x231ec6,
- 0x229248,
- 0x298946,
- 0x2c828b,
- 0x205705,
- 0x2c3248,
- 0x21a3c4,
- 0x27c04a,
- 0x297889,
- 0x2e0d06,
- 0x2160c8,
- 0x258645,
- 0x301944,
- 0x2bed06,
- 0x36eb08,
- 0x27ab48,
- 0x345d06,
- 0x31d6c4,
- 0x30a3c6,
- 0x2adb07,
- 0x2745c7,
- 0x26460f,
- 0x2074c7,
- 0x2f03c7,
- 0x2d1bc5,
- 0x2ed845,
- 0x29c6c9,
- 0x28ae86,
- 0x278fc5,
- 0x27c6c7,
- 0x37b188,
- 0x293705,
- 0x295506,
- 0x213e88,
- 0x29e2ca,
- 0x282988,
- 0x287947,
- 0x22e306,
- 0x27d606,
- 0x21f283,
- 0x2042c3,
- 0x279e49,
- 0x39ed09,
- 0x2bec06,
- 0x2d7985,
- 0x2a84c8,
- 0x2160c8,
- 0x387808,
- 0x38c3cb,
- 0x2c5387,
- 0x2fd189,
- 0x264888,
- 0x33c7c4,
- 0x2c2a08,
- 0x2895c9,
- 0x2acc85,
- 0x334407,
- 0x24b105,
- 0x27aa48,
- 0x28c3cb,
- 0x291910,
- 0x2a8105,
- 0x21a30c,
- 0x228d05,
- 0x2032c3,
- 0x2a2c06,
- 0x2b6e04,
- 0x231606,
- 0x298387,
- 0x213f04,
- 0x2415c8,
- 0x36a08d,
- 0x2d9685,
- 0x23fd84,
- 0x219904,
- 0x27d0c9,
- 0x297408,
- 0x30afc7,
- 0x231f48,
- 0x27b548,
- 0x275fc5,
- 0x331547,
- 0x275f47,
- 0x20af07,
- 0x267109,
- 0x235989,
- 0x23f346,
- 0x2b39c6,
- 0x264846,
- 0x25b8c5,
- 0x3af344,
- 0x204506,
- 0x204a46,
- 0x276008,
- 0x26580b,
- 0x2630c7,
- 0x20ec44,
- 0x317d86,
- 0x203107,
- 0x348b45,
- 0x318f05,
- 0x201e84,
- 0x235906,
- 0x204588,
- 0x27b109,
- 0x257c86,
- 0x282f08,
- 0x243306,
- 0x33ce48,
- 0x2d8a8c,
- 0x275e86,
- 0x29284d,
- 0x292ccb,
- 0x279305,
- 0x203707,
- 0x306306,
- 0x3aea88,
- 0x23f3c9,
- 0x2e7288,
- 0x205285,
- 0x2ecc07,
- 0x27a208,
- 0x384789,
- 0x2a05c6,
- 0x33bfca,
- 0x3ae808,
- 0x2e70cb,
- 0x2c608c,
- 0x25a8c8,
- 0x277506,
- 0x334708,
- 0x29df47,
- 0x2cfa09,
- 0x28ba8d,
- 0x2961c6,
- 0x3017c8,
- 0x39dcc9,
- 0x2b6188,
- 0x27de08,
- 0x2b7f8c,
- 0x2b9347,
- 0x2b9f07,
- 0x266f45,
- 0x3a4d47,
- 0x37b048,
- 0x2bed86,
- 0x257b0c,
- 0x2e4988,
- 0x2c44c8,
- 0x24b5c6,
- 0x3b1d87,
- 0x23f544,
- 0x259348,
- 0x356e4c,
- 0x3a1a0c,
- 0x227f05,
- 0x393d47,
- 0x31d646,
- 0x3b1d06,
- 0x297e48,
- 0x38c284,
- 0x225d4b,
- 0x22844b,
- 0x22e306,
- 0x369f07,
- 0x307d45,
- 0x26ca85,
- 0x225e86,
- 0x258605,
- 0x216d05,
- 0x3accc7,
- 0x273a89,
- 0x233504,
- 0x2722c5,
- 0x2d7645,
- 0x254448,
- 0x22b4c5,
- 0x2a7809,
- 0x2af2c7,
- 0x2af2cb,
- 0x2d1046,
- 0x228789,
- 0x2804c8,
- 0x271c05,
- 0x20b008,
- 0x2359c8,
- 0x207ec7,
- 0x27d4c7,
- 0x27ae49,
- 0x229187,
- 0x32d3c9,
- 0x2aaf4c,
- 0x312a08,
- 0x2b9b49,
- 0x2be7c7,
- 0x27b609,
- 0x3b0107,
- 0x2c6188,
- 0x3afac5,
- 0x2fb046,
- 0x2b8788,
- 0x2f8b88,
- 0x279b49,
- 0x216d47,
- 0x26cb45,
- 0x20e3c9,
- 0x2c4086,
- 0x28b884,
- 0x2e6f46,
- 0x233908,
- 0x2426c7,
- 0x265a08,
- 0x367fc9,
- 0x261a47,
- 0x299886,
- 0x2037c4,
- 0x364689,
- 0x3313c8,
- 0x24b487,
- 0x306e46,
- 0x3b20c6,
- 0x330b44,
+ 0x2c4145,
+ 0x270f45,
+ 0x2b2f86,
+ 0x351746,
+ 0x387046,
+ 0x2b8bc4,
+ 0x286209,
+ 0x28d146,
+ 0x30e50a,
+ 0x222848,
+ 0x309148,
+ 0x361d8a,
+ 0x2145c5,
+ 0x2a1585,
+ 0x37f588,
+ 0x2b6348,
+ 0x21b507,
+ 0x293846,
+ 0x320d48,
+ 0x3674c7,
+ 0x285188,
+ 0x2b9206,
+ 0x2885c8,
+ 0x29ad46,
+ 0x227c87,
+ 0x272b06,
+ 0x38ec86,
+ 0x25d9ca,
+ 0x384706,
+ 0x2d9dc9,
+ 0x2b5446,
+ 0x2e3d8a,
+ 0x2e4449,
+ 0x362586,
+ 0x2ba844,
+ 0x237c4d,
+ 0x28c507,
+ 0x3268c6,
+ 0x2c4a05,
+ 0x3645c5,
+ 0x375846,
+ 0x2d1649,
+ 0x2b4287,
0x27f886,
- 0x205c83,
- 0x308149,
- 0x2056c6,
- 0x2a61c5,
- 0x29a646,
- 0x2a3505,
- 0x27a688,
- 0x25a607,
- 0x362446,
- 0x355c86,
- 0x32b888,
- 0x29c847,
- 0x296205,
- 0x29ab48,
- 0x39ea48,
- 0x3ae808,
- 0x228bc5,
- 0x2fb0c6,
- 0x2f1fc9,
- 0x257584,
- 0x3760cb,
- 0x21b30b,
- 0x22bb49,
- 0x205d03,
- 0x256385,
- 0x205986,
- 0x229908,
- 0x22de44,
- 0x2c7f86,
- 0x2c95c9,
- 0x2c5b05,
- 0x3acc06,
- 0x2cf786,
- 0x2160c4,
- 0x2a1b4a,
- 0x2a6108,
- 0x2f8b86,
- 0x368a05,
- 0x204887,
- 0x301547,
- 0x334c84,
- 0x21b547,
- 0x2b0044,
- 0x2c0a06,
- 0x202e03,
- 0x267105,
- 0x373445,
- 0x207708,
- 0x2ae005,
- 0x275bc9,
- 0x259187,
- 0x25918b,
- 0x2a2d8c,
- 0x2a3a0a,
- 0x30bc07,
- 0x200a83,
- 0x2d3948,
- 0x228d85,
- 0x293785,
- 0x338944,
- 0x2c6086,
- 0x236fc6,
- 0x27f8c7,
- 0x3656cb,
- 0x29abc4,
- 0x3821c4,
- 0x26b904,
- 0x2c25c6,
- 0x213f04,
- 0x2faec8,
- 0x338745,
- 0x23fec5,
- 0x387747,
- 0x203809,
- 0x350005,
- 0x375a4a,
- 0x37b2c9,
- 0x290f8a,
- 0x333bc9,
- 0x353144,
- 0x2cda05,
- 0x2c3d08,
- 0x37fdcb,
- 0x2f9685,
- 0x38d4c6,
- 0x2159c4,
- 0x276106,
- 0x2618c9,
- 0x317e47,
- 0x30b308,
- 0x23fc06,
- 0x2ada87,
- 0x27ab48,
- 0x38f586,
- 0x280204,
- 0x35eb87,
- 0x34e905,
- 0x360c07,
- 0x204604,
- 0x306286,
- 0x218bc8,
- 0x292e88,
- 0x3a4ac7,
- 0x217d88,
- 0x2b3c45,
- 0x205b44,
- 0x3604c8,
- 0x217e84,
- 0x207ec5,
- 0x2ed984,
- 0x202c87,
- 0x286207,
- 0x27b748,
- 0x2a3546,
- 0x2adf85,
- 0x2759c8,
- 0x282b88,
- 0x29c009,
- 0x21b606,
- 0x231948,
- 0x27beca,
- 0x348bc8,
- 0x2d8045,
- 0x275586,
- 0x26d888,
- 0x2eccca,
- 0x341107,
- 0x283985,
- 0x28ef48,
- 0x2b1184,
- 0x24d606,
- 0x2ba688,
- 0x205bc6,
- 0x380dc8,
- 0x2573c7,
- 0x3b3e86,
- 0x37c504,
- 0x29ce07,
- 0x2fac04,
- 0x261887,
- 0x23108d,
- 0x22bbc5,
- 0x2d148b,
- 0x298a46,
- 0x24cb48,
- 0x241584,
- 0x272086,
- 0x277e86,
- 0x334a47,
- 0x29250d,
- 0x25fd07,
- 0x300248,
- 0x29fb05,
- 0x284008,
- 0x2bd146,
- 0x2b3cc8,
- 0x20e886,
- 0x367707,
- 0x368189,
- 0x33f9c7,
- 0x2853c8,
- 0x26f705,
- 0x21ed88,
- 0x3b1c45,
- 0x23b2c5,
- 0x333e45,
- 0x226743,
- 0x27ca44,
- 0x27d645,
- 0x347b09,
- 0x31b646,
- 0x2b2b08,
- 0x2ecec5,
- 0x312447,
- 0x249dca,
- 0x3acb49,
- 0x2a8d8a,
- 0x2c9d48,
- 0x21e80c,
- 0x27c74d,
- 0x2f86c3,
- 0x380cc8,
- 0x378a05,
- 0x29e086,
- 0x381dc6,
- 0x2e3985,
- 0x30ea49,
- 0x310045,
- 0x2759c8,
- 0x279146,
- 0x33f4c6,
- 0x2a1649,
- 0x38ed87,
- 0x28c686,
- 0x249d48,
- 0x2c0988,
- 0x2d0047,
- 0x2293ce,
- 0x2bd385,
- 0x384685,
- 0x205ac8,
- 0x322d07,
- 0x214782,
- 0x2b7b04,
- 0x23150a,
- 0x24b548,
- 0x203206,
- 0x2949c8,
- 0x257706,
- 0x335988,
- 0x2ac988,
- 0x23b284,
- 0x328945,
- 0x683c04,
- 0x683c04,
- 0x683c04,
- 0x203983,
- 0x3b1f46,
- 0x275e86,
- 0x29924c,
- 0x205b03,
- 0x279c86,
- 0x213f84,
- 0x212b48,
- 0x2c9405,
- 0x231606,
- 0x2b5ec8,
- 0x2cb0c6,
- 0x3623c6,
- 0x29f788,
- 0x298cc7,
- 0x228f49,
- 0x2e96ca,
- 0x20abc4,
- 0x28ae45,
- 0x2a9fc5,
- 0x2128c6,
- 0x29da86,
- 0x299c86,
- 0x2ec386,
- 0x229084,
- 0x22908b,
- 0x233904,
- 0x204905,
- 0x2ab5c5,
- 0x203b86,
- 0x359288,
- 0x27c607,
- 0x30b0c4,
- 0x259cc3,
- 0x2b0c85,
- 0x2e6e07,
- 0x2a4449,
- 0x27c50b,
- 0x27f8c7,
- 0x207607,
- 0x2b5dc8,
- 0x312587,
- 0x2a4686,
- 0x242e88,
- 0x299e8b,
- 0x327086,
- 0x213a89,
- 0x29a005,
- 0x2fee83,
- 0x3acc06,
- 0x2572c8,
- 0x20e943,
- 0x2e6f03,
- 0x27ab46,
- 0x257706,
- 0x38ac8a,
- 0x277545,
- 0x277ccb,
- 0x29a58b,
- 0x240a03,
- 0x20f943,
- 0x2affc4,
- 0x367b47,
- 0x257344,
- 0x2039c4,
- 0x39df84,
- 0x348ec8,
- 0x368948,
- 0x30e389,
+ 0x2c9546,
+ 0x28ae49,
+ 0x264a04,
+ 0x2d4a44,
+ 0x3ac808,
+ 0x245c46,
+ 0x277308,
+ 0x2e66c8,
+ 0x202fc7,
+ 0x3a80c9,
+ 0x387247,
+ 0x2b500a,
+ 0x2498cf,
+ 0x250b0a,
+ 0x233c45,
+ 0x27e345,
+ 0x218745,
+ 0x303b07,
+ 0x20e183,
+ 0x2cf888,
+ 0x3028c6,
+ 0x3029c9,
+ 0x2d4006,
+ 0x3aeb47,
+ 0x29e4c9,
+ 0x3194c8,
+ 0x2cbc87,
+ 0x30d803,
+ 0x33c705,
+ 0x20e105,
+ 0x2b8a0b,
+ 0x351304,
+ 0x257984,
+ 0x27cbc6,
+ 0x30e887,
+ 0x38b10a,
+ 0x2757c7,
+ 0x38c807,
+ 0x283305,
+ 0x200045,
+ 0x240909,
+ 0x38ec86,
+ 0x27564d,
+ 0x35af05,
+ 0x29f4c3,
+ 0x20ad83,
+ 0x34f785,
+ 0x347845,
+ 0x255908,
+ 0x280047,
+ 0x2d47c6,
+ 0x2a36c6,
+ 0x2296c5,
+ 0x231e47,
+ 0x202ac7,
+ 0x33f1c7,
+ 0x2d660a,
+ 0x2b4908,
+ 0x2b8bc4,
+ 0x254907,
+ 0x281607,
+ 0x3400c6,
+ 0x26f8c7,
+ 0x2eaa08,
+ 0x2e9e88,
+ 0x2abd86,
+ 0x2d1ec8,
+ 0x2008c4,
+ 0x22cb46,
+ 0x247d86,
+ 0x216646,
+ 0x3a8c46,
+ 0x22d9c4,
+ 0x255c06,
+ 0x2c31c6,
+ 0x29d406,
+ 0x235ec6,
+ 0x20ac46,
+ 0x2ea846,
+ 0x2d46c8,
+ 0x3af1c8,
+ 0x2d6e48,
+ 0x25b448,
+ 0x37f506,
+ 0x212485,
+ 0x2e2006,
+ 0x2b2105,
+ 0x388c87,
+ 0x216605,
+ 0x2136c3,
+ 0x203ec5,
+ 0x33fb44,
+ 0x20ad85,
+ 0x2266c3,
+ 0x338007,
+ 0x34bc88,
+ 0x351c06,
+ 0x32250d,
+ 0x27e306,
+ 0x29c985,
+ 0x2d9743,
+ 0x2be689,
+ 0x264b86,
+ 0x23c0c6,
+ 0x2a4ec4,
+ 0x250a87,
+ 0x233006,
+ 0x2b4545,
+ 0x234a83,
+ 0x207ac4,
+ 0x2817c6,
+ 0x2ded04,
+ 0x32b8c8,
+ 0x39ba49,
+ 0x24d849,
+ 0x2a4cca,
+ 0x387acd,
+ 0x208d07,
+ 0x224bc6,
+ 0x20a684,
+ 0x28b309,
+ 0x28a088,
+ 0x28c106,
+ 0x23dfc6,
+ 0x26f8c7,
+ 0x2b9a46,
+ 0x21f706,
+ 0x3ac246,
+ 0x3a110a,
+ 0x219b08,
+ 0x2464c5,
+ 0x26fd09,
+ 0x28568a,
+ 0x2fa988,
+ 0x2a0ec8,
+ 0x29bd48,
+ 0x2af08c,
+ 0x316305,
+ 0x2a3948,
+ 0x2e8e06,
+ 0x319746,
+ 0x3aea07,
+ 0x2756c5,
+ 0x287645,
+ 0x24d709,
+ 0x213487,
+ 0x302985,
+ 0x227487,
+ 0x20ad83,
+ 0x2c8485,
+ 0x20b8c8,
+ 0x25d647,
+ 0x2a0d89,
+ 0x2de405,
+ 0x307784,
+ 0x2a6508,
+ 0x363207,
+ 0x2cbe48,
+ 0x368c48,
+ 0x2dc805,
+ 0x304286,
+ 0x278686,
+ 0x2ac1c9,
+ 0x31c407,
+ 0x2b29c6,
+ 0x3b3907,
+ 0x221d03,
+ 0x247ac4,
+ 0x2a7885,
+ 0x231f84,
+ 0x383c84,
+ 0x286947,
+ 0x35bdc7,
+ 0x27fa44,
+ 0x2a0bd0,
+ 0x367c87,
+ 0x200045,
+ 0x2536cc,
+ 0x225344,
+ 0x2b1588,
+ 0x227b89,
+ 0x2b4e06,
+ 0x220d88,
+ 0x247344,
+ 0x247348,
+ 0x22ec86,
+ 0x235d48,
+ 0x2a1c06,
+ 0x2d328b,
+ 0x202385,
+ 0x2cb988,
+ 0x216ac4,
+ 0x39be8a,
+ 0x2a0d89,
+ 0x381346,
+ 0x218808,
+ 0x25ebc5,
+ 0x2b69c4,
+ 0x2b1486,
+ 0x33f088,
+ 0x285b88,
+ 0x340bc6,
+ 0x31d104,
+ 0x23cac6,
+ 0x3872c7,
+ 0x27db47,
+ 0x26f8cf,
+ 0x205547,
+ 0x362647,
+ 0x38eb45,
+ 0x352245,
+ 0x2a52c9,
+ 0x30e1c6,
+ 0x284045,
+ 0x2871c7,
+ 0x2c1108,
+ 0x29d505,
+ 0x272b06,
+ 0x222688,
+ 0x224f0a,
+ 0x2e13c8,
+ 0x28f187,
+ 0x249d06,
+ 0x26fcc6,
+ 0x20df43,
+ 0x218303,
+ 0x285849,
+ 0x377e09,
+ 0x2b0586,
+ 0x2de405,
+ 0x2163c8,
+ 0x218808,
+ 0x354dc8,
+ 0x3ac2cb,
+ 0x322747,
+ 0x30b249,
+ 0x26fb48,
+ 0x335844,
+ 0x349588,
+ 0x291409,
+ 0x2b2cc5,
+ 0x303a07,
+ 0x247b45,
+ 0x285a88,
+ 0x293e8b,
+ 0x29b550,
+ 0x2ae605,
+ 0x216a0c,
+ 0x2d4985,
+ 0x283383,
+ 0x29f386,
+ 0x2c0984,
+ 0x203cc6,
+ 0x2a1647,
+ 0x222704,
+ 0x24b388,
+ 0x2cf74d,
+ 0x35e245,
+ 0x208d44,
+ 0x233984,
+ 0x287bc9,
+ 0x2990c8,
+ 0x317647,
+ 0x22ed08,
+ 0x2862c8,
+ 0x27fb85,
+ 0x20f747,
+ 0x27fb07,
+ 0x238287,
+ 0x270f49,
+ 0x232e89,
+ 0x242d86,
+ 0x2bf606,
+ 0x26fb06,
+ 0x289845,
+ 0x39b744,
+ 0x3b0e86,
+ 0x3b5306,
+ 0x27fbc8,
+ 0x2d600b,
+ 0x26de87,
+ 0x20a684,
+ 0x364a46,
+ 0x367a47,
+ 0x34f0c5,
+ 0x263645,
+ 0x212dc4,
+ 0x232e06,
+ 0x3b0f08,
+ 0x28b309,
+ 0x252f86,
+ 0x289a48,
+ 0x2b4606,
+ 0x342708,
+ 0x34c34c,
+ 0x27fa46,
+ 0x29c64d,
+ 0x29cacb,
+ 0x253145,
+ 0x202c07,
+ 0x200946,
+ 0x3343c8,
+ 0x242e09,
+ 0x393c88,
+ 0x200045,
+ 0x2e2a87,
+ 0x284b88,
+ 0x358649,
+ 0x344106,
+ 0x252e8a,
+ 0x334148,
+ 0x393acb,
+ 0x3298cc,
+ 0x247448,
+ 0x280e46,
+ 0x303d08,
+ 0x3a8347,
+ 0x363489,
+ 0x29304d,
+ 0x29f986,
+ 0x21e608,
+ 0x3af089,
+ 0x2bfd08,
+ 0x2886c8,
+ 0x2c3a0c,
+ 0x2c5047,
+ 0x2c5507,
+ 0x270d85,
+ 0x31e5c7,
0x2c0fc8,
- 0x3065c7,
- 0x2293c6,
- 0x2b274f,
- 0x2bd4c6,
- 0x2c9384,
- 0x36878a,
- 0x2e6d07,
- 0x3a37c6,
- 0x28b8c9,
- 0x30e305,
- 0x207845,
- 0x30e446,
- 0x21eec3,
- 0x2b11c9,
- 0x218ac6,
- 0x367d89,
- 0x397946,
- 0x267105,
- 0x228305,
- 0x2074c3,
- 0x367c88,
- 0x2df587,
- 0x334d84,
- 0x2129c8,
- 0x2d3ac4,
- 0x2d4646,
- 0x2a2c06,
- 0x23e7c6,
- 0x2c3109,
- 0x293705,
- 0x2d3d46,
- 0x264ac9,
- 0x3ac846,
- 0x2b2846,
- 0x387c46,
- 0x2119c5,
- 0x2ed986,
- 0x367704,
- 0x3afac5,
- 0x2b8784,
- 0x309246,
- 0x358004,
- 0x202c83,
- 0x283645,
- 0x2356c8,
- 0x21e007,
- 0x2b4549,
- 0x283888,
- 0x294191,
- 0x2cf80a,
- 0x22e247,
- 0x2ee8c6,
- 0x213f84,
- 0x2b8888,
- 0x239748,
- 0x29434a,
- 0x2a75cd,
- 0x29c1c6,
- 0x29f886,
- 0x29cec6,
- 0x2bab47,
- 0x300305,
- 0x250ec7,
- 0x212a85,
- 0x2af404,
- 0x2a7006,
- 0x27f707,
- 0x2b0ecd,
- 0x26d7c7,
- 0x26bbc8,
- 0x275cc9,
- 0x275486,
- 0x2a0545,
- 0x210184,
- 0x233a06,
- 0x334b86,
- 0x24b6c6,
- 0x297088,
- 0x211883,
- 0x203b43,
- 0x323585,
- 0x3112c6,
- 0x2ac945,
- 0x23fe08,
- 0x29854a,
- 0x2f5cc4,
- 0x212b48,
- 0x292108,
- 0x2039c7,
- 0x2ecf89,
- 0x2b5ac8,
- 0x27b187,
- 0x264fc6,
- 0x205bca,
- 0x233a88,
- 0x2c5ec9,
- 0x2974c8,
- 0x21adc9,
- 0x2e7387,
- 0x2d9005,
- 0x226986,
- 0x2bec08,
- 0x24ccc8,
- 0x30bec8,
- 0x22e408,
- 0x204905,
- 0x200884,
- 0x2df288,
- 0x20bdc4,
- 0x3339c4,
- 0x267105,
- 0x28d947,
- 0x2035c9,
- 0x334847,
- 0x231985,
- 0x273686,
- 0x346d46,
- 0x213bc4,
- 0x2a1986,
- 0x2addc4,
- 0x283f06,
- 0x3b0586,
- 0x2150c6,
- 0x205285,
- 0x23fcc7,
- 0x200a83,
- 0x3334c9,
- 0x32b688,
- 0x2129c4,
- 0x27b00d,
- 0x292f88,
- 0x2f0848,
- 0x2c5e46,
- 0x368289,
- 0x3acb49,
- 0x2615c5,
- 0x29864a,
- 0x2863ca,
- 0x28b24c,
- 0x28b3c6,
- 0x274446,
- 0x2bd646,
- 0x269509,
- 0x29e2c6,
- 0x250f06,
- 0x310106,
- 0x259348,
- 0x217d86,
- 0x2c344b,
- 0x28dac5,
- 0x23fec5,
- 0x2746c5,
- 0x202606,
- 0x205b83,
- 0x23e746,
- 0x26d747,
- 0x2b8745,
- 0x379c85,
- 0x3a62c5,
- 0x2eb2c6,
- 0x261684,
- 0x311e06,
- 0x28f789,
- 0x20248c,
- 0x2af148,
- 0x28f8c4,
- 0x2ed746,
- 0x298b46,
- 0x2572c8,
- 0x2160c8,
- 0x202389,
- 0x204887,
- 0x238509,
- 0x24c346,
- 0x22f904,
- 0x20edc4,
- 0x27a944,
- 0x27ab48,
- 0x20340a,
- 0x34ff86,
- 0x353d47,
- 0x2c7687,
- 0x228885,
- 0x2a9f84,
- 0x289586,
- 0x300346,
- 0x235bc3,
- 0x32b4c7,
- 0x273fc8,
- 0x26170a,
- 0x30fa88,
- 0x29ddc8,
- 0x358045,
- 0x279405,
- 0x2631c5,
- 0x228c46,
- 0x229d06,
- 0x3aff05,
- 0x308389,
- 0x2a9d8c,
- 0x263287,
- 0x2943c8,
- 0x258945,
- 0x683c04,
- 0x2e3d84,
- 0x2d17c4,
- 0x214b06,
- 0x29b10e,
- 0x2078c7,
- 0x2bad45,
- 0x25750c,
- 0x2c0847,
- 0x27f687,
- 0x2806c9,
- 0x218189,
- 0x283985,
- 0x32b688,
- 0x2f1fc9,
- 0x2f3d05,
- 0x2b8688,
- 0x2c2c06,
- 0x360746,
- 0x2f6284,
- 0x33c1c8,
- 0x248283,
- 0x3630c4,
- 0x2b0d05,
- 0x305547,
- 0x201ec5,
- 0x27bd89,
- 0x38040d,
- 0x2a1f86,
- 0x2e9644,
- 0x2650c8,
- 0x2738ca,
- 0x21fe87,
- 0x23a245,
- 0x203c43,
- 0x29a74e,
- 0x25770c,
- 0x2f99c7,
- 0x29b2c7,
- 0x204643,
- 0x29e305,
- 0x2d17c5,
- 0x294d88,
- 0x291f49,
- 0x36e986,
- 0x257344,
- 0x22e186,
- 0x32ffcb,
- 0x3a694c,
- 0x35dc47,
- 0x2c90c5,
- 0x39e948,
- 0x2cfe05,
- 0x368787,
- 0x33b7c7,
- 0x248285,
- 0x205b83,
- 0x371284,
- 0x2041c5,
- 0x383505,
- 0x383506,
- 0x28e848,
- 0x27f707,
- 0x3820c6,
- 0x200a06,
- 0x333d86,
- 0x265689,
- 0x331647,
- 0x378186,
- 0x3a6ac6,
- 0x248346,
- 0x2a8405,
- 0x399a86,
- 0x398f45,
- 0x22b548,
- 0x29154b,
- 0x289386,
- 0x2c76c4,
- 0x2eca89,
- 0x259184,
- 0x2c2b88,
- 0x2aab47,
- 0x27dd04,
- 0x2b4e88,
- 0x2b9904,
- 0x2a8444,
- 0x3a26c5,
- 0x2d96c6,
- 0x348e07,
- 0x23fd43,
- 0x299945,
- 0x316144,
- 0x3846c6,
- 0x261648,
- 0x323ac5,
- 0x28d3c9,
- 0x20e5c5,
- 0x2d6288,
- 0x34a5c7,
- 0x388948,
- 0x2b4387,
- 0x2f0489,
- 0x362546,
- 0x336186,
- 0x310104,
- 0x264f05,
- 0x2f490c,
- 0x2746c7,
- 0x274cc7,
- 0x2c7548,
- 0x2a1f86,
- 0x26d684,
- 0x31b184,
- 0x27acc9,
- 0x2bd746,
- 0x219747,
- 0x349b84,
- 0x31b746,
- 0x27f285,
- 0x2a3087,
- 0x2c33c6,
- 0x33be89,
- 0x28b087,
- 0x264607,
- 0x2a14c6,
- 0x23f785,
- 0x278e48,
- 0x218948,
- 0x23acc6,
- 0x323b05,
- 0x251a46,
- 0x206583,
- 0x294c09,
- 0x299a0e,
- 0x2b3188,
- 0x2d3bc8,
- 0x23aacb,
- 0x28d606,
- 0x209c84,
- 0x27c344,
- 0x299b0a,
- 0x21a207,
- 0x378245,
- 0x213a89,
- 0x2b7785,
- 0x333a07,
- 0x2ff984,
- 0x324c07,
- 0x2d6a88,
- 0x2ce546,
- 0x34a889,
- 0x2b5bca,
- 0x21a186,
- 0x292ac6,
- 0x2ab545,
- 0x37e405,
- 0x3261c7,
- 0x244208,
- 0x27f1c8,
- 0x23b286,
- 0x228385,
- 0x29d80e,
- 0x328cc4,
- 0x23ac45,
- 0x273009,
- 0x28ac88,
- 0x287886,
- 0x296d0c,
- 0x298150,
- 0x29ad4f,
- 0x29c5c8,
- 0x30bc07,
- 0x205285,
- 0x27d645,
- 0x348c89,
- 0x28f149,
- 0x30a4c6,
- 0x2f9707,
- 0x393cc5,
- 0x320d49,
- 0x32d106,
- 0x29e10d,
- 0x27a809,
- 0x2039c4,
- 0x2b2f08,
- 0x2df349,
- 0x350146,
- 0x273785,
- 0x336186,
- 0x30b1c9,
- 0x38e148,
- 0x210785,
- 0x27bfc4,
- 0x296ecb,
- 0x350005,
- 0x226786,
- 0x27ca86,
- 0x25f1c6,
- 0x38c5cb,
- 0x28d4c9,
- 0x3b0245,
- 0x388707,
- 0x2cf786,
- 0x231346,
- 0x27bc48,
- 0x2d97c9,
- 0x26b98c,
- 0x2e6c08,
- 0x350246,
- 0x345d03,
- 0x334606,
- 0x27d305,
- 0x278008,
- 0x227d86,
- 0x2a32c8,
- 0x245885,
- 0x294505,
- 0x2a1d48,
- 0x301687,
- 0x381d07,
- 0x27f8c7,
- 0x2a03c8,
- 0x30bd48,
- 0x262286,
- 0x309087,
- 0x24af47,
- 0x27d1ca,
- 0x24c243,
- 0x202606,
- 0x203545,
- 0x231504,
- 0x275cc9,
- 0x2f0404,
- 0x21e084,
- 0x2989c4,
- 0x29b2cb,
- 0x2df4c7,
- 0x29da45,
- 0x2913c8,
- 0x273686,
- 0x273688,
- 0x277486,
- 0x287d45,
- 0x288685,
- 0x28a0c6,
- 0x28b548,
- 0x28b808,
- 0x275e86,
- 0x29120f,
- 0x2946d0,
- 0x358a45,
- 0x200a83,
- 0x24a985,
- 0x2fd0c8,
- 0x28f049,
- 0x3ae808,
- 0x34a708,
- 0x330608,
- 0x2df587,
- 0x273349,
- 0x2a34c8,
- 0x2785c4,
- 0x298848,
- 0x254509,
- 0x30aac7,
- 0x296144,
- 0x334908,
- 0x23fa8a,
- 0x2c2446,
- 0x29c1c6,
- 0x21b4c9,
- 0x298387,
- 0x2c2f88,
- 0x332348,
- 0x349a08,
- 0x353885,
- 0x37f385,
- 0x23fec5,
- 0x2d1785,
- 0x371dc7,
- 0x205b85,
- 0x2b8745,
- 0x36fd86,
- 0x3ae747,
- 0x37fd07,
- 0x23fd86,
- 0x2ca285,
- 0x226786,
- 0x25a685,
- 0x2c06c8,
- 0x31b5c4,
- 0x3ac8c6,
- 0x358844,
- 0x301948,
- 0x22534a,
- 0x27670c,
- 0x3658c5,
- 0x2bac06,
- 0x26bb46,
- 0x323946,
- 0x2fd2c4,
- 0x27f545,
- 0x2772c7,
- 0x298409,
- 0x2a4547,
- 0x683c04,
- 0x683c04,
- 0x30af45,
- 0x20f5c4,
- 0x2966ca,
- 0x273506,
- 0x2e7044,
- 0x3a3745,
- 0x2eee85,
- 0x300244,
- 0x27c6c7,
- 0x20e547,
- 0x2c25c8,
- 0x319188,
- 0x210789,
- 0x2994c8,
- 0x29688b,
- 0x2128c4,
- 0x35d745,
- 0x279045,
- 0x27f849,
- 0x2d97c9,
- 0x2ec988,
- 0x327ac8,
- 0x203b84,
- 0x298b85,
- 0x203443,
- 0x212885,
- 0x2d3dc6,
- 0x291d8c,
- 0x2189c6,
- 0x25a6c6,
- 0x287b05,
- 0x2eb348,
- 0x3a6bc6,
- 0x2eea46,
- 0x29c1c6,
- 0x21f40c,
- 0x24b884,
- 0x333eca,
- 0x287a48,
- 0x291bc7,
- 0x316046,
- 0x36ea47,
- 0x2e12c5,
- 0x306e46,
- 0x352386,
- 0x381bc7,
- 0x21e0c4,
- 0x202d85,
- 0x273004,
- 0x2af487,
- 0x273248,
- 0x2742ca,
- 0x27a087,
- 0x23ae47,
- 0x30bb87,
- 0x2cff49,
- 0x291d8a,
- 0x229043,
- 0x21dfc5,
- 0x215103,
- 0x39dfc9,
- 0x24b308,
- 0x2d1bc7,
- 0x3ae909,
- 0x218a46,
- 0x2c6b08,
- 0x39a745,
- 0x282c8a,
- 0x216249,
- 0x26b649,
- 0x37af07,
- 0x239849,
- 0x214fc8,
- 0x2edb06,
- 0x2badc8,
- 0x2119c7,
- 0x229187,
- 0x37b2c7,
- 0x2d1a48,
- 0x2ed5c6,
- 0x23f845,
- 0x2772c7,
- 0x2925c8,
- 0x3587c4,
- 0x2a58c4,
- 0x28c587,
- 0x2acd07,
- 0x2f1e4a,
- 0x2eda86,
- 0x2f984a,
- 0x2b7a47,
- 0x328a87,
- 0x23b384,
- 0x32d484,
- 0x2272c6,
- 0x30ed84,
- 0x30ed8c,
- 0x3a2005,
- 0x215f09,
- 0x2d6404,
- 0x300305,
- 0x273848,
- 0x28b8c5,
- 0x305546,
- 0x207c84,
- 0x29044a,
- 0x2b14c6,
- 0x29228a,
- 0x20ab87,
- 0x265b45,
- 0x21eec5,
- 0x2288ca,
- 0x2a1a85,
- 0x29c0c6,
- 0x20bdc4,
- 0x2b0146,
- 0x326285,
- 0x227e46,
- 0x3a4acc,
- 0x2cba4a,
- 0x264fc4,
- 0x2293c6,
- 0x298387,
- 0x2c8744,
- 0x259348,
- 0x38d3c6,
- 0x29d689,
- 0x2c4b89,
- 0x312b09,
- 0x376286,
- 0x211ac6,
- 0x2baf07,
- 0x3082c8,
- 0x2118c9,
- 0x2df4c7,
- 0x2b3ac6,
- 0x2adb07,
- 0x29cd85,
- 0x328cc4,
- 0x2baac7,
- 0x24b105,
- 0x2846c5,
- 0x2fe0c7,
- 0x248148,
- 0x39e8c6,
- 0x29344d,
- 0x294f8f,
- 0x29a58d,
- 0x21b3c4,
- 0x2357c6,
- 0x2cbe08,
- 0x3100c5,
- 0x27d388,
- 0x207d8a,
- 0x2039c4,
- 0x330206,
- 0x27e487,
- 0x33fe07,
- 0x298d89,
- 0x2bad85,
- 0x300244,
- 0x32888a,
- 0x2b5689,
- 0x239947,
- 0x268206,
- 0x350146,
- 0x298ac6,
- 0x35ec46,
- 0x2cb70f,
- 0x2cbcc9,
- 0x217d86,
- 0x239646,
- 0x29ed49,
- 0x309187,
- 0x2101c3,
- 0x21f586,
- 0x2042c3,
- 0x2e3848,
- 0x2ad947,
- 0x29c7c9,
- 0x2a2a88,
- 0x381e48,
- 0x216e86,
- 0x331209,
- 0x33b905,
- 0x2a33c4,
- 0x2d90c7,
- 0x269585,
- 0x21b3c4,
- 0x29db08,
- 0x21a4c4,
- 0x302b87,
- 0x31c3c6,
- 0x2ad005,
- 0x2974c8,
- 0x35000b,
- 0x32bb87,
- 0x228b46,
- 0x2bd544,
- 0x209c06,
- 0x267105,
- 0x24b105,
- 0x278bc9,
- 0x27c2c9,
- 0x2291c4,
- 0x229205,
- 0x229405,
- 0x282b06,
- 0x32b788,
- 0x2b7186,
- 0x273e0b,
- 0x2ffa0a,
- 0x2fad05,
- 0x288706,
- 0x2f59c5,
- 0x3b2585,
- 0x297b47,
- 0x204308,
- 0x238504,
- 0x2614c6,
- 0x28b886,
- 0x215187,
- 0x2fee44,
- 0x277e86,
- 0x239d85,
- 0x239d89,
- 0x211cc4,
- 0x2aa109,
- 0x275e86,
- 0x2b9408,
- 0x229405,
- 0x2c7785,
- 0x227e46,
- 0x26b889,
- 0x218189,
- 0x25a746,
- 0x28ad88,
- 0x257608,
- 0x2f5984,
- 0x32e244,
- 0x32e248,
- 0x317a08,
- 0x238609,
- 0x2d3d46,
- 0x29c1c6,
- 0x3151cd,
- 0x2c7f86,
- 0x2d8949,
- 0x254785,
- 0x30e446,
- 0x251008,
- 0x311d45,
- 0x24af84,
- 0x267105,
- 0x27b948,
- 0x296489,
- 0x2730c4,
- 0x306286,
- 0x2e74ca,
- 0x2c54c8,
- 0x2f1fc9,
- 0x2d114a,
- 0x3ae886,
- 0x295148,
- 0x368545,
- 0x30f908,
- 0x2b4485,
- 0x218909,
- 0x36c449,
- 0x228e82,
- 0x29a005,
- 0x26c7c6,
- 0x275dc7,
- 0x3aacc5,
- 0x2f8a86,
- 0x2f7e08,
- 0x2a1f86,
- 0x2c3bc9,
- 0x274dc6,
- 0x27bac8,
- 0x2a90c5,
- 0x244046,
- 0x367808,
- 0x27ab48,
- 0x3b0608,
- 0x2fc788,
- 0x399a84,
- 0x22d8c3,
- 0x2c3e04,
- 0x22e106,
- 0x29cdc4,
- 0x2d3b07,
- 0x2ee949,
- 0x2bcd45,
- 0x332346,
- 0x21f586,
- 0x28e68b,
- 0x2fac46,
- 0x318546,
- 0x3ac9c8,
- 0x379bc6,
- 0x265943,
- 0x396f83,
- 0x328cc4,
- 0x231845,
- 0x243147,
- 0x273248,
- 0x27324f,
- 0x2771cb,
- 0x32b588,
- 0x306306,
- 0x32b88e,
- 0x227e43,
- 0x2430c4,
- 0x2fabc5,
- 0x33db46,
- 0x28968b,
- 0x28da06,
- 0x213f09,
- 0x2ad005,
- 0x389d88,
- 0x206408,
- 0x21804c,
- 0x29b306,
- 0x2128c6,
- 0x2d7985,
- 0x285188,
- 0x276705,
- 0x33c7c8,
- 0x29a9ca,
- 0x226809,
- 0x683c04,
- 0x31216582,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x238483,
- 0x2264c3,
- 0x224103,
- 0x224104,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x22d684,
- 0x21eb03,
- 0x3aaf87,
- 0x211003,
- 0x2025c3,
- 0x32d208,
- 0x2264c3,
- 0x2aeecb,
- 0x2e1a03,
- 0x241f86,
- 0x203e42,
- 0x38660b,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x2264c3,
- 0x280ec3,
- 0x200cc3,
- 0x200882,
- 0x880c8,
- 0x281045,
- 0x2db108,
- 0x2e7e08,
- 0x216582,
- 0x2a0f05,
- 0x340ec7,
- 0x200202,
- 0x2417c7,
- 0x201f82,
- 0x23a887,
- 0x36b2c9,
- 0x318908,
- 0x349889,
- 0x32ed82,
- 0x266707,
- 0x25a4c4,
- 0x340f87,
- 0x2ff907,
- 0x233e42,
- 0x211003,
- 0x20e842,
- 0x205902,
- 0x201502,
- 0x206d42,
- 0x208782,
- 0x217642,
- 0x2a8c45,
- 0x2e3cc5,
- 0x16582,
- 0x343c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x12003,
- 0x481,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x238483,
- 0x2264c3,
- 0x21ca03,
- 0x340f2d86,
- 0x107003,
- 0x79ac5,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x9502,
- 0x880c8,
- 0x441c4,
- 0xd0205,
- 0x200882,
- 0x2ba384,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x35bb03,
- 0x2a9c05,
- 0x202243,
- 0x332683,
- 0x238483,
- 0x201f43,
- 0x2264c3,
- 0x217643,
- 0x224183,
- 0x223ec3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x216582,
- 0x2264c3,
- 0x880c8,
- 0x21eb03,
- 0x880c8,
- 0x316403,
- 0x22d183,
- 0x232144,
- 0x2343c3,
- 0x21eb03,
- 0x2082c2,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x2082c2,
- 0x2348c3,
- 0x238483,
- 0x2264c3,
- 0x2db083,
- 0x217643,
- 0x200882,
- 0x216582,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x241f85,
- 0x1835c6,
- 0x224104,
- 0x203e42,
- 0x880c8,
- 0x200882,
- 0x20448,
- 0x216582,
- 0xee46,
- 0x167404,
- 0x10f2cb,
- 0x173606,
- 0x131ac7,
- 0x2343c3,
- 0x21eb03,
- 0x157f45,
- 0x155dc4,
- 0x202c43,
- 0x4c207,
- 0xcd884,
- 0x238483,
- 0x133184,
- 0x2264c3,
- 0x2e26c4,
- 0x149708,
- 0x155646,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x2025c3,
- 0x2264c3,
- 0x2e1a03,
- 0x203e42,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201603,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x22d684,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x241f86,
- 0x2343c3,
- 0x21eb03,
- 0x179ac3,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x131ac7,
- 0x880c8,
- 0x21eb03,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x3aa2d183,
- 0x2343c3,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x200882,
- 0x216582,
- 0x22d183,
- 0x21eb03,
- 0x238483,
- 0x201502,
- 0x2264c3,
- 0x309dc7,
- 0x20b28b,
- 0x200b03,
- 0x2a06c8,
- 0x308047,
- 0x2017c6,
- 0x2bba05,
- 0x2f7989,
- 0x20bc48,
- 0x20bc49,
- 0x20bc50,
- 0x359fcb,
- 0x2ea589,
- 0x20c783,
- 0x221749,
- 0x232c46,
- 0x232c4c,
- 0x20be48,
- 0x3ac688,
- 0x26e089,
- 0x29bace,
- 0x37cc4b,
- 0x38db4c,
- 0x204803,
- 0x2582cc,
- 0x207209,
- 0x2de107,
- 0x23430c,
- 0x39b60a,
- 0x245dc4,
- 0x3b08cd,
- 0x258188,
- 0x2ded8d,
- 0x266b86,
- 0x28a70b,
- 0x209dc9,
- 0x318407,
- 0x31d846,
- 0x320f49,
- 0x332a4a,
- 0x302708,
- 0x2e1604,
- 0x272187,
- 0x226a87,
- 0x349d84,
- 0x20f244,
- 0x27e989,
- 0x326ec9,
- 0x20a588,
- 0x2114c5,
- 0x392785,
- 0x20d3c6,
- 0x3b0789,
- 0x20800d,
- 0x38d5c8,
- 0x20d2c7,
- 0x2bba88,
- 0x22eec6,
- 0x3a1504,
- 0x37f645,
- 0x2055c6,
- 0x206104,
- 0x207107,
- 0x20914a,
- 0x2139c4,
- 0x21a0c6,
- 0x21aa49,
- 0x21aa4f,
- 0x21b00d,
- 0x21b786,
- 0x220050,
- 0x220446,
- 0x220b87,
- 0x221087,
- 0x22108f,
- 0x222309,
- 0x227746,
- 0x229747,
- 0x229748,
- 0x229b09,
- 0x28d708,
- 0x2d7d07,
- 0x20cd03,
- 0x3852c6,
- 0x204008,
- 0x29bd8a,
- 0x215749,
- 0x20bd83,
- 0x340dc6,
- 0x26130a,
- 0x2ef8c7,
- 0x2ddf4a,
- 0x377e0e,
- 0x222446,
- 0x29a207,
- 0x214d86,
- 0x2072c6,
- 0x37f18b,
- 0x21d18a,
- 0x21768d,
- 0x211b87,
- 0x310288,
- 0x310289,
- 0x31028f,
- 0x3b218c,
- 0x278289,
- 0x33948e,
- 0x3ab08a,
- 0x368dc6,
- 0x37bf86,
- 0x30420c,
- 0x31370c,
- 0x327688,
- 0x33f8c7,
- 0x2131c5,
- 0x29e584,
- 0x24fb0e,
- 0x332cc4,
- 0x238a87,
- 0x26274a,
- 0x382554,
- 0x3839cf,
- 0x221248,
- 0x385188,
- 0x370e8d,
- 0x370e8e,
- 0x38fec9,
- 0x22fe88,
- 0x22fe8f,
- 0x23400c,
- 0x23400f,
- 0x235507,
- 0x237bca,
- 0x21f18b,
- 0x23a0c8,
- 0x23bb47,
- 0x25b08d,
- 0x252506,
- 0x3b0a86,
- 0x23e5c9,
- 0x215d48,
- 0x242188,
- 0x24218e,
+ 0x2b1506,
+ 0x2aaccc,
+ 0x2f55c8,
+ 0x2d0d88,
+ 0x2ba286,
+ 0x20de87,
+ 0x242f84,
+ 0x25b448,
+ 0x28f50c,
+ 0x353d0c,
+ 0x233cc5,
+ 0x2d2887,
+ 0x31d086,
+ 0x20de06,
+ 0x349ac8,
+ 0x2027c4,
+ 0x22d04b,
+ 0x27e8cb,
+ 0x249d06,
+ 0x2cf5c7,
+ 0x31a2c5,
+ 0x276545,
+ 0x22d186,
+ 0x25eb85,
+ 0x3512c5,
+ 0x2cd5c7,
+ 0x27d1c9,
+ 0x351904,
+ 0x34ee05,
+ 0x2e6fc5,
+ 0x2dea88,
+ 0x2287c5,
+ 0x2bca49,
+ 0x37aac7,
+ 0x37aacb,
+ 0x244806,
+ 0x2d4409,
+ 0x349208,
+ 0x27c385,
+ 0x238388,
+ 0x232ec8,
+ 0x23a6c7,
+ 0x2e2f87,
+ 0x2869c9,
+ 0x235c87,
+ 0x289149,
+ 0x2acf8c,
+ 0x2b0588,
+ 0x2b6189,
+ 0x321f87,
+ 0x286389,
+ 0x35bf07,
+ 0x3299c8,
+ 0x3a8285,
+ 0x22cac6,
+ 0x2c4a48,
+ 0x2f0fc8,
+ 0x285549,
+ 0x351307,
+ 0x276605,
+ 0x36b6c9,
+ 0x2b9ec6,
+ 0x2323c4,
+ 0x2323c6,
+ 0x24e8c8,
+ 0x252847,
+ 0x2d6208,
+ 0x2d1f89,
+ 0x3a1e07,
+ 0x2a29c6,
+ 0x202cc4,
+ 0x203f49,
+ 0x20f5c8,
+ 0x2ba147,
+ 0x343e06,
+ 0x20e1c6,
+ 0x3a8484,
+ 0x247f86,
+ 0x201b83,
+ 0x296789,
+ 0x202346,
+ 0x2d2205,
+ 0x2a36c6,
+ 0x24f305,
+ 0x285008,
+ 0x247187,
+ 0x244b46,
+ 0x39c6c6,
+ 0x309148,
+ 0x2a5447,
+ 0x29f9c5,
+ 0x2a09c8,
+ 0x3ada88,
+ 0x334148,
+ 0x2d4845,
+ 0x22cb46,
+ 0x24d609,
+ 0x2ac044,
+ 0x24f18b,
+ 0x21f40b,
+ 0x2463c9,
+ 0x20ad83,
+ 0x25bf05,
+ 0x213a86,
+ 0x313788,
+ 0x249844,
+ 0x351c06,
+ 0x2d6749,
+ 0x2bc545,
+ 0x2cd506,
+ 0x363206,
+ 0x2163c4,
+ 0x2aec0a,
+ 0x2d2148,
+ 0x2f0fc6,
+ 0x2c2585,
+ 0x3b1987,
+ 0x231147,
+ 0x304284,
+ 0x21f647,
+ 0x2165c4,
+ 0x2165c6,
+ 0x203c83,
+ 0x270f45,
+ 0x350e85,
+ 0x205788,
+ 0x254ac5,
+ 0x27f789,
+ 0x25b287,
+ 0x25b28b,
+ 0x2a758c,
+ 0x2a810a,
+ 0x3363c7,
+ 0x204083,
+ 0x212188,
+ 0x2d4a05,
+ 0x29d585,
+ 0x20ae44,
+ 0x3298c6,
+ 0x227b86,
+ 0x247fc7,
+ 0x2349cb,
+ 0x22d9c4,
+ 0x2e8f04,
+ 0x219e04,
+ 0x2cd786,
+ 0x222704,
+ 0x22c948,
+ 0x33c5c5,
+ 0x244d85,
+ 0x354d07,
+ 0x202d09,
+ 0x347845,
+ 0x37584a,
+ 0x277789,
+ 0x29810a,
+ 0x3a1249,
+ 0x335fc4,
+ 0x2c9605,
+ 0x2b9b48,
+ 0x2d18cb,
+ 0x278285,
+ 0x2f0086,
+ 0x2200c4,
+ 0x27fcc6,
+ 0x3a1c89,
+ 0x364b07,
+ 0x317988,
+ 0x387e46,
+ 0x387247,
+ 0x285b88,
+ 0x380946,
+ 0x37f0c4,
+ 0x363f87,
+ 0x366085,
+ 0x377547,
+ 0x25b4c4,
+ 0x2008c6,
+ 0x2f1e08,
+ 0x29cc88,
+ 0x2e88c7,
+ 0x27d548,
+ 0x29ae05,
+ 0x20abc4,
+ 0x361c88,
+ 0x27d644,
+ 0x2186c5,
+ 0x2fac44,
+ 0x3675c7,
+ 0x28d207,
+ 0x2864c8,
+ 0x2cbfc6,
+ 0x254a45,
+ 0x27f588,
+ 0x2e15c8,
+ 0x2a4c09,
+ 0x21f706,
+ 0x22e708,
+ 0x39bd0a,
+ 0x34f148,
+ 0x2e8605,
+ 0x2e2206,
+ 0x277648,
+ 0x2e2b4a,
0x20b387,
- 0x25f8c5,
- 0x243a85,
- 0x202084,
- 0x201a86,
- 0x20a488,
- 0x24f103,
- 0x3b154e,
+ 0x28a645,
+ 0x298888,
+ 0x2b3c44,
+ 0x272206,
+ 0x2c5888,
+ 0x20ac46,
+ 0x239a88,
+ 0x29bfc7,
+ 0x209806,
+ 0x2ba844,
+ 0x28ba07,
+ 0x2b6804,
+ 0x3a1c47,
+ 0x23bf0d,
+ 0x21b585,
+ 0x2d144b,
+ 0x2a1d06,
+ 0x255788,
+ 0x24b344,
+ 0x27bc86,
+ 0x2817c6,
+ 0x304047,
+ 0x29c30d,
+ 0x226dc7,
+ 0x2b6d48,
+ 0x271a05,
+ 0x27f048,
+ 0x2c7ec6,
+ 0x29ae88,
+ 0x223a06,
+ 0x26a9c7,
+ 0x336689,
+ 0x33d2c7,
+ 0x28c3c8,
+ 0x279685,
+ 0x21c848,
+ 0x20dd45,
+ 0x396005,
+ 0x3a14c5,
+ 0x221443,
+ 0x235984,
+ 0x26fd05,
+ 0x2346c9,
+ 0x285f86,
+ 0x2eab08,
+ 0x2e2d45,
+ 0x2b8847,
+ 0x2aee8a,
+ 0x2cd449,
+ 0x2c98ca,
+ 0x2d6ec8,
+ 0x2272cc,
+ 0x28724d,
+ 0x2ff683,
+ 0x239988,
+ 0x207a85,
+ 0x224cc6,
+ 0x319346,
+ 0x2e7f05,
+ 0x3b3a09,
+ 0x358f45,
+ 0x27f588,
+ 0x2841c6,
+ 0x348806,
+ 0x2a63c9,
+ 0x38f247,
+ 0x294146,
+ 0x2aee08,
+ 0x216548,
+ 0x2e0dc7,
+ 0x235ece,
+ 0x2c8105,
+ 0x358545,
+ 0x20ab48,
+ 0x27f3c7,
+ 0x20e202,
+ 0x2c3584,
+ 0x203bca,
+ 0x2ba208,
+ 0x367b46,
+ 0x29e608,
+ 0x278686,
+ 0x31a7c8,
+ 0x2b29c8,
+ 0x395fc4,
+ 0x2b8d85,
+ 0x68a8c4,
+ 0x68a8c4,
+ 0x68a8c4,
+ 0x202403,
+ 0x20e046,
+ 0x27fa46,
+ 0x2a220c,
+ 0x209843,
+ 0x285686,
+ 0x215344,
+ 0x264b08,
+ 0x2d6585,
+ 0x203cc6,
+ 0x2bedc8,
+ 0x2d8206,
+ 0x244ac6,
+ 0x381148,
+ 0x2a7907,
+ 0x235a49,
+ 0x2d4bca,
+ 0x208a84,
+ 0x216605,
+ 0x2a70c5,
+ 0x264886,
+ 0x208d46,
+ 0x2a2dc6,
+ 0x2f9ec6,
+ 0x235b84,
+ 0x235b8b,
+ 0x231144,
+ 0x2a23c5,
+ 0x2b19c5,
+ 0x203086,
+ 0x3b5548,
+ 0x287107,
+ 0x317744,
+ 0x2453c3,
+ 0x2b3745,
+ 0x30a847,
+ 0x28700b,
+ 0x205687,
+ 0x2becc8,
+ 0x2e8b47,
+ 0x231646,
+ 0x24d1c8,
+ 0x2e318b,
+ 0x2067c6,
+ 0x213bc9,
+ 0x2e3305,
+ 0x30d803,
+ 0x2cd506,
+ 0x29bec8,
+ 0x214cc3,
+ 0x200a03,
+ 0x285b86,
+ 0x278686,
+ 0x375dca,
+ 0x280e85,
+ 0x28160b,
+ 0x2a360b,
+ 0x245103,
+ 0x202043,
+ 0x2b4f84,
+ 0x278447,
+ 0x247444,
+ 0x202ec4,
+ 0x2e8c84,
+ 0x34f448,
+ 0x2c24c8,
+ 0x3b2049,
+ 0x38e748,
+ 0x200c07,
+ 0x235ec6,
+ 0x2ea74f,
+ 0x2c8246,
+ 0x2d6504,
+ 0x2c230a,
+ 0x30a747,
+ 0x208386,
+ 0x292e89,
+ 0x3b1fc5,
+ 0x2058c5,
+ 0x3b2106,
+ 0x21c983,
+ 0x2b3c89,
+ 0x219c86,
+ 0x212009,
+ 0x38b106,
+ 0x270f45,
+ 0x2340c5,
+ 0x205543,
+ 0x278588,
+ 0x211607,
+ 0x3028c4,
+ 0x264988,
+ 0x2313c4,
+ 0x338d86,
+ 0x29f386,
+ 0x2419c6,
+ 0x2cb849,
+ 0x29d505,
+ 0x38ec86,
+ 0x2a2fc9,
+ 0x2c7606,
+ 0x2ea846,
+ 0x386e86,
+ 0x200b45,
+ 0x2fac46,
+ 0x26a9c4,
+ 0x3a8285,
+ 0x2c4a44,
+ 0x2b7846,
+ 0x35aec4,
+ 0x20f843,
+ 0x28a145,
+ 0x232bc8,
+ 0x2e9687,
+ 0x2bd949,
+ 0x28a548,
+ 0x29dc51,
+ 0x36328a,
+ 0x249c47,
+ 0x2ea1c6,
+ 0x215344,
+ 0x2c4b48,
+ 0x282f48,
+ 0x29de0a,
+ 0x2bc80d,
+ 0x2a4dc6,
+ 0x381246,
+ 0x28bac6,
+ 0x2c3fc7,
+ 0x2b6e05,
+ 0x262c07,
+ 0x264a45,
+ 0x37ac04,
+ 0x2ad586,
+ 0x216287,
+ 0x2b398d,
+ 0x277587,
+ 0x21a0c8,
+ 0x27f889,
+ 0x2e2106,
+ 0x344085,
+ 0x226704,
+ 0x24e9c6,
+ 0x304186,
+ 0x2ba386,
+ 0x29ee88,
+ 0x2179c3,
+ 0x203043,
+ 0x3598c5,
+ 0x2300c6,
+ 0x2b2985,
+ 0x388048,
+ 0x2a180a,
+ 0x2cee04,
+ 0x264b08,
+ 0x29bd48,
+ 0x202ec7,
+ 0x2e2e09,
+ 0x2be9c8,
+ 0x28b387,
+ 0x2936c6,
+ 0x20ac4a,
+ 0x24ea48,
+ 0x396449,
+ 0x299188,
+ 0x21cec9,
+ 0x2ea087,
+ 0x2effc5,
+ 0x3ac4c6,
+ 0x2b1388,
+ 0x285d08,
+ 0x2a1048,
+ 0x249e08,
+ 0x2a23c5,
+ 0x20f444,
+ 0x211308,
+ 0x208484,
+ 0x3a1044,
+ 0x270f45,
+ 0x297a87,
+ 0x202ac9,
+ 0x303e47,
+ 0x215f45,
+ 0x27cdc6,
+ 0x34ebc6,
+ 0x203d44,
+ 0x2a6706,
+ 0x254884,
+ 0x27ef46,
+ 0x202886,
+ 0x214b06,
+ 0x200045,
+ 0x387f07,
+ 0x204083,
+ 0x206b49,
+ 0x308f48,
+ 0x264984,
+ 0x28b20d,
+ 0x29cd88,
+ 0x3053c8,
+ 0x3963c6,
+ 0x336789,
+ 0x2cd449,
+ 0x3a1985,
+ 0x2a190a,
+ 0x2adb4a,
+ 0x2af7cc,
+ 0x2af946,
+ 0x27d9c6,
+ 0x2c83c6,
+ 0x273209,
+ 0x224f06,
+ 0x262c46,
+ 0x359006,
0x25b448,
- 0x29ff0b,
- 0x366947,
- 0x3a31c5,
- 0x239506,
- 0x2aa947,
- 0x39a248,
- 0x27efc9,
- 0x28f685,
- 0x283688,
- 0x213446,
- 0x38b30a,
- 0x24fa09,
- 0x2343c9,
- 0x2343cb,
- 0x364b88,
- 0x349c49,
- 0x211586,
- 0x2b074a,
- 0x35904a,
- 0x237dcc,
- 0x367287,
- 0x2a998a,
- 0x27258b,
- 0x272599,
- 0x2da488,
- 0x242005,
- 0x25b246,
- 0x2ed389,
- 0x318e06,
- 0x21250a,
- 0x2f31c6,
- 0x212104,
- 0x2bf38d,
- 0x3412c7,
- 0x212109,
- 0x244d45,
- 0x244e88,
- 0x245389,
- 0x2455c4,
- 0x245cc7,
- 0x245cc8,
- 0x246347,
- 0x263e88,
- 0x24c807,
- 0x36f505,
- 0x2567cc,
- 0x256e89,
- 0x2d9a8a,
- 0x38ec09,
- 0x221849,
- 0x26b00c,
- 0x259b8b,
- 0x259e48,
- 0x25bac8,
- 0x25ee84,
- 0x27d9c8,
- 0x282309,
- 0x39b6c7,
- 0x21ac86,
- 0x399907,
- 0x325e89,
- 0x366ecb,
- 0x324907,
- 0x3714c7,
- 0x20acc7,
- 0x2ded04,
- 0x2ded05,
- 0x2a81c5,
- 0x337ecb,
- 0x3981c4,
- 0x319fc8,
- 0x25f4ca,
- 0x213507,
- 0x346547,
- 0x288f12,
- 0x283e06,
- 0x231ac6,
- 0x322fce,
- 0x361506,
- 0x28edc8,
- 0x28ff4f,
- 0x2df148,
- 0x284c08,
- 0x35f54a,
- 0x35f551,
- 0x2a274e,
- 0x23be4a,
- 0x23be4c,
- 0x230087,
- 0x230090,
- 0x204ac8,
- 0x2a2945,
- 0x2aad0a,
- 0x20614c,
- 0x2b3e0d,
- 0x2ac3c6,
- 0x2ac3c7,
- 0x2ac3cc,
- 0x2efc8c,
- 0x2da98c,
- 0x28c98b,
- 0x283044,
- 0x21b644,
- 0x3741c9,
- 0x2d72c7,
- 0x2e94c9,
- 0x358e89,
- 0x36bb47,
- 0x39b486,
- 0x39b489,
- 0x3a4a43,
- 0x2a208a,
- 0x29e7c7,
- 0x30b6cb,
- 0x21750a,
- 0x23a9c4,
- 0x353e86,
- 0x27a309,
- 0x30ec04,
- 0x3a20ca,
- 0x228e45,
- 0x2b6485,
- 0x2b648d,
- 0x2b67ce,
- 0x39f105,
- 0x3167c6,
- 0x241b87,
- 0x26748a,
- 0x39a446,
- 0x35a2c4,
- 0x35e2c7,
- 0x210ecb,
- 0x22ef87,
- 0x202104,
- 0x265d46,
- 0x265d4d,
- 0x325b4c,
- 0x32fd86,
- 0x38d7ca,
- 0x225806,
- 0x210288,
- 0x263507,
- 0x23660a,
- 0x23c3c6,
- 0x211a83,
- 0x251186,
- 0x203e88,
- 0x296a8a,
- 0x24aa47,
- 0x24aa48,
- 0x267b84,
- 0x27b2c7,
- 0x2c4108,
- 0x2a3648,
- 0x286808,
- 0x27fa0a,
- 0x2cf145,
- 0x2cf3c7,
- 0x23bc93,
- 0x22d206,
- 0x2b1648,
- 0x224709,
- 0x241688,
- 0x216f0b,
- 0x2b7848,
- 0x211004,
- 0x2a1e46,
- 0x3b3106,
- 0x2d9509,
- 0x385c07,
- 0x2568c8,
- 0x287bc6,
- 0x3a17c4,
- 0x2c2e45,
- 0x2bdc88,
- 0x2be28a,
- 0x2bf008,
- 0x2c3906,
- 0x29718a,
- 0x233588,
- 0x2c8548,
- 0x2c9908,
- 0x2c9f46,
- 0x2cc006,
- 0x31098c,
- 0x2cc5d0,
- 0x286fc5,
- 0x2def48,
- 0x2f8310,
- 0x2def50,
- 0x20bace,
- 0x31060e,
- 0x310614,
- 0x31d9cf,
- 0x31dd86,
- 0x342211,
- 0x349e53,
- 0x34a2c8,
- 0x27fd45,
- 0x358288,
- 0x20f985,
- 0x22b24c,
- 0x24bf89,
- 0x2388c9,
- 0x399687,
- 0x240589,
- 0x215a47,
- 0x2b9d86,
- 0x37f447,
- 0x20c185,
- 0x212043,
- 0x24f2c9,
- 0x217a49,
- 0x379ac3,
- 0x3aabc4,
- 0x34ae4d,
- 0x3558cf,
- 0x2fe005,
- 0x31aa06,
- 0x20cfc7,
- 0x21d5c7,
- 0x285d86,
- 0x285d8b,
- 0x2a3bc5,
- 0x258ac6,
- 0x208487,
- 0x26d109,
- 0x2de6c6,
- 0x364505,
- 0x21c08b,
- 0x22e946,
- 0x246045,
- 0x27e148,
- 0x2d8748,
- 0x2ca44c,
- 0x2ca450,
- 0x2ce7c9,
- 0x2d5587,
- 0x2f6c4b,
- 0x2d5d46,
- 0x2d7bca,
- 0x2d928b,
- 0x2d9d0a,
- 0x2d9f86,
- 0x2daf45,
- 0x307f46,
- 0x274f88,
- 0x39974a,
- 0x370b1c,
- 0x2e1acc,
- 0x2e1dc8,
- 0x241f85,
- 0x2e42c7,
- 0x29b706,
- 0x273c45,
- 0x21dd86,
- 0x285f48,
- 0x2b5907,
- 0x29b9c8,
- 0x29a30a,
- 0x3212cc,
- 0x321549,
- 0x224a87,
- 0x282844,
- 0x244386,
- 0x28478a,
- 0x358f85,
- 0x3637cc,
- 0x364f08,
- 0x360d08,
- 0x3b188c,
- 0x20c8cc,
- 0x20da49,
- 0x20dc87,
- 0x22d34c,
- 0x29d284,
- 0x2e83ca,
- 0x2ad2cc,
- 0x26eb4b,
- 0x39070b,
- 0x3a5946,
- 0x23c107,
- 0x2302c7,
- 0x2302cf,
- 0x2f0c11,
- 0x3b3a12,
- 0x23c90d,
- 0x23c90e,
- 0x23cc4e,
- 0x31db88,
- 0x31db92,
- 0x23ea88,
- 0x201407,
- 0x248bca,
- 0x20d888,
- 0x3614c5,
- 0x371c0a,
- 0x220987,
- 0x2da0c4,
- 0x202b43,
- 0x311185,
- 0x35f7c7,
- 0x39fe87,
- 0x2b400e,
- 0x3366cd,
- 0x338149,
- 0x20dfc5,
- 0x35d103,
- 0x24ea46,
- 0x36fb85,
- 0x271a48,
- 0x2b2449,
- 0x25b285,
- 0x25b28f,
- 0x2dad87,
- 0x2f78c5,
- 0x306b0a,
- 0x27fc06,
- 0x23dd09,
- 0x2ea18c,
- 0x2ebe09,
- 0x378a86,
- 0x25f2cc,
- 0x2ec206,
- 0x2ef3c8,
- 0x2ef5c6,
- 0x2da606,
- 0x280604,
- 0x25a1c3,
- 0x35760a,
- 0x369111,
- 0x38c04a,
- 0x3627c5,
- 0x2a64c7,
- 0x253647,
- 0x2c4204,
- 0x2c420b,
- 0x318788,
- 0x2b3006,
- 0x2c75c5,
- 0x38b604,
- 0x262b49,
- 0x29f2c4,
- 0x21da87,
- 0x322045,
- 0x322047,
- 0x323205,
- 0x2a8d03,
- 0x2012c8,
- 0x27f30a,
- 0x23fd43,
- 0x28108a,
- 0x26db46,
- 0x25b00f,
- 0x356849,
- 0x3b14d0,
- 0x2e22c8,
- 0x2c45c9,
- 0x293287,
- 0x265ccf,
- 0x3aecc4,
- 0x22d704,
- 0x219f46,
- 0x222b86,
- 0x3a5dca,
- 0x3903c6,
- 0x33eb87,
- 0x2f6fc8,
- 0x2f71c7,
- 0x2f7bc7,
- 0x34b94a,
- 0x2fa14b,
- 0x38e7c5,
- 0x3b3648,
- 0x238b83,
- 0x261d0c,
- 0x212f4f,
- 0x2594cd,
- 0x2bb187,
- 0x338289,
- 0x22f4c7,
- 0x25a288,
- 0x38274c,
- 0x2a6c48,
- 0x252cc8,
- 0x30c28e,
- 0x31f814,
- 0x31fd24,
- 0x33f28a,
- 0x35a54b,
- 0x215b04,
- 0x215b09,
- 0x330288,
- 0x244545,
- 0x24ec0a,
- 0x36b187,
- 0x307e44,
- 0x323ac3,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x211003,
- 0x2cc5c6,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x21bd03,
- 0x200882,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x21eb03,
- 0x202243,
- 0x2cc5c6,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x200882,
- 0x2f5003,
- 0x216582,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x202ec2,
- 0x200482,
- 0x216582,
- 0x22d183,
- 0x22b782,
- 0x200a82,
- 0x201604,
- 0x307b04,
- 0x219382,
- 0x212444,
- 0x201502,
- 0x2264c3,
+ 0x27d546,
+ 0x2d36cb,
+ 0x297c05,
+ 0x244d85,
+ 0x27dc45,
+ 0x366f46,
+ 0x20ac03,
+ 0x241946,
+ 0x277507,
+ 0x2c4a05,
+ 0x24c705,
+ 0x3645c5,
+ 0x327346,
+ 0x31da84,
+ 0x31da86,
+ 0x3add49,
+ 0x366dcc,
+ 0x37a948,
+ 0x33f004,
+ 0x2fa886,
+ 0x2a1e06,
+ 0x29bec8,
+ 0x218808,
+ 0x366cc9,
+ 0x3b1987,
+ 0x245989,
+ 0x254106,
+ 0x22c2c4,
+ 0x20bf04,
+ 0x286cc4,
+ 0x285b88,
+ 0x20290a,
+ 0x3477c6,
+ 0x352107,
+ 0x36f007,
+ 0x2d4505,
+ 0x2a7084,
+ 0x2913c6,
+ 0x2b6e46,
+ 0x202803,
+ 0x308d87,
+ 0x368b48,
+ 0x3a1aca,
+ 0x2ce348,
+ 0x2cec88,
+ 0x35af05,
+ 0x253245,
+ 0x26df85,
+ 0x2d48c6,
+ 0x33d4c6,
+ 0x35bd05,
+ 0x2969c9,
+ 0x2a6e8c,
+ 0x26e047,
+ 0x29de88,
+ 0x381a45,
+ 0x68a8c4,
+ 0x24df84,
+ 0x25d784,
+ 0x214486,
+ 0x2a450e,
+ 0x205947,
+ 0x2c41c5,
+ 0x2abfcc,
+ 0x231287,
+ 0x216207,
+ 0x218089,
+ 0x218f89,
+ 0x28a645,
+ 0x308f48,
+ 0x24d609,
+ 0x334005,
+ 0x2c4948,
+ 0x322906,
+ 0x361f06,
+ 0x2e4444,
+ 0x2ae848,
+ 0x251f43,
+ 0x303084,
+ 0x2b37c5,
+ 0x3ac0c7,
+ 0x210445,
+ 0x39bbc9,
+ 0x28aa8d,
+ 0x299886,
+ 0x245404,
+ 0x2937c8,
+ 0x27d00a,
+ 0x224107,
+ 0x23be45,
+ 0x203143,
+ 0x2a37ce,
+ 0x27868c,
+ 0x2faa87,
+ 0x2a46c7,
+ 0x203c03,
+ 0x224f45,
+ 0x25d785,
+ 0x29e9c8,
+ 0x29bb89,
+ 0x33ef06,
+ 0x247444,
+ 0x249b86,
+ 0x21e3cb,
+ 0x2cd1cc,
+ 0x221507,
+ 0x2d5c45,
+ 0x3ad988,
+ 0x2e0b85,
+ 0x2c2307,
+ 0x3630c7,
+ 0x251f45,
+ 0x20ac03,
+ 0x39a644,
+ 0x212905,
+ 0x351805,
+ 0x351806,
+ 0x34fd08,
+ 0x216287,
+ 0x319646,
+ 0x35c106,
+ 0x3a1406,
+ 0x2d5e89,
+ 0x20f847,
+ 0x26a5c6,
+ 0x2cd346,
+ 0x252006,
+ 0x2aeb45,
+ 0x219646,
+ 0x3768c5,
+ 0x228848,
+ 0x2973cb,
+ 0x291086,
+ 0x36f044,
+ 0x2e2909,
+ 0x25b284,
+ 0x322888,
+ 0x2324c7,
+ 0x2885c4,
+ 0x2be288,
+ 0x2c5304,
+ 0x2aeb84,
+ 0x28b145,
+ 0x35e286,
+ 0x34f387,
+ 0x239b43,
+ 0x2a2a85,
+ 0x322e84,
+ 0x358586,
+ 0x3a1a08,
+ 0x368885,
+ 0x297089,
+ 0x3363c5,
+ 0x2e1e88,
+ 0x215207,
+ 0x388dc8,
+ 0x2bd787,
+ 0x362709,
+ 0x255a86,
+ 0x32b3c6,
+ 0x359004,
+ 0x293605,
+ 0x30150c,
+ 0x27dc47,
+ 0x27e207,
+ 0x36eec8,
+ 0x299886,
+ 0x277444,
+ 0x32e344,
+ 0x286849,
+ 0x2c84c6,
+ 0x240987,
+ 0x3a8bc4,
+ 0x286086,
+ 0x343905,
+ 0x2cbb07,
+ 0x2d3646,
+ 0x252d49,
+ 0x2aab07,
+ 0x26f8c7,
+ 0x2a6246,
+ 0x3879c5,
+ 0x283988,
+ 0x219b08,
+ 0x2646c6,
+ 0x3688c5,
+ 0x261b06,
+ 0x209983,
+ 0x29e849,
+ 0x2a2b4e,
+ 0x2bd488,
+ 0x2314c8,
+ 0x2644cb,
+ 0x2972c6,
+ 0x2089c4,
+ 0x244ac4,
+ 0x2a2c4a,
+ 0x216907,
+ 0x26a685,
+ 0x213bc9,
+ 0x2c3285,
+ 0x3a1087,
+ 0x2b4c04,
+ 0x284487,
+ 0x2e65c8,
+ 0x2cb206,
+ 0x21e789,
+ 0x2beaca,
+ 0x216886,
+ 0x29c8c6,
+ 0x2b1945,
+ 0x37ccc5,
+ 0x31a107,
+ 0x24dd08,
+ 0x343848,
+ 0x395fc6,
+ 0x234145,
+ 0x208ace,
+ 0x2b8bc4,
+ 0x264645,
+ 0x27c749,
+ 0x30dfc8,
+ 0x28f0c6,
+ 0x2a04cc,
+ 0x2a1410,
+ 0x2a414f,
+ 0x2a51c8,
+ 0x3363c7,
+ 0x200045,
+ 0x26fd05,
+ 0x34f209,
+ 0x298a89,
+ 0x23cbc6,
+ 0x278307,
+ 0x2d2805,
+ 0x21b509,
+ 0x340146,
+ 0x224d4d,
+ 0x286b89,
+ 0x202ec4,
+ 0x2bd208,
+ 0x2113c9,
+ 0x347986,
+ 0x27cec5,
+ 0x32b3c6,
+ 0x317849,
+ 0x26ba08,
+ 0x212485,
+ 0x2ae844,
+ 0x2a068b,
+ 0x347845,
+ 0x2a07c6,
+ 0x287586,
+ 0x26ed86,
+ 0x287fcb,
+ 0x297189,
+ 0x35c045,
+ 0x388b87,
+ 0x363206,
+ 0x220f06,
+ 0x25d508,
+ 0x35e389,
+ 0x219e8c,
+ 0x30a648,
+ 0x360406,
+ 0x340bc3,
+ 0x303c06,
+ 0x287e05,
+ 0x281948,
+ 0x233b46,
+ 0x2cbd48,
+ 0x275845,
+ 0x29dfc5,
+ 0x215348,
+ 0x31a947,
+ 0x319287,
+ 0x247fc7,
+ 0x220d88,
+ 0x336508,
+ 0x31e4c6,
+ 0x2b7687,
+ 0x247987,
+ 0x287cca,
+ 0x254003,
+ 0x366f46,
+ 0x202a45,
+ 0x203bc4,
+ 0x27f889,
+ 0x362684,
+ 0x2a7e44,
+ 0x2a1c84,
+ 0x2a46cb,
+ 0x211547,
+ 0x208d05,
+ 0x29ab08,
+ 0x27cdc6,
+ 0x27cdc8,
+ 0x280dc6,
+ 0x2900c5,
+ 0x290385,
+ 0x291f46,
+ 0x292b08,
+ 0x292dc8,
+ 0x27fa46,
+ 0x29a94f,
+ 0x29e310,
+ 0x3b1785,
+ 0x204083,
+ 0x22c385,
+ 0x30b188,
+ 0x298989,
+ 0x334148,
+ 0x2d5d08,
+ 0x224788,
+ 0x211607,
+ 0x27ca89,
+ 0x2cbf48,
+ 0x25bd44,
+ 0x2a1b08,
+ 0x2deb49,
+ 0x2b81c7,
+ 0x29f904,
+ 0x303f08,
+ 0x387cca,
+ 0x2ebe06,
+ 0x2a4dc6,
+ 0x21f5c9,
+ 0x2a1647,
+ 0x2ce1c8,
+ 0x30cc88,
+ 0x3a8a48,
+ 0x356245,
+ 0x37dc45,
+ 0x244d85,
+ 0x25d745,
+ 0x37e287,
+ 0x20ac05,
+ 0x2c4a05,
+ 0x2b5546,
+ 0x334087,
+ 0x2d1807,
+ 0x387fc6,
+ 0x2d7405,
+ 0x2a07c6,
+ 0x212245,
+ 0x2b84c8,
+ 0x2f1d84,
+ 0x2c7686,
+ 0x343744,
+ 0x2b69c8,
+ 0x2c778a,
+ 0x28004c,
+ 0x234bc5,
+ 0x2c4086,
+ 0x21a046,
+ 0x368706,
+ 0x30b384,
+ 0x343bc5,
+ 0x280c07,
+ 0x2a16c9,
+ 0x2cdc87,
+ 0x68a8c4,
+ 0x68a8c4,
+ 0x3175c5,
+ 0x32dd04,
+ 0x29fe8a,
+ 0x27cc46,
+ 0x24d404,
+ 0x208305,
+ 0x37a545,
+ 0x2b6d44,
+ 0x2871c7,
+ 0x36b847,
+ 0x2cd788,
+ 0x368ec8,
+ 0x212489,
+ 0x340248,
+ 0x2a004b,
+ 0x250b44,
+ 0x221005,
+ 0x2840c5,
+ 0x247f49,
+ 0x35e389,
+ 0x2e2808,
+ 0x232248,
+ 0x203084,
+ 0x2a1e45,
+ 0x202943,
+ 0x264845,
+ 0x38ed06,
+ 0x29b9cc,
+ 0x20f4c6,
+ 0x247246,
+ 0x28f345,
+ 0x3273c8,
+ 0x2bd606,
+ 0x2ea346,
+ 0x2a4dc6,
+ 0x2297cc,
+ 0x2ba544,
+ 0x3a154a,
+ 0x28f288,
+ 0x29b807,
+ 0x322d86,
+ 0x33efc7,
+ 0x2f2185,
+ 0x343e06,
+ 0x34af86,
+ 0x356707,
+ 0x2be7c4,
+ 0x3676c5,
+ 0x27c744,
+ 0x37ac87,
+ 0x27c988,
+ 0x27d84a,
+ 0x284a07,
+ 0x2d22c7,
+ 0x336347,
+ 0x2e0cc9,
+ 0x29b9ca,
+ 0x219e43,
+ 0x2e9645,
+ 0x200c83,
+ 0x2e8cc9,
+ 0x26ac48,
+ 0x38eb47,
+ 0x334249,
+ 0x219c06,
+ 0x2d4108,
+ 0x337f85,
+ 0x2e16ca,
+ 0x2d8c49,
+ 0x2abc49,
+ 0x3aea07,
+ 0x283049,
+ 0x214a08,
+ 0x3568c6,
+ 0x2c4248,
+ 0x217b07,
+ 0x235c87,
+ 0x277787,
+ 0x2d2688,
+ 0x2fa706,
+ 0x387a85,
+ 0x280c07,
+ 0x29c3c8,
+ 0x3436c4,
+ 0x30e3c4,
+ 0x294047,
+ 0x2b2d47,
+ 0x24d48a,
+ 0x356846,
+ 0x330f0a,
+ 0x2c34c7,
+ 0x2b8987,
+ 0x257e44,
+ 0x289204,
+ 0x2d3546,
+ 0x3b3d44,
+ 0x3b3d4c,
+ 0x203505,
+ 0x218649,
+ 0x2dfc44,
+ 0x2b6e05,
+ 0x27cf88,
+ 0x292e85,
+ 0x375846,
+ 0x217f84,
+ 0x3ae3ca,
+ 0x32b7c6,
+ 0x2a68ca,
+ 0x237f07,
+ 0x2d3385,
+ 0x21c985,
+ 0x2d454a,
+ 0x2a6805,
+ 0x2a4cc6,
+ 0x208484,
+ 0x2b5106,
+ 0x31a1c5,
+ 0x233c06,
+ 0x2e88cc,
+ 0x2cd90a,
+ 0x2936c4,
+ 0x235ec6,
+ 0x2a1647,
+ 0x2d5204,
+ 0x25b448,
+ 0x38e5c6,
+ 0x208949,
+ 0x2bb109,
+ 0x2b0689,
+ 0x24f346,
+ 0x217c06,
+ 0x2c4387,
+ 0x296908,
+ 0x217a09,
+ 0x211547,
+ 0x29ac86,
+ 0x3872c7,
+ 0x28b985,
+ 0x2b8bc4,
+ 0x2c3f47,
+ 0x247b45,
+ 0x28b085,
+ 0x235247,
+ 0x251e08,
+ 0x3ad906,
+ 0x29d24d,
+ 0x29ebcf,
+ 0x2a360d,
+ 0x215f84,
+ 0x232cc6,
+ 0x2d91c8,
+ 0x358fc5,
+ 0x287e88,
+ 0x23a58a,
+ 0x202ec4,
+ 0x21e946,
+ 0x239607,
+ 0x22d9c7,
+ 0x2a79c9,
+ 0x2c4205,
+ 0x2b6d44,
+ 0x2b8cca,
+ 0x2be589,
+ 0x283147,
+ 0x272086,
+ 0x347986,
+ 0x2a1d86,
+ 0x364046,
+ 0x2d890f,
+ 0x2d9089,
+ 0x27d546,
+ 0x282e46,
+ 0x32fd89,
+ 0x2b7787,
+ 0x226743,
+ 0x229946,
+ 0x218303,
+ 0x2e7dc8,
+ 0x387107,
+ 0x2a53c9,
+ 0x29f208,
+ 0x3193c8,
+ 0x351446,
+ 0x20f409,
+ 0x23c1c5,
+ 0x2b7844,
+ 0x2a73c7,
+ 0x273285,
+ 0x215f84,
+ 0x208dc8,
+ 0x216bc4,
+ 0x2b74c7,
+ 0x34bc06,
+ 0x2b3045,
+ 0x299188,
+ 0x34784b,
+ 0x319c07,
+ 0x2d47c6,
+ 0x2c82c4,
+ 0x32d146,
+ 0x270f45,
+ 0x247b45,
+ 0x283709,
+ 0x286dc9,
+ 0x235cc4,
+ 0x235d05,
+ 0x235f05,
+ 0x2e1546,
+ 0x309048,
+ 0x2c2c46,
+ 0x36898b,
+ 0x2b4c8a,
+ 0x2b6905,
+ 0x290406,
+ 0x3025c5,
+ 0x2e0a45,
+ 0x2ab6c7,
+ 0x3ac808,
+ 0x245984,
+ 0x26c586,
+ 0x292e46,
+ 0x214bc7,
+ 0x30d7c4,
+ 0x2817c6,
+ 0x2b9f85,
+ 0x2b9f89,
+ 0x2135c4,
+ 0x2a7209,
+ 0x27fa46,
+ 0x2c5108,
+ 0x235f05,
+ 0x36f105,
+ 0x233c06,
+ 0x219d89,
+ 0x218f89,
+ 0x2472c6,
+ 0x30e0c8,
+ 0x28abc8,
+ 0x302584,
+ 0x2b9004,
+ 0x2b9008,
+ 0x3269c8,
+ 0x245a89,
+ 0x38ec86,
+ 0x2a4dc6,
+ 0x320c0d,
+ 0x351c06,
+ 0x34c209,
+ 0x23d1c5,
+ 0x3b2106,
+ 0x262d48,
+ 0x31d9c5,
+ 0x2479c4,
+ 0x270f45,
+ 0x2866c8,
+ 0x29fc49,
+ 0x27c804,
+ 0x2008c6,
+ 0x39660a,
+ 0x2fa988,
+ 0x24d609,
+ 0x244c4a,
+ 0x3341c6,
+ 0x29ed88,
+ 0x2c20c5,
+ 0x2c0e48,
+ 0x2bd885,
+ 0x219ac9,
+ 0x36bd09,
+ 0x203602,
+ 0x2e3305,
+ 0x276286,
+ 0x27f987,
+ 0x295705,
+ 0x2f0ec6,
+ 0x306288,
+ 0x299886,
+ 0x2b9a09,
+ 0x27e306,
+ 0x25d388,
+ 0x2afb85,
+ 0x25c586,
+ 0x26aac8,
+ 0x285b88,
+ 0x2e9f88,
+ 0x347b08,
+ 0x219644,
+ 0x209fc3,
+ 0x2b9c44,
+ 0x249b06,
+ 0x28b9c4,
+ 0x231407,
+ 0x2ea249,
+ 0x2c7a05,
+ 0x30cc86,
+ 0x229946,
+ 0x34fb4b,
+ 0x2b6846,
+ 0x20edc6,
+ 0x2cb6c8,
+ 0x24c646,
+ 0x2bcb03,
+ 0x2080c3,
+ 0x2b8bc4,
+ 0x22e605,
+ 0x2b4447,
+ 0x27c988,
+ 0x27c98f,
+ 0x280b0b,
+ 0x308e48,
+ 0x200946,
+ 0x30914e,
+ 0x233c03,
+ 0x2b43c4,
+ 0x2b67c5,
+ 0x2b6bc6,
+ 0x2914cb,
+ 0x297b46,
+ 0x222709,
+ 0x2b3045,
+ 0x38a208,
+ 0x211d88,
+ 0x218e4c,
+ 0x2a4706,
+ 0x264886,
+ 0x2de405,
+ 0x28c188,
+ 0x26aac5,
+ 0x335848,
+ 0x2a084a,
+ 0x2a3a49,
+ 0x68a8c4,
+ 0x3760d1c2,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204ac3,
+ 0x200383,
+ 0x210e03,
+ 0x24ae04,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x2da904,
+ 0x332ec3,
+ 0x2959c7,
+ 0x20fbc3,
+ 0x20abc3,
+ 0x2842c8,
+ 0x200383,
+ 0x2b400b,
+ 0x2f2a03,
+ 0x2716c6,
+ 0x205bc2,
+ 0x26b44b,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x200383,
+ 0x200e03,
+ 0x203383,
+ 0x204cc2,
+ 0x15f048,
+ 0x325b45,
+ 0x247bc8,
+ 0x2ec408,
+ 0x20d1c2,
+ 0x329dc5,
+ 0x39c307,
+ 0x2001c2,
+ 0x24b587,
+ 0x208a42,
+ 0x246f87,
+ 0x239ec9,
+ 0x2c1c88,
+ 0x3a88c9,
+ 0x338b02,
+ 0x270647,
+ 0x2abac4,
+ 0x39c3c7,
+ 0x2b4b87,
+ 0x24ca02,
+ 0x20fbc3,
+ 0x20b602,
+ 0x202082,
+ 0x200382,
+ 0x217902,
+ 0x200e02,
+ 0x20c4c2,
+ 0x2af685,
+ 0x24dec5,
+ 0xd1c2,
+ 0x31b83,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x117c3,
+ 0x701,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x204ac3,
+ 0x200383,
0x21bd03,
- 0x3a5946,
- 0x221e42,
- 0x206202,
- 0x224dc2,
- 0x3d224643,
- 0x3d626703,
- 0x53d46,
- 0x53d46,
- 0x224104,
- 0x140a30a,
- 0x16970c,
- 0x165f0c,
- 0x798cd,
- 0xdb7c7,
- 0x1b908,
- 0x22f08,
- 0x1a7eca,
- 0x3e31f345,
- 0x11f349,
- 0x163048,
- 0x1ac10a,
- 0x16348e,
- 0x144148b,
- 0x167404,
- 0x2988,
- 0x16e847,
- 0x178587,
- 0x112089,
- 0x10ec87,
- 0x132d48,
- 0x1a2f89,
- 0x17a845,
- 0x5074e,
- 0xa910d,
- 0x131948,
- 0x3e6d7e86,
- 0x60c47,
- 0x62607,
- 0x67347,
- 0x6c4c7,
- 0xd382,
- 0x141807,
- 0x1d34c,
- 0xeaec7,
- 0x8ddc6,
- 0xa5449,
- 0xa7188,
- 0xf1c2,
- 0xa82,
- 0x13088b,
- 0x15309,
- 0x33c49,
- 0x2b848,
- 0xb09c2,
- 0x1afb89,
- 0xccf89,
- 0xcdbc8,
- 0xce147,
- 0xcf0c9,
- 0xd2905,
- 0xd2d10,
- 0x164d46,
- 0x51f05,
- 0x23b4d,
- 0x10e846,
- 0xdc047,
- 0xe26d8,
- 0x108548,
- 0x19104a,
- 0x4114d,
- 0x1402,
- 0x161186,
- 0x89948,
- 0x180248,
- 0x87f89,
- 0x45e88,
- 0x4da0e,
- 0xe8f85,
- 0x539c8,
- 0x3282,
- 0x155646,
- 0x6c2,
- 0xb81,
- 0x3eae2f44,
- 0x3ee90c43,
+ 0x3a40d686,
+ 0x5e303,
+ 0x854c5,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x8082,
+ 0x15f048,
+ 0x4dcc4,
+ 0xe0f85,
+ 0x204cc2,
+ 0x2cfa44,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x236d03,
+ 0x2b0405,
+ 0x204303,
+ 0x205d83,
+ 0x204ac3,
+ 0x2104c3,
+ 0x200383,
+ 0x213e83,
+ 0x24ae83,
+ 0x24abc3,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x20d1c2,
+ 0x200383,
+ 0x15f048,
+ 0x332ec3,
+ 0x15f048,
+ 0x26ae03,
+ 0x2d0783,
+ 0x22ef04,
+ 0x231b83,
+ 0x332ec3,
+ 0x20a3c2,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20a3c2,
+ 0x22d603,
+ 0x204ac3,
+ 0x200383,
+ 0x2ec383,
+ 0x213e83,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2716c5,
+ 0x1540c6,
+ 0x24ae04,
+ 0x205bc2,
+ 0x15f048,
+ 0x204cc2,
+ 0x1d508,
+ 0x20d1c2,
+ 0x97606,
+ 0x1681c4,
+ 0x16e1cb,
+ 0x3dc06,
+ 0xfcc7,
+ 0x231b83,
+ 0x332ec3,
+ 0x15ae05,
+ 0x19c804,
+ 0x221543,
+ 0x53fc7,
+ 0xdc304,
+ 0x204ac3,
+ 0x94fc4,
+ 0x200383,
+ 0x2f39c4,
+ 0xfe588,
+ 0x125886,
+ 0x114f85,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x20abc3,
+ 0x200383,
+ 0x2f2a03,
+ 0x205bc2,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204143,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x2da904,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2716c6,
+ 0x231b83,
+ 0x332ec3,
+ 0x178ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0xfcc7,
+ 0x15f048,
+ 0x332ec3,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x40ed0783,
+ 0x231b83,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200382,
+ 0x200383,
+ 0x316e47,
+ 0x23860b,
+ 0x2396c3,
+ 0x24be08,
+ 0x296687,
+ 0x225246,
+ 0x2c6145,
+ 0x373549,
+ 0x20f948,
+ 0x260d09,
+ 0x260d10,
+ 0x35d28b,
+ 0x385989,
+ 0x209303,
+ 0x2b5649,
+ 0x230806,
+ 0x23080c,
+ 0x260f08,
+ 0x3ae848,
+ 0x35d7c9,
+ 0x2a5d0e,
+ 0x20780b,
+ 0x2eb20c,
+ 0x205283,
+ 0x26cc4c,
+ 0x205289,
+ 0x257a87,
+ 0x231acc,
+ 0x36aa8a,
+ 0x24fe44,
+ 0x393f4d,
+ 0x26cb08,
+ 0x210e0d,
+ 0x272746,
+ 0x29258b,
+ 0x31a3c9,
+ 0x23d087,
+ 0x339606,
+ 0x349d89,
+ 0x38ce8a,
+ 0x37a0c8,
+ 0x2f24c4,
+ 0x34ecc7,
+ 0x3ac5c7,
+ 0x3a8dc4,
+ 0x32d984,
+ 0x237209,
+ 0x2ceac9,
+ 0x237908,
+ 0x210b85,
+ 0x392545,
+ 0x20aa06,
+ 0x393e09,
+ 0x23a80d,
+ 0x2eac88,
+ 0x20a907,
+ 0x2c61c8,
+ 0x382986,
+ 0x37ed04,
+ 0x359b85,
+ 0x202246,
+ 0x203204,
+ 0x205187,
+ 0x206d8a,
+ 0x211cc4,
+ 0x2167c6,
+ 0x2182c9,
+ 0x2182cf,
+ 0x2197cd,
+ 0x21a486,
+ 0x21d110,
+ 0x21d506,
+ 0x21dc47,
+ 0x21ebc7,
+ 0x21ebcf,
+ 0x21f889,
+ 0x2242c6,
+ 0x226487,
+ 0x226488,
+ 0x227649,
+ 0x2b3108,
+ 0x2e7907,
+ 0x20a203,
+ 0x378c86,
+ 0x3abf08,
+ 0x2a5fca,
+ 0x21fe49,
+ 0x20fa83,
+ 0x39c206,
+ 0x26c3ca,
+ 0x2fca47,
+ 0x2578ca,
+ 0x26a24e,
+ 0x21f9c6,
+ 0x2e3507,
+ 0x227086,
+ 0x201806,
+ 0x37da4b,
+ 0x30c58a,
+ 0x317ecd,
+ 0x217cc7,
+ 0x359188,
+ 0x359189,
+ 0x35918f,
+ 0x20e28c,
+ 0x281bc9,
+ 0x2e928e,
+ 0x295aca,
+ 0x3035c6,
+ 0x2fbbc6,
+ 0x3b06cc,
+ 0x3106cc,
+ 0x311448,
+ 0x33d1c7,
+ 0x25b7c5,
+ 0x2251c4,
+ 0x2438ce,
+ 0x38d104,
+ 0x257bc7,
+ 0x26d08a,
+ 0x36e914,
+ 0x373a4f,
+ 0x21ed88,
+ 0x378b48,
+ 0x357e8d,
+ 0x357e8e,
+ 0x3823c9,
+ 0x3a5b08,
+ 0x3a5b0f,
+ 0x2317cc,
+ 0x2317cf,
+ 0x232a07,
+ 0x23acca,
+ 0x21cc4b,
+ 0x23bcc8,
+ 0x23e5c7,
+ 0x264f4d,
+ 0x3151c6,
+ 0x394106,
+ 0x2417c9,
+ 0x259888,
+ 0x24c108,
+ 0x24c10e,
+ 0x238707,
+ 0x226985,
+ 0x24da85,
+ 0x205e04,
+ 0x225506,
+ 0x237808,
+ 0x260183,
+ 0x2efb8e,
+ 0x265308,
+ 0x2f198b,
+ 0x26afc7,
+ 0x395e05,
+ 0x26cdc6,
+ 0x2b0e07,
+ 0x307048,
+ 0x319f09,
+ 0x298fc5,
+ 0x28a188,
+ 0x217306,
+ 0x3a02ca,
+ 0x2437c9,
+ 0x231b89,
+ 0x231b8b,
+ 0x201148,
+ 0x3a8c89,
+ 0x210c46,
+ 0x22c54a,
+ 0x2b7f4a,
+ 0x23aecc,
+ 0x3acb87,
+ 0x2c1a8a,
+ 0x328ecb,
+ 0x328ed9,
+ 0x30fa48,
+ 0x271745,
+ 0x265106,
+ 0x258fc9,
+ 0x261cc6,
+ 0x21324a,
+ 0x20fb46,
+ 0x201e44,
+ 0x2c9ecd,
+ 0x201e47,
+ 0x20b549,
+ 0x383305,
+ 0x24e548,
+ 0x24ee89,
+ 0x24f0c4,
+ 0x24fd47,
+ 0x24fd48,
+ 0x250287,
+ 0x26ea08,
+ 0x2545c7,
+ 0x35c2c5,
+ 0x25c70c,
+ 0x25cf49,
+ 0x2c4dca,
+ 0x38f0c9,
+ 0x2b5749,
+ 0x2739cc,
+ 0x263e0b,
+ 0x2640c8,
+ 0x265688,
+ 0x268a44,
+ 0x288288,
+ 0x289389,
+ 0x36ab47,
+ 0x218506,
+ 0x317287,
+ 0x21e1c9,
+ 0x328b0b,
+ 0x32cfc7,
+ 0x200407,
+ 0x238047,
+ 0x210d84,
+ 0x210d85,
+ 0x2ac905,
+ 0x33c00b,
+ 0x399404,
+ 0x369d08,
+ 0x26f08a,
+ 0x2173c7,
+ 0x341dc7,
+ 0x290c12,
+ 0x27ee46,
+ 0x22e886,
+ 0x35898e,
+ 0x281346,
+ 0x298708,
+ 0x29938f,
+ 0x2111c8,
+ 0x38bb08,
+ 0x3af64a,
+ 0x3af651,
+ 0x2a6b4e,
+ 0x254e4a,
+ 0x254e4c,
+ 0x2014c7,
+ 0x3a5d10,
+ 0x3b5388,
+ 0x2a6d45,
+ 0x2b114a,
+ 0x20324c,
+ 0x29afcd,
+ 0x2fce06,
+ 0x2fce07,
+ 0x2fce0c,
+ 0x305c8c,
+ 0x32814c,
+ 0x28f98b,
+ 0x289b84,
+ 0x21f744,
+ 0x374149,
+ 0x2fe3c7,
+ 0x23e389,
+ 0x2b7d89,
+ 0x35a587,
+ 0x36a906,
+ 0x36a909,
+ 0x39d403,
+ 0x2129ca,
+ 0x32f807,
+ 0x238acb,
+ 0x317d4a,
+ 0x2abb44,
+ 0x39c546,
+ 0x284c89,
+ 0x3b3bc4,
+ 0x2035ca,
+ 0x2d4ac5,
+ 0x2c0005,
+ 0x2c000d,
+ 0x2c034e,
+ 0x378205,
+ 0x323506,
+ 0x2712c7,
+ 0x38684a,
+ 0x38d406,
+ 0x35ecc4,
+ 0x2f8987,
+ 0x2da18b,
+ 0x382a47,
+ 0x282ac4,
+ 0x24f706,
+ 0x24f70d,
+ 0x21de8c,
+ 0x204986,
+ 0x2eae8a,
+ 0x235806,
+ 0x2f3248,
+ 0x28bf47,
+ 0x33f88a,
+ 0x23d986,
+ 0x217bc3,
+ 0x262ec6,
+ 0x3abd88,
+ 0x2a024a,
+ 0x2766c7,
+ 0x2766c8,
+ 0x27dd84,
+ 0x2cc0c7,
+ 0x23ccc8,
+ 0x29e008,
+ 0x288b48,
+ 0x33110a,
+ 0x2e0405,
+ 0x2e0687,
+ 0x254c93,
+ 0x2d0806,
+ 0x26f288,
+ 0x222c09,
+ 0x24b448,
+ 0x3514cb,
+ 0x2cddc8,
+ 0x273704,
+ 0x215446,
+ 0x3b4f06,
+ 0x35e0c9,
+ 0x2c72c7,
+ 0x25c808,
+ 0x29e186,
+ 0x235144,
+ 0x2ce085,
+ 0x2c8a08,
+ 0x2c900a,
+ 0x2c9b48,
+ 0x2ce746,
+ 0x29ef8a,
+ 0x351988,
+ 0x2d5008,
+ 0x2d6a88,
+ 0x2d70c6,
+ 0x2d93c6,
+ 0x20168c,
+ 0x2d99d0,
+ 0x28de45,
+ 0x210fc8,
+ 0x306790,
+ 0x210fd0,
+ 0x260b8e,
+ 0x20130e,
+ 0x201314,
+ 0x31abcf,
+ 0x31af86,
+ 0x3319d1,
+ 0x339793,
+ 0x339c08,
+ 0x3aafc5,
+ 0x35b6c8,
+ 0x385785,
+ 0x22854c,
+ 0x229489,
+ 0x282449,
+ 0x245d47,
+ 0x377009,
+ 0x243d87,
+ 0x2fadc6,
+ 0x359987,
+ 0x261245,
+ 0x211803,
+ 0x260349,
+ 0x222ec9,
+ 0x378ac3,
+ 0x39a544,
+ 0x35c40d,
+ 0x3b1b0f,
+ 0x235185,
+ 0x35b5c6,
+ 0x211b07,
+ 0x325987,
+ 0x28cd86,
+ 0x28cd8b,
+ 0x2a82c5,
+ 0x25f106,
+ 0x2fba47,
+ 0x276ec9,
+ 0x2290c6,
+ 0x22e405,
+ 0x31190b,
+ 0x23bb46,
+ 0x3724c5,
+ 0x28b548,
+ 0x321d88,
+ 0x2d75cc,
+ 0x2d75d0,
+ 0x2e0149,
+ 0x2e7107,
+ 0x30860b,
+ 0x2e6186,
+ 0x2e77ca,
+ 0x2ea4cb,
+ 0x2eb74a,
+ 0x2eb9c6,
+ 0x2ec245,
+ 0x32f546,
+ 0x27e4c8,
+ 0x245e0a,
+ 0x357b1c,
+ 0x2f2acc,
+ 0x2f2dc8,
+ 0x2716c5,
+ 0x2f4f07,
+ 0x26a106,
+ 0x27d385,
+ 0x21c2c6,
+ 0x28cf48,
+ 0x2be807,
+ 0x2a5c08,
+ 0x2e360a,
+ 0x34a10c,
+ 0x34a389,
+ 0x37ee87,
+ 0x20d244,
+ 0x24db46,
+ 0x38b68a,
+ 0x2b7e85,
+ 0x20734c,
+ 0x20b088,
+ 0x377648,
+ 0x20d98c,
+ 0x21be8c,
+ 0x2206c9,
+ 0x220907,
+ 0x342c0c,
+ 0x3aa644,
+ 0x23c54a,
+ 0x2580cc,
+ 0x278acb,
+ 0x24140b,
+ 0x241f46,
+ 0x383847,
+ 0x2ddb07,
+ 0x3a5f4f,
+ 0x2fda11,
+ 0x2ddb12,
+ 0x30d0cd,
+ 0x30d0ce,
+ 0x30d40e,
+ 0x31ad88,
+ 0x31ad92,
+ 0x252288,
+ 0x2962c7,
+ 0x25260a,
+ 0x204748,
+ 0x281305,
+ 0x37e0ca,
+ 0x21da47,
+ 0x305304,
+ 0x21b083,
+ 0x2b0fc5,
+ 0x3af8c7,
+ 0x2fea07,
+ 0x29b1ce,
+ 0x30ff4d,
+ 0x313c49,
+ 0x220c45,
+ 0x33aa03,
+ 0x25fac6,
+ 0x36ffc5,
+ 0x2f1bc8,
+ 0x30c009,
+ 0x265145,
+ 0x26514f,
+ 0x2ec087,
+ 0x373485,
+ 0x21b2ca,
+ 0x299b86,
+ 0x2f33c9,
+ 0x384d0c,
+ 0x2f99c9,
+ 0x207b06,
+ 0x26ee8c,
+ 0x340cc6,
+ 0x2fc548,
+ 0x2fc746,
+ 0x30fbc6,
+ 0x349344,
+ 0x264443,
+ 0x2b270a,
+ 0x35b211,
+ 0x281d8a,
+ 0x255d05,
+ 0x277947,
+ 0x259307,
+ 0x23cdc4,
+ 0x23cdcb,
+ 0x3a8748,
+ 0x2bd306,
+ 0x36ef45,
+ 0x3a05c4,
+ 0x291949,
+ 0x330304,
+ 0x25cd87,
+ 0x332705,
+ 0x332707,
+ 0x358bc5,
+ 0x2af743,
+ 0x296188,
+ 0x34398a,
+ 0x239b43,
+ 0x325b8a,
+ 0x3b4086,
+ 0x264ecf,
+ 0x353689,
+ 0x2efb10,
+ 0x2dee88,
+ 0x2d0e89,
+ 0x29d087,
+ 0x24f68f,
+ 0x334604,
+ 0x2da984,
+ 0x21d386,
+ 0x2b3546,
+ 0x256dca,
+ 0x383586,
+ 0x32a787,
+ 0x3055c8,
+ 0x3057c7,
+ 0x306047,
+ 0x307a4a,
+ 0x309b4b,
+ 0x3a2445,
+ 0x2dd748,
+ 0x2166c3,
+ 0x3b120c,
+ 0x37140f,
+ 0x25b5cd,
+ 0x2c4607,
+ 0x313d89,
+ 0x217687,
+ 0x23e148,
+ 0x36eb0c,
+ 0x273608,
+ 0x258908,
+ 0x3188ce,
+ 0x32bad4,
+ 0x32bfe4,
+ 0x3424ca,
+ 0x35ea8b,
+ 0x243e44,
+ 0x243e49,
+ 0x21e9c8,
+ 0x24e105,
+ 0x25fc8a,
+ 0x239d87,
+ 0x2957c4,
+ 0x368883,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x20fbc3,
+ 0x201686,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0x204cc2,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x332ec3,
+ 0x204303,
+ 0x201686,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x204cc2,
+ 0x21fd43,
+ 0x20d1c2,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x20e542,
+ 0x20d882,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x209c02,
+ 0x201d42,
+ 0x2964c4,
+ 0x222044,
+ 0x223342,
+ 0x213184,
+ 0x200382,
+ 0x200383,
+ 0x21aa03,
+ 0x241f46,
+ 0x217082,
+ 0x2016c2,
+ 0x201a82,
+ 0x436111c3,
+ 0x43a014c3,
+ 0x59a86,
+ 0x59a86,
+ 0x24ae04,
+ 0x143768a,
+ 0x2608c,
+ 0x21ecc,
+ 0x852cd,
+ 0x2ac47,
+ 0x1a608,
+ 0x218c8,
+ 0x19834a,
+ 0x446db445,
+ 0x12b089,
+ 0x103008,
+ 0x8ed4a,
+ 0x14a60e,
+ 0x144b24b,
+ 0x1681c4,
+ 0x1672c8,
+ 0x13edc7,
+ 0x16f07,
+ 0x11dd09,
+ 0x1b3c47,
+ 0x94b88,
+ 0x61f49,
+ 0x4bfc5,
+ 0x12494e,
+ 0xafbcd,
+ 0xfb48,
+ 0x44a37046,
+ 0x45437048,
+ 0x79c88,
+ 0x117050,
+ 0x69c87,
+ 0x6cf47,
+ 0x71187,
+ 0x75f87,
+ 0xa9c2,
+ 0x62507,
+ 0x10c74c,
+ 0x3b9c7,
+ 0xa9f46,
+ 0xaa689,
+ 0xad708,
+ 0x18d82,
+ 0x1d42,
+ 0x24a0b,
+ 0x2ccc9,
+ 0x4c809,
+ 0x17de88,
+ 0xb5e02,
+ 0x104389,
+ 0xd2fca,
+ 0xdb9c9,
+ 0xdd048,
+ 0xddfc7,
+ 0xe0389,
+ 0xe4685,
+ 0xe4a90,
+ 0x1a8e86,
+ 0x63c85,
+ 0x4a84d,
+ 0x1b3806,
+ 0xee547,
+ 0xf39d8,
+ 0x96b88,
+ 0xba9ca,
+ 0x53b4d,
+ 0x1702,
+ 0x177ac6,
+ 0x91788,
+ 0x1ae208,
+ 0x15ef09,
+ 0x56608,
+ 0x5dece,
+ 0xd68d,
+ 0xf8805,
+ 0x62288,
+ 0x59688,
+ 0x6902,
+ 0x125886,
+ 0x6c82,
+ 0x3c1,
+ 0x8b4c3,
+ 0x44ef4244,
+ 0x4529a283,
0x141,
- 0x1650c6,
+ 0x15c06,
0x141,
0x1,
- 0x1650c6,
- 0x14f60c5,
- 0x245dc4,
- 0x22d183,
- 0x247344,
- 0x201604,
- 0x238483,
- 0x2245c5,
- 0x21ca03,
- 0x215cc3,
- 0x2e9cc5,
- 0x223ec3,
- 0x3fe2d183,
- 0x2343c3,
- 0x21eb03,
+ 0x15c06,
+ 0x8b4c3,
+ 0x14e4285,
+ 0x24fe44,
+ 0x2d0783,
+ 0x251304,
+ 0x2964c4,
+ 0x204ac3,
+ 0x222ac5,
+ 0x21bd03,
+ 0x2202c3,
+ 0x370145,
+ 0x24abc3,
+ 0x466d0783,
+ 0x231b83,
+ 0x332ec3,
0x200041,
- 0x211003,
- 0x307b04,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x880c8,
- 0x200882,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x200a82,
- 0x201604,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x223ec3,
- 0x880c8,
- 0x38bcc2,
- 0x16582,
- 0x1462d48,
- 0xf738e,
- 0x40e00142,
- 0x29e988,
- 0x227fc6,
- 0x2bb546,
- 0x227947,
- 0x41201102,
- 0x417566c8,
- 0x3af8ca,
- 0x2606c8,
- 0x201002,
- 0x29e609,
- 0x38e807,
- 0x21ac06,
- 0x201009,
- 0x254704,
- 0x2f5fc6,
- 0x2d5fc4,
- 0x273a04,
- 0x2563c9,
- 0x281786,
- 0x2e3d85,
- 0x220e45,
- 0x3a5287,
- 0x2b7cc7,
- 0x243884,
- 0x227b86,
- 0x39fac5,
- 0x202b05,
- 0x2f5905,
- 0x392547,
- 0x366785,
- 0x308bc9,
- 0x2808c5,
- 0x2d07c4,
- 0x39a387,
- 0x30584e,
- 0x30fc49,
- 0x322e89,
- 0x348986,
- 0x31e708,
- 0x2b024b,
- 0x2d210c,
- 0x25b946,
- 0x37cb07,
- 0x209805,
- 0x20f24a,
- 0x20a689,
- 0x252249,
- 0x293d86,
- 0x2ee6c5,
- 0x28b145,
- 0x361f09,
- 0x2f5a8b,
- 0x277606,
- 0x32e5c6,
- 0x20d2c4,
- 0x288bc6,
- 0x25f948,
- 0x203d06,
- 0x3a82c6,
- 0x208bc8,
- 0x2093c7,
- 0x209589,
- 0x20c445,
- 0x880c8,
- 0x378504,
- 0x229e04,
- 0x212d45,
- 0x395589,
- 0x223707,
- 0x22370b,
- 0x2255ca,
- 0x22b185,
- 0x41a0b602,
- 0x2173c7,
- 0x41e2c488,
- 0x2833c7,
- 0x281ac5,
- 0x32594a,
- 0x16582,
- 0x24b90b,
- 0x2adc4a,
- 0x2248c6,
- 0x3a31c3,
- 0x230dcd,
- 0x3320cc,
- 0x36210d,
- 0x3845c5,
- 0x237205,
- 0x24f147,
- 0x3a8e89,
- 0x3af7c6,
- 0x390245,
- 0x2ee3c8,
- 0x288ac3,
- 0x2e8108,
- 0x288ac8,
- 0x2bc507,
- 0x2e62c8,
- 0x3af3c9,
- 0x236107,
- 0x20ae07,
- 0x335048,
- 0x253384,
- 0x253387,
- 0x266a88,
- 0x205846,
- 0x3661cf,
- 0x215507,
- 0x2e3506,
- 0x25a405,
- 0x224f43,
- 0x372207,
- 0x36e143,
- 0x246506,
- 0x247f86,
- 0x249686,
- 0x28d1c5,
- 0x263e83,
- 0x3885c8,
- 0x370489,
- 0x38124b,
- 0x249808,
- 0x24c4c5,
- 0x24d4c5,
- 0x4223aa82,
- 0x37f509,
- 0x201687,
- 0x258b45,
- 0x2562c7,
- 0x257e06,
- 0x35eb05,
- 0x36f9cb,
- 0x259e44,
- 0x260285,
- 0x2603c7,
- 0x271986,
- 0x271fc5,
- 0x27dbc7,
- 0x27e647,
- 0x26db04,
- 0x2871ca,
- 0x287688,
- 0x3685c9,
- 0x3a65c5,
- 0x333386,
- 0x25fb0a,
- 0x220d46,
- 0x24bb47,
- 0x318a8d,
- 0x2273c9,
- 0x30ff45,
- 0x24ff87,
- 0x335608,
- 0x3675c8,
- 0x341b87,
- 0x34a486,
- 0x2116c7,
- 0x247883,
- 0x337ec4,
- 0x35c385,
- 0x38cac7,
- 0x391f49,
- 0x21a6c8,
- 0x22fd05,
- 0x382a04,
- 0x240e85,
- 0x2448cd,
- 0x201142,
- 0x3006c6,
- 0x3610c6,
- 0x2bde4a,
- 0x3791c6,
- 0x37fc45,
- 0x319285,
- 0x319287,
- 0x38b14c,
- 0x26fb8a,
- 0x288886,
- 0x29e445,
- 0x288a06,
+ 0x20fbc3,
+ 0x222044,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x15f048,
+ 0x204cc2,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x201d42,
+ 0x2964c4,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x24abc3,
+ 0x15f048,
+ 0x371182,
+ 0xd1c2,
+ 0x1491b48,
+ 0x10598e,
+ 0x47608c42,
+ 0x32f9c8,
+ 0x233d86,
+ 0x210186,
+ 0x233707,
+ 0x47a00902,
+ 0x47f53508,
+ 0x20ebca,
+ 0x269708,
+ 0x201442,
+ 0x32f649,
+ 0x3a2487,
+ 0x218486,
+ 0x295ec9,
+ 0x247ec4,
+ 0x2e4186,
+ 0x2e1bc4,
+ 0x26bdc4,
+ 0x25bf49,
+ 0x326286,
+ 0x24df85,
+ 0x291285,
+ 0x390387,
+ 0x2c3747,
+ 0x2911c4,
+ 0x233946,
+ 0x2ffb45,
+ 0x367445,
+ 0x302505,
+ 0x392307,
+ 0x26ae05,
+ 0x315e49,
+ 0x32d305,
+ 0x307184,
+ 0x38d347,
+ 0x32ecce,
+ 0x330a09,
+ 0x358849,
+ 0x3ac9c6,
+ 0x2fe248,
+ 0x2b520b,
+ 0x2e3b0c,
+ 0x2898c6,
+ 0x2076c7,
+ 0x37b305,
+ 0x32d98a,
+ 0x237a09,
+ 0x3aa989,
+ 0x257646,
+ 0x2fb805,
+ 0x2aabc5,
+ 0x348f89,
+ 0x30268b,
+ 0x280f46,
+ 0x338346,
+ 0x20a904,
+ 0x2908c6,
+ 0x226a08,
+ 0x3abc06,
+ 0x20c5c6,
+ 0x206188,
+ 0x207f47,
+ 0x208649,
+ 0x209705,
+ 0x15f048,
+ 0x216e84,
+ 0x33d5c4,
+ 0x369f05,
+ 0x204f49,
+ 0x222347,
+ 0x22234b,
+ 0x223e4a,
+ 0x228485,
+ 0x4820a002,
+ 0x238987,
+ 0x48629248,
+ 0x27be07,
+ 0x2bf945,
+ 0x3aac0a,
+ 0xd1c2,
+ 0x38740b,
+ 0x25470a,
+ 0x222dc6,
+ 0x395e03,
+ 0x29538d,
+ 0x3582cc,
+ 0x37f24d,
+ 0x381085,
+ 0x227dc5,
+ 0x2601c7,
+ 0x209c09,
+ 0x20eac6,
+ 0x383405,
+ 0x2d8008,
+ 0x2907c3,
+ 0x2ec708,
+ 0x2907c8,
+ 0x2c6c47,
+ 0x3b2448,
+ 0x39b7c9,
+ 0x2c9747,
+ 0x238187,
+ 0x302b88,
+ 0x38ca44,
+ 0x38ca47,
+ 0x272648,
+ 0x2024c6,
+ 0x206fcf,
+ 0x2118c7,
+ 0x2e7a86,
+ 0x23e2c5,
+ 0x223783,
+ 0x365a47,
+ 0x36da03,
+ 0x250446,
+ 0x251c46,
+ 0x252a06,
+ 0x296e85,
+ 0x26ea03,
+ 0x388a48,
+ 0x370c89,
+ 0x37ffcb,
+ 0x252b88,
+ 0x254285,
+ 0x256405,
+ 0x48aabc02,
+ 0x359a49,
+ 0x296547,
+ 0x25f185,
+ 0x25be47,
+ 0x25dd86,
+ 0x363f05,
+ 0x36fe0b,
+ 0x2640c4,
+ 0x2692c5,
+ 0x269407,
+ 0x27b786,
+ 0x27bbc5,
+ 0x288487,
0x288d47,
- 0x28a9c6,
- 0x28d0cc,
- 0x201149,
- 0x42765547,
- 0x290305,
- 0x290306,
- 0x2906c8,
- 0x2b1f05,
- 0x2a4805,
- 0x2a4a48,
- 0x2a4c4a,
- 0x42a6a242,
- 0x42e0ff82,
- 0x382245,
- 0x29cdc3,
- 0x37a688,
- 0x21d083,
- 0x2a4ec4,
- 0x23de4b,
- 0x272408,
- 0x2d77c8,
- 0x433255c9,
- 0x2a8949,
- 0x2a9006,
- 0x2aa5c8,
- 0x2aa7c9,
- 0x2ab386,
- 0x2ab505,
- 0x383086,
- 0x2abc09,
- 0x2802c7,
- 0x243f06,
- 0x235c47,
- 0x3af647,
- 0x33b504,
- 0x43743909,
- 0x2c2288,
- 0x3565c8,
- 0x2368c7,
- 0x2bd906,
- 0x2fe209,
- 0x331f47,
- 0x2f1b0a,
- 0x376848,
- 0x3237c7,
- 0x326086,
- 0x33aa0a,
- 0x249fc8,
- 0x28ab05,
- 0x21bf85,
- 0x2bcb87,
- 0x2d26c9,
- 0x2d6e0b,
- 0x2dd8c8,
- 0x280949,
- 0x249b07,
- 0x3ad20c,
- 0x2b1acc,
- 0x2b1dca,
- 0x2b204c,
- 0x2bb4c8,
- 0x2bb6c8,
- 0x2bb8c4,
- 0x2bbc89,
- 0x2bbec9,
- 0x2bc10a,
- 0x2bc389,
- 0x2bc6c7,
- 0x20010c,
- 0x36ef86,
- 0x26de48,
- 0x220e06,
- 0x387346,
- 0x30fe47,
- 0x341d08,
- 0x25180b,
- 0x283287,
- 0x2aeb49,
- 0x2474c9,
- 0x255f87,
- 0x2d6204,
- 0x35efc7,
- 0x29f606,
- 0x219006,
- 0x38d985,
- 0x2ccd88,
- 0x20ef04,
- 0x20ef06,
- 0x26fa4b,
- 0x2a2389,
- 0x364086,
- 0x3a8409,
- 0x3926c6,
- 0x2fec08,
- 0x214803,
- 0x2083c5,
- 0x219149,
- 0x21fe05,
- 0x3a6084,
- 0x270fc6,
- 0x3a5a85,
- 0x2e6846,
- 0x2fbc07,
- 0x367186,
- 0x2952cb,
- 0x2b0647,
- 0x2d2586,
- 0x374346,
- 0x3a5346,
- 0x243849,
- 0x26238a,
- 0x2b6045,
- 0x21f68d,
- 0x2a4d46,
- 0x391246,
- 0x2e21c6,
- 0x210205,
- 0x2d3007,
- 0x2962c7,
- 0x23b68e,
- 0x211003,
- 0x2bd8c9,
- 0x318fc9,
- 0x20f647,
- 0x276b87,
- 0x299d85,
- 0x306f45,
- 0x43a7eacf,
- 0x2c4807,
- 0x2c49c8,
- 0x2c5a44,
- 0x2c5d06,
- 0x43e43b02,
- 0x2ca1c6,
- 0x2cc5c6,
- 0x251b4e,
- 0x2e7f4a,
- 0x21cd06,
- 0x33fcca,
- 0x3b4089,
- 0x316fc5,
- 0x393b48,
- 0x3ad0c6,
- 0x34ab88,
- 0x30f788,
- 0x25ab8b,
- 0x227a45,
- 0x366808,
- 0x208d0c,
- 0x281987,
- 0x248b06,
- 0x22f108,
- 0x201948,
- 0x44208382,
- 0x362b0b,
- 0x280bc9,
- 0x363e89,
- 0x209987,
- 0x30e688,
- 0x4460c648,
- 0x3a8c0b,
- 0x22b6c9,
- 0x20870d,
- 0x217e88,
- 0x22c288,
- 0x44a02282,
- 0x31d784,
- 0x44e23b42,
- 0x2ebc06,
- 0x452016c2,
- 0x3a180a,
- 0x201fc6,
- 0x225f08,
- 0x31ea08,
- 0x2b7546,
- 0x386986,
- 0x2e6606,
- 0x2a00c5,
- 0x23b184,
- 0x456feb84,
- 0x338986,
- 0x269047,
- 0x45a2ab47,
- 0x32be0b,
- 0x305c09,
- 0x23724a,
- 0x251404,
- 0x3193c8,
- 0x243ccd,
- 0x2e07c9,
- 0x2e0a08,
- 0x2e1149,
- 0x2e26c4,
- 0x200f04,
- 0x269885,
- 0x30b48b,
- 0x272386,
- 0x3387c5,
- 0x281c49,
- 0x227c48,
- 0x29ca84,
- 0x20f3c9,
- 0x2b0585,
- 0x2b7d08,
- 0x20b4c7,
- 0x323288,
- 0x27a506,
- 0x217287,
- 0x28eb89,
- 0x21c209,
- 0x2460c5,
- 0x231445,
- 0x45e25242,
- 0x39a144,
- 0x2fd585,
- 0x2a9746,
- 0x2f89c5,
- 0x268307,
- 0x243405,
- 0x243484,
- 0x348a46,
- 0x3902c7,
- 0x243b46,
- 0x325dc5,
- 0x31d488,
- 0x2281c5,
- 0x332607,
- 0x397409,
- 0x2a24ca,
- 0x22dac7,
- 0x22dacc,
- 0x2e3d46,
- 0x226349,
- 0x2ad585,
- 0x2c6e08,
- 0x211543,
- 0x211545,
- 0x2e9405,
- 0x256cc7,
- 0x46214f02,
- 0x236e47,
- 0x2d6786,
- 0x343846,
- 0x2e8cc6,
- 0x201886,
- 0x347e88,
- 0x3583c5,
- 0x2e35c7,
- 0x2e35cd,
- 0x202b43,
- 0x3a35c5,
- 0x3068c7,
- 0x3864c8,
- 0x386085,
- 0x366c88,
- 0x22a946,
- 0x31f507,
- 0x2bcf05,
- 0x227ac6,
- 0x3711c5,
- 0x2ba40a,
- 0x2eb1c6,
- 0x236487,
- 0x2c5bc5,
- 0x35a387,
- 0x35e244,
- 0x3a6006,
- 0x2f61c5,
- 0x28158b,
- 0x29f489,
- 0x37a20a,
- 0x246148,
- 0x2ff148,
- 0x300a4c,
- 0x3047c7,
- 0x32b388,
- 0x32edc8,
- 0x336085,
- 0x2bc94a,
- 0x35d109,
- 0x46601082,
- 0x205446,
- 0x214684,
- 0x3b1249,
- 0x2220c9,
- 0x24d307,
- 0x26c307,
- 0x358d09,
- 0x210408,
- 0x21040f,
- 0x3477c6,
- 0x20a0cb,
- 0x2e9b05,
- 0x2e9b07,
- 0x2e9f49,
- 0x20f346,
- 0x20f347,
- 0x3b3d85,
- 0x232784,
- 0x2633c6,
- 0x201284,
- 0x30ac07,
- 0x345e08,
- 0x46aee5c8,
- 0x2eebc5,
- 0x2eed07,
- 0x238289,
- 0x2740c4,
- 0x3a3888,
- 0x46f20b88,
- 0x2c4204,
- 0x2330c8,
- 0x31d904,
- 0x21f989,
- 0x2230c5,
- 0x47203e42,
- 0x347805,
- 0x220c85,
- 0x29fc88,
- 0x235347,
- 0x47600cc2,
- 0x2c81c5,
- 0x246b46,
- 0x256646,
- 0x39a108,
- 0x2ec008,
- 0x2f8986,
- 0x31b086,
- 0x22a489,
- 0x343786,
- 0x37870b,
- 0x30c145,
- 0x20d7c6,
- 0x390088,
- 0x252606,
- 0x28f506,
- 0x21c64a,
- 0x2ae4ca,
- 0x24ce85,
- 0x358487,
- 0x2d8e06,
- 0x47a03dc2,
- 0x306a07,
- 0x2c7a45,
- 0x25fa84,
- 0x25fa85,
- 0x251306,
- 0x270447,
- 0x2144c5,
- 0x222184,
- 0x2712c8,
- 0x28f5c5,
- 0x2cebc7,
- 0x39c105,
- 0x216805,
- 0x247b04,
- 0x28cbc9,
- 0x39f908,
- 0x2f5ec6,
- 0x36fcc6,
- 0x2c3f06,
- 0x47ef3648,
- 0x2f3847,
- 0x2f3fcd,
- 0x2f460c,
- 0x2f4c09,
- 0x2f4e49,
- 0x48351e02,
- 0x3a4803,
- 0x24cf03,
- 0x29f6c5,
- 0x38cbca,
- 0x31af46,
- 0x2f8e05,
- 0x2fc144,
- 0x2fc14b,
- 0x30d10c,
- 0x30d94c,
- 0x30dc55,
- 0x311acd,
- 0x313a0f,
- 0x313dd2,
- 0x31424f,
- 0x314612,
- 0x314a93,
- 0x314f4d,
- 0x31550d,
- 0x31588e,
- 0x315d4e,
- 0x31658c,
- 0x31694c,
- 0x316d8b,
- 0x31710e,
- 0x31a1d2,
- 0x31ad0c,
- 0x31b8d0,
- 0x327e52,
- 0x328dcc,
- 0x32948d,
- 0x3297cc,
- 0x32d8d1,
- 0x32e74d,
- 0x336b0d,
- 0x33710a,
- 0x33738c,
- 0x337c8c,
- 0x3384cc,
- 0x338d4c,
- 0x33c9d3,
- 0x33d050,
- 0x33d450,
- 0x33dccd,
- 0x33e2cc,
- 0x33efc9,
- 0x3402cd,
- 0x340613,
- 0x342e51,
- 0x343293,
- 0x343b4f,
- 0x343f0c,
- 0x34420f,
- 0x3445cd,
- 0x344bcf,
- 0x344f90,
- 0x345a0e,
- 0x34b48e,
- 0x34bbd0,
- 0x34c7cd,
- 0x34d14e,
- 0x34d4cc,
- 0x34e493,
- 0x34fc8e,
- 0x3503d0,
- 0x3507d1,
- 0x350c0f,
- 0x350fd3,
- 0x35198d,
- 0x351ccf,
- 0x35208e,
- 0x352990,
- 0x352d89,
- 0x3539d0,
- 0x35400f,
- 0x35468f,
- 0x354a52,
- 0x355ece,
- 0x35788d,
- 0x35998d,
- 0x359ccd,
- 0x35ac4d,
- 0x35af8d,
- 0x35b2d0,
- 0x35b6cb,
- 0x35c14c,
- 0x35c4cc,
- 0x35c7cc,
- 0x35cace,
- 0x372990,
- 0x3744d2,
- 0x37494b,
- 0x3750ce,
- 0x37544e,
- 0x375cce,
- 0x37728b,
- 0x48777856,
- 0x378ecd,
- 0x379354,
- 0x37a98d,
- 0x37c655,
- 0x37d78d,
- 0x37e10f,
- 0x37e94f,
- 0x38150f,
- 0x3818ce,
- 0x382b0d,
- 0x384151,
- 0x386b0c,
- 0x386e0c,
- 0x38710b,
- 0x387a0c,
- 0x387dcf,
- 0x388192,
- 0x388b4d,
- 0x389b0c,
+ 0x2d1784,
+ 0x28e04a,
+ 0x28e508,
+ 0x2c2149,
+ 0x3648c5,
+ 0x2951c6,
+ 0x226bca,
+ 0x387646,
+ 0x26f5c7,
+ 0x2c1e0d,
+ 0x2a1f09,
+ 0x3597c5,
+ 0x339dc7,
+ 0x368388,
+ 0x26a888,
+ 0x314d07,
+ 0x20b246,
+ 0x217807,
+ 0x221143,
+ 0x33c004,
+ 0x3607c5,
+ 0x38dcc7,
+ 0x391d09,
+ 0x22a8c8,
+ 0x33fac5,
+ 0x242844,
+ 0x2f5bc5,
+ 0x38174d,
+ 0x203742,
+ 0x386ac6,
+ 0x377a06,
+ 0x2c8bca,
+ 0x37e686,
+ 0x38b5c5,
+ 0x368fc5,
+ 0x368fc7,
+ 0x3a010c,
+ 0x279b0a,
+ 0x290586,
+ 0x225085,
+ 0x290706,
+ 0x290a47,
+ 0x292846,
+ 0x296d8c,
+ 0x296009,
+ 0x48e16087,
+ 0x299745,
+ 0x299746,
+ 0x299d08,
+ 0x236785,
+ 0x2a8b45,
+ 0x2a9548,
+ 0x2a974a,
+ 0x49258142,
+ 0x4960c2c2,
+ 0x2e8f85,
+ 0x28b9c3,
+ 0x22b108,
+ 0x241d03,
+ 0x2a99c4,
+ 0x2f350b,
+ 0x34ef48,
+ 0x305148,
+ 0x49b67ec9,
+ 0x2af389,
+ 0x2afac6,
+ 0x2b0a88,
+ 0x2b0c89,
+ 0x2b1786,
+ 0x2b1905,
+ 0x372a86,
+ 0x2b1e49,
+ 0x319d87,
+ 0x25c446,
+ 0x233147,
+ 0x20e947,
+ 0x362e04,
+ 0x49f453c9,
+ 0x2cd008,
+ 0x353408,
+ 0x383d07,
+ 0x2c8686,
+ 0x235389,
+ 0x210147,
+ 0x34970a,
+ 0x330d48,
+ 0x349407,
+ 0x3b1546,
+ 0x2e834a,
+ 0x2733c8,
+ 0x30de45,
+ 0x36dac5,
+ 0x2f9807,
+ 0x371d49,
+ 0x3097cb,
+ 0x31e0c8,
+ 0x32d389,
+ 0x253487,
+ 0x2bad4c,
+ 0x2bb74c,
+ 0x2bba4a,
+ 0x2bbccc,
+ 0x2c5c08,
+ 0x2c5e08,
+ 0x2c6004,
+ 0x2c63c9,
+ 0x2c6609,
+ 0x2c684a,
+ 0x2c6ac9,
+ 0x2c6e07,
+ 0x3a448c,
+ 0x24b946,
+ 0x35d588,
+ 0x387706,
+ 0x330c06,
+ 0x3596c7,
+ 0x238ec8,
+ 0x2618cb,
+ 0x303207,
+ 0x359c49,
+ 0x251489,
+ 0x25bbc7,
+ 0x2e1e04,
+ 0x3643c7,
+ 0x2e1246,
+ 0x214046,
+ 0x2eb045,
+ 0x2c7408,
+ 0x2976c4,
+ 0x2976c6,
+ 0x2799cb,
+ 0x212cc9,
+ 0x209e06,
+ 0x20c709,
+ 0x392486,
+ 0x3aae08,
+ 0x214183,
+ 0x2fb985,
+ 0x215a09,
+ 0x224085,
+ 0x2f9644,
+ 0x27acc6,
+ 0x2ed005,
+ 0x2f7346,
+ 0x309ec7,
+ 0x328dc6,
+ 0x3a174b,
+ 0x22c447,
+ 0x234886,
+ 0x3742c6,
+ 0x390446,
+ 0x291189,
+ 0x240aca,
+ 0x2b8ec5,
+ 0x21898d,
+ 0x2a9846,
+ 0x2babc6,
+ 0x2ded86,
+ 0x2f31c5,
+ 0x2e4d87,
+ 0x29fa87,
+ 0x22bd4e,
+ 0x20fbc3,
+ 0x2c8649,
+ 0x263709,
+ 0x32dd87,
+ 0x2804c7,
+ 0x2a2ec5,
+ 0x343f05,
+ 0x4a23734f,
+ 0x2d10c7,
+ 0x2d1288,
+ 0x2d25c4,
+ 0x2d2e86,
+ 0x4a64db02,
+ 0x2d7346,
+ 0x201686,
+ 0x2638ce,
+ 0x2ec54a,
+ 0x28b6c6,
+ 0x22d88a,
+ 0x209a09,
+ 0x323d05,
+ 0x393948,
+ 0x3aef46,
+ 0x359508,
+ 0x2392c8,
+ 0x34434b,
+ 0x233805,
+ 0x26ae88,
+ 0x2062cc,
+ 0x2bf807,
+ 0x252546,
+ 0x281fc8,
+ 0x2253c8,
+ 0x4aa09282,
+ 0x25604b,
+ 0x37b489,
+ 0x2cf2c9,
+ 0x2f02c7,
+ 0x3b3648,
+ 0x4ae289c8,
+ 0x20e64b,
+ 0x37dd09,
+ 0x33f58d,
+ 0x27d648,
+ 0x290188,
+ 0x4b201882,
+ 0x3b2f44,
+ 0x4b60dc42,
+ 0x2f9486,
+ 0x4ba038c2,
+ 0x2448ca,
+ 0x210546,
+ 0x22d208,
+ 0x289e88,
+ 0x2e4086,
+ 0x2eb5c6,
+ 0x2f7106,
+ 0x2f1b45,
+ 0x23c804,
+ 0x4be1de04,
+ 0x20ae86,
+ 0x29a787,
+ 0x4c2f7d07,
+ 0x2dc60b,
+ 0x32f089,
+ 0x227e0a,
+ 0x263144,
+ 0x369108,
+ 0x25c20d,
+ 0x2f1509,
+ 0x2f1748,
+ 0x2f2009,
+ 0x2f39c4,
+ 0x20ce44,
+ 0x283cc5,
+ 0x317b0b,
+ 0x34eec6,
+ 0x33c645,
+ 0x21fb89,
+ 0x233a08,
+ 0x263844,
+ 0x32db09,
+ 0x208f45,
+ 0x2c3788,
+ 0x238847,
+ 0x358c48,
+ 0x284e86,
+ 0x22b987,
+ 0x2984c9,
+ 0x311a89,
+ 0x372545,
+ 0x295645,
+ 0x4c626a82,
+ 0x306f44,
+ 0x30ce05,
+ 0x2c1846,
+ 0x327285,
+ 0x2b4707,
+ 0x20af85,
+ 0x27b7c4,
+ 0x3aca86,
+ 0x383487,
+ 0x232106,
+ 0x21e105,
+ 0x202608,
+ 0x233f85,
+ 0x205d07,
+ 0x20bc49,
+ 0x212e0a,
+ 0x2494c7,
+ 0x2494cc,
+ 0x24df46,
+ 0x2e9ac9,
+ 0x230505,
+ 0x2366c8,
+ 0x210c03,
+ 0x210c05,
+ 0x2f7b45,
+ 0x26e707,
+ 0x4ca27202,
+ 0x227a07,
+ 0x2e5206,
+ 0x345306,
+ 0x2e62c6,
+ 0x225306,
+ 0x2091c8,
+ 0x35b805,
+ 0x2e7b47,
+ 0x2e7b4d,
+ 0x21b083,
+ 0x21f305,
+ 0x21b087,
+ 0x26b308,
+ 0x21ac45,
+ 0x2281c8,
+ 0x2ab9c6,
+ 0x32b247,
+ 0x2c7bc5,
+ 0x233886,
+ 0x2cfac5,
+ 0x22dfca,
+ 0x2efec6,
+ 0x25dbc7,
+ 0x2bc605,
+ 0x2f44c7,
+ 0x2f8904,
+ 0x2f95c6,
+ 0x3624c5,
+ 0x32608b,
+ 0x2e10c9,
+ 0x23d74a,
+ 0x3725c8,
+ 0x3007c8,
+ 0x300f0c,
+ 0x306b47,
+ 0x308c48,
+ 0x30aa88,
+ 0x30dac5,
+ 0x338b4a,
+ 0x33aa09,
+ 0x4ce00202,
+ 0x200206,
+ 0x20d684,
+ 0x2ef889,
+ 0x275d49,
+ 0x27b1c7,
+ 0x2fa547,
+ 0x2b7c09,
+ 0x331308,
+ 0x33130f,
+ 0x2dfa86,
+ 0x2db10b,
+ 0x361545,
+ 0x361547,
+ 0x374c89,
+ 0x2171c6,
+ 0x32da87,
+ 0x2dde85,
+ 0x22f544,
+ 0x26e186,
+ 0x211984,
+ 0x2e6c47,
+ 0x34c5c8,
+ 0x4d2fb708,
+ 0x2fbe85,
+ 0x2fbfc7,
+ 0x245709,
+ 0x208444,
+ 0x208448,
+ 0x4d7190c8,
+ 0x23cdc4,
+ 0x230c88,
+ 0x3396c4,
+ 0x220389,
+ 0x333105,
+ 0x4da05bc2,
+ 0x2dfac5,
+ 0x2e6845,
+ 0x271b88,
+ 0x232847,
+ 0x4de03382,
+ 0x30cbc5,
+ 0x2d4e86,
+ 0x27a786,
+ 0x306f08,
+ 0x318308,
+ 0x327246,
+ 0x32e246,
+ 0x249009,
+ 0x345246,
+ 0x21708b,
+ 0x2a12c5,
+ 0x204686,
+ 0x382588,
+ 0x3152c6,
+ 0x298e46,
+ 0x21b94a,
+ 0x22f9ca,
+ 0x2e8245,
+ 0x35b8c7,
+ 0x2f0cc6,
+ 0x4e206602,
+ 0x21b1c7,
+ 0x2a9085,
+ 0x226b44,
+ 0x226b45,
+ 0x263046,
+ 0x27a447,
+ 0x20d405,
+ 0x22fb44,
+ 0x365008,
+ 0x298f05,
+ 0x33c8c7,
+ 0x39fa85,
+ 0x22df05,
+ 0x256b44,
+ 0x28fbc9,
+ 0x2ff988,
+ 0x2ecec6,
+ 0x2de9c6,
+ 0x2b9d46,
+ 0x4e700448,
+ 0x300647,
+ 0x3009cd,
+ 0x30120c,
+ 0x301809,
+ 0x301a49,
+ 0x4eb546c2,
+ 0x3a5503,
+ 0x20b303,
+ 0x2e1305,
+ 0x38ddca,
+ 0x327106,
+ 0x307905,
+ 0x30a084,
+ 0x30a08b,
+ 0x31bdcc,
+ 0x31c5cc,
+ 0x31c8d5,
+ 0x31d74d,
+ 0x31f44f,
+ 0x31f812,
+ 0x31fc8f,
+ 0x320052,
+ 0x3204d3,
+ 0x32098d,
+ 0x320f4d,
+ 0x3212ce,
+ 0x322a8e,
+ 0x3232cc,
+ 0x32368c,
+ 0x323acb,
+ 0x323e4e,
+ 0x324f92,
+ 0x326ecc,
+ 0x327610,
+ 0x3335d2,
+ 0x3347cc,
+ 0x334e8d,
+ 0x3351cc,
+ 0x337611,
+ 0x3384cd,
+ 0x33ac4d,
+ 0x33b24a,
+ 0x33b4cc,
+ 0x33bdcc,
+ 0x33c34c,
+ 0x33cbcc,
+ 0x33fc53,
+ 0x340450,
+ 0x340850,
+ 0x340e4d,
+ 0x34144c,
+ 0x342209,
+ 0x342f0d,
+ 0x343253,
+ 0x344911,
+ 0x344d53,
+ 0x34560f,
+ 0x3459cc,
+ 0x345ccf,
+ 0x34608d,
+ 0x34668f,
+ 0x346a50,
+ 0x3474ce,
+ 0x34ac8e,
+ 0x34b590,
+ 0x34ca8d,
+ 0x34d40e,
+ 0x34d78c,
+ 0x34e753,
+ 0x351e0e,
+ 0x352390,
+ 0x352791,
+ 0x352bcf,
+ 0x352f93,
+ 0x35424d,
+ 0x35458f,
+ 0x35494e,
+ 0x354fd0,
+ 0x3553c9,
+ 0x356390,
+ 0x356acf,
+ 0x35714f,
+ 0x357512,
+ 0x359e8e,
+ 0x35a74d,
+ 0x35cc4d,
+ 0x35cf8d,
+ 0x35f68d,
+ 0x35f9cd,
+ 0x35fd10,
+ 0x36010b,
+ 0x36058c,
+ 0x36090c,
+ 0x360c0c,
+ 0x360f0e,
+ 0x372c10,
+ 0x374452,
+ 0x3748cb,
+ 0x374ece,
+ 0x37524e,
+ 0x375ace,
+ 0x37604b,
+ 0x4ef76396,
+ 0x37724d,
+ 0x378354,
+ 0x378e0d,
+ 0x37ae55,
+ 0x37c04d,
+ 0x37c9cf,
+ 0x37d20f,
+ 0x38028f,
+ 0x38064e,
+ 0x380acd,
+ 0x382f11,
+ 0x385ecc,
+ 0x3861cc,
+ 0x3864cb,
+ 0x386c4c,
+ 0x38824f,
+ 0x388612,
+ 0x388fcd,
0x389f8c,
- 0x38a28d,
- 0x38a5cf,
- 0x38a98e,
- 0x38c88c,
- 0x38ce4d,
- 0x38d18b,
- 0x38e9cc,
- 0x38ef4d,
- 0x38f28e,
- 0x38f709,
- 0x3909d3,
- 0x3913cd,
- 0x39170d,
- 0x391d0c,
- 0x39218e,
- 0x392b0f,
- 0x392ecc,
- 0x3931cd,
- 0x39350f,
- 0x3938cc,
- 0x393fcc,
- 0x39444c,
- 0x39474c,
- 0x394e0d,
- 0x395152,
- 0x3957cc,
- 0x395acc,
- 0x395dd1,
- 0x39620f,
- 0x3965cf,
- 0x396993,
- 0x39764e,
- 0x397bcf,
- 0x397f8c,
- 0x48b982ce,
- 0x39864f,
- 0x398a16,
- 0x399c12,
- 0x39b88c,
- 0x39c24f,
- 0x39c8cd,
- 0x39cc0f,
- 0x39cfcc,
- 0x39d2cd,
- 0x39d60d,
- 0x39f4ce,
- 0x3a058c,
- 0x3a088c,
- 0x3a0b90,
- 0x3a3a91,
- 0x3a3ecb,
- 0x3a440c,
- 0x3a470e,
+ 0x38a40c,
+ 0x38a70d,
+ 0x38aa4f,
+ 0x38ae0e,
+ 0x38da8c,
+ 0x38e04d,
+ 0x38e38b,
+ 0x38ee8c,
+ 0x38f40d,
+ 0x38f74e,
+ 0x38fac9,
+ 0x390c53,
+ 0x39118d,
+ 0x3914cd,
+ 0x391acc,
+ 0x391f4e,
+ 0x39290f,
+ 0x392ccc,
+ 0x392fcd,
+ 0x39330f,
+ 0x3936cc,
+ 0x3943cc,
+ 0x39484c,
+ 0x394b4c,
+ 0x39520d,
+ 0x395552,
+ 0x396c0c,
+ 0x396f0c,
+ 0x397211,
+ 0x39764f,
+ 0x397a0f,
+ 0x397dd3,
+ 0x398a8e,
+ 0x398e0f,
+ 0x3991cc,
+ 0x4f39950e,
+ 0x39988f,
+ 0x399c56,
+ 0x39b312,
+ 0x39d64c,
+ 0x39e14f,
+ 0x39e7cd,
+ 0x39eb0f,
+ 0x39eecc,
+ 0x39f1cd,
+ 0x39f50d,
+ 0x3a0c4e,
+ 0x3a2b8c,
+ 0x3a2e8c,
+ 0x3a3190,
+ 0x3a4991,
+ 0x3a4dcb,
+ 0x3a510c,
+ 0x3a540e,
0x3a7051,
0x3a748e,
0x3a780d,
- 0x3ace8b,
- 0x3adbcf,
- 0x3aee94,
- 0x21c2c2,
- 0x21c2c2,
- 0x205903,
- 0x21c2c2,
- 0x205903,
- 0x21c2c2,
- 0x205e02,
- 0x3830c5,
+ 0x3aed0b,
+ 0x3afdcf,
+ 0x3b09d4,
+ 0x2630c2,
+ 0x2630c2,
+ 0x202583,
+ 0x2630c2,
+ 0x202583,
+ 0x2630c2,
+ 0x20ae82,
+ 0x372ac5,
0x3a6d4c,
- 0x21c2c2,
- 0x21c2c2,
- 0x205e02,
- 0x21c2c2,
- 0x290d45,
- 0x2a24c5,
- 0x21c2c2,
- 0x21c2c2,
- 0x211d42,
- 0x290d45,
- 0x312d49,
- 0x342b4c,
- 0x21c2c2,
- 0x21c2c2,
- 0x21c2c2,
- 0x21c2c2,
- 0x3830c5,
- 0x21c2c2,
- 0x21c2c2,
- 0x21c2c2,
- 0x21c2c2,
- 0x211d42,
- 0x312d49,
- 0x21c2c2,
- 0x21c2c2,
- 0x21c2c2,
- 0x2a24c5,
- 0x21c2c2,
- 0x2a24c5,
- 0x342b4c,
+ 0x2630c2,
+ 0x2630c2,
+ 0x20ae82,
+ 0x2630c2,
+ 0x29a385,
+ 0x212e05,
+ 0x2630c2,
+ 0x2630c2,
+ 0x211cc2,
+ 0x29a385,
+ 0x31e789,
+ 0x34460c,
+ 0x2630c2,
+ 0x2630c2,
+ 0x2630c2,
+ 0x2630c2,
+ 0x372ac5,
+ 0x2630c2,
+ 0x2630c2,
+ 0x2630c2,
+ 0x2630c2,
+ 0x211cc2,
+ 0x31e789,
+ 0x2630c2,
+ 0x2630c2,
+ 0x2630c2,
+ 0x212e05,
+ 0x2630c2,
+ 0x212e05,
+ 0x34460c,
0x3a6d4c,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x238483,
- 0x2264c3,
- 0x141388,
- 0x4db44,
- 0xed208,
- 0x200882,
- 0x49a16582,
- 0x240003,
- 0x22b944,
- 0x208f43,
- 0x21eb04,
- 0x231ac6,
- 0x31d243,
- 0x34aa44,
- 0x26cc05,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x24690a,
- 0x3a5946,
- 0x3757cc,
- 0x880c8,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x2348c3,
- 0x2cc5c6,
- 0x238483,
- 0x2264c3,
- 0x21bd03,
- 0xd42,
- 0xdb7c7,
- 0xca908,
- 0xfd8e,
- 0x85792,
- 0x2ecb,
- 0x4a71f345,
- 0x4ab76d0c,
- 0x131007,
- 0x16e747,
- 0x119b8a,
- 0x3c550,
- 0x2988,
- 0x16e847,
- 0xae14b,
- 0x112089,
- 0x173507,
- 0x10ec87,
- 0x77847,
- 0x169c6,
- 0x132d48,
- 0x4b01e1c6,
- 0xa910d,
- 0x119550,
- 0x4b400d82,
- 0x131948,
- 0x680c7,
- 0x84109,
- 0x53e06,
- 0x908c8,
- 0x5e82,
- 0x9c34a,
- 0x8e507,
- 0xeaec7,
- 0xa5449,
- 0xa7188,
- 0x157f45,
- 0xe168e,
- 0xe9ce,
- 0x14c4f,
- 0x15309,
- 0x33c49,
- 0x6528b,
- 0x7cdcf,
- 0x8cdcc,
- 0xdcbcb,
- 0xd99c8,
- 0x12bd07,
- 0xede48,
- 0x11e50b,
- 0x13e94c,
- 0x14624c,
- 0x14f98c,
- 0x1524cd,
- 0x2b848,
- 0x30cc2,
- 0x1afb89,
- 0x14c24b,
- 0xbdb06,
- 0xce6c5,
- 0xd2d10,
- 0x1229c6,
- 0x51f05,
- 0xd6908,
- 0xdc047,
- 0xdc307,
- 0x163287,
- 0xeba4a,
- 0xca78a,
- 0x161186,
- 0x8db8d,
- 0x180248,
- 0x45e88,
- 0x47a49,
- 0xeb58c,
- 0x1526cb,
- 0x171ac4,
- 0xf3109,
- 0x44bc6,
- 0x6202,
- 0x155646,
- 0xfefc7,
- 0x6c2,
- 0xc0e85,
- 0x481,
- 0x3b583,
- 0x4af9eb86,
- 0x90c43,
- 0x1f82,
- 0x3a4c4,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204ac3,
+ 0x200383,
+ 0x1f08,
+ 0x15444,
+ 0xc1348,
+ 0x204cc2,
+ 0x5020d1c2,
+ 0x243403,
+ 0x24c944,
+ 0x202743,
+ 0x38e8c4,
+ 0x22e886,
+ 0x213843,
+ 0x31aa84,
+ 0x288845,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x25084a,
+ 0x241f46,
+ 0x3755cc,
+ 0x15f048,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x22d603,
+ 0x201686,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0xaa288,
+ 0x3942,
+ 0x513856c5,
+ 0x2ac47,
+ 0xd7a88,
+ 0xc0ce,
+ 0x8c792,
+ 0x16780b,
+ 0x516db445,
+ 0x51adb44c,
+ 0xf207,
+ 0x13ecc7,
+ 0x1698ca,
+ 0x3efd0,
+ 0x1acd05,
+ 0x16e1cb,
+ 0x1672c8,
+ 0x13edc7,
+ 0x2f64b,
+ 0x11dd09,
+ 0x150f47,
+ 0x1b3c47,
+ 0x81187,
+ 0x20586,
+ 0x94b88,
+ 0x52028b86,
+ 0xafbcd,
+ 0x169290,
+ 0x52401742,
+ 0xfb48,
+ 0x71f47,
+ 0x7f149,
+ 0x59b46,
+ 0x99f08,
+ 0x74842,
+ 0xa4f4a,
+ 0x2d587,
+ 0x3b9c7,
+ 0xaa689,
+ 0xad708,
+ 0x15ae05,
+ 0x194e8e,
+ 0x14d4e,
+ 0x26f4f,
+ 0x2ccc9,
+ 0x4c809,
+ 0x77e8b,
+ 0x878cf,
+ 0x8fdcc,
+ 0xadd8b,
+ 0xc4d08,
+ 0xdc507,
+ 0x162908,
+ 0xfe04b,
+ 0x12a54c,
+ 0x141acc,
+ 0x147f4c,
+ 0x14b0cd,
+ 0x17de88,
+ 0x42602,
+ 0x104389,
+ 0x18528b,
+ 0xc8886,
+ 0x116f8b,
+ 0xdd5ca,
+ 0xde185,
+ 0xe4a90,
+ 0x1294c6,
+ 0x63c85,
+ 0xe6448,
+ 0xee547,
+ 0xee807,
+ 0x5e987,
+ 0xf92ca,
+ 0xd790a,
+ 0x177ac6,
+ 0x97ccd,
+ 0x1ae208,
+ 0x56608,
+ 0x56a89,
+ 0xb9905,
+ 0x19de4c,
+ 0x14b2cb,
+ 0x171c84,
+ 0xff749,
+ 0x8146,
+ 0x16c2,
+ 0x125886,
+ 0x10d947,
+ 0x6c82,
+ 0xcb605,
+ 0x29b04,
+ 0x701,
+ 0x2bc43,
+ 0x51fadbc6,
+ 0x9a283,
+ 0x8a42,
+ 0x2d584,
+ 0x1442,
+ 0x4ae04,
+ 0x1342,
+ 0x2f82,
+ 0x3682,
+ 0x1124c2,
+ 0xe542,
+ 0xdb442,
+ 0x2ac2,
+ 0x1c402,
+ 0x26982,
+ 0x4d02,
+ 0x3b02,
+ 0x34682,
+ 0x31b83,
+ 0x7d02,
+ 0x1c2,
+ 0x41c2,
+ 0xda42,
+ 0x642,
+ 0xdc2,
+ 0x18d82,
+ 0x1a02,
+ 0x2282,
+ 0x1d42,
+ 0x4303,
+ 0xb02,
+ 0x2f02,
+ 0xb5e02,
+ 0x1b02,
+ 0x5d82,
+ 0x32c2,
+ 0x73c2,
+ 0x17c2,
+ 0x1f02,
+ 0x173102,
+ 0x73fc2,
+ 0x5e402,
+ 0x4ac3,
+ 0x2c2,
+ 0x9282,
0x1002,
- 0x24104,
- 0x9c2,
- 0x1182,
- 0x3182,
- 0x4f882,
- 0x2ec2,
- 0x104e82,
- 0x8c2,
- 0x1dec2,
- 0x37e42,
+ 0x14602,
+ 0x1724c5,
+ 0x6ec2,
+ 0x1202,
+ 0x41703,
0x682,
- 0xf82,
- 0xb1d82,
- 0x343c3,
- 0x8042,
- 0x202,
- 0x6ac2,
- 0x21842,
- 0xb2c2,
- 0x32a02,
- 0xf1c2,
- 0x42,
- 0x5602,
- 0xa82,
- 0x2243,
- 0x74c2,
- 0x1982,
- 0xb09c2,
- 0x9682,
- 0xb402,
- 0x61c2,
- 0xa242,
- 0x9a1c2,
- 0x6742,
- 0x172e82,
- 0xe02,
- 0x9f82,
- 0x38483,
- 0x1dc2,
- 0x8382,
- 0x25c2,
- 0x2182,
- 0x46045,
- 0x6a42,
- 0x41542,
- 0x3e503,
- 0x4b42,
- 0x7982,
- 0x1402,
- 0x15c2,
- 0x1882,
- 0xcc2,
- 0x3282,
- 0x6202,
- 0x6b247,
- 0x212d03,
- 0x200882,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x201d83,
- 0x2348c3,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x290c83,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x211003,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
+ 0xd42,
+ 0x1702,
+ 0xe5c2,
+ 0x1ac2,
+ 0x3382,
+ 0x6902,
+ 0x16c2,
+ 0x73c07,
+ 0x213dc3,
+ 0x204cc2,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x201d43,
+ 0x22d603,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x29a2c3,
+ 0x1a5c3,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
0x200041,
- 0x211003,
- 0x238483,
- 0x201f43,
- 0x2264c3,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x25f643,
- 0x211cc3,
- 0x3112c3,
- 0x27cc03,
- 0x201f83,
- 0x25a603,
- 0x21eb03,
- 0x201604,
- 0x238483,
- 0x2264c3,
- 0x223ec3,
- 0x305fc4,
- 0x21e143,
- 0x4803,
- 0x203e03,
- 0x2a0cc8,
- 0x332a44,
- 0x317f8a,
- 0x330786,
- 0xda404,
- 0x3a2e47,
- 0x22138a,
- 0x347689,
- 0x3b3507,
- 0x20054a,
- 0x323ac3,
- 0x3822cb,
- 0x368b49,
- 0x2c4005,
- 0x2ca007,
- 0x16582,
- 0x22d183,
- 0x326647,
- 0x22a1c5,
- 0x2d60c9,
- 0x2343c3,
- 0x227846,
- 0x2ba0c3,
- 0x9f543,
- 0xfaa86,
- 0x4f4c6,
- 0x11d1c7,
- 0x3a8786,
- 0x213e45,
- 0x20c507,
- 0x338b87,
- 0x4d61eb03,
- 0x329007,
- 0x35eec3,
- 0x38e705,
- 0x201604,
- 0x221c08,
- 0x2af6cc,
- 0x2ad6c5,
- 0x363c06,
- 0x326507,
- 0x224b47,
- 0x205087,
- 0x206e48,
- 0x2597cf,
- 0x280b05,
- 0x240107,
- 0x27e347,
- 0x2a500a,
- 0x2ee209,
- 0x2d7185,
- 0x2d830a,
- 0xdea46,
- 0x2ba145,
- 0x374b84,
- 0x2b7486,
- 0x2fe5c7,
- 0x230bc7,
- 0x2a0a08,
- 0x214805,
- 0x22a0c6,
- 0x3a8245,
- 0x37a445,
- 0x21fd44,
- 0x31e907,
- 0x347cca,
- 0x365a48,
- 0x2edb86,
- 0x348c3,
- 0x2cf145,
- 0x238d06,
- 0x200346,
- 0x251e06,
- 0x211003,
- 0x388dc7,
- 0x27e2c5,
- 0x238483,
- 0x3b378d,
- 0x2025c3,
- 0x2a0b08,
- 0x3aac44,
- 0x205fc5,
- 0x2a4f06,
- 0x236b06,
- 0x20d6c7,
- 0x355747,
- 0x2641c5,
- 0x2264c3,
- 0x322c07,
- 0x33b009,
- 0x258f49,
- 0x2434ca,
- 0x242a42,
- 0x38e6c4,
- 0x2d7ac4,
- 0x210d87,
- 0x236d08,
- 0x2dce89,
- 0x3a3489,
- 0x2df807,
- 0x334206,
- 0xe1406,
- 0x2e26c4,
- 0x2e2cca,
- 0x2e5c88,
- 0x2e64c9,
- 0x2b6306,
- 0x3003c5,
- 0x365908,
- 0x2bf10a,
- 0x25b743,
- 0x306146,
- 0x2df907,
- 0x207c85,
- 0x3aab05,
- 0x242083,
- 0x252dc4,
- 0x21bf45,
- 0x27e747,
- 0x39fa45,
- 0x2f3bc6,
- 0xfa705,
- 0x212a43,
- 0x21cdc9,
- 0x238dcc,
- 0x2ab90c,
- 0x2c65c8,
- 0x28f8c7,
- 0x2ef748,
- 0x2efa8a,
- 0x2f0a4b,
- 0x368c88,
- 0x363d08,
- 0x36ee86,
- 0x341985,
- 0x36498a,
- 0x21ebc5,
- 0x203e42,
- 0x2bcdc7,
- 0x26a8c6,
- 0x353505,
- 0x2f1949,
- 0x38dec5,
- 0x376785,
- 0x38e2c9,
- 0x238b86,
- 0x261b88,
- 0x2d1343,
- 0x3a88c6,
- 0x270f06,
- 0x2fdcc5,
- 0x2fdcc9,
- 0x2dd5c9,
- 0x242d87,
- 0xfdb44,
- 0x2fdb47,
- 0x3a3389,
- 0x221585,
- 0x16f208,
- 0x355545,
- 0x355245,
- 0x399309,
- 0x201482,
- 0x21df44,
- 0x202e82,
- 0x2074c2,
- 0x293c45,
- 0x2da188,
- 0x374e45,
- 0x2bc883,
- 0x2bc885,
- 0x2ca3c3,
- 0x2111c2,
- 0x264a04,
- 0x233503,
- 0x207a82,
- 0x358704,
- 0x2d8003,
- 0x2014c2,
- 0x293cc3,
- 0x2898c4,
- 0x2d7703,
- 0x23a804,
- 0x201bc2,
- 0x21bc03,
- 0x219283,
- 0x208d82,
- 0x35b202,
- 0x2dd409,
- 0x2011c2,
- 0x286304,
- 0x200dc2,
- 0x365784,
- 0x3341c4,
- 0x3a1cc4,
- 0x206202,
- 0x23e802,
- 0x20dc03,
- 0x2f0083,
- 0x23f704,
- 0x27e8c4,
- 0x2d13c4,
- 0x2dd7c4,
- 0x2fd083,
- 0x3491c3,
- 0x2de9c4,
- 0x2fee04,
- 0x2ff346,
- 0x260dc2,
- 0x216582,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x200882,
- 0x323ac3,
- 0x22d183,
- 0x2343c3,
- 0x205403,
- 0x21eb03,
- 0x201604,
- 0x2dd6c4,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x21bd03,
- 0x2e3444,
- 0x29e943,
- 0x2b3783,
- 0x3436c4,
- 0x355346,
- 0x20ca03,
- 0x16e747,
- 0x219b83,
- 0x208143,
- 0x2b1a03,
- 0x206003,
- 0x2348c3,
- 0x376f85,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x2db443,
- 0x230743,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x202243,
- 0x238483,
- 0x234fc4,
- 0x2264c3,
- 0x29b704,
- 0x2b7285,
- 0x16e747,
- 0x216582,
- 0x201a42,
- 0x201f82,
- 0x205902,
- 0x201502,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x224104,
- 0x880c8,
- 0x22d183,
- 0x2025c3,
- 0x245dc4,
- 0x880c8,
- 0x22d183,
- 0x247344,
- 0x201604,
- 0x2025c3,
- 0x202282,
- 0x2264c3,
- 0x215cc3,
- 0x52dc4,
- 0x2e9cc5,
- 0x203e42,
- 0x2fef43,
- 0x200882,
- 0x880c8,
- 0x216582,
- 0x2343c3,
- 0x21eb03,
- 0x200a82,
- 0x2264c3,
- 0x200882,
- 0x200707,
- 0x254705,
- 0x29f844,
- 0x385f86,
- 0x366a4b,
- 0x263a49,
- 0x363b46,
- 0x340a89,
- 0x2b2c88,
- 0x207103,
- 0x880c8,
- 0x22a807,
- 0x364288,
- 0x24f843,
- 0x21d184,
- 0x2226cb,
- 0x259145,
- 0x24b188,
- 0x2f2ec9,
- 0x25a203,
- 0x22d183,
- 0x205348,
- 0x2ee787,
- 0x24fe46,
- 0x2343c3,
- 0x24f947,
- 0x21eb03,
- 0x339b06,
- 0x202243,
- 0x22f9c7,
- 0x33a6c7,
- 0x390e87,
- 0x31e885,
- 0x209403,
- 0x205dcb,
- 0x36b4c8,
- 0x227548,
- 0x33b1c6,
- 0x367989,
- 0x335b07,
- 0x2f9145,
- 0x339444,
- 0x3478c8,
- 0x23d54a,
- 0x23d789,
- 0x346f03,
- 0x2696c5,
- 0x21bb83,
- 0x3ad706,
- 0x387704,
- 0x2fdec8,
- 0x38748b,
- 0x346dc5,
- 0x2b7006,
- 0x2b8e85,
- 0x2b9608,
- 0x2ba287,
- 0x206cc7,
- 0x317b87,
- 0x294544,
- 0x30a5c7,
- 0x294546,
- 0x211003,
- 0x2c2088,
- 0x268383,
- 0x2cab08,
- 0x2d3f45,
- 0x3251c8,
- 0x2345c7,
- 0x238483,
- 0x2447c3,
- 0x287dc4,
- 0x323647,
- 0x208fc3,
- 0x33a78b,
- 0x205003,
- 0x268344,
- 0x2e9d48,
- 0x2264c3,
- 0x2f3d45,
- 0x311145,
- 0x3250c6,
- 0x2117c5,
- 0x2d4304,
- 0x202002,
- 0x2e69c3,
- 0x374c0a,
- 0x3a1583,
- 0x306709,
- 0x30a2c6,
- 0x204e48,
- 0x289406,
- 0x214347,
- 0x2db948,
- 0x39a588,
- 0x2ebd43,
- 0x293d03,
- 0x272c09,
- 0x2f4c83,
- 0x2d8d06,
- 0x254386,
- 0x39f7c6,
- 0x3a1e09,
- 0x2fd784,
- 0x20e3c3,
- 0x2d6d05,
- 0x349589,
- 0x206dc3,
- 0x35a244,
- 0x2f2ac4,
- 0x36fc84,
- 0x35f906,
- 0x3b4303,
- 0x3b4308,
- 0x256a08,
- 0x39db86,
- 0x2f8f4b,
- 0x2f9288,
- 0x2f948b,
- 0x2fb949,
- 0x2fa987,
- 0x2fbdc8,
- 0x2fc983,
- 0x22ad86,
- 0x3a9247,
- 0x295245,
- 0x34b789,
- 0x33530d,
- 0x204c91,
- 0x22eb85,
- 0x200882,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x22d684,
- 0x21eb03,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x2348c3,
- 0x238483,
- 0x2264c3,
- 0x265903,
- 0x217643,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x2348c3,
- 0x238483,
- 0x2264c3,
- 0x221e42,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x2104c3,
+ 0x200383,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x20fb43,
+ 0x2135c3,
+ 0x2300c3,
+ 0x287703,
+ 0x210503,
+ 0x234743,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204ac3,
+ 0x200383,
+ 0x24abc3,
+ 0x200604,
+ 0x250c83,
+ 0x5283,
+ 0x3abd03,
+ 0x329b88,
+ 0x2e8384,
+ 0x2c264a,
+ 0x224906,
+ 0x10f9c4,
+ 0x38c2c7,
+ 0x21eeca,
+ 0x2df949,
+ 0x3a3b07,
+ 0x3a7dca,
+ 0x368883,
+ 0x2e900b,
+ 0x303349,
+ 0x2b9e45,
+ 0x2d7187,
+ 0xd1c2,
+ 0x2d0783,
+ 0x204d07,
+ 0x248d45,
+ 0x2e1cc9,
+ 0x231b83,
+ 0x233606,
+ 0x2c56c3,
+ 0xe1183,
+ 0x109686,
+ 0x60546,
+ 0x137c7,
+ 0x217546,
+ 0x222645,
+ 0x2cf187,
+ 0x2da587,
+ 0x54b32ec3,
+ 0x334a07,
+ 0x3642c3,
+ 0x3a2385,
+ 0x2964c4,
+ 0x32e3c8,
+ 0x2751cc,
+ 0x3a5745,
+ 0x2a2086,
+ 0x204bc7,
+ 0x37ef47,
+ 0x25b8c7,
+ 0x31f248,
+ 0x307ecf,
+ 0x2dfb85,
+ 0x243507,
+ 0x2394c7,
+ 0x2a9b0a,
+ 0x2d7e49,
+ 0x30bc85,
+ 0x32194a,
+ 0x1b06,
+ 0x2c5745,
+ 0x376284,
+ 0x289dc6,
+ 0x2f8cc7,
+ 0x242507,
+ 0x38cbc8,
+ 0x214185,
+ 0x248c46,
+ 0x20c545,
+ 0x387845,
+ 0x212c04,
+ 0x2e3f87,
+ 0x20900a,
+ 0x234d48,
+ 0x356946,
+ 0x2d603,
+ 0x2e0405,
+ 0x26c686,
+ 0x3a46c6,
+ 0x263b86,
+ 0x20fbc3,
+ 0x389247,
+ 0x239445,
+ 0x204ac3,
+ 0x2dd88d,
+ 0x20abc3,
+ 0x38ccc8,
+ 0x39a5c4,
+ 0x27ba85,
+ 0x2a9a06,
+ 0x2362c6,
+ 0x204587,
+ 0x2ae707,
+ 0x270b05,
+ 0x200383,
+ 0x27f2c7,
+ 0x329709,
+ 0x22b689,
+ 0x2f590a,
+ 0x24cd82,
+ 0x3a2344,
+ 0x2e76c4,
+ 0x261787,
+ 0x2278c8,
+ 0x2ef309,
+ 0x21f1c9,
+ 0x2f0487,
+ 0x303806,
+ 0xf22c6,
+ 0x2f39c4,
+ 0x2f3fca,
+ 0x2f6a08,
+ 0x2f6fc9,
+ 0x2bfe86,
+ 0x2b6ec5,
+ 0x234c08,
+ 0x2c9c4a,
+ 0x22c6c3,
+ 0x200786,
+ 0x2f0587,
+ 0x217f85,
+ 0x39a485,
+ 0x2717c3,
+ 0x258a04,
+ 0x36da85,
+ 0x288e47,
+ 0x2ffac5,
+ 0x2ed686,
+ 0xfff05,
+ 0x264a03,
+ 0x28b789,
+ 0x27b84c,
+ 0x2a7e0c,
+ 0x2d3bc8,
+ 0x3ade87,
+ 0x2fc8c8,
+ 0x2fcc0a,
+ 0x2fd84b,
+ 0x303488,
+ 0x33f408,
+ 0x2363c6,
+ 0x262685,
+ 0x200f4a,
+ 0x219545,
+ 0x205bc2,
+ 0x2c7a87,
+ 0x2a32c6,
+ 0x355ec5,
+ 0x38e989,
+ 0x26b785,
+ 0x285ec5,
+ 0x3a1f49,
+ 0x257cc6,
+ 0x3b1088,
+ 0x23e0c3,
+ 0x3b3306,
+ 0x27ac06,
+ 0x30ba85,
+ 0x30ba89,
+ 0x2bc289,
+ 0x24d0c7,
+ 0x10b904,
+ 0x30b907,
+ 0x21f0c9,
+ 0x23c905,
+ 0x4bbc8,
+ 0x3b3205,
+ 0x339505,
+ 0x376c89,
+ 0x205ac2,
+ 0x2e95c4,
+ 0x20d782,
+ 0x200b02,
+ 0x2ce985,
+ 0x30f748,
+ 0x2b9845,
+ 0x2c6fc3,
+ 0x2c6fc5,
+ 0x2d7543,
+ 0x210882,
+ 0x2e30c4,
+ 0x351903,
+ 0x204c82,
+ 0x35bb44,
+ 0x2e85c3,
+ 0x200e82,
+ 0x25e903,
+ 0x291704,
+ 0x2e7083,
+ 0x246f04,
+ 0x202602,
+ 0x21a903,
+ 0x215b43,
+ 0x206342,
+ 0x33c282,
+ 0x2bc0c9,
+ 0x202d82,
+ 0x28d304,
+ 0x201782,
+ 0x234a84,
+ 0x3037c4,
+ 0x2bcc44,
+ 0x2016c2,
+ 0x241a02,
+ 0x220883,
+ 0x225f83,
+ 0x387944,
+ 0x269e44,
+ 0x2bc484,
+ 0x2ce884,
+ 0x30b143,
+ 0x34f743,
+ 0x201a84,
+ 0x30d784,
+ 0x30e786,
+ 0x2e7782,
+ 0x20d1c2,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x204cc2,
+ 0x368883,
+ 0x2d0783,
+ 0x231b83,
+ 0x2001c3,
+ 0x332ec3,
+ 0x2964c4,
+ 0x2bc384,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0x2f4684,
+ 0x32f983,
+ 0x2bf3c3,
+ 0x345184,
+ 0x3b3006,
+ 0x211503,
+ 0x13ecc7,
+ 0x234fc3,
+ 0x23a943,
+ 0x2b6703,
+ 0x265383,
+ 0x22d603,
+ 0x2db6c5,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2ed143,
+ 0x2ab343,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204303,
+ 0x204ac3,
+ 0x23ee04,
+ 0x200383,
+ 0x26a104,
+ 0x2c2d45,
+ 0x13ecc7,
+ 0x20d1c2,
+ 0x2000c2,
+ 0x208a42,
+ 0x202082,
+ 0x200382,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x24ae04,
+ 0x15f048,
+ 0x2d0783,
+ 0x20abc3,
+ 0x1a5c3,
+ 0x24fe44,
+ 0x15f048,
+ 0x2d0783,
+ 0x251304,
+ 0x2964c4,
+ 0x20abc3,
+ 0x201882,
+ 0x200383,
+ 0x2202c3,
+ 0x58a04,
+ 0x370145,
+ 0x205bc2,
+ 0x30d8c3,
+ 0x204cc2,
+ 0x15f048,
+ 0x20d1c2,
+ 0x231b83,
+ 0x332ec3,
+ 0x201d42,
+ 0x200383,
+ 0x204cc2,
+ 0x15f048,
+ 0x231b83,
+ 0x332ec3,
+ 0x204303,
+ 0x20fbc3,
+ 0x30b544,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x2da904,
+ 0x332ec3,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x22d603,
+ 0x204ac3,
+ 0x200383,
+ 0x26a103,
+ 0x213e83,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x1a5c3,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x22d603,
+ 0x204ac3,
+ 0x200383,
+ 0x217082,
0x200141,
- 0x200882,
+ 0x204cc2,
0x200001,
- 0x313b02,
- 0x880c8,
- 0x220045,
- 0x200481,
- 0x2d183,
- 0x200741,
- 0x200081,
- 0x200c81,
- 0x2333c2,
- 0x36e144,
- 0x383043,
- 0x2007c1,
- 0x200901,
- 0x200041,
- 0x2001c1,
- 0x2dda87,
- 0x2b8f8f,
- 0x2cacc6,
+ 0x31f542,
+ 0x15f048,
+ 0x21d105,
+ 0x200701,
+ 0xd0783,
+ 0x200101,
0x2000c1,
- 0x25b806,
- 0x200341,
- 0x200ac1,
- 0x341ece,
- 0x201501,
- 0x2264c3,
- 0x2014c1,
- 0x260e05,
- 0x202002,
- 0x241f85,
- 0x200b81,
+ 0x201e41,
+ 0x29da82,
+ 0x36da04,
+ 0x372a43,
+ 0x200181,
+ 0x200941,
+ 0x200041,
+ 0x200081,
+ 0x2ed7c7,
+ 0x2eeccf,
+ 0x2fc146,
+ 0x201481,
+ 0x289786,
+ 0x200c01,
+ 0x2002c1,
+ 0x33168e,
+ 0x200381,
+ 0x200383,
+ 0x200e81,
+ 0x279e45,
+ 0x210582,
+ 0x2716c5,
+ 0x2003c1,
+ 0x200201,
0x200241,
+ 0x205bc2,
0x200a01,
- 0x203e42,
- 0x2002c1,
- 0x204701,
- 0x20dec1,
- 0x200781,
- 0x200641,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x21ca03,
- 0x22d183,
- 0x21eb03,
- 0x89ec8,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x14da788,
- 0x880c8,
- 0x441c4,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x238483,
- 0x2264c3,
- 0x204803,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x22d684,
- 0x2264c3,
- 0x28fb85,
- 0x27f304,
- 0x22d183,
- 0x238483,
- 0x2264c3,
- 0xa014a,
- 0x216582,
- 0x22d183,
- 0x2326c9,
- 0x2343c3,
- 0x23af09,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x2e24c8,
- 0x2100c7,
- 0x2e9cc5,
- 0x200707,
- 0x366a4b,
- 0x365188,
- 0x340a89,
- 0x22a807,
- 0x205348,
- 0x339b06,
- 0x33a6c7,
- 0x227548,
- 0x33b1c6,
- 0x335b07,
- 0x23d789,
- 0x37c409,
- 0x2b7006,
- 0x2b7e45,
- 0x2c2088,
- 0x268383,
- 0x2cab08,
- 0x2345c7,
- 0x208fc3,
- 0x326387,
- 0x2117c5,
- 0x2dc608,
- 0x310205,
- 0x293d03,
- 0x33b9c9,
- 0x2aa9c7,
- 0x35a244,
- 0x2f2ac4,
- 0x2f8f4b,
- 0x2f9288,
- 0x2fa987,
- 0x22d183,
- 0x2343c3,
- 0x211cc3,
- 0x2264c3,
- 0x21e503,
- 0x21eb03,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x653cb,
- 0x200882,
- 0x216582,
- 0x2264c3,
- 0x880c8,
- 0x200882,
- 0x216582,
- 0x201f82,
- 0x200a82,
- 0x200342,
- 0x238483,
- 0x201502,
- 0x200882,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x201f82,
- 0x21eb03,
- 0x202243,
- 0x211003,
- 0x212444,
- 0x238483,
- 0x21ab43,
- 0x2264c3,
- 0x2fd784,
- 0x223ec3,
- 0x21eb03,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2025c3,
- 0x2264c3,
- 0x39bd47,
- 0x22d183,
- 0x256b87,
- 0x2edfc6,
- 0x219203,
- 0x206ac3,
- 0x21eb03,
- 0x220883,
- 0x201604,
- 0x284804,
- 0x2d43c6,
- 0x20bac3,
- 0x238483,
- 0x2264c3,
- 0x28fb85,
- 0x20d4c4,
- 0x31a083,
- 0x217a03,
- 0x2bcdc7,
- 0x20b445,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x219f02,
- 0x380383,
- 0x2b2c83,
- 0x323ac3,
- 0x5822d183,
- 0x22b782,
- 0x2343c3,
- 0x208f43,
- 0x21eb03,
- 0x201604,
- 0x36b683,
- 0x280b03,
- 0x211003,
- 0x212444,
- 0x58606bc2,
- 0x238483,
- 0x2264c3,
- 0x232dc3,
- 0x245483,
- 0x221e42,
- 0x223ec3,
- 0x880c8,
- 0x21eb03,
- 0x307e44,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2374c4,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x2f5d44,
- 0x307b04,
- 0x2cc5c6,
- 0x212444,
- 0x238483,
- 0x2264c3,
+ 0x201a81,
+ 0x2005c1,
+ 0x2007c1,
+ 0x200cc1,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
0x21bd03,
- 0x26a8c6,
- 0x1737cb,
- 0x1e1c6,
- 0x23d0a,
- 0xfcb8a,
- 0x880c8,
- 0x3a8204,
- 0x22d183,
- 0x323a84,
- 0x2343c3,
- 0x247b84,
- 0x21eb03,
- 0x251283,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x32248b,
- 0x39d94a,
- 0x3b298c,
- 0x200882,
- 0x216582,
- 0x201f82,
- 0x2a9c05,
- 0x201604,
- 0x206742,
- 0x211003,
- 0x307b04,
- 0x205902,
- 0x201502,
- 0x217642,
- 0x221e42,
- 0x123ac3,
- 0x357309,
- 0x254208,
- 0x301189,
- 0x33a509,
- 0x35bd8a,
- 0x23808a,
- 0x20cc82,
- 0x21dec2,
- 0x16582,
- 0x22d183,
- 0x200bc2,
- 0x2402c6,
- 0x354502,
- 0x202982,
- 0x3861ce,
- 0x21bc4e,
- 0x278107,
- 0x32fe47,
- 0x26b302,
- 0x2343c3,
- 0x21eb03,
- 0x202842,
- 0x200a82,
- 0x23d1cf,
- 0x204ec2,
- 0x33b3c7,
- 0x24cf87,
- 0x256107,
- 0x26204c,
- 0x268b4c,
- 0x2057c4,
- 0x2696ca,
- 0x21bb82,
- 0x209682,
- 0x2b2684,
- 0x215bc2,
- 0x2bb4c2,
- 0x268d84,
- 0x21ac42,
- 0x20b402,
- 0x33b247,
- 0x233285,
- 0x20a242,
- 0x23d144,
- 0x372e82,
- 0x2cea08,
- 0x238483,
- 0x3a2308,
- 0x203082,
- 0x235885,
- 0x3a25c6,
- 0x2264c3,
- 0x206a42,
- 0x2dd0c7,
- 0x2002,
- 0x26ccc5,
- 0x393e85,
- 0x2166c2,
- 0x226442,
- 0x31864a,
- 0x26404a,
- 0x210fc2,
- 0x376c04,
- 0x201a02,
- 0x38e588,
+ 0x2d0783,
+ 0x332ec3,
+ 0x91d48,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x48803,
+ 0x200383,
+ 0x14ebc48,
+ 0x15f048,
+ 0x4dcc4,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x204ac3,
+ 0x200383,
+ 0x205283,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x2da904,
+ 0x200383,
+ 0x293ac5,
+ 0x343984,
+ 0x2d0783,
+ 0x204ac3,
+ 0x200383,
+ 0x16b18a,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x22f489,
+ 0x231b83,
+ 0x2d2389,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x2f37c8,
+ 0x226647,
+ 0x370145,
+ 0x3a7f87,
+ 0x26b0cb,
+ 0x215cc8,
+ 0x32eac9,
+ 0x228087,
+ 0x200108,
+ 0x36f906,
+ 0x2344c7,
+ 0x29c108,
+ 0x2ab806,
+ 0x31d407,
+ 0x2aa449,
+ 0x2ba749,
+ 0x2c2ac6,
+ 0x2c38c5,
+ 0x2cce08,
+ 0x2b4783,
+ 0x2d7c88,
+ 0x231d87,
+ 0x206583,
+ 0x31d287,
+ 0x217905,
+ 0x2eeb08,
+ 0x359105,
+ 0x2cea43,
+ 0x23c289,
+ 0x2b0e87,
+ 0x35d504,
+ 0x2ff244,
+ 0x307ccb,
+ 0x308288,
+ 0x309587,
+ 0x2d0783,
+ 0x231b83,
+ 0x2135c3,
+ 0x200383,
+ 0x236ec3,
+ 0x332ec3,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x77fcb,
0x204cc2,
- 0x2fd448,
- 0x2f64c7,
- 0x2f67c9,
- 0x26cd42,
- 0x2fbb85,
- 0x2546c5,
- 0x2148cb,
- 0x2bfdcc,
- 0x22f848,
- 0x2fbf48,
- 0x260dc2,
- 0x20d782,
- 0x200882,
- 0x880c8,
- 0x216582,
- 0x22d183,
- 0x201f82,
- 0x205902,
- 0x201502,
- 0x2264c3,
- 0x217642,
- 0x200882,
- 0x5a616582,
- 0x5aa1eb03,
- 0x332683,
- 0x206742,
- 0x238483,
- 0x364e83,
- 0x2264c3,
- 0x2db083,
- 0x26b346,
- 0x1617643,
- 0x880c8,
- 0x51f05,
- 0xa7dcd,
- 0x5f007,
- 0x5b200182,
- 0x5b601002,
- 0x5ba04802,
- 0x5be01842,
- 0x5c2108c2,
- 0x5c602ec2,
- 0x16e747,
- 0x5ca16582,
- 0x5ce30542,
- 0x5d21e582,
- 0x5d600f82,
- 0x21bc43,
- 0x1b4284,
- 0x20ddc3,
- 0x5da18fc2,
- 0x5de038c2,
- 0x47887,
- 0x5e214b82,
- 0x5e600902,
- 0x5ea02ac2,
- 0x5ee082c2,
- 0x5f205602,
- 0x5f600a82,
- 0xb97c5,
- 0x226743,
- 0x30ec04,
- 0x5fa15bc2,
- 0x5fe16c82,
- 0x60200102,
- 0x7508b,
- 0x60600982,
- 0x60e09782,
- 0x61206742,
- 0x61600342,
- 0x61a50042,
- 0x61e03042,
- 0x6220e842,
- 0x62600e02,
- 0x62a06bc2,
- 0x62e01302,
- 0x63205902,
- 0x6361d302,
- 0x63a04242,
- 0x63e425c2,
- 0x133184,
- 0x371183,
- 0x64206602,
- 0x64613942,
- 0x64a06942,
- 0x64e03742,
- 0x65201502,
- 0x65607a82,
- 0x65547,
- 0x65a07442,
- 0x65e07482,
- 0x66217642,
- 0x6660a442,
- 0xeb58c,
- 0x66a24982,
- 0x66e6f2c2,
- 0x6721dcc2,
- 0x67603dc2,
- 0x67a2d742,
- 0x67e1eb82,
- 0x68204702,
- 0x68606f42,
- 0x68a71282,
- 0x68e15ac2,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x75803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x60b6b683,
- 0x275803,
- 0x377004,
- 0x254106,
- 0x2e6a83,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x200482,
- 0x200482,
- 0x36b683,
- 0x275803,
- 0x6962d183,
- 0x2343c3,
- 0x2a0fc3,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x880c8,
- 0x216582,
- 0x22d183,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x245dc4,
- 0x216582,
- 0x22d183,
- 0x308703,
- 0x2343c3,
- 0x247344,
- 0x211cc3,
- 0x21eb03,
- 0x201604,
- 0x202243,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x215cc3,
- 0x2e9cc5,
- 0x241403,
- 0x223ec3,
- 0x216582,
- 0x22d183,
- 0x36b683,
- 0x238483,
- 0x2264c3,
- 0x200882,
- 0x323ac3,
- 0x880c8,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x231ac6,
- 0x201604,
- 0x202243,
- 0x212444,
- 0x238483,
- 0x2264c3,
- 0x21bd03,
- 0x22d183,
- 0x2343c3,
- 0x238483,
- 0x2264c3,
- 0x22d183,
- 0x1e1c6,
- 0x2343c3,
- 0x21eb03,
- 0xd1906,
- 0x238483,
- 0x2264c3,
- 0x308a48,
- 0x30b989,
- 0x31bcc9,
- 0x326c48,
- 0x37efc8,
- 0x37efc9,
- 0x333c5,
- 0x200882,
- 0x20b285,
- 0x231b43,
- 0x6c216582,
- 0x2343c3,
- 0x21eb03,
- 0x22f647,
- 0x206003,
- 0x211003,
- 0x238483,
- 0x201f43,
- 0x210783,
- 0x2025c3,
- 0x2264c3,
- 0x3a5946,
- 0x203e42,
- 0x223ec3,
- 0x880c8,
- 0x200882,
- 0x323ac3,
- 0x216582,
- 0x22d183,
- 0x2343c3,
- 0x21eb03,
- 0x201604,
- 0x211003,
- 0x238483,
- 0x2264c3,
- 0x217643,
- 0x14fa806,
+ 0x20d1c2,
+ 0x200383,
+ 0x15f048,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x208a42,
+ 0x201d42,
+ 0x203cc2,
+ 0x204ac3,
+ 0x200382,
+ 0x204cc2,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x208a42,
+ 0x332ec3,
+ 0x204303,
+ 0x20fbc3,
+ 0x213184,
+ 0x204ac3,
+ 0x2183c3,
+ 0x200383,
+ 0x30b544,
+ 0x24abc3,
+ 0x332ec3,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x20abc3,
+ 0x200383,
+ 0x39db07,
+ 0x2d0783,
+ 0x26e5c7,
+ 0x362a86,
+ 0x215ac3,
+ 0x2041c3,
+ 0x332ec3,
+ 0x209e43,
+ 0x2964c4,
+ 0x38b704,
+ 0x30dbc6,
+ 0x201303,
+ 0x204ac3,
+ 0x200383,
+ 0x293ac5,
+ 0x318244,
+ 0x369dc3,
+ 0x37ed83,
+ 0x2c7a87,
+ 0x2387c5,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x203782,
+ 0x3ae343,
+ 0x2c2d43,
+ 0x368883,
+ 0x5fed0783,
+ 0x209c02,
+ 0x231b83,
+ 0x202743,
+ 0x332ec3,
+ 0x2964c4,
+ 0x23a0c3,
+ 0x2dfb83,
+ 0x20fbc3,
+ 0x213184,
+ 0x6020c002,
+ 0x204ac3,
+ 0x200383,
+ 0x209103,
+ 0x229b03,
+ 0x217082,
+ 0x24abc3,
+ 0x15f048,
+ 0x332ec3,
+ 0x1a5c3,
+ 0x2957c4,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x23a184,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x2cee84,
+ 0x222044,
+ 0x201686,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0x2a32c6,
+ 0x3ddcb,
+ 0x28b86,
+ 0x4aa0a,
+ 0x10adca,
+ 0x15f048,
+ 0x20c504,
+ 0x2d0783,
+ 0x368844,
+ 0x231b83,
+ 0x256bc4,
+ 0x332ec3,
+ 0x262fc3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x32e84b,
+ 0x39f84a,
+ 0x3b478c,
+ 0x204cc2,
+ 0x20d1c2,
+ 0x208a42,
+ 0x2b0405,
+ 0x2964c4,
+ 0x201f02,
+ 0x20fbc3,
+ 0x222044,
+ 0x202082,
+ 0x200382,
+ 0x20c4c2,
+ 0x217082,
+ 0x168883,
+ 0xd882,
+ 0x2b2409,
+ 0x259f88,
+ 0x332d49,
+ 0x234309,
+ 0x23b18a,
+ 0x24550a,
+ 0x20a182,
+ 0x21c402,
+ 0xd1c2,
+ 0x2d0783,
+ 0x220802,
+ 0x2436c6,
+ 0x356fc2,
+ 0x20a542,
+ 0x21ad8e,
+ 0x21a94e,
+ 0x281a47,
+ 0x204a47,
+ 0x221202,
+ 0x231b83,
+ 0x332ec3,
+ 0x20b502,
+ 0x201d42,
+ 0x4143,
+ 0x24058f,
+ 0x26b142,
+ 0x362cc7,
+ 0x2fa1c7,
+ 0x39d487,
+ 0x31e28c,
+ 0x364d0c,
+ 0x202444,
+ 0x283b0a,
+ 0x21a882,
+ 0x201b02,
+ 0x2bc744,
+ 0x22b1c2,
+ 0x2c5c02,
+ 0x364f44,
+ 0x2184c2,
+ 0x205d82,
+ 0x5d83,
+ 0x2ab887,
+ 0x33d885,
+ 0x2073c2,
+ 0x240504,
+ 0x373102,
+ 0x2df088,
+ 0x204ac3,
+ 0x203808,
+ 0x203ac2,
+ 0x232d85,
+ 0x203ac6,
+ 0x200383,
+ 0x206ec2,
+ 0x2ef547,
+ 0x10582,
+ 0x350845,
+ 0x31d185,
+ 0x207c82,
+ 0x236b82,
+ 0x3a860a,
+ 0x27098a,
+ 0x212bc2,
+ 0x353f84,
+ 0x2018c2,
+ 0x3a2208,
+ 0x219682,
+ 0x2a2588,
+ 0x304987,
+ 0x304c89,
+ 0x2037c2,
+ 0x309e45,
+ 0x247e85,
+ 0x21424b,
+ 0x2ca84c,
+ 0x22c208,
+ 0x3186c8,
+ 0x2e7782,
+ 0x204642,
+ 0x204cc2,
+ 0x15f048,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x208a42,
+ 0x202082,
+ 0x200382,
+ 0x200383,
+ 0x20c4c2,
+ 0x204cc2,
+ 0x6260d1c2,
+ 0x62b32ec3,
+ 0x205d83,
+ 0x201f02,
+ 0x204ac3,
+ 0x3a8fc3,
+ 0x200383,
+ 0x2ec383,
+ 0x273d06,
+ 0x1613e83,
+ 0x15f048,
+ 0x63c85,
+ 0xae2cd,
+ 0xaafca,
+ 0x6ebc7,
+ 0x63201b82,
+ 0x63601442,
+ 0x63a00f82,
+ 0x63e02e02,
+ 0x642125c2,
+ 0x6460e542,
+ 0x13ecc7,
+ 0x64a0d1c2,
+ 0x64e0e482,
+ 0x6520fe42,
+ 0x65603b02,
+ 0x21a943,
+ 0x102c4,
+ 0x220a43,
+ 0x65a14002,
+ 0x65e023c2,
+ 0x51847,
+ 0x66214502,
+ 0x66600b82,
+ 0x66a00542,
+ 0x66e0a3c2,
+ 0x67202282,
+ 0x67601d42,
+ 0xbe445,
+ 0x221443,
+ 0x3b3bc4,
+ 0x67a2b1c2,
+ 0x67e42682,
+ 0x68202682,
+ 0x7e5cb,
+ 0x68600c02,
+ 0x68e513c2,
+ 0x69201f02,
+ 0x69603cc2,
+ 0x69a0bcc2,
+ 0x69e05f02,
+ 0x6a20b602,
+ 0x6a673fc2,
+ 0x6aa0c002,
+ 0x6ae04a02,
+ 0x6b202082,
+ 0x6b603702,
+ 0x6ba12982,
+ 0x6be31302,
+ 0x94fc4,
+ 0x358183,
+ 0x6c2126c2,
+ 0x6c61a582,
+ 0x6ca098c2,
+ 0x6ce00982,
+ 0x6d200382,
+ 0x6d604c82,
+ 0x78147,
+ 0x6da054c2,
+ 0x6de05502,
+ 0x6e20c4c2,
+ 0x6e609f42,
+ 0x19de4c,
+ 0x6ea22e82,
+ 0x6ee79242,
+ 0x6f200a02,
+ 0x6f606602,
+ 0x6fa019c2,
+ 0x6fe3b302,
+ 0x70206d02,
+ 0x70613882,
+ 0x70a7af82,
+ 0x70e43e02,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x75c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x68a3a0c3,
+ 0x2075c3,
+ 0x2db744,
+ 0x259e86,
+ 0x2f74c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x20d882,
+ 0x20d882,
+ 0x23a0c3,
+ 0x2075c3,
+ 0x716d0783,
+ 0x231b83,
+ 0x329e83,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x15f048,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x24fe44,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x3303c3,
+ 0x231b83,
+ 0x251304,
+ 0x2135c3,
+ 0x332ec3,
+ 0x2964c4,
+ 0x204303,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x2202c3,
+ 0x370145,
+ 0x2b2703,
+ 0x24abc3,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x23a0c3,
+ 0x204ac3,
+ 0x200383,
+ 0x204cc2,
+ 0x368883,
+ 0x15f048,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x22e886,
+ 0x2964c4,
+ 0x204303,
+ 0x213184,
+ 0x204ac3,
+ 0x200383,
+ 0x21aa03,
+ 0x2d0783,
+ 0x231b83,
+ 0x204ac3,
+ 0x200383,
+ 0x2d0783,
+ 0x28b86,
+ 0x231b83,
+ 0x332ec3,
+ 0xe1946,
+ 0x204ac3,
+ 0x200383,
+ 0x315cc8,
+ 0x318509,
+ 0x327a09,
+ 0x332548,
+ 0x37d888,
+ 0x37d889,
+ 0x9da85,
+ 0x204cc2,
+ 0x238605,
+ 0x205d43,
+ 0x7420d1c2,
+ 0x231b83,
+ 0x332ec3,
+ 0x33e387,
+ 0x265383,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x2104c3,
+ 0x212483,
+ 0x20abc3,
+ 0x200383,
+ 0x241f46,
+ 0x205bc2,
+ 0x24abc3,
+ 0x15f048,
+ 0x204cc2,
+ 0x368883,
+ 0x20d1c2,
+ 0x2d0783,
+ 0x231b83,
+ 0x332ec3,
+ 0x2964c4,
+ 0x20fbc3,
+ 0x204ac3,
+ 0x200383,
+ 0x213e83,
+ 0x153ca46,
}
// children is the list of nodes' children, the parent's wildcard bit and the
@@ -8636,439 +8623,471 @@ var children = [...]uint32{
0x40000000,
0x50000000,
0x60000000,
- 0x185c611,
- 0x1860617,
- 0x1880618,
- 0x19dc620,
- 0x19f0677,
- 0x1a0467c,
- 0x1a14681,
- 0x1a30685,
- 0x1a3468c,
- 0x1a4c68d,
- 0x1a70693,
- 0x1a7469c,
- 0x1a8c69d,
- 0x1a906a3,
+ 0x1860612,
+ 0x1864618,
+ 0x1884619,
+ 0x19e0621,
+ 0x19f4678,
+ 0x1a0867d,
+ 0x1a18682,
+ 0x1a34686,
+ 0x1a3868d,
+ 0x1a5068e,
+ 0x1a74694,
+ 0x1a7869d,
+ 0x1a9069e,
0x1a946a4,
- 0x1ab86a5,
- 0x1abc6ae,
- 0x21ac46af,
- 0x1b0c6b1,
- 0x1b106c3,
- 0x1b306c4,
- 0x1b446cc,
- 0x1b486d1,
- 0x1b786d2,
- 0x1b946de,
- 0x1bbc6e5,
- 0x1bc86ef,
- 0x1bcc6f2,
- 0x1c606f3,
- 0x1c74718,
- 0x1c8871d,
- 0x1cb8722,
- 0x1cc872e,
- 0x1cdc732,
- 0x1d00737,
- 0x1e18740,
- 0x1e1c786,
- 0x1e88787,
- 0x1e9c7a2,
- 0x1eb07a7,
- 0x1eb87ac,
- 0x1ec87ae,
- 0x1ecc7b2,
- 0x1ee47b3,
- 0x1f2c7b9,
- 0x1f447cb,
- 0x1f487d1,
- 0x1f4c7d2,
- 0x1f547d3,
- 0x1f907d5,
- 0x61f947e4,
- 0x1fa87e5,
- 0x1fac7ea,
- 0x1fb07eb,
- 0x1fc07ec,
- 0x20707f0,
- 0x207481c,
- 0x2207c81d,
- 0x2208081f,
+ 0x1a986a5,
+ 0x1ac06a6,
+ 0x1ac46b0,
+ 0x21acc6b1,
+ 0x1b146b3,
+ 0x1b186c5,
+ 0x1b386c6,
+ 0x1b4c6ce,
+ 0x1b506d3,
+ 0x1b806d4,
+ 0x1b9c6e0,
+ 0x1bc46e7,
+ 0x1bd06f1,
+ 0x1bd46f4,
+ 0x1c686f5,
+ 0x1c7c71a,
+ 0x1c9071f,
+ 0x1cc0724,
+ 0x1cd0730,
+ 0x1ce4734,
+ 0x1d08739,
+ 0x1e20742,
+ 0x1e24788,
+ 0x1e90789,
+ 0x1ea47a4,
+ 0x1eb87a9,
+ 0x1ec07ae,
+ 0x1ed07b0,
+ 0x1ed47b4,
+ 0x1eec7b5,
+ 0x1f347bb,
+ 0x1f4c7cd,
+ 0x1f507d3,
+ 0x1f547d4,
+ 0x1f5c7d5,
+ 0x1f987d7,
+ 0x61f9c7e6,
+ 0x1fb07e7,
+ 0x1fbc7ec,
+ 0x1fc07ef,
+ 0x1fd07f0,
+ 0x20807f4,
0x2084820,
- 0x20b8821,
- 0x20bc82e,
- 0x24f482f,
- 0x2254493d,
- 0x22548951,
- 0x2570952,
- 0x257895c,
- 0x2257c95e,
- 0x258495f,
- 0x22594961,
- 0x22598965,
- 0x25a4966,
- 0x225a8969,
- 0x25ac96a,
+ 0x22090821,
+ 0x22098824,
+ 0x20cc826,
+ 0x20d0833,
+ 0x2514834,
+ 0x225ac945,
0x225b096b,
- 0x25cc96c,
- 0x25e4973,
- 0x25e8979,
- 0x25f897a,
- 0x260097e,
- 0x22634980,
- 0x263898d,
- 0x264898e,
- 0x267c992,
+ 0x225b496c,
+ 0x225c096d,
+ 0x225c4970,
+ 0x225d0971,
+ 0x225d4974,
+ 0x225d8975,
+ 0x225dc976,
+ 0x225e0977,
+ 0x225e4978,
+ 0x225f0979,
+ 0x225f497c,
+ 0x2260097d,
+ 0x22604980,
+ 0x22608981,
+ 0x2260c982,
+ 0x22610983,
+ 0x22614984,
+ 0x2618985,
+ 0x2261c986,
+ 0x22628987,
+ 0x2262c98a,
+ 0x263498b,
+ 0x2264498d,
+ 0x22648991,
+ 0x2654992,
+ 0x22658995,
+ 0x265c996,
+ 0x22660997,
+ 0x267c998,
0x269499f,
- 0x26a89a5,
- 0x26d09aa,
- 0x26f09b4,
- 0x27209bc,
- 0x27489c8,
- 0x274c9d2,
- 0x27709d3,
- 0x27749dc,
- 0x27889dd,
- 0x278c9e2,
- 0x27909e3,
- 0x27b09e4,
- 0x27c09ec,
- 0x27d09f0,
- 0x27d49f4,
- 0x28489f5,
- 0x2864a12,
- 0x2870a19,
- 0x2884a1c,
- 0x289ca21,
- 0x28b0a27,
- 0x28c8a2c,
- 0x28e0a32,
- 0x28f8a38,
- 0x2914a3e,
- 0x292ca45,
- 0x298ca4b,
- 0x29a4a63,
- 0x29a8a69,
- 0x29bca6a,
- 0x2a00a6f,
- 0x2a80a80,
- 0x2aacaa0,
- 0x2ab0aab,
- 0x2ab8aac,
- 0x2ad8aae,
- 0x2adcab6,
- 0x2afcab7,
- 0x2b04abf,
- 0x2b3cac1,
- 0x2b78acf,
- 0x2b7cade,
- 0x2bbcadf,
- 0x2bd4aef,
- 0x2bf8af5,
- 0x2c18afe,
- 0x31dcb06,
- 0x31e8c77,
- 0x3208c7a,
- 0x33c4c82,
- 0x3494cf1,
- 0x3504d25,
- 0x355cd41,
- 0x3644d57,
- 0x369cd91,
- 0x36d8da7,
- 0x37d4db6,
- 0x38a0df5,
- 0x3938e28,
- 0x39c8e4e,
- 0x3a2ce72,
- 0x3c64e8b,
- 0x3d1cf19,
- 0x3de8f47,
- 0x3e34f7a,
- 0x3ebcf8d,
- 0x3ef8faf,
- 0x3f48fbe,
- 0x3fc0fd2,
- 0x63fc4ff0,
- 0x63fc8ff1,
- 0x63fccff2,
- 0x4048ff3,
- 0x40ad012,
- 0x412902b,
- 0x41a104a,
- 0x4221068,
- 0x428d088,
- 0x43b90a3,
- 0x44110ee,
- 0x64415104,
- 0x44ad105,
- 0x453512b,
- 0x458114d,
- 0x45e9160,
- 0x469117a,
- 0x47591a4,
- 0x47c11d6,
- 0x48d51f0,
- 0x648d9235,
- 0x648dd236,
- 0x4939237,
- 0x499524e,
- 0x4a25265,
- 0x4aa1289,
- 0x4ae52a8,
- 0x4bc92b9,
- 0x4bfd2f2,
- 0x4c5d2ff,
- 0x4cd1317,
- 0x4d59334,
- 0x4d99356,
- 0x4e09366,
- 0x64e0d382,
- 0x64e11383,
- 0x24e15384,
- 0x4e2d385,
- 0x4e4938b,
- 0x4e8d392,
- 0x4e9d3a3,
- 0x4eb53a7,
- 0x4f2d3ad,
- 0x4f353cb,
- 0x4f493cd,
- 0x4f613d2,
- 0x4f893d8,
- 0x4f8d3e2,
- 0x4f953e3,
- 0x4fa93e5,
- 0x4fc53ea,
- 0x4fc93f1,
- 0x4fd13f2,
- 0x500d3f4,
- 0x5021403,
- 0x5029408,
- 0x503140a,
- 0x503540c,
- 0x505940d,
- 0x507d416,
- 0x509541f,
- 0x5099425,
- 0x50a1426,
- 0x50a5428,
- 0x50f9429,
- 0x511d43e,
- 0x513d447,
- 0x515944f,
- 0x5169456,
- 0x517d45a,
- 0x518145f,
- 0x5189460,
- 0x519d462,
- 0x51ad467,
- 0x51b146b,
- 0x51cd46c,
- 0x5a5d473,
- 0x5a95697,
- 0x5ac16a5,
- 0x5ad96b0,
- 0x5af96b6,
- 0x5b196be,
- 0x5b5d6c6,
- 0x5b656d7,
- 0x25b696d9,
- 0x25b6d6da,
- 0x5b716db,
- 0x5c956dc,
- 0x25c99725,
- 0x25ca1726,
- 0x25ca9728,
- 0x25cb572a,
- 0x5cb972d,
- 0x5ce172e,
- 0x5d09738,
- 0x5d0d742,
- 0x25d45743,
- 0x5d59751,
- 0x68b1756,
- 0x68b5a2c,
- 0x68b9a2d,
- 0x268bda2e,
- 0x68c1a2f,
- 0x268c5a30,
- 0x68c9a31,
- 0x268d5a32,
- 0x68d9a35,
- 0x68dda36,
- 0x268e1a37,
- 0x68e5a38,
- 0x268eda39,
- 0x68f1a3b,
- 0x68f5a3c,
- 0x26905a3d,
- 0x6909a41,
- 0x690da42,
- 0x6911a43,
- 0x6915a44,
- 0x26919a45,
- 0x691da46,
- 0x6921a47,
- 0x6925a48,
- 0x6929a49,
- 0x26931a4a,
- 0x6935a4c,
- 0x6939a4d,
- 0x693da4e,
- 0x26941a4f,
- 0x6945a50,
- 0x2694da51,
- 0x26951a53,
- 0x696da54,
- 0x6979a5b,
- 0x69b9a5e,
- 0x69bda6e,
- 0x69e1a6f,
- 0x6b31a78,
- 0x26b39acc,
- 0x26b3dace,
- 0x26b41acf,
- 0x6b49ad0,
- 0x6c25ad2,
- 0x6c29b09,
- 0x6c55b0a,
- 0x6c75b15,
- 0x6c81b1d,
- 0x6ca1b20,
- 0x6cd9b28,
- 0x6f71b36,
- 0x702dbdc,
- 0x7041c0b,
- 0x7075c10,
- 0x70a5c1d,
- 0x70c1c29,
- 0x70e5c30,
- 0x7101c39,
- 0x711dc40,
- 0x7141c47,
- 0x7151c50,
- 0x7185c54,
- 0x71a1c61,
- 0x73adc68,
- 0x73d1ceb,
- 0x73f1cf4,
- 0x7405cfc,
- 0x7419d01,
- 0x7439d06,
- 0x74ddd0e,
- 0x74f9d37,
- 0x7515d3e,
+ 0x26989a5,
+ 0x26a89a6,
+ 0x26b09aa,
+ 0x26e49ac,
+ 0x26e89b9,
+ 0x26f89ba,
+ 0x27909be,
+ 0x227949e4,
+ 0x279c9e5,
+ 0x27a09e7,
+ 0x27b89e8,
+ 0x27cc9ee,
+ 0x27f49f3,
+ 0x28149fd,
+ 0x2844a05,
+ 0x286ca11,
+ 0x2870a1b,
+ 0x2894a1c,
+ 0x2898a25,
+ 0x28aca26,
+ 0x28b0a2b,
+ 0x28b4a2c,
+ 0x28d4a2d,
+ 0x28eca35,
+ 0x28f0a3b,
+ 0x228f4a3c,
+ 0x28f8a3d,
+ 0x2908a3e,
+ 0x290ca42,
+ 0x2984a43,
+ 0x29a0a61,
+ 0x29aca68,
+ 0x29c0a6b,
+ 0x29d8a70,
+ 0x29eca76,
+ 0x2a04a7b,
+ 0x2a1ca81,
+ 0x2a34a87,
+ 0x2a50a8d,
+ 0x2a68a94,
+ 0x2ac8a9a,
+ 0x2ae0ab2,
+ 0x2ae4ab8,
+ 0x2af8ab9,
+ 0x2b3cabe,
+ 0x2bbcacf,
+ 0x2be8aef,
+ 0x2becafa,
+ 0x2bf4afb,
+ 0x2c14afd,
+ 0x2c18b05,
+ 0x2c38b06,
+ 0x2c40b0e,
+ 0x2c78b10,
+ 0x2cb8b1e,
+ 0x2cbcb2e,
+ 0x2d0cb2f,
+ 0x2d10b43,
+ 0x22d14b44,
+ 0x2d2cb45,
+ 0x2d50b4b,
+ 0x2d70b54,
+ 0x3334b5c,
+ 0x3340ccd,
+ 0x3360cd0,
+ 0x351ccd8,
+ 0x35ecd47,
+ 0x365cd7b,
+ 0x36b4d97,
+ 0x379cdad,
+ 0x37f4de7,
+ 0x3830dfd,
+ 0x392ce0c,
+ 0x39f8e4b,
+ 0x3a90e7e,
+ 0x3b20ea4,
+ 0x3b84ec8,
+ 0x3dbcee1,
+ 0x3e74f6f,
+ 0x3f40f9d,
+ 0x3f8cfd0,
+ 0x4014fe3,
+ 0x4051005,
+ 0x40a1014,
+ 0x4119028,
+ 0x6411d046,
+ 0x64121047,
+ 0x64125048,
+ 0x41a1049,
+ 0x41fd068,
+ 0x427907f,
+ 0x42f109e,
+ 0x43710bc,
+ 0x43dd0dc,
+ 0x45090f7,
+ 0x4561142,
+ 0x64565158,
+ 0x45fd159,
+ 0x468517f,
+ 0x46d11a1,
+ 0x47391b4,
+ 0x47e11ce,
+ 0x48a91f8,
+ 0x491122a,
+ 0x4a25244,
+ 0x64a29289,
+ 0x64a2d28a,
+ 0x4a8928b,
+ 0x4ae52a2,
+ 0x4b752b9,
+ 0x4bf12dd,
+ 0x4c352fc,
+ 0x4d1930d,
+ 0x4d4d346,
+ 0x4dad353,
+ 0x4e2136b,
+ 0x4ea9388,
+ 0x4ee93aa,
+ 0x4f593ba,
+ 0x64f5d3d6,
+ 0x64f613d7,
+ 0x24f653d8,
+ 0x4f7d3d9,
+ 0x4f993df,
+ 0x4fdd3e6,
+ 0x4fed3f7,
+ 0x50053fb,
+ 0x507d401,
+ 0x508541f,
+ 0x5099421,
+ 0x50b1426,
+ 0x50d942c,
+ 0x50dd436,
+ 0x50e5437,
+ 0x50f9439,
+ 0x511543e,
+ 0x5119445,
+ 0x5121446,
+ 0x515d448,
+ 0x5171457,
+ 0x517945c,
+ 0x518145e,
+ 0x5185460,
+ 0x51a9461,
+ 0x51cd46a,
+ 0x51e5473,
+ 0x51e9479,
+ 0x51f147a,
+ 0x51f547c,
+ 0x524d47d,
+ 0x5271493,
+ 0x529149c,
+ 0x52ad4a4,
+ 0x52bd4ab,
+ 0x52d14af,
+ 0x52d54b4,
+ 0x52dd4b5,
+ 0x52f14b7,
+ 0x53014bc,
+ 0x53054c0,
+ 0x53214c1,
+ 0x5bb14c8,
+ 0x5be96ec,
+ 0x5c156fa,
+ 0x5c2d705,
+ 0x5c4d70b,
+ 0x5c6d713,
+ 0x5cb171b,
+ 0x5cb972c,
+ 0x25cbd72e,
+ 0x25cc172f,
+ 0x5cc5730,
+ 0x5e01731,
+ 0x25e05780,
+ 0x25e11781,
+ 0x25e19784,
+ 0x25e25786,
+ 0x5e29789,
+ 0x5e2d78a,
+ 0x5e5578b,
+ 0x5e7d795,
+ 0x5e8179f,
+ 0x5eb97a0,
+ 0x5ecd7ae,
+ 0x6a257b3,
+ 0x6a29a89,
+ 0x6a2da8a,
+ 0x26a31a8b,
+ 0x6a35a8c,
+ 0x26a39a8d,
+ 0x6a3da8e,
+ 0x26a49a8f,
+ 0x6a4da92,
+ 0x6a51a93,
+ 0x26a55a94,
+ 0x6a59a95,
+ 0x26a61a96,
+ 0x6a65a98,
+ 0x6a69a99,
+ 0x26a79a9a,
+ 0x6a7da9e,
+ 0x6a81a9f,
+ 0x6a85aa0,
+ 0x6a89aa1,
+ 0x26a8daa2,
+ 0x6a91aa3,
+ 0x6a95aa4,
+ 0x6a99aa5,
+ 0x6a9daa6,
+ 0x26aa5aa7,
+ 0x6aa9aa9,
+ 0x6aadaaa,
+ 0x6ab1aab,
+ 0x26ab5aac,
+ 0x6ab9aad,
+ 0x26ac1aae,
+ 0x26ac5ab0,
+ 0x6ae1ab1,
+ 0x6aedab8,
+ 0x6b2dabb,
+ 0x6b31acb,
+ 0x6b55acc,
+ 0x6b59ad5,
+ 0x6cc1ad6,
+ 0x26cc5b30,
+ 0x26ccdb31,
+ 0x26cd1b33,
+ 0x26cd5b34,
+ 0x6cddb35,
+ 0x6db9b37,
+ 0x6dbdb6e,
+ 0x6de9b6f,
+ 0x6dedb7a,
+ 0x6e0db7b,
+ 0x6e19b83,
+ 0x6e39b86,
+ 0x6e71b8e,
+ 0x7109b9c,
+ 0x71c5c42,
+ 0x71d9c71,
+ 0x720dc76,
+ 0x723dc83,
+ 0x7259c8f,
+ 0x727dc96,
+ 0x7299c9f,
+ 0x72b5ca6,
+ 0x72d9cad,
+ 0x72e9cb6,
+ 0x72edcba,
+ 0x7321cbb,
+ 0x733dcc8,
+ 0x7359ccf,
+ 0x737dcd6,
+ 0x739dcdf,
+ 0x73b1ce7,
+ 0x73c5cec,
+ 0x73c9cf1,
+ 0x73e9cf2,
+ 0x748dcfa,
+ 0x74a9d23,
+ 0x74c9d2a,
+ 0x74cdd32,
+ 0x74d1d33,
+ 0x74d5d34,
+ 0x74e9d35,
+ 0x7509d3a,
+ 0x7515d42,
0x7519d45,
- 0x751dd46,
- 0x7521d47,
- 0x7535d48,
- 0x7555d4d,
- 0x7561d55,
- 0x7565d58,
- 0x7595d59,
- 0x7615d65,
- 0x7629d85,
- 0x762dd8a,
- 0x7645d8b,
- 0x7649d91,
- 0x7655d92,
- 0x7659d95,
- 0x7675d96,
- 0x76b1d9d,
- 0x76b5dac,
- 0x76d5dad,
- 0x7725db5,
- 0x773ddc9,
- 0x7791dcf,
- 0x7795de4,
- 0x7799de5,
- 0x77ddde6,
- 0x77eddf7,
- 0x7825dfb,
- 0x7855e09,
- 0x7991e15,
- 0x79b5e64,
- 0x79e1e6d,
- 0x79ede78,
- 0x79f1e7b,
- 0x7b01e7c,
- 0x7b0dec0,
- 0x7b19ec3,
- 0x7b25ec6,
- 0x7b31ec9,
- 0x7b3decc,
- 0x7b49ecf,
- 0x7b55ed2,
- 0x7b61ed5,
- 0x7b6ded8,
+ 0x7549d46,
+ 0x75c9d52,
+ 0x75ddd72,
+ 0x75e1d77,
+ 0x75f9d78,
+ 0x75fdd7e,
+ 0x7609d7f,
+ 0x760dd82,
+ 0x7629d83,
+ 0x7665d8a,
+ 0x7669d99,
+ 0x7689d9a,
+ 0x76d9da2,
+ 0x76f1db6,
+ 0x7745dbc,
+ 0x7749dd1,
+ 0x774ddd2,
+ 0x7751dd3,
+ 0x7795dd4,
+ 0x77a5de5,
+ 0x77ddde9,
+ 0x780ddf7,
+ 0x7955e03,
+ 0x7979e55,
+ 0x79a5e5e,
+ 0x79b1e69,
+ 0x79b9e6c,
+ 0x7ac9e6e,
+ 0x7ad5eb2,
+ 0x7ae1eb5,
+ 0x7aedeb8,
+ 0x7af9ebb,
+ 0x7b05ebe,
+ 0x7b11ec1,
+ 0x7b1dec4,
+ 0x7b29ec7,
+ 0x7b35eca,
+ 0x7b41ecd,
+ 0x7b4ded0,
+ 0x7b59ed3,
+ 0x7b65ed6,
+ 0x7b6ded9,
0x7b79edb,
0x7b85ede,
0x7b91ee1,
0x7b9dee4,
- 0x7ba5ee7,
- 0x7bb1ee9,
- 0x7bbdeec,
- 0x7bc9eef,
- 0x7bd5ef2,
- 0x7be1ef5,
- 0x7bedef8,
- 0x7bf9efb,
- 0x7c05efe,
- 0x7c11f01,
- 0x7c1df04,
- 0x7c29f07,
- 0x7c35f0a,
- 0x7c41f0d,
+ 0x7ba9ee7,
+ 0x7bb5eea,
+ 0x7bc1eed,
+ 0x7bcdef0,
+ 0x7bd9ef3,
+ 0x7be5ef6,
+ 0x7bf1ef9,
+ 0x7bfdefc,
+ 0x7c09eff,
+ 0x7c15f02,
+ 0x7c21f05,
+ 0x7c2df08,
+ 0x7c39f0b,
+ 0x7c41f0e,
0x7c4df10,
0x7c59f13,
0x7c65f16,
0x7c71f19,
- 0x7c79f1c,
- 0x7c85f1e,
- 0x7c91f21,
- 0x7c9df24,
- 0x7ca9f27,
- 0x7cb5f2a,
- 0x7cc1f2d,
- 0x7ccdf30,
- 0x7cd9f33,
- 0x7ce5f36,
+ 0x7c7df1c,
+ 0x7c89f1f,
+ 0x7c95f22,
+ 0x7ca1f25,
+ 0x7cadf28,
+ 0x7cb9f2b,
+ 0x7cc5f2e,
+ 0x7cd1f31,
+ 0x7cddf34,
+ 0x7ce5f37,
0x7cf1f39,
0x7cfdf3c,
0x7d09f3f,
0x7d15f42,
- 0x7d1df45,
- 0x7d29f47,
- 0x7d35f4a,
- 0x7d41f4d,
- 0x7d4df50,
- 0x7d59f53,
- 0x7d65f56,
- 0x7d71f59,
- 0x7d7df5c,
- 0x7d81f5f,
- 0x7d8df60,
- 0x7da5f63,
- 0x7da9f69,
- 0x7db9f6a,
- 0x7dd1f6e,
- 0x7e15f74,
- 0x7e29f85,
- 0x7e5df8a,
- 0x7e6df97,
- 0x7e89f9b,
- 0x7ea1fa2,
- 0x7ea5fa8,
- 0x27ee9fa9,
- 0x7eedfba,
- 0x7f19fbb,
- 0x7f1dfc6,
+ 0x7d21f45,
+ 0x7d2df48,
+ 0x7d39f4b,
+ 0x7d45f4e,
+ 0x7d49f51,
+ 0x7d55f52,
+ 0x7d6df55,
+ 0x7d71f5b,
+ 0x7d81f5c,
+ 0x7d99f60,
+ 0x7dddf66,
+ 0x7df1f77,
+ 0x7e25f7c,
+ 0x7e35f89,
+ 0x7e51f8d,
+ 0x7e69f94,
+ 0x7e6df9a,
+ 0x27eb1f9b,
+ 0x7eb5fac,
+ 0x7ee1fad,
+ 0x7ee5fb8,
}
-// max children 434 (capacity 511)
-// max text offset 27930 (capacity 32767)
+// max children 466 (capacity 511)
+// max text offset 28023 (capacity 32767)
// max text length 36 (capacity 63)
-// max hi 8135 (capacity 16383)
-// max lo 8134 (capacity 16383)
+// max hi 8121 (capacity 16383)
+// max lo 8120 (capacity 16383)
diff --git a/vendor/golang.org/x/net/publicsuffix/table_test.go b/vendor/golang.org/x/net/publicsuffix/table_test.go
index 5433f3b17..f60c80e79 100644
--- a/vendor/golang.org/x/net/publicsuffix/table_test.go
+++ b/vendor/golang.org/x/net/publicsuffix/table_test.go
@@ -541,6 +541,7 @@ var rules = [...]string{
"org.cw",
"cx",
"gov.cx",
+ "cy",
"ac.cy",
"biz.cy",
"com.cy",
@@ -2207,9 +2208,7 @@ var rules = [...]string{
"aso.kumamoto.jp",
"choyo.kumamoto.jp",
"gyokuto.kumamoto.jp",
- "hitoyoshi.kumamoto.jp",
"kamiamakusa.kumamoto.jp",
- "kashima.kumamoto.jp",
"kikuchi.kumamoto.jp",
"kumamoto.kumamoto.jp",
"mashiki.kumamoto.jp",
@@ -3968,20 +3967,21 @@ var rules = [...]string{
"net.ng",
"org.ng",
"sch.ng",
+ "ni",
+ "ac.ni",
+ "biz.ni",
+ "co.ni",
"com.ni",
- "gob.ni",
"edu.ni",
- "org.ni",
- "nom.ni",
- "net.ni",
- "mil.ni",
- "co.ni",
- "biz.ni",
- "web.ni",
- "int.ni",
- "ac.ni",
+ "gob.ni",
"in.ni",
"info.ni",
+ "int.ni",
+ "mil.ni",
+ "net.ni",
+ "nom.ni",
+ "org.ni",
+ "web.ni",
"nl",
"bv.nl",
"no",
@@ -4775,6 +4775,7 @@ var rules = [...]string{
"net.om",
"org.om",
"pro.om",
+ "onion",
"org",
"pa",
"ac.pa",
@@ -5126,133 +5127,9 @@ var rules = [...]string{
"org.rs",
"ru",
"ac.ru",
- "com.ru",
"edu.ru",
- "int.ru",
- "net.ru",
- "org.ru",
- "pp.ru",
- "adygeya.ru",
- "altai.ru",
- "amur.ru",
- "arkhangelsk.ru",
- "astrakhan.ru",
- "bashkiria.ru",
- "belgorod.ru",
- "bir.ru",
- "bryansk.ru",
- "buryatia.ru",
- "cbg.ru",
- "chel.ru",
- "chelyabinsk.ru",
- "chita.ru",
- "chukotka.ru",
- "chuvashia.ru",
- "dagestan.ru",
- "dudinka.ru",
- "e-burg.ru",
- "grozny.ru",
- "irkutsk.ru",
- "ivanovo.ru",
- "izhevsk.ru",
- "jar.ru",
- "joshkar-ola.ru",
- "kalmykia.ru",
- "kaluga.ru",
- "kamchatka.ru",
- "karelia.ru",
- "kazan.ru",
- "kchr.ru",
- "kemerovo.ru",
- "khabarovsk.ru",
- "khakassia.ru",
- "khv.ru",
- "kirov.ru",
- "koenig.ru",
- "komi.ru",
- "kostroma.ru",
- "krasnoyarsk.ru",
- "kuban.ru",
- "kurgan.ru",
- "kursk.ru",
- "lipetsk.ru",
- "magadan.ru",
- "mari.ru",
- "mari-el.ru",
- "marine.ru",
- "mordovia.ru",
- "msk.ru",
- "murmansk.ru",
- "nalchik.ru",
- "nnov.ru",
- "nov.ru",
- "novosibirsk.ru",
- "nsk.ru",
- "omsk.ru",
- "orenburg.ru",
- "oryol.ru",
- "palana.ru",
- "penza.ru",
- "perm.ru",
- "ptz.ru",
- "rnd.ru",
- "ryazan.ru",
- "sakhalin.ru",
- "samara.ru",
- "saratov.ru",
- "simbirsk.ru",
- "smolensk.ru",
- "spb.ru",
- "stavropol.ru",
- "stv.ru",
- "surgut.ru",
- "tambov.ru",
- "tatarstan.ru",
- "tom.ru",
- "tomsk.ru",
- "tsaritsyn.ru",
- "tsk.ru",
- "tula.ru",
- "tuva.ru",
- "tver.ru",
- "tyumen.ru",
- "udm.ru",
- "udmurtia.ru",
- "ulan-ude.ru",
- "vladikavkaz.ru",
- "vladimir.ru",
- "vladivostok.ru",
- "volgograd.ru",
- "vologda.ru",
- "voronezh.ru",
- "vrn.ru",
- "vyatka.ru",
- "yakutia.ru",
- "yamal.ru",
- "yaroslavl.ru",
- "yekaterinburg.ru",
- "yuzhno-sakhalinsk.ru",
- "amursk.ru",
- "baikal.ru",
- "cmw.ru",
- "fareast.ru",
- "jamal.ru",
- "kms.ru",
- "k-uralsk.ru",
- "kustanai.ru",
- "kuzbass.ru",
- "mytis.ru",
- "nakhodka.ru",
- "nkz.ru",
- "norilsk.ru",
- "oskol.ru",
- "pyatigorsk.ru",
- "rubtsovsk.ru",
- "snz.ru",
- "syzran.ru",
- "vdonsk.ru",
- "zgrad.ru",
"gov.ru",
+ "int.ru",
"mil.ru",
"test.ru",
"rw",
@@ -6379,7 +6256,6 @@ var rules = [...]string{
"education",
"email",
"emerck",
- "emerson",
"energy",
"engineer",
"engineering",
@@ -6542,6 +6418,7 @@ var rules = [...]string{
"honda",
"honeywell",
"horse",
+ "hospital",
"host",
"hosting",
"hot",
@@ -7293,43 +7170,64 @@ var rules = [...]string{
"*.alces.network",
"*.alwaysdata.net",
"cloudfront.net",
- "compute.amazonaws.com",
- "ap-northeast-1.compute.amazonaws.com",
- "ap-northeast-2.compute.amazonaws.com",
- "ap-southeast-1.compute.amazonaws.com",
- "ap-southeast-2.compute.amazonaws.com",
- "eu-central-1.compute.amazonaws.com",
- "eu-west-1.compute.amazonaws.com",
- "sa-east-1.compute.amazonaws.com",
- "us-gov-west-1.compute.amazonaws.com",
- "us-west-1.compute.amazonaws.com",
- "us-west-2.compute.amazonaws.com",
- "compute-1.amazonaws.com",
- "z-1.compute-1.amazonaws.com",
- "z-2.compute-1.amazonaws.com",
+ "*.compute.amazonaws.com",
+ "*.compute-1.amazonaws.com",
+ "*.compute.amazonaws.com.cn",
"us-east-1.amazonaws.com",
- "compute.amazonaws.com.cn",
- "cn-north-1.compute.amazonaws.com.cn",
- "elasticbeanstalk.com",
- "elb.amazonaws.com",
- "s3.amazonaws.com",
+ "elasticbeanstalk.cn-north-1.amazonaws.com.cn",
+ "*.elasticbeanstalk.com",
+ "*.elb.amazonaws.com",
+ "*.elb.amazonaws.com.cn",
+ "*.s3.amazonaws.com",
"s3-ap-northeast-1.amazonaws.com",
"s3-ap-northeast-2.amazonaws.com",
+ "s3-ap-south-1.amazonaws.com",
"s3-ap-southeast-1.amazonaws.com",
"s3-ap-southeast-2.amazonaws.com",
+ "s3-ca-central-1.amazonaws.com",
"s3-eu-central-1.amazonaws.com",
"s3-eu-west-1.amazonaws.com",
"s3-external-1.amazonaws.com",
- "s3-external-2.amazonaws.com",
"s3-fips-us-gov-west-1.amazonaws.com",
"s3-sa-east-1.amazonaws.com",
"s3-us-gov-west-1.amazonaws.com",
+ "s3-us-east-2.amazonaws.com",
"s3-us-west-1.amazonaws.com",
"s3-us-west-2.amazonaws.com",
"s3.ap-northeast-2.amazonaws.com",
+ "s3.ap-south-1.amazonaws.com",
"s3.cn-north-1.amazonaws.com.cn",
+ "s3.ca-central-1.amazonaws.com",
"s3.eu-central-1.amazonaws.com",
+ "s3.us-east-2.amazonaws.com",
+ "s3.dualstack.ap-northeast-1.amazonaws.com",
+ "s3.dualstack.ap-northeast-2.amazonaws.com",
+ "s3.dualstack.ap-south-1.amazonaws.com",
+ "s3.dualstack.ap-southeast-1.amazonaws.com",
+ "s3.dualstack.ap-southeast-2.amazonaws.com",
+ "s3.dualstack.ca-central-1.amazonaws.com",
+ "s3.dualstack.eu-central-1.amazonaws.com",
+ "s3.dualstack.eu-west-1.amazonaws.com",
+ "s3.dualstack.sa-east-1.amazonaws.com",
+ "s3.dualstack.us-east-1.amazonaws.com",
+ "s3.dualstack.us-east-2.amazonaws.com",
+ "s3-website-us-east-1.amazonaws.com",
+ "s3-website-us-west-1.amazonaws.com",
+ "s3-website-us-west-2.amazonaws.com",
+ "s3-website-ap-northeast-1.amazonaws.com",
+ "s3-website-ap-southeast-1.amazonaws.com",
+ "s3-website-ap-southeast-2.amazonaws.com",
+ "s3-website-eu-west-1.amazonaws.com",
+ "s3-website-sa-east-1.amazonaws.com",
+ "s3-website.ap-northeast-2.amazonaws.com",
+ "s3-website.ap-south-1.amazonaws.com",
+ "s3-website.ca-central-1.amazonaws.com",
+ "s3-website.eu-central-1.amazonaws.com",
+ "s3-website.us-east-2.amazonaws.com",
+ "t3l3p0rt.net",
+ "tele.amune.org",
"on-aptible.com",
+ "user.party.eus",
"pimienta.org",
"poivron.org",
"potager.org",
@@ -7402,6 +7300,15 @@ var rules = [...]string{
"co.nl",
"co.no",
"*.platform.sh",
+ "dyn.cosidns.de",
+ "dynamisches-dns.de",
+ "dnsupdater.de",
+ "internet-dns.de",
+ "l-o-g-i-n.de",
+ "dynamic-dns.info",
+ "feste-ip.net",
+ "knx-server.net",
+ "static-access.net",
"realm.cz",
"*.cryptonomic.net",
"cupcake.is",
@@ -7701,8 +7608,19 @@ var rules = [...]string{
"webhop.org",
"worse-than.tv",
"writesthisblog.com",
+ "ddnss.de",
+ "dyn.ddnss.de",
+ "dyndns.ddnss.de",
+ "dyndns1.de",
+ "dyn-ip24.de",
+ "home-webserver.de",
+ "dyn.home-webserver.de",
+ "myhome-server.de",
+ "ddnss.org",
"dynv6.net",
"e4.cz",
+ "enonic.io",
+ "customer.enonic.io",
"eu.org",
"al.eu.org",
"asso.eu.org",
@@ -7764,11 +7682,14 @@ var rules = [...]string{
"us-1.evennode.com",
"us-2.evennode.com",
"apps.fbsbx.com",
+ "map.fastly.net",
+ "a.prod.fastly.net",
+ "global.prod.fastly.net",
"a.ssl.fastly.net",
"b.ssl.fastly.net",
"global.ssl.fastly.net",
- "a.prod.fastly.net",
- "global.prod.fastly.net",
+ "fastlylb.net",
+ "map.fastlylb.net",
"fhapp.xyz",
"firebaseapp.com",
"flynnhub.com",
@@ -7778,9 +7699,12 @@ var rules = [...]string{
"fbxos.fr",
"freebox-os.fr",
"freeboxos.fr",
+ "myfusion.cloud",
+ "futurehosting.at",
"futuremailing.at",
"*.ex.ortsinfo.at",
"*.kunden.ortsinfo.at",
+ "*.statics.cloud",
"service.gov.uk",
"github.io",
"githubusercontent.com",
@@ -7790,7 +7714,7 @@ var rules = [...]string{
"gist.githubcloud.com",
"*.githubcloudusercontent.com",
"gitlab.io",
- "ro.com",
+ "homeoffice.gov.uk",
"ro.im",
"shop.ro",
"goip.de",
@@ -8036,6 +7960,7 @@ var rules = [...]string{
"pantheonsite.io",
"gotpantheon.com",
"mypep.link",
+ "on-web.fr",
"xen.prgmr.com",
"priv.at",
"protonet.io",
@@ -8054,19 +7979,34 @@ var rules = [...]string{
"sandcats.io",
"logoip.de",
"logoip.com",
+ "firewall-gateway.com",
+ "firewall-gateway.de",
+ "my-gateway.de",
+ "my-router.de",
+ "spdns.de",
+ "spdns.eu",
+ "firewall-gateway.net",
+ "my-firewall.org",
+ "myfirewall.org",
+ "spdns.org",
"biz.ua",
"co.ua",
"pp.ua",
+ "shiftedit.io",
"myshopblocks.com",
+ "1kapp.com",
+ "appchizi.com",
+ "applinzi.com",
"sinaapp.com",
"vipsinaapp.com",
- "1kapp.com",
"bounty-full.com",
"alpha.bounty-full.com",
"beta.bounty-full.com",
"static.land",
"dev.static.land",
"sites.static.land",
+ "apps.lair.io",
+ "*.stolos.io",
"spacekit.io",
"stackspace.space",
"diskstation.me",
@@ -8094,16 +8034,41 @@ var rules = [...]string{
"*.transurl.eu",
"*.transurl.nl",
"tuxfamily.org",
+ "dd-dns.de",
+ "diskstation.eu",
+ "diskstation.org",
+ "dray-dns.de",
+ "draydns.de",
+ "dyn-vpn.de",
+ "dynvpn.de",
+ "mein-vigor.de",
+ "my-vigor.de",
+ "my-wan.de",
+ "syno-ds.de",
+ "synology-diskstation.de",
+ "synology-ds.de",
"hk.com",
"hk.org",
"ltd.hk",
"inc.hk",
"lib.de.us",
"router.management",
+ "remotewd.com",
"wmflabs.org",
"yolasite.com",
+ "ybo.faith",
+ "yombo.me",
+ "homelink.one",
+ "ybo.party",
+ "ybo.review",
+ "ybo.science",
+ "ybo.trade",
"za.net",
"za.org",
+ "now.sh",
+ "cc.ua",
+ "inf.ua",
+ "ltd.ua",
}
var nodeLabels = [...]string{
@@ -8497,7 +8462,6 @@ var nodeLabels = [...]string{
"eg",
"email",
"emerck",
- "emerson",
"energy",
"engineer",
"engineering",
@@ -8693,6 +8657,7 @@ var nodeLabels = [...]string{
"honda",
"honeywell",
"horse",
+ "hospital",
"host",
"hosting",
"hot",
@@ -9034,6 +8999,7 @@ var nodeLabels = [...]string{
"omega",
"one",
"ong",
+ "onion",
"onl",
"online",
"onyourside",
@@ -9811,6 +9777,7 @@ var nodeLabels = [...]string{
"ac",
"biz",
"co",
+ "futurehosting",
"futuremailing",
"gv",
"info",
@@ -10134,6 +10101,8 @@ var nodeLabels = [...]string{
"gov",
"mil",
"magentosite",
+ "myfusion",
+ "statics",
"cloudns",
"co",
"com",
@@ -10186,8 +10155,9 @@ var nodeLabels = [...]string{
"amazonaws",
"cn-north-1",
"compute",
+ "elb",
+ "elasticbeanstalk",
"s3",
- "cn-north-1",
"arts",
"com",
"edu",
@@ -10209,6 +10179,8 @@ var nodeLabels = [...]string{
"africa",
"alpha-myqnapcloud",
"amazonaws",
+ "appchizi",
+ "applinzi",
"appspot",
"ar",
"betainabox",
@@ -10265,6 +10237,7 @@ var nodeLabels = [...]string{
"familyds",
"fbsbx",
"firebaseapp",
+ "firewall-gateway",
"flynnhub",
"freebox-os",
"freeboxos",
@@ -10429,8 +10402,8 @@ var nodeLabels = [...]string{
"qc",
"quicksytes",
"rackmaze",
+ "remotewd",
"rhcloud",
- "ro",
"ru",
"sa",
"saves-the-whales",
@@ -10472,39 +10445,75 @@ var nodeLabels = [...]string{
"xenapponazure",
"yolasite",
"za",
+ "ap-northeast-1",
"ap-northeast-2",
+ "ap-south-1",
+ "ap-southeast-1",
+ "ap-southeast-2",
+ "ca-central-1",
"compute",
"compute-1",
"elb",
"eu-central-1",
+ "eu-west-1",
"s3",
"s3-ap-northeast-1",
"s3-ap-northeast-2",
+ "s3-ap-south-1",
"s3-ap-southeast-1",
"s3-ap-southeast-2",
+ "s3-ca-central-1",
"s3-eu-central-1",
"s3-eu-west-1",
"s3-external-1",
- "s3-external-2",
"s3-fips-us-gov-west-1",
"s3-sa-east-1",
+ "s3-us-east-2",
"s3-us-gov-west-1",
"s3-us-west-1",
"s3-us-west-2",
+ "s3-website-ap-northeast-1",
+ "s3-website-ap-southeast-1",
+ "s3-website-ap-southeast-2",
+ "s3-website-eu-west-1",
+ "s3-website-sa-east-1",
+ "s3-website-us-east-1",
+ "s3-website-us-west-1",
+ "s3-website-us-west-2",
+ "sa-east-1",
"us-east-1",
+ "us-east-2",
+ "dualstack",
"s3",
- "ap-northeast-1",
- "ap-northeast-2",
- "ap-southeast-1",
- "ap-southeast-2",
- "eu-central-1",
- "eu-west-1",
- "sa-east-1",
- "us-gov-west-1",
- "us-west-1",
- "us-west-2",
- "z-1",
- "z-2",
+ "dualstack",
+ "s3",
+ "s3-website",
+ "s3",
+ "dualstack",
+ "s3",
+ "s3-website",
+ "s3",
+ "dualstack",
+ "s3",
+ "dualstack",
+ "s3",
+ "dualstack",
+ "s3",
+ "s3-website",
+ "s3",
+ "dualstack",
+ "s3",
+ "s3-website",
+ "s3",
+ "dualstack",
+ "s3",
+ "dualstack",
+ "s3",
+ "dualstack",
+ "s3",
+ "dualstack",
+ "s3",
+ "s3-website",
"s3",
"alpha",
"beta",
@@ -10559,17 +10568,46 @@ var nodeLabels = [...]string{
"realm",
"blogspot",
"com",
+ "cosidns",
+ "dd-dns",
+ "ddnss",
"dnshome",
+ "dnsupdater",
+ "dray-dns",
+ "draydns",
+ "dyn-ip24",
+ "dyn-vpn",
+ "dynamisches-dns",
+ "dyndns1",
+ "dynvpn",
+ "firewall-gateway",
"fuettertdasnetz",
"goip",
+ "home-webserver",
+ "internet-dns",
"isteingeek",
"istmein",
"keymachine",
+ "l-o-g-i-n",
"lebtimnetz",
"leitungsen",
"logoip",
+ "mein-vigor",
+ "my-gateway",
+ "my-router",
+ "my-vigor",
+ "my-wan",
+ "myhome-server",
+ "spdns",
+ "syno-ds",
+ "synology-diskstation",
+ "synology-ds",
"taifun-dns",
"traeumtgerade",
+ "dyn",
+ "dyn",
+ "dyndns",
+ "dyn",
"biz",
"blogspot",
"co",
@@ -10648,9 +10686,14 @@ var nodeLabels = [...]string{
"net",
"org",
"cloudns",
+ "diskstation",
"mycd",
+ "spdns",
"transurl",
"wellbeingzone",
+ "party",
+ "user",
+ "ybo",
"aland",
"blogspot",
"dy",
@@ -10679,6 +10722,7 @@ var nodeLabels = [...]string{
"medecin",
"nom",
"notaires",
+ "on-web",
"pharmacien",
"port",
"prd",
@@ -10878,6 +10922,7 @@ var nodeLabels = [...]string{
"barrell-of-knowledge",
"cloudns",
"dvrcam",
+ "dynamic-dns",
"dyndns",
"for-our",
"groks-the",
@@ -10896,16 +10941,22 @@ var nodeLabels = [...]string{
"com",
"dedyn",
"drud",
+ "enonic",
"github",
"gitlab",
"hasura-app",
"hzc",
+ "lair",
"ngrok",
"nid",
"pantheonsite",
"protonet",
"sandcats",
+ "shiftedit",
"spacekit",
+ "stolos",
+ "customer",
+ "apps",
"com",
"edu",
"gov",
@@ -12226,9 +12277,7 @@ var nodeLabels = [...]string{
"aso",
"choyo",
"gyokuto",
- "hitoyoshi",
"kamiamakusa",
- "kashima",
"kikuchi",
"kumamoto",
"mashiki",
@@ -13289,6 +13338,7 @@ var nodeLabels = [...]string{
"priv",
"synology",
"webhop",
+ "yombo",
"co",
"com",
"edu",
@@ -13986,6 +14036,9 @@ var nodeLabels = [...]string{
"endofinternet",
"familyds",
"fastly",
+ "fastlylb",
+ "feste-ip",
+ "firewall-gateway",
"from-az",
"from-co",
"from-la",
@@ -14005,6 +14058,7 @@ var nodeLabels = [...]string{
"isa-geek",
"jp",
"kicks-ass",
+ "knx-server",
"mydissent",
"myeffect",
"myfritz",
@@ -14027,12 +14081,15 @@ var nodeLabels = [...]string{
"serveblog",
"serveftp",
"serveminecraft",
+ "static-access",
"sytes",
+ "t3l3p0rt",
"thruhere",
"uk",
"webhop",
"za",
"r",
+ "map",
"prod",
"ssl",
"a",
@@ -14040,6 +14097,7 @@ var nodeLabels = [...]string{
"a",
"b",
"global",
+ "map",
"alces",
"arts",
"com",
@@ -14883,7 +14941,9 @@ var nodeLabels = [...]string{
"net",
"org",
"pro",
+ "homelink",
"ae",
+ "amune",
"blogdns",
"blogsite",
"bmoattachments",
@@ -14895,6 +14955,8 @@ var nodeLabels = [...]string{
"cloudns",
"collegefan",
"couchpotatofries",
+ "ddnss",
+ "diskstation",
"dnsalias",
"dnsdojo",
"doesntexist",
@@ -14942,6 +15004,8 @@ var nodeLabels = [...]string{
"kicks-ass",
"misconfused",
"mlbfan",
+ "my-firewall",
+ "myfirewall",
"myftp",
"mysecuritycamera",
"nflfan",
@@ -14957,6 +15021,7 @@ var nodeLabels = [...]string{
"servebbs",
"serveftp",
"servegame",
+ "spdns",
"stuff-4-sale",
"sweetpepper",
"tunk",
@@ -14967,6 +15032,7 @@ var nodeLabels = [...]string{
"wmflabs",
"za",
"zapto",
+ "tele",
"c",
"rsc",
"origin",
@@ -15040,6 +15106,7 @@ var nodeLabels = [...]string{
"nom",
"org",
"sld",
+ "ybo",
"blogspot",
"com",
"edu",
@@ -15359,6 +15426,7 @@ var nodeLabels = [...]string{
"blogspot",
"com",
"nom",
+ "ybo",
"arts",
"blogspot",
"com",
@@ -15380,136 +15448,12 @@ var nodeLabels = [...]string{
"in",
"org",
"ac",
- "adygeya",
- "altai",
- "amur",
- "amursk",
- "arkhangelsk",
- "astrakhan",
- "baikal",
- "bashkiria",
- "belgorod",
- "bir",
"blogspot",
- "bryansk",
- "buryatia",
- "cbg",
- "chel",
- "chelyabinsk",
- "chita",
- "chukotka",
- "chuvashia",
- "cmw",
- "com",
- "dagestan",
- "dudinka",
- "e-burg",
"edu",
- "fareast",
"gov",
- "grozny",
"int",
- "irkutsk",
- "ivanovo",
- "izhevsk",
- "jamal",
- "jar",
- "joshkar-ola",
- "k-uralsk",
- "kalmykia",
- "kaluga",
- "kamchatka",
- "karelia",
- "kazan",
- "kchr",
- "kemerovo",
- "khabarovsk",
- "khakassia",
- "khv",
- "kirov",
- "kms",
- "koenig",
- "komi",
- "kostroma",
- "krasnoyarsk",
- "kuban",
- "kurgan",
- "kursk",
- "kustanai",
- "kuzbass",
- "lipetsk",
- "magadan",
- "mari",
- "mari-el",
- "marine",
"mil",
- "mordovia",
- "msk",
- "murmansk",
- "mytis",
- "nakhodka",
- "nalchik",
- "net",
- "nkz",
- "nnov",
- "norilsk",
- "nov",
- "novosibirsk",
- "nsk",
- "omsk",
- "orenburg",
- "org",
- "oryol",
- "oskol",
- "palana",
- "penza",
- "perm",
- "pp",
- "ptz",
- "pyatigorsk",
- "rnd",
- "rubtsovsk",
- "ryazan",
- "sakhalin",
- "samara",
- "saratov",
- "simbirsk",
- "smolensk",
- "snz",
- "spb",
- "stavropol",
- "stv",
- "surgut",
- "syzran",
- "tambov",
- "tatarstan",
"test",
- "tom",
- "tomsk",
- "tsaritsyn",
- "tsk",
- "tula",
- "tuva",
- "tver",
- "tyumen",
- "udm",
- "udmurtia",
- "ulan-ude",
- "vdonsk",
- "vladikavkaz",
- "vladimir",
- "vladivostok",
- "volgograd",
- "vologda",
- "voronezh",
- "vrn",
- "vyatka",
- "yakutia",
- "yamal",
- "yaroslavl",
- "yekaterinburg",
- "yuzhno-sakhalinsk",
- "zgrad",
"ac",
"co",
"com",
@@ -15537,6 +15481,7 @@ var nodeLabels = [...]string{
"gov",
"net",
"org",
+ "ybo",
"com",
"edu",
"gov",
@@ -15598,6 +15543,7 @@ var nodeLabels = [...]string{
"hashbang",
"mil",
"net",
+ "now",
"org",
"platform",
"blogspot",
@@ -15761,6 +15707,7 @@ var nodeLabels = [...]string{
"web",
"blogspot",
"gov",
+ "ybo",
"aero",
"biz",
"co",
@@ -15809,6 +15756,7 @@ var nodeLabels = [...]string{
"sc",
"tv",
"biz",
+ "cc",
"cherkassy",
"cherkasy",
"chernigov",
@@ -15832,6 +15780,7 @@ var nodeLabels = [...]string{
"gov",
"if",
"in",
+ "inf",
"ivano-frankivsk",
"kh",
"kharkiv",
@@ -15849,6 +15798,7 @@ var nodeLabels = [...]string{
"kyiv",
"lg",
"lt",
+ "ltd",
"lugansk",
"lutsk",
"lv",
@@ -15910,6 +15860,7 @@ var nodeLabels = [...]string{
"blogspot",
"no-ip",
"wellbeingzone",
+ "homeoffice",
"service",
"ak",
"al",
diff --git a/vendor/golang.org/x/net/route/address.go b/vendor/golang.org/x/net/route/address.go
index a56909c10..e6bfa39e9 100644
--- a/vendor/golang.org/x/net/route/address.go
+++ b/vendor/golang.org/x/net/route/address.go
@@ -24,6 +24,39 @@ type LinkAddr struct {
// Family implements the Family method of Addr interface.
func (a *LinkAddr) Family() int { return sysAF_LINK }
+func (a *LinkAddr) lenAndSpace() (int, int) {
+ l := 8 + len(a.Name) + len(a.Addr)
+ return l, roundup(l)
+}
+
+func (a *LinkAddr) marshal(b []byte) (int, error) {
+ l, ll := a.lenAndSpace()
+ if len(b) < ll {
+ return 0, errShortBuffer
+ }
+ nlen, alen := len(a.Name), len(a.Addr)
+ if nlen > 255 || alen > 255 {
+ return 0, errInvalidAddr
+ }
+ b[0] = byte(l)
+ b[1] = sysAF_LINK
+ if a.Index > 0 {
+ nativeEndian.PutUint16(b[2:4], uint16(a.Index))
+ }
+ data := b[8:]
+ if nlen > 0 {
+ b[5] = byte(nlen)
+ copy(data[:nlen], a.Addr)
+ data = data[nlen:]
+ }
+ if alen > 0 {
+ b[6] = byte(alen)
+ copy(data[:alen], a.Name)
+ data = data[alen:]
+ }
+ return ll, nil
+}
+
func parseLinkAddr(b []byte) (Addr, error) {
if len(b) < 8 {
return nil, errInvalidAddr
@@ -90,6 +123,21 @@ type Inet4Addr struct {
// Family implements the Family method of Addr interface.
func (a *Inet4Addr) Family() int { return sysAF_INET }
+func (a *Inet4Addr) lenAndSpace() (int, int) {
+ return sizeofSockaddrInet, roundup(sizeofSockaddrInet)
+}
+
+func (a *Inet4Addr) marshal(b []byte) (int, error) {
+ l, ll := a.lenAndSpace()
+ if len(b) < ll {
+ return 0, errShortBuffer
+ }
+ b[0] = byte(l)
+ b[1] = sysAF_INET
+ copy(b[4:8], a.IP[:])
+ return ll, nil
+}
+
// An Inet6Addr represents an internet address for IPv6.
type Inet6Addr struct {
IP [16]byte // IP address
@@ -99,18 +147,36 @@ type Inet6Addr struct {
// Family implements the Family method of Addr interface.
func (a *Inet6Addr) Family() int { return sysAF_INET6 }
+func (a *Inet6Addr) lenAndSpace() (int, int) {
+ return sizeofSockaddrInet6, roundup(sizeofSockaddrInet6)
+}
+
+func (a *Inet6Addr) marshal(b []byte) (int, error) {
+ l, ll := a.lenAndSpace()
+ if len(b) < ll {
+ return 0, errShortBuffer
+ }
+ b[0] = byte(l)
+ b[1] = sysAF_INET6
+ copy(b[8:24], a.IP[:])
+ if a.ZoneID > 0 {
+ nativeEndian.PutUint32(b[24:28], uint32(a.ZoneID))
+ }
+ return ll, nil
+}
+
// parseInetAddr parses b as an internet address for IPv4 or IPv6.
func parseInetAddr(af int, b []byte) (Addr, error) {
switch af {
case sysAF_INET:
- if len(b) < 16 {
+ if len(b) < sizeofSockaddrInet {
return nil, errInvalidAddr
}
a := &Inet4Addr{}
copy(a.IP[:], b[4:8])
return a, nil
case sysAF_INET6:
- if len(b) < 28 {
+ if len(b) < sizeofSockaddrInet6 {
return nil, errInvalidAddr
}
a := &Inet6Addr{ZoneID: int(nativeEndian.Uint32(b[24:28]))}
@@ -174,7 +240,7 @@ func parseKernelInetAddr(af int, b []byte) (int, Addr, error) {
off6 = 8 // offset of in6_addr
)
switch {
- case b[0] == 28: // size of sockaddr_in6
+ case b[0] == sizeofSockaddrInet6:
a := &Inet6Addr{}
copy(a.IP[:], b[off6:off6+16])
return int(b[0]), a, nil
@@ -186,7 +252,7 @@ func parseKernelInetAddr(af int, b []byte) (int, Addr, error) {
copy(a.IP[:], b[l-off6:l])
}
return int(b[0]), a, nil
- case b[0] == 16: // size of sockaddr_in
+ case b[0] == sizeofSockaddrInet:
a := &Inet4Addr{}
copy(a.IP[:], b[off4:off4+4])
return int(b[0]), a, nil
@@ -211,6 +277,24 @@ type DefaultAddr struct {
// Family implements the Family method of Addr interface.
func (a *DefaultAddr) Family() int { return a.af }
+func (a *DefaultAddr) lenAndSpace() (int, int) {
+ l := len(a.Raw)
+ return l, roundup(l)
+}
+
+func (a *DefaultAddr) marshal(b []byte) (int, error) {
+ l, ll := a.lenAndSpace()
+ if len(b) < ll {
+ return 0, errShortBuffer
+ }
+ if l > 255 {
+ return 0, errInvalidAddr
+ }
+ b[1] = byte(l)
+ copy(b[:l], a.Raw)
+ return ll, nil
+}
+
func parseDefaultAddr(b []byte) (Addr, error) {
if len(b) < 2 || len(b) < int(b[0]) {
return nil, errInvalidAddr
@@ -219,6 +303,66 @@ func parseDefaultAddr(b []byte) (Addr, error) {
return a, nil
}
+func addrsSpace(as []Addr) int {
+ var l int
+ for _, a := range as {
+ switch a := a.(type) {
+ case *LinkAddr:
+ _, ll := a.lenAndSpace()
+ l += ll
+ case *Inet4Addr:
+ _, ll := a.lenAndSpace()
+ l += ll
+ case *Inet6Addr:
+ _, ll := a.lenAndSpace()
+ l += ll
+ case *DefaultAddr:
+ _, ll := a.lenAndSpace()
+ l += ll
+ }
+ }
+ return l
+}
+
+// marshalAddrs marshals as and returns a bitmap indicating which
+// address is stored in b.
+func marshalAddrs(b []byte, as []Addr) (uint, error) {
+ var attrs uint
+ for i, a := range as {
+ switch a := a.(type) {
+ case *LinkAddr:
+ l, err := a.marshal(b)
+ if err != nil {
+ return 0, err
+ }
+ b = b[l:]
+ attrs |= 1 << uint(i)
+ case *Inet4Addr:
+ l, err := a.marshal(b)
+ if err != nil {
+ return 0, err
+ }
+ b = b[l:]
+ attrs |= 1 << uint(i)
+ case *Inet6Addr:
+ l, err := a.marshal(b)
+ if err != nil {
+ return 0, err
+ }
+ b = b[l:]
+ attrs |= 1 << uint(i)
+ case *DefaultAddr:
+ l, err := a.marshal(b)
+ if err != nil {
+ return 0, err
+ }
+ b = b[l:]
+ attrs |= 1 << uint(i)
+ }
+ }
+ return attrs, nil
+}
+
func parseAddrs(attrs uint, fn func(int, []byte) (int, Addr, error), b []byte) ([]Addr, error) {
var as [sysRTAX_MAX]Addr
af := int(sysAF_UNSPEC)
diff --git a/vendor/golang.org/x/net/route/binary.go b/vendor/golang.org/x/net/route/binary.go
index 4c561631b..6910520ec 100644
--- a/vendor/golang.org/x/net/route/binary.go
+++ b/vendor/golang.org/x/net/route/binary.go
@@ -9,7 +9,7 @@ package route
// This file contains duplicates of encoding/binary package.
//
// This package is supposed to be used by the net package of standard
-// library. Therefore a package set used in the package must be the
+// library. Therefore the package set used in the package must be the
// same as net package.
var (
diff --git a/vendor/golang.org/x/net/route/defs_darwin.go b/vendor/golang.org/x/net/route/defs_darwin.go
index f452ad14c..e7716442d 100644
--- a/vendor/golang.org/x/net/route/defs_darwin.go
+++ b/vendor/golang.org/x/net/route/defs_darwin.go
@@ -13,6 +13,8 @@ package route
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
+
+#include <netinet/in.h>
*/
import "C"
@@ -23,6 +25,8 @@ const (
sysAF_LINK = C.AF_LINK
sysAF_INET6 = C.AF_INET6
+ sysSOCK_RAW = C.SOCK_RAW
+
sysNET_RT_DUMP = C.NET_RT_DUMP
sysNET_RT_FLAGS = C.NET_RT_FLAGS
sysNET_RT_IFLIST = C.NET_RT_IFLIST
@@ -103,4 +107,8 @@ const (
sizeofRtMsghdrDarwin15 = C.sizeof_struct_rt_msghdr
sizeofRtMsghdr2Darwin15 = C.sizeof_struct_rt_msghdr2
sizeofRtMetricsDarwin15 = C.sizeof_struct_rt_metrics
+
+ sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
+ sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
+ sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
)
diff --git a/vendor/golang.org/x/net/route/defs_dragonfly.go b/vendor/golang.org/x/net/route/defs_dragonfly.go
index c737751d7..dd31de269 100644
--- a/vendor/golang.org/x/net/route/defs_dragonfly.go
+++ b/vendor/golang.org/x/net/route/defs_dragonfly.go
@@ -13,6 +13,8 @@ package route
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
+
+#include <netinet/in.h>
*/
import "C"
@@ -23,6 +25,8 @@ const (
sysAF_LINK = C.AF_LINK
sysAF_INET6 = C.AF_INET6
+ sysSOCK_RAW = C.SOCK_RAW
+
sysNET_RT_DUMP = C.NET_RT_DUMP
sysNET_RT_FLAGS = C.NET_RT_FLAGS
sysNET_RT_IFLIST = C.NET_RT_IFLIST
@@ -102,4 +106,8 @@ const (
sizeofRtMsghdrDragonFlyBSD4 = C.sizeof_struct_rt_msghdr
sizeofRtMetricsDragonFlyBSD4 = C.sizeof_struct_rt_metrics
+
+ sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
+ sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
+ sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
)
diff --git a/vendor/golang.org/x/net/route/defs_freebsd.go b/vendor/golang.org/x/net/route/defs_freebsd.go
index 8f834e81d..d95594d8e 100644
--- a/vendor/golang.org/x/net/route/defs_freebsd.go
+++ b/vendor/golang.org/x/net/route/defs_freebsd.go
@@ -14,6 +14,8 @@ package route
#include <net/if_dl.h>
#include <net/route.h>
+#include <netinet/in.h>
+
struct if_data_freebsd7 {
u_char ifi_type;
u_char ifi_physical;
@@ -222,6 +224,8 @@ const (
sysAF_LINK = C.AF_LINK
sysAF_INET6 = C.AF_INET6
+ sysSOCK_RAW = C.SOCK_RAW
+
sysNET_RT_DUMP = C.NET_RT_DUMP
sysNET_RT_FLAGS = C.NET_RT_FLAGS
sysNET_RT_IFLIST = C.NET_RT_IFLIST
@@ -326,4 +330,8 @@ const (
sizeofIfDataFreeBSD9Emu = C.sizeof_struct_if_data_freebsd9
sizeofIfDataFreeBSD10Emu = C.sizeof_struct_if_data_freebsd10
sizeofIfDataFreeBSD11Emu = C.sizeof_struct_if_data_freebsd11
+
+ sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
+ sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
+ sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
)
diff --git a/vendor/golang.org/x/net/route/defs_netbsd.go b/vendor/golang.org/x/net/route/defs_netbsd.go
index b18d85e01..b0abd549a 100644
--- a/vendor/golang.org/x/net/route/defs_netbsd.go
+++ b/vendor/golang.org/x/net/route/defs_netbsd.go
@@ -13,6 +13,8 @@ package route
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
+
+#include <netinet/in.h>
*/
import "C"
@@ -23,6 +25,8 @@ const (
sysAF_LINK = C.AF_LINK
sysAF_INET6 = C.AF_INET6
+ sysSOCK_RAW = C.SOCK_RAW
+
sysNET_RT_DUMP = C.NET_RT_DUMP
sysNET_RT_FLAGS = C.NET_RT_FLAGS
sysNET_RT_IFLIST = C.NET_RT_IFLIST
@@ -101,4 +105,8 @@ const (
sizeofRtMsghdrNetBSD7 = C.sizeof_struct_rt_msghdr
sizeofRtMetricsNetBSD7 = C.sizeof_struct_rt_metrics
+
+ sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
+ sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
+ sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
)
diff --git a/vendor/golang.org/x/net/route/defs_openbsd.go b/vendor/golang.org/x/net/route/defs_openbsd.go
index 5df7a43bc..0f66d3619 100644
--- a/vendor/golang.org/x/net/route/defs_openbsd.go
+++ b/vendor/golang.org/x/net/route/defs_openbsd.go
@@ -13,6 +13,8 @@ package route
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
+
+#include <netinet/in.h>
*/
import "C"
@@ -23,6 +25,8 @@ const (
sysAF_LINK = C.AF_LINK
sysAF_INET6 = C.AF_INET6
+ sysSOCK_RAW = C.SOCK_RAW
+
sysNET_RT_DUMP = C.NET_RT_DUMP
sysNET_RT_FLAGS = C.NET_RT_FLAGS
sysNET_RT_IFLIST = C.NET_RT_IFLIST
@@ -91,3 +95,11 @@ const (
sysRTAX_LABEL = C.RTAX_LABEL
sysRTAX_MAX = C.RTAX_MAX
)
+
+const (
+ sizeofRtMsghdr = C.sizeof_struct_rt_msghdr
+
+ sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
+ sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
+ sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
+)
diff --git a/vendor/golang.org/x/net/route/message.go b/vendor/golang.org/x/net/route/message.go
index d7ae0eb50..0fa7e09f4 100644
--- a/vendor/golang.org/x/net/route/message.go
+++ b/vendor/golang.org/x/net/route/message.go
@@ -7,9 +7,6 @@
package route
// A Message represents a routing message.
-//
-// Note: This interface will be changed to support Marshal method in
-// future version.
type Message interface {
// Sys returns operating system-specific information.
Sys() []Sys
@@ -52,11 +49,10 @@ func ParseRIB(typ RIBType, b []byte) ([]Message, error) {
b = b[l:]
continue
}
- mtyp := int(b[3])
- if fn, ok := parseFns[mtyp]; !ok {
+ if w, ok := wireFormats[int(b[3])]; !ok {
nskips++
} else {
- m, err := fn(typ, b)
+ m, err := w.parse(typ, b)
if err != nil {
return nil, err
}
diff --git a/vendor/golang.org/x/net/route/message_test.go b/vendor/golang.org/x/net/route/message_test.go
index c0c7c57a9..b3bc60c62 100644
--- a/vendor/golang.org/x/net/route/message_test.go
+++ b/vendor/golang.org/x/net/route/message_test.go
@@ -33,11 +33,28 @@ func TestFetchAndParseRIB(t *testing.T) {
}
}
+var (
+ rtmonSock int
+ rtmonErr error
+)
+
+func init() {
+ // We need to keep rtmonSock alive to avoid treading on
+ // recycled socket descriptors.
+ rtmonSock, rtmonErr = syscall.Socket(sysAF_ROUTE, sysSOCK_RAW, sysAF_UNSPEC)
+}
+
+// TestMonitorAndParseRIB leaks a worker goroutine and a socket
+// descriptor but that's intentional.
func TestMonitorAndParseRIB(t *testing.T) {
if testing.Short() || os.Getuid() != 0 {
t.Skip("must be root")
}
+ if rtmonErr != nil {
+ t.Fatal(rtmonErr)
+ }
+
// We suppose that using an IPv4 link-local address and the
// dot1Q ID for Token Ring and FDDI doesn't harm anyone.
pv := &propVirtual{addr: "169.254.0.1", mask: "255.255.255.0"}
@@ -49,16 +66,18 @@ func TestMonitorAndParseRIB(t *testing.T) {
}
pv.teardown()
- s, err := syscall.Socket(syscall.AF_ROUTE, syscall.SOCK_RAW, syscall.AF_UNSPEC)
- if err != nil {
- t.Fatal(err)
- }
- defer syscall.Close(s)
-
go func() {
b := make([]byte, os.Getpagesize())
for {
- n, err := syscall.Read(s, b)
+ // There's no easy way to unblock this read
+ // call because the routing message exchange
+ // over routing socket is a connectionless
+ // message-oriented protocol, no control plane
+ // for signaling connectivity, and we cannot
+ // use the net package of standard library due
+ // to the lack of support for routing socket
+ // and circular dependency.
+ n, err := syscall.Read(rtmonSock, b)
if err != nil {
return
}
@@ -116,3 +135,99 @@ func TestParseRIBWithFuzz(t *testing.T) {
}
}
}
+
+func TestRouteMessage(t *testing.T) {
+ s, err := syscall.Socket(sysAF_ROUTE, sysSOCK_RAW, sysAF_UNSPEC)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer syscall.Close(s)
+
+ var ms []RouteMessage
+ for _, af := range []int{sysAF_INET, sysAF_INET6} {
+ rs, err := fetchAndParseRIB(af, sysNET_RT_DUMP)
+ if err != nil || len(rs) == 0 {
+ continue
+ }
+ switch af {
+ case sysAF_INET:
+ ms = append(ms, []RouteMessage{
+ {
+ Type: sysRTM_GET,
+ Addrs: []Addr{
+ &Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
+ nil,
+ nil,
+ nil,
+ &LinkAddr{},
+ &Inet4Addr{},
+ nil,
+ &Inet4Addr{},
+ },
+ },
+ {
+ Type: sysRTM_GET,
+ Addrs: []Addr{
+ &Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
+ },
+ },
+ }...)
+ case sysAF_INET6:
+ ms = append(ms, []RouteMessage{
+ {
+ Type: sysRTM_GET,
+ Addrs: []Addr{
+ &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
+ nil,
+ nil,
+ nil,
+ &LinkAddr{},
+ &Inet6Addr{},
+ nil,
+ &Inet6Addr{},
+ },
+ },
+ {
+ Type: sysRTM_GET,
+ Addrs: []Addr{
+ &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
+ },
+ },
+ }...)
+ }
+ }
+ for i, m := range ms {
+ m.ID = uintptr(os.Getpid())
+ m.Seq = i + 1
+ wb, err := m.Marshal()
+ if err != nil {
+ t.Fatalf("%v: %v", m, err)
+ }
+ if _, err := syscall.Write(s, wb); err != nil {
+ t.Fatalf("%v: %v", m, err)
+ }
+ rb := make([]byte, os.Getpagesize())
+ n, err := syscall.Read(s, rb)
+ if err != nil {
+ t.Fatalf("%v: %v", m, err)
+ }
+ rms, err := ParseRIB(0, rb[:n])
+ if err != nil {
+ t.Fatalf("%v: %v", m, err)
+ }
+ for _, rm := range rms {
+ err := rm.(*RouteMessage).Err
+ if err != nil {
+ t.Errorf("%v: %v", m, err)
+ }
+ }
+ ss, err := msgs(rms).validate()
+ if err != nil {
+ t.Fatalf("%v: %v", m, err)
+ }
+ for _, s := range ss {
+ t.Log(s)
+ }
+
+ }
+}
diff --git a/vendor/golang.org/x/net/route/route.go b/vendor/golang.org/x/net/route/route.go
index c986e29eb..081da0d5c 100644
--- a/vendor/golang.org/x/net/route/route.go
+++ b/vendor/golang.org/x/net/route/route.go
@@ -24,21 +24,70 @@ var (
errMessageTooShort = errors.New("message too short")
errInvalidMessage = errors.New("invalid message")
errInvalidAddr = errors.New("invalid address")
+ errShortBuffer = errors.New("short buffer")
)
// A RouteMessage represents a message conveying an address prefix, a
// nexthop address and an output interface.
+//
+// Unlike other messages, this message can be used to query adjacency
+// information for the given address prefix, to add a new route, and
+// to delete or modify the existing route from the routing information
+// base inside the kernel by writing and reading route messages on a
+// routing socket.
+//
+// For the manipulation of routing information, the route message must
+// contain appropriate fields that include:
+//
+// Version = <must be specified>
+// Type = <must be specified>
+// Flags = <must be specified>
+// Index = <must be specified if necessary>
+// ID = <must be specified>
+// Seq = <must be specified>
+// Addrs = <must be specified>
+//
+// The Type field specifies a type of manipulation, the Flags field
+// specifies a class of target information and the Addrs field
+// specifies target information like the following:
+//
+// route.RouteMessage{
+// Version: RTM_VERSION,
+// Type: RTM_GET,
+// Flags: RTF_UP | RTF_HOST,
+// ID: uintptr(os.Getpid()),
+// Seq: 1,
+// Addrs: []route.Addrs{
+// RTAX_DST: &route.Inet4Addr{ ... },
+// RTAX_IFP: &route.LinkAddr{ ... },
+// RTAX_BRD: &route.Inet4Addr{ ... },
+// },
+// }
+//
+// The values for the above fields depend on the implementation of
+// each operating system.
+//
+// The Err field on a response message contains an error value on the
+// requested operation. If non-nil, the requested operation is failed.
type RouteMessage struct {
- Version int // message version
- Type int // message type
- Flags int // route flags
- Index int // interface index when atatched
- Addrs []Addr // addresses
+ Version int // message version
+ Type int // message type
+ Flags int // route flags
+ Index int // interface index when atatched
+ ID uintptr // sender's identifier; usually process ID
+ Seq int // sequence number
+ Err error // error on requested operation
+ Addrs []Addr // addresses
extOff int // offset of header extension
raw []byte // raw message
}
+// Marshal returns the binary encoding of m.
+func (m *RouteMessage) Marshal() ([]byte, error) {
+ return m.marshal()
+}
+
// A RIBType reprensents a type of routing information base.
type RIBType int
diff --git a/vendor/golang.org/x/net/route/route_classic.go b/vendor/golang.org/x/net/route/route_classic.go
index d333c6aa5..61b2bb4ad 100644
--- a/vendor/golang.org/x/net/route/route_classic.go
+++ b/vendor/golang.org/x/net/route/route_classic.go
@@ -6,6 +6,36 @@
package route
+import "syscall"
+
+func (m *RouteMessage) marshal() ([]byte, error) {
+ w, ok := wireFormats[m.Type]
+ if !ok {
+ return nil, errUnsupportedMessage
+ }
+ l := w.bodyOff + addrsSpace(m.Addrs)
+ b := make([]byte, l)
+ nativeEndian.PutUint16(b[:2], uint16(l))
+ if m.Version == 0 {
+ b[2] = sysRTM_VERSION
+ } else {
+ b[2] = byte(m.Version)
+ }
+ b[3] = byte(m.Type)
+ nativeEndian.PutUint32(b[8:12], uint32(m.Flags))
+ nativeEndian.PutUint16(b[4:6], uint16(m.Index))
+ nativeEndian.PutUint32(b[16:20], uint32(m.ID))
+ nativeEndian.PutUint32(b[20:24], uint32(m.Seq))
+ attrs, err := marshalAddrs(b[w.bodyOff:], m.Addrs)
+ if err != nil {
+ return nil, err
+ }
+ if attrs > 0 {
+ nativeEndian.PutUint32(b[12:16], uint32(attrs))
+ }
+ return b, nil
+}
+
func (w *wireFormat) parseRouteMessage(typ RIBType, b []byte) (Message, error) {
if len(b) < w.bodyOff {
return nil, errMessageTooShort
@@ -19,9 +49,15 @@ func (w *wireFormat) parseRouteMessage(typ RIBType, b []byte) (Message, error) {
Type: int(b[3]),
Flags: int(nativeEndian.Uint32(b[8:12])),
Index: int(nativeEndian.Uint16(b[4:6])),
+ ID: uintptr(nativeEndian.Uint32(b[16:20])),
+ Seq: int(nativeEndian.Uint32(b[20:24])),
extOff: w.extOff,
raw: b[:l],
}
+ errno := syscall.Errno(nativeEndian.Uint32(b[28:32]))
+ if errno != 0 {
+ m.Err = errno
+ }
var err error
m.Addrs, err = parseAddrs(uint(nativeEndian.Uint32(b[12:16])), parseKernelInetAddr, b[w.bodyOff:])
if err != nil {
diff --git a/vendor/golang.org/x/net/route/route_openbsd.go b/vendor/golang.org/x/net/route/route_openbsd.go
index 76eae40d8..daf2e90c4 100644
--- a/vendor/golang.org/x/net/route/route_openbsd.go
+++ b/vendor/golang.org/x/net/route/route_openbsd.go
@@ -4,8 +4,35 @@
package route
+import "syscall"
+
+func (m *RouteMessage) marshal() ([]byte, error) {
+ l := sizeofRtMsghdr + addrsSpace(m.Addrs)
+ b := make([]byte, l)
+ nativeEndian.PutUint16(b[:2], uint16(l))
+ if m.Version == 0 {
+ b[2] = sysRTM_VERSION
+ } else {
+ b[2] = byte(m.Version)
+ }
+ b[3] = byte(m.Type)
+ nativeEndian.PutUint16(b[4:6], uint16(sizeofRtMsghdr))
+ nativeEndian.PutUint32(b[16:20], uint32(m.Flags))
+ nativeEndian.PutUint16(b[6:8], uint16(m.Index))
+ nativeEndian.PutUint32(b[24:28], uint32(m.ID))
+ nativeEndian.PutUint32(b[28:32], uint32(m.Seq))
+ attrs, err := marshalAddrs(b[sizeofRtMsghdr:], m.Addrs)
+ if err != nil {
+ return nil, err
+ }
+ if attrs > 0 {
+ nativeEndian.PutUint32(b[12:16], uint32(attrs))
+ }
+ return b, nil
+}
+
func (*wireFormat) parseRouteMessage(_ RIBType, b []byte) (Message, error) {
- if len(b) < 40 {
+ if len(b) < sizeofRtMsghdr {
return nil, errMessageTooShort
}
l := int(nativeEndian.Uint16(b[:2]))
@@ -17,12 +44,18 @@ func (*wireFormat) parseRouteMessage(_ RIBType, b []byte) (Message, error) {
Type: int(b[3]),
Flags: int(nativeEndian.Uint32(b[16:20])),
Index: int(nativeEndian.Uint16(b[6:8])),
+ ID: uintptr(nativeEndian.Uint32(b[24:28])),
+ Seq: int(nativeEndian.Uint32(b[28:32])),
raw: b[:l],
}
ll := int(nativeEndian.Uint16(b[4:6]))
if len(b) < ll {
return nil, errInvalidMessage
}
+ errno := syscall.Errno(nativeEndian.Uint32(b[32:36]))
+ if errno != 0 {
+ m.Err = errno
+ }
as, err := parseAddrs(uint(nativeEndian.Uint32(b[12:16])), parseKernelInetAddr, b[ll:])
if err != nil {
return nil, err
diff --git a/vendor/golang.org/x/net/route/sys.go b/vendor/golang.org/x/net/route/sys.go
index 80ca83ae1..3d0ee9b14 100644
--- a/vendor/golang.org/x/net/route/sys.go
+++ b/vendor/golang.org/x/net/route/sys.go
@@ -11,7 +11,7 @@ import "unsafe"
var (
nativeEndian binaryByteOrder
kernelAlign int
- parseFns map[int]parseFn
+ wireFormats map[int]*wireFormat
)
func init() {
@@ -22,7 +22,7 @@ func init() {
} else {
nativeEndian = bigEndian
}
- kernelAlign, parseFns = probeRoutingStack()
+ kernelAlign, wireFormats = probeRoutingStack()
}
func roundup(l int) int {
@@ -32,9 +32,8 @@ func roundup(l int) int {
return (l + kernelAlign - 1) & ^(kernelAlign - 1)
}
-type parseFn func(RIBType, []byte) (Message, error)
-
type wireFormat struct {
extOff int // offset of header extension
bodyOff int // offset of message body
+ parse func(RIBType, []byte) (Message, error)
}
diff --git a/vendor/golang.org/x/net/route/sys_darwin.go b/vendor/golang.org/x/net/route/sys_darwin.go
index fff3a0fd1..e742c919d 100644
--- a/vendor/golang.org/x/net/route/sys_darwin.go
+++ b/vendor/golang.org/x/net/route/sys_darwin.go
@@ -49,32 +49,39 @@ func (m *InterfaceMessage) Sys() []Sys {
}
}
-func probeRoutingStack() (int, map[int]parseFn) {
+func probeRoutingStack() (int, map[int]*wireFormat) {
rtm := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdrDarwin15}
+ rtm.parse = rtm.parseRouteMessage
rtm2 := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdr2Darwin15}
+ rtm2.parse = rtm2.parseRouteMessage
ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDarwin15}
+ ifm.parse = ifm.parseInterfaceMessage
ifm2 := &wireFormat{extOff: 32, bodyOff: sizeofIfMsghdr2Darwin15}
+ ifm2.parse = ifm2.parseInterfaceMessage
ifam := &wireFormat{extOff: sizeofIfaMsghdrDarwin15, bodyOff: sizeofIfaMsghdrDarwin15}
+ ifam.parse = ifam.parseInterfaceAddrMessage
ifmam := &wireFormat{extOff: sizeofIfmaMsghdrDarwin15, bodyOff: sizeofIfmaMsghdrDarwin15}
+ ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage
ifmam2 := &wireFormat{extOff: sizeofIfmaMsghdr2Darwin15, bodyOff: sizeofIfmaMsghdr2Darwin15}
+ ifmam2.parse = ifmam2.parseInterfaceMulticastAddrMessage
// Darwin kernels require 32-bit aligned access to routing facilities.
- return 4, map[int]parseFn{
- sysRTM_ADD: rtm.parseRouteMessage,
- sysRTM_DELETE: rtm.parseRouteMessage,
- sysRTM_CHANGE: rtm.parseRouteMessage,
- sysRTM_GET: rtm.parseRouteMessage,
- sysRTM_LOSING: rtm.parseRouteMessage,
- sysRTM_REDIRECT: rtm.parseRouteMessage,
- sysRTM_MISS: rtm.parseRouteMessage,
- sysRTM_LOCK: rtm.parseRouteMessage,
- sysRTM_RESOLVE: rtm.parseRouteMessage,
- sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_DELADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_IFINFO: ifm.parseInterfaceMessage,
- sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_IFINFO2: ifm2.parseInterfaceMessage,
- sysRTM_NEWMADDR2: ifmam2.parseInterfaceMulticastAddrMessage,
- sysRTM_GET2: rtm2.parseRouteMessage,
+ return 4, map[int]*wireFormat{
+ sysRTM_ADD: rtm,
+ sysRTM_DELETE: rtm,
+ sysRTM_CHANGE: rtm,
+ sysRTM_GET: rtm,
+ sysRTM_LOSING: rtm,
+ sysRTM_REDIRECT: rtm,
+ sysRTM_MISS: rtm,
+ sysRTM_LOCK: rtm,
+ sysRTM_RESOLVE: rtm,
+ sysRTM_NEWADDR: ifam,
+ sysRTM_DELADDR: ifam,
+ sysRTM_IFINFO: ifm,
+ sysRTM_NEWMADDR: ifmam,
+ sysRTM_DELMADDR: ifmam,
+ sysRTM_IFINFO2: ifm2,
+ sysRTM_NEWMADDR2: ifmam2,
+ sysRTM_GET2: rtm2,
}
}
diff --git a/vendor/golang.org/x/net/route/sys_dragonfly.go b/vendor/golang.org/x/net/route/sys_dragonfly.go
index da848b3d0..b175cb18c 100644
--- a/vendor/golang.org/x/net/route/sys_dragonfly.go
+++ b/vendor/golang.org/x/net/route/sys_dragonfly.go
@@ -44,28 +44,33 @@ func (m *InterfaceMessage) Sys() []Sys {
}
}
-func probeRoutingStack() (int, map[int]parseFn) {
+func probeRoutingStack() (int, map[int]*wireFormat) {
var p uintptr
rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrDragonFlyBSD4}
+ rtm.parse = rtm.parseRouteMessage
ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDragonFlyBSD4}
+ ifm.parse = ifm.parseInterfaceMessage
ifam := &wireFormat{extOff: sizeofIfaMsghdrDragonFlyBSD4, bodyOff: sizeofIfaMsghdrDragonFlyBSD4}
+ ifam.parse = ifam.parseInterfaceAddrMessage
ifmam := &wireFormat{extOff: sizeofIfmaMsghdrDragonFlyBSD4, bodyOff: sizeofIfmaMsghdrDragonFlyBSD4}
+ ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage
ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrDragonFlyBSD4, bodyOff: sizeofIfAnnouncemsghdrDragonFlyBSD4}
- return int(unsafe.Sizeof(p)), map[int]parseFn{
- sysRTM_ADD: rtm.parseRouteMessage,
- sysRTM_DELETE: rtm.parseRouteMessage,
- sysRTM_CHANGE: rtm.parseRouteMessage,
- sysRTM_GET: rtm.parseRouteMessage,
- sysRTM_LOSING: rtm.parseRouteMessage,
- sysRTM_REDIRECT: rtm.parseRouteMessage,
- sysRTM_MISS: rtm.parseRouteMessage,
- sysRTM_LOCK: rtm.parseRouteMessage,
- sysRTM_RESOLVE: rtm.parseRouteMessage,
- sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_DELADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_IFINFO: ifm.parseInterfaceMessage,
- sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage,
+ ifanm.parse = ifanm.parseInterfaceAnnounceMessage
+ return int(unsafe.Sizeof(p)), map[int]*wireFormat{
+ sysRTM_ADD: rtm,
+ sysRTM_DELETE: rtm,
+ sysRTM_CHANGE: rtm,
+ sysRTM_GET: rtm,
+ sysRTM_LOSING: rtm,
+ sysRTM_REDIRECT: rtm,
+ sysRTM_MISS: rtm,
+ sysRTM_LOCK: rtm,
+ sysRTM_RESOLVE: rtm,
+ sysRTM_NEWADDR: ifam,
+ sysRTM_DELADDR: ifam,
+ sysRTM_IFINFO: ifm,
+ sysRTM_NEWMADDR: ifmam,
+ sysRTM_DELMADDR: ifmam,
+ sysRTM_IFANNOUNCE: ifanm,
}
}
diff --git a/vendor/golang.org/x/net/route/sys_freebsd.go b/vendor/golang.org/x/net/route/sys_freebsd.go
index 7b05c1a5a..010d4ae78 100644
--- a/vendor/golang.org/x/net/route/sys_freebsd.go
+++ b/vendor/golang.org/x/net/route/sys_freebsd.go
@@ -54,7 +54,7 @@ func (m *InterfaceMessage) Sys() []Sys {
}
}
-func probeRoutingStack() (int, map[int]parseFn) {
+func probeRoutingStack() (int, map[int]*wireFormat) {
var p uintptr
wordSize := int(unsafe.Sizeof(p))
align := int(unsafe.Sizeof(p))
@@ -130,21 +130,26 @@ func probeRoutingStack() (int, map[int]parseFn) {
ifm.bodyOff = sizeofIfMsghdrFreeBSD11
}
}
- return align, map[int]parseFn{
- sysRTM_ADD: rtm.parseRouteMessage,
- sysRTM_DELETE: rtm.parseRouteMessage,
- sysRTM_CHANGE: rtm.parseRouteMessage,
- sysRTM_GET: rtm.parseRouteMessage,
- sysRTM_LOSING: rtm.parseRouteMessage,
- sysRTM_REDIRECT: rtm.parseRouteMessage,
- sysRTM_MISS: rtm.parseRouteMessage,
- sysRTM_LOCK: rtm.parseRouteMessage,
- sysRTM_RESOLVE: rtm.parseRouteMessage,
- sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_DELADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_IFINFO: ifm.parseInterfaceMessage,
- sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage,
- sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage,
+ rtm.parse = rtm.parseRouteMessage
+ ifm.parse = ifm.parseInterfaceMessage
+ ifam.parse = ifam.parseInterfaceAddrMessage
+ ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage
+ ifanm.parse = ifanm.parseInterfaceAnnounceMessage
+ return align, map[int]*wireFormat{
+ sysRTM_ADD: rtm,
+ sysRTM_DELETE: rtm,
+ sysRTM_CHANGE: rtm,
+ sysRTM_GET: rtm,
+ sysRTM_LOSING: rtm,
+ sysRTM_REDIRECT: rtm,
+ sysRTM_MISS: rtm,
+ sysRTM_LOCK: rtm,
+ sysRTM_RESOLVE: rtm,
+ sysRTM_NEWADDR: ifam,
+ sysRTM_DELADDR: ifam,
+ sysRTM_IFINFO: ifm,
+ sysRTM_NEWMADDR: ifmam,
+ sysRTM_DELMADDR: ifmam,
+ sysRTM_IFANNOUNCE: ifanm,
}
}
diff --git a/vendor/golang.org/x/net/route/sys_netbsd.go b/vendor/golang.org/x/net/route/sys_netbsd.go
index 4d8076b51..b4e330140 100644
--- a/vendor/golang.org/x/net/route/sys_netbsd.go
+++ b/vendor/golang.org/x/net/route/sys_netbsd.go
@@ -42,26 +42,30 @@ func (m *InterfaceMessage) Sys() []Sys {
}
}
-func probeRoutingStack() (int, map[int]parseFn) {
+func probeRoutingStack() (int, map[int]*wireFormat) {
rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrNetBSD7}
+ rtm.parse = rtm.parseRouteMessage
ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrNetBSD7}
+ ifm.parse = ifm.parseInterfaceMessage
ifam := &wireFormat{extOff: sizeofIfaMsghdrNetBSD7, bodyOff: sizeofIfaMsghdrNetBSD7}
+ ifam.parse = ifam.parseInterfaceAddrMessage
ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrNetBSD7, bodyOff: sizeofIfAnnouncemsghdrNetBSD7}
+ ifanm.parse = ifanm.parseInterfaceAnnounceMessage
// NetBSD 6 and above kernels require 64-bit aligned access to
// routing facilities.
- return 8, map[int]parseFn{
- sysRTM_ADD: rtm.parseRouteMessage,
- sysRTM_DELETE: rtm.parseRouteMessage,
- sysRTM_CHANGE: rtm.parseRouteMessage,
- sysRTM_GET: rtm.parseRouteMessage,
- sysRTM_LOSING: rtm.parseRouteMessage,
- sysRTM_REDIRECT: rtm.parseRouteMessage,
- sysRTM_MISS: rtm.parseRouteMessage,
- sysRTM_LOCK: rtm.parseRouteMessage,
- sysRTM_RESOLVE: rtm.parseRouteMessage,
- sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_DELADDR: ifam.parseInterfaceAddrMessage,
- sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage,
- sysRTM_IFINFO: ifm.parseInterfaceMessage,
+ return 8, map[int]*wireFormat{
+ sysRTM_ADD: rtm,
+ sysRTM_DELETE: rtm,
+ sysRTM_CHANGE: rtm,
+ sysRTM_GET: rtm,
+ sysRTM_LOSING: rtm,
+ sysRTM_REDIRECT: rtm,
+ sysRTM_MISS: rtm,
+ sysRTM_LOCK: rtm,
+ sysRTM_RESOLVE: rtm,
+ sysRTM_NEWADDR: ifam,
+ sysRTM_DELADDR: ifam,
+ sysRTM_IFANNOUNCE: ifanm,
+ sysRTM_IFINFO: ifm,
}
}
diff --git a/vendor/golang.org/x/net/route/sys_openbsd.go b/vendor/golang.org/x/net/route/sys_openbsd.go
index 26d043869..8798dc4ca 100644
--- a/vendor/golang.org/x/net/route/sys_openbsd.go
+++ b/vendor/golang.org/x/net/route/sys_openbsd.go
@@ -51,22 +51,29 @@ func (m *InterfaceMessage) Sys() []Sys {
}
}
-func probeRoutingStack() (int, map[int]parseFn) {
+func probeRoutingStack() (int, map[int]*wireFormat) {
var p uintptr
- nooff := &wireFormat{extOff: -1, bodyOff: -1}
- return int(unsafe.Sizeof(p)), map[int]parseFn{
- sysRTM_ADD: nooff.parseRouteMessage,
- sysRTM_DELETE: nooff.parseRouteMessage,
- sysRTM_CHANGE: nooff.parseRouteMessage,
- sysRTM_GET: nooff.parseRouteMessage,
- sysRTM_LOSING: nooff.parseRouteMessage,
- sysRTM_REDIRECT: nooff.parseRouteMessage,
- sysRTM_MISS: nooff.parseRouteMessage,
- sysRTM_LOCK: nooff.parseRouteMessage,
- sysRTM_RESOLVE: nooff.parseRouteMessage,
- sysRTM_NEWADDR: nooff.parseInterfaceAddrMessage,
- sysRTM_DELADDR: nooff.parseInterfaceAddrMessage,
- sysRTM_IFINFO: nooff.parseInterfaceMessage,
- sysRTM_IFANNOUNCE: nooff.parseInterfaceAnnounceMessage,
+ rtm := &wireFormat{extOff: -1, bodyOff: -1}
+ rtm.parse = rtm.parseRouteMessage
+ ifm := &wireFormat{extOff: -1, bodyOff: -1}
+ ifm.parse = ifm.parseInterfaceMessage
+ ifam := &wireFormat{extOff: -1, bodyOff: -1}
+ ifam.parse = ifam.parseInterfaceAddrMessage
+ ifanm := &wireFormat{extOff: -1, bodyOff: -1}
+ ifanm.parse = ifanm.parseInterfaceAnnounceMessage
+ return int(unsafe.Sizeof(p)), map[int]*wireFormat{
+ sysRTM_ADD: rtm,
+ sysRTM_DELETE: rtm,
+ sysRTM_CHANGE: rtm,
+ sysRTM_GET: rtm,
+ sysRTM_LOSING: rtm,
+ sysRTM_REDIRECT: rtm,
+ sysRTM_MISS: rtm,
+ sysRTM_LOCK: rtm,
+ sysRTM_RESOLVE: rtm,
+ sysRTM_NEWADDR: ifam,
+ sysRTM_DELADDR: ifam,
+ sysRTM_IFINFO: ifm,
+ sysRTM_IFANNOUNCE: ifanm,
}
}
diff --git a/vendor/golang.org/x/net/route/syscall.go b/vendor/golang.org/x/net/route/syscall.go
index d136325a3..c211188b1 100644
--- a/vendor/golang.org/x/net/route/syscall.go
+++ b/vendor/golang.org/x/net/route/syscall.go
@@ -11,10 +11,6 @@ import (
"unsafe"
)
-// TODO: replace with runtime.KeepAlive when available
-//go:noescape
-func keepAlive(p unsafe.Pointer)
-
var zero uintptr
func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
@@ -25,7 +21,6 @@ func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
p = unsafe.Pointer(&zero)
}
_, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- keepAlive(p)
if errno != 0 {
return error(errno)
}
diff --git a/vendor/golang.org/x/net/route/syscall.s b/vendor/golang.org/x/net/route/syscall.s
deleted file mode 100644
index fa6297f0a..000000000
--- a/vendor/golang.org/x/net/route/syscall.s
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-TEXT ·keepAlive(SB),NOSPLIT,$0
- RET
diff --git a/vendor/golang.org/x/net/route/zsys_darwin.go b/vendor/golang.org/x/net/route/zsys_darwin.go
index 265b81cd5..4e2e1ab09 100644
--- a/vendor/golang.org/x/net/route/zsys_darwin.go
+++ b/vendor/golang.org/x/net/route/zsys_darwin.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x1e
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -90,4 +92,8 @@ const (
sizeofRtMsghdrDarwin15 = 0x5c
sizeofRtMsghdr2Darwin15 = 0x5c
sizeofRtMetricsDarwin15 = 0x38
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_dragonfly.go b/vendor/golang.org/x/net/route/zsys_dragonfly.go
index dd36dece0..719c88d11 100644
--- a/vendor/golang.org/x/net/route/zsys_dragonfly.go
+++ b/vendor/golang.org/x/net/route/zsys_dragonfly.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x1c
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -89,4 +91,8 @@ const (
sizeofRtMsghdrDragonFlyBSD4 = 0x98
sizeofRtMetricsDragonFlyBSD4 = 0x70
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_386.go b/vendor/golang.org/x/net/route/zsys_freebsd_386.go
index 9bac2e390..b03bc01f6 100644
--- a/vendor/golang.org/x/net/route/zsys_freebsd_386.go
+++ b/vendor/golang.org/x/net/route/zsys_freebsd_386.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x1c
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -117,4 +119,8 @@ const (
sizeofIfDataFreeBSD9Emu = 0x98
sizeofIfDataFreeBSD10Emu = 0x98
sizeofIfDataFreeBSD11Emu = 0x98
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go
index b1920d7ac..0b675b3d3 100644
--- a/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go
+++ b/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x1c
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -114,4 +116,8 @@ const (
sizeofIfDataFreeBSD9Emu = 0x98
sizeofIfDataFreeBSD10Emu = 0x98
sizeofIfDataFreeBSD11Emu = 0x98
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_arm.go b/vendor/golang.org/x/net/route/zsys_freebsd_arm.go
index a034d6fcb..58f8ea16f 100644
--- a/vendor/golang.org/x/net/route/zsys_freebsd_arm.go
+++ b/vendor/golang.org/x/net/route/zsys_freebsd_arm.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x1c
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -114,4 +116,8 @@ const (
sizeofIfDataFreeBSD9Emu = 0x60
sizeofIfDataFreeBSD10Emu = 0x60
sizeofIfDataFreeBSD11Emu = 0x98
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_netbsd.go b/vendor/golang.org/x/net/route/zsys_netbsd.go
index aa4aad161..e0df45e8b 100644
--- a/vendor/golang.org/x/net/route/zsys_netbsd.go
+++ b/vendor/golang.org/x/net/route/zsys_netbsd.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x18
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x5
@@ -88,4 +90,8 @@ const (
sizeofRtMsghdrNetBSD7 = 0x78
sizeofRtMetricsNetBSD7 = 0x50
+
+ sizeofSockaddrStorage = 0x80
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
)
diff --git a/vendor/golang.org/x/net/route/zsys_openbsd.go b/vendor/golang.org/x/net/route/zsys_openbsd.go
index 4fadc4e8f..f5a1ff967 100644
--- a/vendor/golang.org/x/net/route/zsys_openbsd.go
+++ b/vendor/golang.org/x/net/route/zsys_openbsd.go
@@ -10,6 +10,8 @@ const (
sysAF_LINK = 0x12
sysAF_INET6 = 0x18
+ sysSOCK_RAW = 0x3
+
sysNET_RT_DUMP = 0x1
sysNET_RT_FLAGS = 0x2
sysNET_RT_IFLIST = 0x3
@@ -78,3 +80,11 @@ const (
sysRTAX_LABEL = 0xa
sysRTAX_MAX = 0xb
)
+
+const (
+ sizeofRtMsghdr = 0x60
+
+ sizeofSockaddrStorage = 0x100
+ sizeofSockaddrInet = 0x10
+ sizeofSockaddrInet6 = 0x1c
+)
diff --git a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go b/vendor/golang.org/x/net/webdav/internal/xml/marshal.go
index 3c3b6aca5..cb82ec214 100644
--- a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go
+++ b/vendor/golang.org/x/net/webdav/internal/xml/marshal.go
@@ -26,9 +26,9 @@ const (
//
// Marshal handles an array or slice by marshalling each of the elements.
// Marshal handles a pointer by marshalling the value it points at or, if the
-// pointer is nil, by writing nothing. Marshal handles an interface value by
+// pointer is nil, by writing nothing. Marshal handles an interface value by
// marshalling the value it contains or, if the interface value is nil, by
-// writing nothing. Marshal handles all other data by writing one or more XML
+// writing nothing. Marshal handles all other data by writing one or more XML
// elements containing the data.
//
// The name for the XML elements is taken from, in order of preference:
@@ -61,7 +61,7 @@ const (
// value were part of the outer struct.
//
// If a field uses a tag "a>b>c", then the element c will be nested inside
-// parent elements a and b. Fields that appear next to each other that name
+// parent elements a and b. Fields that appear next to each other that name
// the same parent will be enclosed in one XML element.
//
// See MarshalIndent for an example.
@@ -222,7 +222,7 @@ func (enc *Encoder) EncodeToken(t Token) error {
return p.cachedWriteError()
case ProcInst:
// First token to be encoded which is also a ProcInst with target of xml
- // is the xml declaration. The only ProcInst where target of xml is allowed.
+ // is the xml declaration. The only ProcInst where target of xml is allowed.
if t.Target == "xml" && p.Buffered() != 0 {
return fmt.Errorf("xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded")
}
diff --git a/vendor/golang.org/x/net/webdav/internal/xml/read.go b/vendor/golang.org/x/net/webdav/internal/xml/read.go
index 3ece08c49..4089056a1 100644
--- a/vendor/golang.org/x/net/webdav/internal/xml/read.go
+++ b/vendor/golang.org/x/net/webdav/internal/xml/read.go
@@ -27,7 +27,7 @@ import (
// discarded.
//
// Because Unmarshal uses the reflect package, it can only assign
-// to exported (upper case) fields. Unmarshal uses a case-sensitive
+// to exported (upper case) fields. Unmarshal uses a case-sensitive
// comparison to match XML element names to tag values and struct
// field names.
//
@@ -37,7 +37,7 @@ import (
//
// * If the struct has a field of type []byte or string with tag
// ",innerxml", Unmarshal accumulates the raw XML nested inside the
-// element in that field. The rest of the rules still apply.
+// element in that field. The rest of the rules still apply.
//
// * If the struct has a field named XMLName of type xml.Name,
// Unmarshal records the element name in that field.
@@ -59,7 +59,7 @@ import (
//
// * If the XML element contains comments, they are accumulated in
// the first struct field that has tag ",comment". The struct
-// field may have type []byte or string. If there is no such
+// field may have type []byte or string. If there is no such
// field, the comments are discarded.
//
// * If the XML element contains a sub-element whose name matches
@@ -102,7 +102,7 @@ import (
//
// Unmarshal maps an XML element or attribute value to an integer or
// floating-point field by setting the field to the result of
-// interpreting the string value in decimal. There is no check for
+// interpreting the string value in decimal. There is no check for
// overflow.
//
// Unmarshal maps an XML element to an xml.Name by recording the
diff --git a/vendor/golang.org/x/net/webdav/internal/xml/xml.go b/vendor/golang.org/x/net/webdav/internal/xml/xml.go
index ffab4a70c..5b79cbecb 100644
--- a/vendor/golang.org/x/net/webdav/internal/xml/xml.go
+++ b/vendor/golang.org/x/net/webdav/internal/xml/xml.go
@@ -252,7 +252,7 @@ func NewDecoder(r io.Reader) *Decoder {
//
// Slices of bytes in the returned token data refer to the
// parser's internal buffer and remain valid only until the next
-// call to Token. To acquire a copy of the bytes, call CopyToken
+// call to Token. To acquire a copy of the bytes, call CopyToken
// or the token's Copy method.
//
// Token expands self-closing elements such as <br/>
@@ -360,7 +360,7 @@ func (d *Decoder) switchToReader(r io.Reader) {
}
// Parsing state - stack holds old name space translations
-// and the current set of open elements. The translations to pop when
+// and the current set of open elements. The translations to pop when
// ending a given tag are *below* it on the stack, which is
// more work but forced on us by XML.
type stack struct {
@@ -1253,7 +1253,7 @@ func isNameString(s string) bool {
// These tables were generated by cut and paste from Appendix B of
// the XML spec at http://www.xml.com/axml/testaxml.htm
-// and then reformatting. First corresponds to (Letter | '_' | ':')
+// and then reformatting. First corresponds to (Letter | '_' | ':')
// and second corresponds to NameChar.
var first = &unicode.RangeTable{
diff --git a/vendor/golang.org/x/sys/unix/asm.s b/vendor/golang.org/x/sys/unix/asm.s
deleted file mode 100644
index 8ed2fdb94..000000000
--- a/vendor/golang.org/x/sys/unix/asm.s
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-TEXT ·use(SB),NOSPLIT,$0
- RET
diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh
index 2a1473f16..c1fc2adb8 100755
--- a/vendor/golang.org/x/sys/unix/mkall.sh
+++ b/vendor/golang.org/x/sys/unix/mkall.sh
@@ -89,6 +89,8 @@ case "$1" in
-syscalls)
for i in zsyscall*go
do
+ # Run the command line that appears in the first line
+ # of the generated file to regenerate it.
sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
rm _$i
done
@@ -280,7 +282,7 @@ esac
syscall_goos="syscall_bsd.go $syscall_goos"
;;
esac
- if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
+ if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
;;
esac
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
index 7e6276b9c..8da63576a 100755
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ b/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -114,13 +114,16 @@ includes_Linux='
#include <sys/time.h>
#include <sys/socket.h>
#include <linux/if.h>
+#include <linux/if_alg.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
#include <linux/if_packet.h>
#include <linux/if_addr.h>
+#include <linux/falloc.h>
#include <linux/filter.h>
#include <linux/netlink.h>
+#include <linux/random.h>
#include <linux/reboot.h>
#include <linux/rtnetlink.h>
#include <linux/ptrace.h>
@@ -129,6 +132,7 @@ includes_Linux='
#include <linux/icmpv6.h>
#include <linux/serial.h>
#include <linux/can.h>
+#include <linux/vm_sockets.h>
#include <net/route.h>
#include <asm/termbits.h>
@@ -144,6 +148,10 @@ includes_Linux='
#define PTRACE_SETREGS 0xd
#endif
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+
#ifdef SOL_BLUETOOTH
// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
// but it is already in bluetooth_linux.go
@@ -312,6 +320,7 @@ ccflags="$@"
$2 ~ /^IN_/ ||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
+ $2 ~ /^FALLOC_/ ||
$2 == "ICMPV6_FILTER" ||
$2 == "SOMAXCONN" ||
$2 == "NAME_MAX" ||
@@ -341,8 +350,13 @@ ccflags="$@"
$2 ~ /^(BPF|DLT)_/ ||
$2 ~ /^CLOCK_/ ||
$2 ~ /^CAN_/ ||
+ $2 ~ /^ALG_/ ||
+ $2 ~ /^GRND_/ ||
+ $2 ~ /^SPLICE_/ ||
+ $2 ~ /^(VM|VMADDR)_/ ||
$2 !~ "WMESGLEN" &&
- $2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
+ $2 ~ /^W[A-Z0-9]+$/ ||
+ $2 ~ /^BLK/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
@@ -456,7 +470,7 @@ main(void)
printf("\t%d: \"%s\",\n", e, buf);
}
printf("}\n\n");
-
+
printf("\n\n// Signal table\n");
printf("var signals = [...]string {\n");
qsort(signals, nelem(signals), sizeof signals[0], intcmp);
diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl
index b1e7766da..34f8ef829 100755
--- a/vendor/golang.org/x/sys/unix/mksyscall.pl
+++ b/vendor/golang.org/x/sys/unix/mksyscall.pl
@@ -29,6 +29,7 @@ my $openbsd = 0;
my $netbsd = 0;
my $dragonfly = 0;
my $arm = 0; # 64-bit value should use (even, odd)-pair
+my $tags = ""; # build tags
if($ARGV[0] eq "-b32") {
$_32bit = "big-endian";
@@ -57,14 +58,14 @@ if($ARGV[0] eq "-arm") {
$arm = 1;
shift;
}
-
-if($ARGV[0] =~ /^-/) {
- print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n";
- exit 1;
+if($ARGV[0] eq "-tags") {
+ shift;
+ $tags = $ARGV[0];
+ shift;
}
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
- print STDERR "GOARCH or GOOS not defined in environment\n";
+if($ARGV[0] =~ /^-/) {
+ print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
@@ -132,7 +133,6 @@ while(<>) {
# Prepare arguments to Syscall.
my @args = ();
- my @uses = ();
my $n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
@@ -143,14 +143,12 @@ while(<>) {
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n *byte\n";
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
@@ -185,7 +183,7 @@ while(<>) {
}
} elsif($type eq "int64" && $_32bit ne "") {
if(@args % 2 && $arm) {
- # arm abi specifies 64-bit argument uses
+ # arm abi specifies 64-bit argument uses
# (even, odd) pair
push @args, "0"
}
@@ -278,11 +276,8 @@ while(<>) {
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
}
- foreach my $use (@uses) {
- $text .= "\t$use\n";
- }
$text .= $body;
-
+
if ($plan9 && $ret[2] eq "e1") {
$text .= "\tif int32(r0) == -1 {\n";
$text .= "\t\terr = e1\n";
@@ -307,7 +302,7 @@ print <<EOF;
// $cmdline
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+// +build $tags
package unix
diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
index 06bade768..939c8a791 100755
--- a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
+++ b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
@@ -12,7 +12,7 @@
# * The parameter lists must give a type for each argument:
# the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named err.
-# * If go func name needs to be different than its libc name,
+# * If go func name needs to be different than its libc name,
# * or the function is not in libc, name could be specified
# * at the end, after "=" sign, like
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
@@ -22,6 +22,7 @@ use strict;
my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
my $errors = 0;
my $_32bit = "";
+my $tags = ""; # build tags
binmode STDOUT;
@@ -32,14 +33,14 @@ if($ARGV[0] eq "-b32") {
$_32bit = "little-endian";
shift;
}
-
-if($ARGV[0] =~ /^-/) {
- print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [file ...]\n";
- exit 1;
+if($ARGV[0] eq "-tags") {
+ shift;
+ $tags = $ARGV[0];
+ shift;
}
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
- print STDERR "GOARCH or GOOS not defined in environment\n";
+if($ARGV[0] =~ /^-/) {
+ print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
@@ -138,7 +139,6 @@ while(<>) {
# Prepare arguments to Syscall.
my @args = ();
- my @uses = ();
my $n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
@@ -149,14 +149,12 @@ while(<>) {
$text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n $strconvtype\n";
$text .= "\t_p$n, _ = $strconvfunc($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
@@ -243,9 +241,6 @@ while(<>) {
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
}
- foreach my $use (@uses) {
- $text .= "\t$use\n";
- }
$text .= $body;
if ($do_errno) {
@@ -265,7 +260,7 @@ print <<EOF;
// $cmdline
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+// +build $tags
package $package
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_linux.pl b/vendor/golang.org/x/sys/unix/mksysnum_linux.pl
index 52b16139e..872ae8c52 100755
--- a/vendor/golang.org/x/sys/unix/mksysnum_linux.pl
+++ b/vendor/golang.org/x/sys/unix/mksysnum_linux.pl
@@ -38,15 +38,22 @@ sub fmt {
}
my $prev;
-open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc";
+open(GCC, "gcc -E -dD @ARGV |") || die "can't run gcc";
while(<GCC>){
if(/^#define __NR_Linux\s+([0-9]+)/){
# mips/mips64: extract offset
$offset = $1;
}
+ elsif(/^#define __NR(\w*)_SYSCALL_BASE\s+([0-9]+)/){
+ # arm: extract offset
+ $offset = $1;
+ }
elsif(/^#define __NR_syscalls\s+/) {
# ignore redefinitions of __NR_syscalls
}
+ elsif(/^#define __NR_(\w*)Linux_syscalls\s+/) {
+ # mips/mips64: ignore definitions about the number of syscalls
+ }
elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
$prev = $2;
fmt($1, $2);
@@ -61,6 +68,9 @@ while(<GCC>){
elsif(/^#define __NR_(\w+)\s+\(__NR_Linux \+ ([0-9]+)/){
fmt($1, $2);
}
+ elsif(/^#define __NR_(\w+)\s+\(__NR_SYSCALL_BASE \+ ([0-9]+)/){
+ fmt($1, $2);
+ }
}
print <<EOF;
diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go
index a0bcf842c..85e35020e 100644
--- a/vendor/golang.org/x/sys/unix/syscall.go
+++ b/vendor/golang.org/x/sys/unix/syscall.go
@@ -21,8 +21,6 @@
// holds a value of type syscall.Errno.
package unix // import "golang.org/x/sys/unix"
-import "unsafe"
-
// ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL).
@@ -69,8 +67,3 @@ func (tv *Timeval) Nano() int64 {
}
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-// use is a no-op, but the compiler cannot see that it is.
-// Calling use(p) ensures that p is kept live until that point.
-//go:noescape
-func use(p unsafe.Pointer)
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go
index 3d534d2da..0d1771c3f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go
@@ -144,7 +144,6 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
uintptr(options),
0,
)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
return nil, e1
}
@@ -197,7 +196,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index ec408ee78..fbbe0dce2 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -109,7 +109,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
index 520ccbeaf..ec56ed608 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
@@ -129,7 +129,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
index 01c569ad5..1ff45e9f6 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -452,6 +452,127 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
}
+// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
+// SockaddrALG enables userspace access to the Linux kernel's cryptography
+// subsystem. The Type and Name fields specify which type of hash or cipher
+// should be used with a given socket.
+//
+// To create a file descriptor that provides access to a hash or cipher, both
+// Bind and Accept must be used. Once the setup process is complete, input
+// data can be written to the socket, processed by the kernel, and then read
+// back as hash output or ciphertext.
+//
+// Here is an example of using an AF_ALG socket with SHA1 hashing.
+// The initial socket setup process is as follows:
+//
+// // Open a socket to perform SHA1 hashing.
+// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
+// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
+// unix.Bind(fd, addr)
+// // Note: unix.Accept does not work at this time; must invoke accept()
+// // manually using unix.Syscall.
+// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
+//
+// Once a file descriptor has been returned from Accept, it may be used to
+// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
+// may be re-used repeatedly with subsequent Write and Read operations.
+//
+// When hashing a small byte slice or string, a single Write and Read may
+// be used:
+//
+// // Assume hashfd is already configured using the setup process.
+// hash := os.NewFile(hashfd, "sha1")
+// // Hash an input string and read the results. Each Write discards
+// // previous hash state. Read always reads the current state.
+// b := make([]byte, 20)
+// for i := 0; i < 2; i++ {
+// io.WriteString(hash, "Hello, world.")
+// hash.Read(b)
+// fmt.Println(hex.EncodeToString(b))
+// }
+// // Output:
+// // 2ae01472317d1935a84797ec1983ae243fc6aa28
+// // 2ae01472317d1935a84797ec1983ae243fc6aa28
+//
+// For hashing larger byte slices, or byte streams such as those read from
+// a file or socket, use Sendto with MSG_MORE to instruct the kernel to update
+// the hash digest instead of creating a new one for a given chunk and finalizing it.
+//
+// // Assume hashfd and addr are already configured using the setup process.
+// hash := os.NewFile(hashfd, "sha1")
+// // Hash the contents of a file.
+// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
+// b := make([]byte, 4096)
+// for {
+// n, err := f.Read(b)
+// if err == io.EOF {
+// break
+// }
+// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
+// }
+// hash.Read(b)
+// fmt.Println(hex.EncodeToString(b))
+// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
+//
+// For more information, see: http://www.chronox.de/crypto-API/crypto/userspace-if.html.
+type SockaddrALG struct {
+ Type string
+ Name string
+ Feature uint32
+ Mask uint32
+ raw RawSockaddrALG
+}
+
+func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
+ // Leave room for NUL byte terminator.
+ if len(sa.Type) > 13 {
+ return nil, 0, EINVAL
+ }
+ if len(sa.Name) > 63 {
+ return nil, 0, EINVAL
+ }
+
+ sa.raw.Family = AF_ALG
+ sa.raw.Feat = sa.Feature
+ sa.raw.Mask = sa.Mask
+
+ typ, err := ByteSliceFromString(sa.Type)
+ if err != nil {
+ return nil, 0, err
+ }
+ name, err := ByteSliceFromString(sa.Name)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ copy(sa.raw.Type[:], typ)
+ copy(sa.raw.Name[:], name)
+
+ return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
+}
+
+// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
+// SockaddrVM provides access to Linux VM sockets: a mechanism that enables
+// bidirectional communication between a hypervisor and its guest virtual
+// machines.
+type SockaddrVM struct {
+ // CID and Port specify a context ID and port address for a VM socket.
+ // Guests have a unique CID, and hosts may have a well-known CID of:
+ // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
+ // - VMADDR_CID_HOST: refers to other processes on the host.
+ CID uint32
+ Port uint32
+ raw RawSockaddrVM
+}
+
+func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
+ sa.raw.Family = AF_VSOCK
+ sa.raw.Port = sa.Port
+ sa.raw.Cid = sa.CID
+
+ return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
+}
+
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_NETLINK:
@@ -521,6 +642,14 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
sa.Addr[i] = pp.Addr[i]
}
return sa, nil
+
+ case AF_VSOCK:
+ pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
+ sa := &SockaddrVM{
+ CID: pp.Cid,
+ Port: pp.Port,
+ }
+ return sa, nil
}
return nil, EAFNOSUPPORT
}
@@ -939,6 +1068,7 @@ func Getpgrp() (pid int) {
//sysnb Getpid() (pid int)
//sysnb Getppid() (ppid int)
//sys Getpriority(which int, who int) (prio int, err error)
+//sys Getrandom(buf []byte, flags int) (n int, err error)
//sysnb Getrusage(who int, rusage *Rusage) (err error)
//sysnb Getsid(pid int) (sid int, err error)
//sysnb Gettid() (tid int)
@@ -1019,6 +1149,25 @@ func Munmap(b []byte) (err error) {
//sys Mlockall(flags int) (err error)
//sys Munlockall() (err error)
+// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
+// using the specified flags.
+func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
+ n, _, errno := Syscall6(
+ SYS_VMSPLICE,
+ uintptr(fd),
+ uintptr(unsafe.Pointer(&iovs[0])),
+ uintptr(len(iovs)),
+ uintptr(flags),
+ 0,
+ 0,
+ )
+ if errno != 0 {
+ return 0, syscall.Errno(errno)
+ }
+
+ return int(n), nil
+}
+
/*
* Unimplemented
*/
@@ -1146,7 +1295,6 @@ func Munmap(b []byte) (err error) {
// Utimensat
// Vfork
// Vhangup
-// Vmsplice
// Vserver
// Waitid
// _Sysctl
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
index 5ed801369..be77d24a4 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
@@ -73,7 +73,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
func Fstatfs(fd int, buf *Statfs_t) (err error) {
_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- use(unsafe.Pointer(buf))
if e != 0 {
err = errnoErr(e)
}
@@ -86,7 +85,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return err
}
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- use(unsafe.Pointer(p))
if e != 0 {
err = errnoErr(e)
}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
index 81c5f4732..1708a4bbf 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
@@ -132,7 +132,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
- use(unsafe.Pointer(&mmap_args[0]))
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
index 554a82342..246131d2a 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
@@ -111,7 +111,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1
diff --git a/vendor/golang.org/x/sys/unix/types_linux.go b/vendor/golang.org/x/sys/unix/types_linux.go
index f3d8f90ee..ae79779ed 100644
--- a/vendor/golang.org/x/sys/unix/types_linux.go
+++ b/vendor/golang.org/x/sys/unix/types_linux.go
@@ -59,6 +59,8 @@ package unix
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <linux/can.h>
+#include <linux/if_alg.h>
+#include <linux/vm_sockets.h>
#ifdef TCSETS2
// On systems that have "struct termios2" use this as type Termios.
@@ -221,6 +223,10 @@ type RawSockaddrHCI C.struct_sockaddr_hci
type RawSockaddrCAN C.struct_sockaddr_can
+type RawSockaddrALG C.struct_sockaddr_alg
+
+type RawSockaddrVM C.struct_sockaddr_vm
+
type RawSockaddr C.struct_sockaddr
type RawSockaddrAny C.struct_sockaddr_any
@@ -262,6 +268,8 @@ const (
SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
+ SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
+ SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
SizeofLinger = C.sizeof_struct_linger
SizeofIPMreq = C.sizeof_struct_ip_mreq
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
index b40d0299b..2d02caf0e 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
@@ -51,8 +51,16 @@ const (
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0x0
+ AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -145,6 +153,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80041270
+ BLKBSZSET = 0x40041271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80041272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -385,6 +408,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -424,6 +453,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -808,6 +839,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1247,6 +1279,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1292,6 +1325,17 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1464,6 +1508,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
index 9f0600ccb..f21dcd9dc 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
@@ -51,8 +51,16 @@ const (
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0x0
+ AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -145,6 +153,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -385,6 +408,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -424,6 +453,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -766,6 +797,7 @@ const (
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
+ NETLINK_CAP_ACK = 0xa
NETLINK_CONNECTOR = 0xb
NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
@@ -778,14 +810,19 @@ const (
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
+ NETLINK_LISTEN_ALL_NSID = 0x8
+ NETLINK_LIST_MEMBERSHIPS = 0x9
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_RDMA = 0x14
NETLINK_ROUTE = 0x0
+ NETLINK_RX_RING = 0x6
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
+ NETLINK_SOCK_DIAG = 0x4
+ NETLINK_TX_RING = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
@@ -808,6 +845,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1248,6 +1286,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1293,6 +1332,17 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1465,7 +1515,13 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6
+ VM_SOCKETS_INVALID_VERSION = 0xffffffff
VQUIT = 0x1
VREPRINT = 0xc
VSTART = 0x8
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
index 647a796e3..7889e6477 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
@@ -50,8 +50,16 @@ const (
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0x0
+ AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -141,6 +149,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -370,6 +393,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -409,6 +438,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -726,6 +757,7 @@ const (
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
NETLINK_CONNECTOR = 0xb
+ NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
NETLINK_DROP_MEMBERSHIP = 0x2
NETLINK_ECRYPTFS = 0x13
@@ -742,8 +774,11 @@ const (
NETLINK_PKTINFO = 0x3
NETLINK_RDMA = 0x14
NETLINK_ROUTE = 0x0
+ NETLINK_RX_RING = 0x6
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
+ NETLINK_SOCK_DIAG = 0x4
+ NETLINK_TX_RING = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
@@ -766,6 +801,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
NLM_F_MATCH = 0x200
@@ -1171,6 +1207,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1216,6 +1253,17 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1388,6 +1436,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
index a6d1e1fa3..16a18f595 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
@@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -149,6 +156,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -399,6 +421,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -438,6 +466,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -795,6 +825,7 @@ const (
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
+ NETLINK_CAP_ACK = 0xa
NETLINK_CONNECTOR = 0xb
NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
@@ -807,6 +838,8 @@ const (
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
+ NETLINK_LISTEN_ALL_NSID = 0x8
+ NETLINK_LIST_MEMBERSHIPS = 0x9
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
@@ -840,6 +873,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1294,6 +1328,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1347,7 +1382,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1542,6 +1588,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
index e4fb9ad57..80e69e4cb 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
@@ -50,8 +50,16 @@ const (
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0x0
+ AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -144,6 +152,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -375,6 +398,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -414,6 +443,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -753,6 +784,7 @@ const (
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
+ NETLINK_CAP_ACK = 0xa
NETLINK_CONNECTOR = 0xb
NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
@@ -765,14 +797,19 @@ const (
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
+ NETLINK_LISTEN_ALL_NSID = 0x8
+ NETLINK_LIST_MEMBERSHIPS = 0x9
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_RDMA = 0x14
NETLINK_ROUTE = 0x0
+ NETLINK_RX_RING = 0x6
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
+ NETLINK_SOCK_DIAG = 0x4
+ NETLINK_TX_RING = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
@@ -795,6 +832,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1221,6 +1259,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0xffff
@@ -1267,6 +1306,17 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1435,6 +1485,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
index 36535b242..9c91dbf60 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
@@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -152,6 +159,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BPF_A = 0x10
BPF_ABS = 0x20
BPF_ADD = 0x0
@@ -374,6 +396,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FLUSHO = 0x2000
@@ -413,6 +441,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
ICANON = 0x2
ICMPV6_FILTER = 0x1
@@ -806,6 +836,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1304,6 +1335,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0xffff
@@ -1362,7 +1394,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1540,6 +1583,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
index 112f05de5..fb15b41ed 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
@@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -152,6 +159,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BPF_A = 0x10
BPF_ABS = 0x20
BPF_ADD = 0x0
@@ -374,6 +396,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FLUSHO = 0x2000
@@ -413,6 +441,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
ICANON = 0x2
ICMPV6_FILTER = 0x1
@@ -806,6 +836,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1304,6 +1335,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0xffff
@@ -1362,7 +1394,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1540,6 +1583,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
index 0f5ee2237..9a3a73766 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
@@ -57,6 +57,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -153,6 +160,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -411,6 +433,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -453,6 +481,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -1437,7 +1467,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1641,6 +1682,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
index 4e4193951..4d602e6d2 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
@@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -150,6 +157,21 @@ const (
B75 = 0x2
B921600 = 0x16
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1f
BPF_A = 0x10
BPF_ABS = 0x20
@@ -401,6 +423,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -443,6 +471,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x4000
IBSHIFT = 0x10
ICANON = 0x100
@@ -785,6 +815,7 @@ const (
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
+ NETLINK_CAP_ACK = 0xa
NETLINK_CONNECTOR = 0xb
NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
@@ -797,6 +828,8 @@ const (
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
+ NETLINK_LISTEN_ALL_NSID = 0x8
+ NETLINK_LIST_MEMBERSHIPS = 0x9
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
@@ -832,6 +865,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1361,6 +1395,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1415,7 +1450,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1614,6 +1660,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x5
VQUIT = 0x1
VREPRINT = 0xb
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
index 407e6b539..5280d9e8c 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
@@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
@@ -149,6 +156,21 @@ const (
B75 = 0x2
B921600 = 0x16
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1f
BPF_A = 0x10
BPF_ABS = 0x20
@@ -397,6 +419,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -436,6 +464,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x4000
IBSHIFT = 0x10
ICANON = 0x100
@@ -840,6 +870,7 @@ const (
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
+ NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
@@ -1361,6 +1392,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1414,7 +1446,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1613,6 +1656,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x5
VQUIT = 0x1
VREPRINT = 0xb
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
index 40c9b8793..81ad7a876 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
@@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -152,6 +159,21 @@ const (
B75 = 0x2
B921600 = 0x1007
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -407,6 +429,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -449,6 +477,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -1412,6 +1442,7 @@ const (
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
+ SOL_NETLINK = 0x10e
SOL_PACKET = 0x107
SOL_RAW = 0xff
SOL_SOCKET = 0x1
@@ -1469,7 +1500,18 @@ const (
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1672,6 +1714,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
index 62680ed8a..95de199fc 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
@@ -57,6 +57,13 @@ const (
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
+ ALG_OP_DECRYPT = 0x0
+ ALG_OP_ENCRYPT = 0x1
+ ALG_SET_AEAD_ASSOCLEN = 0x4
+ ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_IV = 0x2
+ ALG_SET_KEY = 0x1
+ ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
@@ -156,6 +163,21 @@ const (
B76800 = 0x1005
B921600 = 0x1009
B9600 = 0xd
+ BLKBSZGET = 0x80081270
+ BLKBSZSET = 0x40081271
+ BLKFLSBUF = 0x1261
+ BLKFRAGET = 0x1265
+ BLKFRASET = 0x1264
+ BLKGETSIZE = 0x1260
+ BLKGETSIZE64 = 0x80081272
+ BLKRAGET = 0x1263
+ BLKRASET = 0x1262
+ BLKROGET = 0x125e
+ BLKROSET = 0x125d
+ BLKRRPART = 0x125f
+ BLKSECTGET = 0x1267
+ BLKSECTSET = 0x1266
+ BLKSSZGET = 0x1268
BOTHER = 0x1000
BPF_A = 0x10
BPF_ABS = 0x20
@@ -415,6 +437,12 @@ const (
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000
+ FALLOC_FL_COLLAPSE_RANGE = 0x8
+ FALLOC_FL_INSERT_RANGE = 0x20
+ FALLOC_FL_KEEP_SIZE = 0x1
+ FALLOC_FL_NO_HIDE_STALE = 0x4
+ FALLOC_FL_PUNCH_HOLE = 0x2
+ FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@@ -457,6 +485,8 @@ const (
F_ULOCK = 0x0
F_UNLCK = 0x3
F_WRLCK = 0x2
+ GRND_NONBLOCK = 0x1
+ GRND_RANDOM = 0x2
HUPCL = 0x400
IBSHIFT = 0x10
ICANON = 0x2
@@ -1510,7 +1540,18 @@ const (
SO_TIMESTAMPING = 0x23
SO_TIMESTAMPNS = 0x21
SO_TYPE = 0x1008
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
+ SO_VM_SOCKETS_BUFFER_SIZE = 0x0
+ SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
+ SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
+ SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
+ SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x25
+ SPLICE_F_GIFT = 0x8
+ SPLICE_F_MORE = 0x4
+ SPLICE_F_MOVE = 0x1
+ SPLICE_F_NONBLOCK = 0x2
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@@ -1715,6 +1756,11 @@ const (
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
+ VMADDR_CID_ANY = 0xffffffff
+ VMADDR_CID_HOST = 0x2
+ VMADDR_CID_HYPERVISOR = 0x0
+ VMADDR_CID_RESERVED = 0x1
+ VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4
VQUIT = 0x1
VREPRINT = 0xc
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
index 031034a34..e48f4a5c1 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go
+// mksyscall.pl -l32 -tags darwin,386 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build 386,darwin
+// +build darwin,386
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -307,7 +305,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -333,7 +330,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -349,7 +345,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -365,7 +360,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -381,7 +375,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -397,7 +390,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -449,8 +441,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -727,7 +717,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -748,8 +737,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -807,7 +792,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -823,7 +807,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -907,7 +890,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -924,7 +906,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,7 +979,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1020,8 +1000,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1037,7 +1015,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1053,7 +1030,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1120,7 +1096,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1227,7 +1202,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1264,8 +1237,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1291,7 +1262,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1315,7 +1285,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1331,7 +1300,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1347,7 +1315,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
index ee96f78ba..672ada0e4 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go
+// mksyscall.pl -tags darwin,amd64 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,darwin
+// +build darwin,amd64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -307,7 +305,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -333,7 +330,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -349,7 +345,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -365,7 +360,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -381,7 +375,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -397,7 +390,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -449,8 +441,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -727,7 +717,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -748,8 +737,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -807,7 +792,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -823,7 +807,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -907,7 +890,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -924,7 +906,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,7 +979,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1020,8 +1000,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1037,7 +1015,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1053,7 +1030,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1120,7 +1096,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1227,7 +1202,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1264,8 +1237,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1291,7 +1262,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1315,7 +1285,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1331,7 +1300,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1347,7 +1315,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1423,7 +1390,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
index e52cd0d54..d516409db 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go
+// mksyscall.pl -l32 -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm,darwin
+// +build darwin,arm
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -307,7 +305,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -333,7 +330,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -349,7 +345,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -365,7 +360,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -381,7 +375,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -397,7 +390,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -449,8 +441,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -558,7 +548,7 @@ func Fsync(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
- _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
+ _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -727,7 +717,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -748,8 +737,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -807,7 +792,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -823,7 +807,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -907,7 +890,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -924,7 +906,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -941,7 +922,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
} else {
_p0 = unsafe.Pointer(&_zero)
}
- r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
+ r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -958,7 +939,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
} else {
_p0 = unsafe.Pointer(&_zero)
}
- r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
+ r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,7 +979,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1020,8 +1000,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1037,7 +1015,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1053,7 +1030,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1063,8 +1039,8 @@ func Rmdir(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
- r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
- newoffset = int64(r0)
+ r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0)
+ newoffset = int64(int64(r1)<<32 | int64(r0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1120,7 +1096,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1227,7 +1202,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1264,8 +1237,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1290,8 +1261,7 @@ func Truncate(path string, length int64) (err error) {
if err != nil {
return
}
- _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
+ _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1315,7 +1285,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1331,7 +1300,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1347,7 +1315,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1374,7 +1341,7 @@ func write(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
- r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
+ r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
ret = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
index 9863ef99e..e97759c35 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go
+// mksyscall.pl -tags darwin,arm64 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm64,darwin
+// +build darwin,arm64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -307,7 +305,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -333,7 +330,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -349,7 +345,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -365,7 +360,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -381,7 +375,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -397,7 +390,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -449,8 +441,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -727,7 +717,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -748,8 +737,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -807,7 +792,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -823,7 +807,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -907,7 +890,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -924,7 +906,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,7 +979,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1020,8 +1000,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1037,7 +1015,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1053,7 +1030,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1120,7 +1096,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1227,7 +1202,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1264,8 +1237,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1291,7 +1262,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1315,7 +1285,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1331,7 +1300,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1347,7 +1315,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
index 78de48dcf..3e9d82a27 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -dragonfly syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go
+// mksyscall.pl -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,dragonfly
+// +build dragonfly,amd64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -321,7 +319,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -347,7 +344,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -363,7 +359,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -379,7 +374,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +389,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -411,7 +404,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -739,7 +731,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -760,8 +751,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -787,7 +776,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -803,7 +791,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -819,7 +806,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -835,7 +821,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -929,7 +914,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -946,7 +930,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -986,7 +969,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1008,8 +990,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1025,7 +1005,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1041,7 +1020,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1108,7 +1086,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1225,7 +1202,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1241,7 +1217,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1262,8 +1237,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1289,7 +1262,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1313,7 +1285,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1329,7 +1300,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1345,7 +1315,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
index fade994dc..f53801cee 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go
+// mksyscall.pl -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build 386,freebsd
+// +build freebsd,386
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -287,7 +285,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -313,7 +310,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -329,7 +325,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -345,7 +340,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -361,7 +355,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -377,7 +370,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -431,7 +423,6 @@ func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -448,7 +439,6 @@ func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -465,7 +455,6 @@ func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -497,8 +486,6 @@ func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -520,8 +507,6 @@ func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -543,8 +528,6 @@ func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -560,7 +543,6 @@ func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -582,8 +564,6 @@ func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -605,8 +585,6 @@ func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -628,8 +606,6 @@ func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -645,7 +621,6 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -946,7 +921,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -967,8 +941,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -994,7 +966,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1010,7 +981,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1026,7 +996,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1042,7 +1011,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1136,7 +1104,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1153,7 +1120,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1227,7 +1193,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1249,8 +1214,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1266,7 +1229,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1282,7 +1244,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1349,7 +1310,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1466,7 +1426,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1482,7 +1441,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1503,8 +1461,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1530,7 +1486,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1554,7 +1509,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1570,7 +1524,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1586,7 +1539,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
index c28281e83..55b07412c 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go
+// mksyscall.pl -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,freebsd
+// +build freebsd,amd64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -287,7 +285,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -313,7 +310,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -329,7 +325,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -345,7 +340,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -361,7 +355,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -377,7 +370,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -431,7 +423,6 @@ func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -448,7 +439,6 @@ func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -465,7 +455,6 @@ func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -497,8 +486,6 @@ func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -520,8 +507,6 @@ func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -543,8 +528,6 @@ func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -560,7 +543,6 @@ func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -582,8 +564,6 @@ func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -605,8 +585,6 @@ func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -628,8 +606,6 @@ func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -645,7 +621,6 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -946,7 +921,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -967,8 +941,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -994,7 +966,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1010,7 +981,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1026,7 +996,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1042,7 +1011,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1136,7 +1104,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1153,7 +1120,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1227,7 +1193,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1249,8 +1214,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1266,7 +1229,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1282,7 +1244,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1349,7 +1310,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1466,7 +1426,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1482,7 +1441,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1503,8 +1461,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1530,7 +1486,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1554,7 +1509,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1570,7 +1524,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1586,7 +1539,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
index a18ba5c88..0e9b42bf4 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go
+// mksyscall.pl -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm,freebsd
+// +build freebsd,arm
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -287,7 +285,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -313,7 +310,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -329,7 +325,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -345,7 +340,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -361,7 +355,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -377,7 +370,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -431,7 +423,6 @@ func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -448,7 +439,6 @@ func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbyt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -465,7 +455,6 @@ func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) {
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -497,8 +486,6 @@ func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -520,8 +507,6 @@ func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -543,8 +528,6 @@ func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -560,7 +543,6 @@ func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -582,8 +564,6 @@ func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -605,8 +585,6 @@ func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintpt
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -628,8 +606,6 @@ func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err err
return
}
_, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -645,7 +621,6 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (
return
}
r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0)
- use(unsafe.Pointer(_p0))
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -946,7 +921,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -967,8 +941,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -994,7 +966,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1010,7 +981,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1026,7 +996,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1042,7 +1011,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1136,7 +1104,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1153,7 +1120,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1227,7 +1193,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1249,8 +1214,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1266,7 +1229,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1282,7 +1244,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1349,7 +1310,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1466,7 +1426,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1482,7 +1441,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1503,8 +1461,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1530,7 +1486,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1554,7 +1509,6 @@ func Undelete(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1570,7 +1524,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1586,7 +1539,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
index fa92387b1..d4ec806db 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 syscall_linux.go syscall_linux_386.go
+// mksyscall.pl -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build 386,linux
+// +build linux,386
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1351,7 +1334,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1367,7 +1349,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1499,7 +1480,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1525,7 +1505,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1652,7 +1631,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
index b34d5c26f..8b2e87dfc 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_amd64.go
+// mksyscall.pl -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,linux
+// +build linux,amd64
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1368,7 +1351,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1394,7 +1376,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1578,7 +1559,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1594,7 +1574,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1620,7 +1599,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1826,7 +1804,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
index 2e5cb3984..82d36a411 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -arm syscall_linux.go syscall_linux_arm.go
+// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm,linux
+// +build linux,arm
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1480,7 +1463,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1506,7 +1488,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1625,7 +1606,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1712,7 +1692,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
index 0d584cc0d..f6cc3200d 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_arm64.go
+// mksyscall.pl -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm64,linux
+// +build linux,arm64
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1255,7 +1238,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1501,7 +1483,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1527,7 +1508,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
index a18e0b171..f91afb481 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -b32 -arm syscall_linux.go syscall_linux_mipsx.go
+// mksyscall.pl -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build mips,linux
+// +build linux,mips
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1280,7 +1263,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1453,7 +1435,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length>>32), uintptr(length), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1700,7 +1681,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1726,7 +1706,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1742,7 +1721,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
index bf6f3603b..657d11eff 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_mips64x.go
+// mksyscall.pl -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build mips64,linux
+// +build linux,mips64
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1307,7 +1290,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1501,7 +1483,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1527,7 +1508,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1743,7 +1723,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1779,7 +1758,6 @@ func lstat(path string, st *stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1795,7 +1773,6 @@ func stat(path string, st *stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
index 8c86bd70b..31ff1774c 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_mips64x.go
+// mksyscall.pl -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build mips64le,linux
+// +build linux,mips64le
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1307,7 +1290,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1501,7 +1483,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1527,7 +1508,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1743,7 +1723,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1779,7 +1758,6 @@ func lstat(path string, st *stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1795,7 +1773,6 @@ func stat(path string, st *stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
index 645e00ebd..797e6336e 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -arm syscall_linux.go syscall_linux_mipsx.go
+// mksyscall.pl -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build mipsle,linux
+// +build linux,mipsle
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1280,7 +1263,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1453,7 +1435,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1700,7 +1681,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1726,7 +1706,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1742,7 +1721,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
index f5d488b4a..307dbb5bd 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_ppc64x.go
+// mksyscall.pl -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build ppc64,linux
+// +build linux,ppc64
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1358,7 +1341,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1384,7 +1366,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1568,7 +1549,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1584,7 +1564,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1610,7 +1589,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1837,7 +1815,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
index 5183711ec..f458a63ad 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_ppc64x.go
+// mksyscall.pl -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build ppc64le,linux
+// +build linux,ppc64le
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1358,7 +1341,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1384,7 +1366,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1568,7 +1549,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1584,7 +1564,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1610,7 +1589,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1837,7 +1815,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
index 4c7ed08cc..b1d5a9bc3 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_s390x.go
+// mksyscall.pl -tags linux,s390x syscall_linux.go syscall_linux_s390x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build s390x,linux
+// +build linux,s390x
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1348,7 +1331,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1364,7 +1346,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1538,7 +1519,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1554,7 +1534,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1580,7 +1559,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1627,7 +1605,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
index beb83e4fd..ce3ec585b 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl syscall_linux.go syscall_linux_sparc64.go
+// mksyscall.pl -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build sparc64,linux
+// +build linux,sparc64
package unix
@@ -26,8 +26,6 @@ func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags in
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -43,7 +41,6 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -77,7 +74,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -99,8 +95,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -116,7 +110,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -132,7 +125,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -148,7 +140,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -212,7 +203,6 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,9 +228,6 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
- use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -256,7 +243,6 @@ func Acct(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -283,7 +269,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -299,7 +284,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -395,7 +379,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -441,7 +424,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -457,7 +439,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -562,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Getrandom(buf []byte, flags int) (n int, err error) {
+ var _p0 unsafe.Pointer
+ if len(buf) > 0 {
+ _p0 = unsafe.Pointer(&buf[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
@@ -609,8 +607,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -627,7 +623,6 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
- use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -699,7 +694,6 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
- use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -716,7 +710,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -732,7 +725,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -763,8 +755,6 @@ func PivotRoot(newroot string, putold string) (err error) {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -822,8 +812,6 @@ func Removexattr(path string, attr string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -844,8 +832,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -955,8 +941,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1039,7 +1023,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1338,7 +1321,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1364,7 +1346,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1548,7 +1529,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1564,7 +1544,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1590,7 +1569,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1806,7 +1784,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
index b16e1d0ee..3182345ec 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -netbsd syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go
+// mksyscall.pl -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build 386,netbsd
+// +build netbsd,386
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -304,7 +302,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -330,7 +327,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -346,7 +342,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -362,7 +357,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -378,7 +372,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -394,7 +387,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -687,7 +679,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -708,8 +699,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -735,7 +724,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -751,7 +739,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -767,7 +754,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -783,7 +769,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -877,7 +862,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -894,7 +878,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -968,7 +951,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -990,8 +972,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1007,7 +987,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1023,7 +1002,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1171,7 +1149,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1192,8 +1169,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1219,7 +1194,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1259,7 +1232,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
index b63667da9..74ba8189a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -netbsd syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go
+// mksyscall.pl -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,netbsd
+// +build netbsd,amd64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -304,7 +302,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -330,7 +327,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -346,7 +342,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -362,7 +357,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -378,7 +372,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -394,7 +387,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -687,7 +679,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -708,8 +699,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -735,7 +724,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -751,7 +739,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -767,7 +754,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -783,7 +769,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -877,7 +862,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -894,7 +878,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -968,7 +951,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -990,8 +972,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1007,7 +987,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1023,7 +1002,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1171,7 +1149,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1192,8 +1169,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1219,7 +1194,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1259,7 +1232,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
index b0d19038d..1f346e2f5 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go
+// mksyscall.pl -l32 -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build arm,netbsd
+// +build netbsd,arm
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -304,7 +302,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -330,7 +327,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -346,7 +342,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -362,7 +357,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -378,7 +372,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -394,7 +387,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -687,7 +679,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -708,8 +699,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -735,7 +724,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -751,7 +739,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -767,7 +754,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -783,7 +769,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -877,7 +862,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -894,7 +878,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -968,7 +951,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -990,8 +972,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1007,7 +987,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1023,7 +1002,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1171,7 +1149,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1192,8 +1169,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1219,7 +1194,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1243,7 +1217,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1259,7 +1232,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
index f91a5b856..ca3e81392 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -l32 -openbsd syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go
+// mksyscall.pl -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build 386,openbsd
+// +build openbsd,386
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -302,7 +300,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -328,7 +325,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -344,7 +340,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -360,7 +355,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -376,7 +370,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -392,7 +385,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -695,7 +687,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -716,8 +707,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -743,7 +732,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -759,7 +747,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -885,7 +870,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -902,7 +886,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -976,7 +959,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,8 +980,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1015,7 +995,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1031,7 +1010,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1098,7 +1076,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1215,7 +1192,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1231,7 +1207,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1252,8 +1227,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1279,7 +1252,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1303,7 +1275,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1319,7 +1290,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
index 2e8d59d72..bf63d552e 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall.pl -openbsd syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go
+// mksyscall.pl -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,openbsd
+// +build openbsd,amd64
package unix
@@ -222,7 +222,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
- use(_p0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -238,7 +237,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -302,7 +300,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -328,7 +325,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -344,7 +340,6 @@ func Chflags(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -360,7 +355,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -376,7 +370,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -392,7 +385,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -695,7 +687,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -716,8 +707,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -743,7 +732,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -759,7 +747,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -775,7 +762,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -791,7 +777,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -885,7 +870,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -902,7 +886,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -976,7 +959,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -998,8 +980,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1015,7 +995,6 @@ func Revoke(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1031,7 +1010,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1098,7 +1076,6 @@ func Setlogin(name string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1215,7 +1192,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1231,7 +1207,6 @@ func Statfs(path string, stat *Statfs_t) (err error) {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1252,8 +1227,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1279,7 +1252,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1303,7 +1275,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
@@ -1319,7 +1290,6 @@ func Unmount(path string, flags int) (err error) {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
index c0ecfc044..bdf140b18 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
@@ -1,7 +1,7 @@
-// mksyscall_solaris.pl syscall_solaris.go syscall_solaris_amd64.go
+// mksyscall_solaris.pl -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
-// +build amd64,solaris
+// +build solaris,amd64
package unix
@@ -442,7 +442,6 @@ func utimes(path string, times *[2]Timeval) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimes)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -456,7 +455,6 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimensat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -530,7 +528,6 @@ func Access(path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAccess)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -552,7 +549,6 @@ func Chdir(path string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -566,7 +562,6 @@ func Chmod(path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChmod)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -580,7 +575,6 @@ func Chown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -594,7 +588,6 @@ func Chroot(path string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChroot)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -616,7 +609,6 @@ func Creat(path string, mode uint32) (fd int, err error) {
return
}
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procCreat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = e1
@@ -669,7 +661,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -691,7 +682,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchownat)), 5, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -838,7 +828,6 @@ func Lchown(path string, uid int, gid int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLchown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -857,8 +846,6 @@ func Link(path string, link string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = e1
}
@@ -880,7 +867,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLstat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -906,7 +892,6 @@ func Mkdir(path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdir)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -920,7 +905,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdirat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -934,7 +918,6 @@ func Mkfifo(path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifo)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -948,7 +931,6 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifoat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -962,7 +944,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknod)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -976,7 +957,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1050,7 +1030,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
return
}
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpen)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = e1
@@ -1065,7 +1044,6 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return
}
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpenat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = e1
@@ -1080,7 +1058,6 @@ func Pathconf(path string, name int) (val int, err error) {
return
}
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPathconf)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
val = int(r0)
if e1 != 0 {
err = e1
@@ -1146,7 +1123,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
_p1 = &buf[0]
}
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procReadlink)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0)
- use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1
@@ -1166,8 +1142,6 @@ func Rename(from string, to string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRename)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = e1
}
@@ -1186,8 +1160,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRenameat)), 4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = e1
}
@@ -1201,7 +1173,6 @@ func Rmdir(path string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRmdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1325,7 +1296,6 @@ func Stat(path string, stat *Stat_t) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1344,8 +1314,6 @@ func Symlink(path string, link string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSymlink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if e1 != 0 {
err = e1
}
@@ -1376,7 +1344,6 @@ func Truncate(path string, length int64) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procTruncate)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1420,7 +1387,6 @@ func Unmount(target string, flags int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procumount)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1434,7 +1400,6 @@ func Unlink(path string) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlink)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1448,7 +1413,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlinkat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
@@ -1470,7 +1434,6 @@ func Utime(path string, buf *Utimbuf) (err error) {
return
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUtime)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0)
- use(unsafe.Pointer(_p0))
if e1 != 0 {
err = e1
}
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
index ba952c675..206b3c281 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd_32.h
+// mksysnum_linux.pl -Ilinux/usr/include -m32 -D__i386__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build 386,linux
@@ -226,7 +226,6 @@ const (
SYS_PIVOT_ROOT = 217
SYS_MINCORE = 218
SYS_MADVISE = 219
- SYS_MADVISE1 = 219
SYS_GETDENTS64 = 220
SYS_FCNTL64 = 221
SYS_GETTID = 224
@@ -352,4 +351,38 @@ const (
SYS_SETNS = 346
SYS_PROCESS_VM_READV = 347
SYS_PROCESS_VM_WRITEV = 348
+ SYS_KCMP = 349
+ SYS_FINIT_MODULE = 350
+ SYS_SCHED_SETATTR = 351
+ SYS_SCHED_GETATTR = 352
+ SYS_RENAMEAT2 = 353
+ SYS_SECCOMP = 354
+ SYS_GETRANDOM = 355
+ SYS_MEMFD_CREATE = 356
+ SYS_BPF = 357
+ SYS_EXECVEAT = 358
+ SYS_SOCKET = 359
+ SYS_SOCKETPAIR = 360
+ SYS_BIND = 361
+ SYS_CONNECT = 362
+ SYS_LISTEN = 363
+ SYS_ACCEPT4 = 364
+ SYS_GETSOCKOPT = 365
+ SYS_SETSOCKOPT = 366
+ SYS_GETSOCKNAME = 367
+ SYS_GETPEERNAME = 368
+ SYS_SENDTO = 369
+ SYS_SENDMSG = 370
+ SYS_RECVFROM = 371
+ SYS_RECVMSG = 372
+ SYS_SHUTDOWN = 373
+ SYS_USERFAULTFD = 374
+ SYS_MEMBARRIER = 375
+ SYS_MLOCK2 = 376
+ SYS_COPY_FILE_RANGE = 377
+ SYS_PREADV2 = 378
+ SYS_PWRITEV2 = 379
+ SYS_PKEY_MPROTECT = 380
+ SYS_PKEY_ALLOC = 381
+ SYS_PKEY_FREE = 382
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
index ddac31f58..904231736 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd_64.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build amd64,linux
@@ -318,4 +318,24 @@ const (
SYS_GETCPU = 309
SYS_PROCESS_VM_READV = 310
SYS_PROCESS_VM_WRITEV = 311
+ SYS_KCMP = 312
+ SYS_FINIT_MODULE = 313
+ SYS_SCHED_SETATTR = 314
+ SYS_SCHED_GETATTR = 315
+ SYS_RENAMEAT2 = 316
+ SYS_SECCOMP = 317
+ SYS_GETRANDOM = 318
+ SYS_MEMFD_CREATE = 319
+ SYS_KEXEC_FILE_LOAD = 320
+ SYS_BPF = 321
+ SYS_EXECVEAT = 322
+ SYS_USERFAULTFD = 323
+ SYS_MEMBARRIER = 324
+ SYS_MLOCK2 = 325
+ SYS_COPY_FILE_RANGE = 326
+ SYS_PREADV2 = 327
+ SYS_PWRITEV2 = 328
+ SYS_PKEY_MPROTECT = 329
+ SYS_PKEY_ALLOC = 330
+ SYS_PKEY_FREE = 331
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
index 45ced17fc..e3e674562 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl
+// mksysnum_linux.pl -Ilinux/usr/include -m32 -D__ARM_EABI__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build arm,linux
@@ -6,8 +6,6 @@
package unix
const (
- SYS_OABI_SYSCALL_BASE = 0
- SYS_SYSCALL_BASE = 0
SYS_RESTART_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
@@ -20,21 +18,16 @@ const (
SYS_UNLINK = 10
SYS_EXECVE = 11
SYS_CHDIR = 12
- SYS_TIME = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_LCHOWN = 16
SYS_LSEEK = 19
SYS_GETPID = 20
SYS_MOUNT = 21
- SYS_UMOUNT = 22
SYS_SETUID = 23
SYS_GETUID = 24
- SYS_STIME = 25
SYS_PTRACE = 26
- SYS_ALARM = 27
SYS_PAUSE = 29
- SYS_UTIME = 30
SYS_ACCESS = 33
SYS_NICE = 34
SYS_SYNC = 36
@@ -69,20 +62,16 @@ const (
SYS_SIGPENDING = 73
SYS_SETHOSTNAME = 74
SYS_SETRLIMIT = 75
- SYS_GETRLIMIT = 76
SYS_GETRUSAGE = 77
SYS_GETTIMEOFDAY = 78
SYS_SETTIMEOFDAY = 79
SYS_GETGROUPS = 80
SYS_SETGROUPS = 81
- SYS_SELECT = 82
SYS_SYMLINK = 83
SYS_READLINK = 85
SYS_USELIB = 86
SYS_SWAPON = 87
SYS_REBOOT = 88
- SYS_READDIR = 89
- SYS_MMAP = 90
SYS_MUNMAP = 91
SYS_TRUNCATE = 92
SYS_FTRUNCATE = 93
@@ -92,7 +81,6 @@ const (
SYS_SETPRIORITY = 97
SYS_STATFS = 99
SYS_FSTATFS = 100
- SYS_SOCKETCALL = 102
SYS_SYSLOG = 103
SYS_SETITIMER = 104
SYS_GETITIMER = 105
@@ -100,11 +88,9 @@ const (
SYS_LSTAT = 107
SYS_FSTAT = 108
SYS_VHANGUP = 111
- SYS_SYSCALL = 113
SYS_WAIT4 = 114
SYS_SWAPOFF = 115
SYS_SYSINFO = 116
- SYS_IPC = 117
SYS_FSYNC = 118
SYS_SIGRETURN = 119
SYS_CLONE = 120
@@ -353,4 +339,23 @@ const (
SYS_SETNS = 375
SYS_PROCESS_VM_READV = 376
SYS_PROCESS_VM_WRITEV = 377
+ SYS_KCMP = 378
+ SYS_FINIT_MODULE = 379
+ SYS_SCHED_SETATTR = 380
+ SYS_SCHED_GETATTR = 381
+ SYS_RENAMEAT2 = 382
+ SYS_SECCOMP = 383
+ SYS_GETRANDOM = 384
+ SYS_MEMFD_CREATE = 385
+ SYS_BPF = 386
+ SYS_EXECVEAT = 387
+ SYS_USERFAULTFD = 388
+ SYS_MEMBARRIER = 389
+ SYS_MLOCK2 = 390
+ SYS_COPY_FILE_RANGE = 391
+ SYS_PREADV2 = 392
+ SYS_PWRITEV2 = 393
+ SYS_PKEY_MPROTECT = 394
+ SYS_PKEY_ALLOC = 395
+ SYS_PKEY_FREE = 396
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
index 2e9514f28..90e43d006 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm-generic/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build arm64,linux
@@ -269,4 +269,17 @@ const (
SYS_SCHED_GETATTR = 275
SYS_RENAMEAT2 = 276
SYS_SECCOMP = 277
+ SYS_GETRANDOM = 278
+ SYS_MEMFD_CREATE = 279
+ SYS_BPF = 280
+ SYS_EXECVEAT = 281
+ SYS_USERFAULTFD = 282
+ SYS_MEMBARRIER = 283
+ SYS_MLOCK2 = 284
+ SYS_COPY_FILE_RANGE = 285
+ SYS_PREADV2 = 286
+ SYS_PWRITEV2 = 287
+ SYS_PKEY_MPROTECT = 288
+ SYS_PKEY_ALLOC = 289
+ SYS_PKEY_FREE = 290
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
index 0786867e9..77ff644d7 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/mips-linux-gnu/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m32 -D_MIPS_SIM=_MIPS_SIM_ABI32 -D__MIPSEB__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build mips,linux
@@ -352,8 +352,23 @@ const (
SYS_SETNS = 4344
SYS_PROCESS_VM_READV = 4345
SYS_PROCESS_VM_WRITEV = 4346
- SYS_LINUX_SYSCALLS = 4346
- SYS_O32_LINUX_SYSCALLS = 4346
- SYS_64_LINUX_SYSCALLS = 4305
- SYS_N32_LINUX_SYSCALLS = 4310
+ SYS_KCMP = 4347
+ SYS_FINIT_MODULE = 4348
+ SYS_SCHED_SETATTR = 4349
+ SYS_SCHED_GETATTR = 4350
+ SYS_RENAMEAT2 = 4351
+ SYS_SECCOMP = 4352
+ SYS_GETRANDOM = 4353
+ SYS_MEMFD_CREATE = 4354
+ SYS_BPF = 4355
+ SYS_EXECVEAT = 4356
+ SYS_USERFAULTFD = 4357
+ SYS_MEMBARRIER = 4358
+ SYS_MLOCK2 = 4359
+ SYS_COPY_FILE_RANGE = 4360
+ SYS_PREADV2 = 4361
+ SYS_PWRITEV2 = 4362
+ SYS_PKEY_MPROTECT = 4363
+ SYS_PKEY_ALLOC = 4364
+ SYS_PKEY_FREE = 4365
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
index 5ffe1c719..fc86fcdb6 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D_MIPS_SIM=_MIPS_SIM_ABI64 -D__MIPSEB__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build mips64,linux
@@ -324,4 +324,11 @@ const (
SYS_EXECVEAT = 5316
SYS_USERFAULTFD = 5317
SYS_MEMBARRIER = 5318
+ SYS_MLOCK2 = 5319
+ SYS_COPY_FILE_RANGE = 5320
+ SYS_PREADV2 = 5321
+ SYS_PWRITEV2 = 5322
+ SYS_PKEY_MPROTECT = 5323
+ SYS_PKEY_ALLOC = 5324
+ SYS_PKEY_FREE = 5325
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
index d192b940c..993873c37 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D_MIPS_SIM=_MIPS_SIM_ABI64 -D__MIPSEL__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build mips64le,linux
@@ -324,4 +324,11 @@ const (
SYS_EXECVEAT = 5316
SYS_USERFAULTFD = 5317
SYS_MEMBARRIER = 5318
+ SYS_MLOCK2 = 5319
+ SYS_COPY_FILE_RANGE = 5320
+ SYS_PREADV2 = 5321
+ SYS_PWRITEV2 = 5322
+ SYS_PKEY_MPROTECT = 5323
+ SYS_PKEY_ALLOC = 5324
+ SYS_PKEY_FREE = 5325
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
index 25d231708..f0155ba5a 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/mips-linux-gnu/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m32 -D_MIPS_SIM=_MIPS_SIM_ABI32 -D__MIPSEL__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build mipsle,linux
@@ -352,8 +352,23 @@ const (
SYS_SETNS = 4344
SYS_PROCESS_VM_READV = 4345
SYS_PROCESS_VM_WRITEV = 4346
- SYS_LINUX_SYSCALLS = 4346
- SYS_O32_LINUX_SYSCALLS = 4346
- SYS_64_LINUX_SYSCALLS = 4305
- SYS_N32_LINUX_SYSCALLS = 4310
+ SYS_KCMP = 4347
+ SYS_FINIT_MODULE = 4348
+ SYS_SCHED_SETATTR = 4349
+ SYS_SCHED_GETATTR = 4350
+ SYS_RENAMEAT2 = 4351
+ SYS_SECCOMP = 4352
+ SYS_GETRANDOM = 4353
+ SYS_MEMFD_CREATE = 4354
+ SYS_BPF = 4355
+ SYS_EXECVEAT = 4356
+ SYS_USERFAULTFD = 4357
+ SYS_MEMBARRIER = 4358
+ SYS_MLOCK2 = 4359
+ SYS_COPY_FILE_RANGE = 4360
+ SYS_PREADV2 = 4361
+ SYS_PWRITEV2 = 4362
+ SYS_PKEY_MPROTECT = 4363
+ SYS_PKEY_ALLOC = 4364
+ SYS_PKEY_FREE = 4365
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
index e1b08f00d..0deec82c7 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__powerpc64__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build ppc64,linux
@@ -357,4 +357,13 @@ const (
SYS_GETRANDOM = 359
SYS_MEMFD_CREATE = 360
SYS_BPF = 361
+ SYS_EXECVEAT = 362
+ SYS_SWITCH_ENDIAN = 363
+ SYS_USERFAULTFD = 364
+ SYS_MEMBARRIER = 365
+ SYS_MLOCK2 = 378
+ SYS_COPY_FILE_RANGE = 379
+ SYS_PREADV2 = 380
+ SYS_PWRITEV2 = 381
+ SYS_KEXEC_FILE_LOAD = 382
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
index 45e63f51a..3f701be7c 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/powerpc64le-linux-gnu/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__powerpc64__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build ppc64le,linux
@@ -350,4 +350,20 @@ const (
SYS_PROCESS_VM_WRITEV = 352
SYS_FINIT_MODULE = 353
SYS_KCMP = 354
+ SYS_SCHED_SETATTR = 355
+ SYS_SCHED_GETATTR = 356
+ SYS_RENAMEAT2 = 357
+ SYS_SECCOMP = 358
+ SYS_GETRANDOM = 359
+ SYS_MEMFD_CREATE = 360
+ SYS_BPF = 361
+ SYS_EXECVEAT = 362
+ SYS_SWITCH_ENDIAN = 363
+ SYS_USERFAULTFD = 364
+ SYS_MEMBARRIER = 365
+ SYS_MLOCK2 = 378
+ SYS_COPY_FILE_RANGE = 379
+ SYS_PREADV2 = 380
+ SYS_PWRITEV2 = 381
+ SYS_KEXEC_FILE_LOAD = 382
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
index 42d4f5cda..8b35997d6 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__s390x__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build s390x,linux
@@ -303,6 +303,9 @@ const (
SYS_RECVMSG = 372
SYS_SHUTDOWN = 373
SYS_MLOCK2 = 374
+ SYS_COPY_FILE_RANGE = 375
+ SYS_PREADV2 = 376
+ SYS_PWRITEV2 = 377
SYS_SELECT = 142
SYS_GETRLIMIT = 191
SYS_LCHOWN = 198
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
index 46b5bee1d..c9c129dc4 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
@@ -1,4 +1,4 @@
-// mksysnum_linux.pl /usr/include/sparc64-linux-gnu/asm/unistd.h
+// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__arch64__ linux/usr/include/asm/unistd.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build sparc64,linux
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
index a3631053c..99dfd588a 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
@@ -210,6 +210,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -334,6 +350,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
index 0573e6cd2..c9e1e64a2 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
@@ -212,6 +212,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -338,6 +354,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
index 0578b5396..4bfba2a9e 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
@@ -214,6 +214,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]uint8
@@ -338,6 +354,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
index 808e04669..e58c500c1 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -339,6 +355,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
index 2eaff573d..a960085f8 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -336,6 +352,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
index 73e4b76c0..9d46a62c7 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -338,6 +354,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
index 479ca3e1b..267bfe903 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -338,6 +354,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
index 7617a69d0..950515a8e 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -336,6 +352,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
index 2db548b90..88538cbdc 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
@@ -214,6 +214,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]uint8
@@ -340,6 +356,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
index 4bfdcc0ac..2f63bc032 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
@@ -214,6 +214,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]uint8
@@ -340,6 +356,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
index 435cd792f..2c5bb05d1 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
@@ -213,6 +213,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -338,6 +354,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
index 439f96914..22bdab961 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
@@ -218,6 +218,22 @@ type RawSockaddrCAN struct {
Addr [8]byte
}
+type RawSockaddrALG struct {
+ Family uint16
+ Type [14]uint8
+ Feat uint32
+ Mask uint32
+ Name [64]uint8
+}
+
+type RawSockaddrVM struct {
+ Family uint16
+ Reserved1 uint16
+ Port uint32
+ Cid uint32
+ Zero [4]uint8
+}
+
type RawSockaddr struct {
Family uint16
Data [14]int8
@@ -343,6 +359,8 @@ const (
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
+ SizeofSockaddrALG = 0x58
+ SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
diff --git a/vendor/gopkg.in/gomail.v2/.travis.yml b/vendor/gopkg.in/gomail.v2/.travis.yml
new file mode 100644
index 000000000..24edf22cc
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/.travis.yml
@@ -0,0 +1,8 @@
+language: go
+
+go:
+ - 1.2
+ - 1.3
+ - 1.4
+ - 1.5
+ - tip
diff --git a/vendor/gopkg.in/gomail.v2/CHANGELOG.md b/vendor/gopkg.in/gomail.v2/CHANGELOG.md
new file mode 100644
index 000000000..a797ab4c0
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/CHANGELOG.md
@@ -0,0 +1,20 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+This project adheres to [Semantic Versioning](http://semver.org/).
+
+## [2.0.0] - 2015-09-02
+
+- Mailer has been removed. It has been replaced by Dialer and Sender.
+- `File` type and the `CreateFile` and `OpenFile` functions have been removed.
+- `Message.Attach` and `Message.Embed` have a new signature.
+- `Message.GetBodyWriter` has been removed. Use `Message.AddAlternativeWriter`
+instead.
+- `Message.Export` has been removed. `Message.WriteTo` can be used instead.
+- `Message.DelHeader` has been removed.
+- The `Bcc` header field is no longer sent. It is far more simpler and
+efficient: the same message is sent to all recipients instead of sending a
+different email to each Bcc address.
+- LoginAuth has been removed. `NewPlainDialer` now implements the LOGIN
+authentication mechanism when needed.
+- Go 1.2 is now required instead of Go 1.3. No external dependency are used when
+using Go 1.5.
diff --git a/vendor/gopkg.in/gomail.v2/CONTRIBUTING.md b/vendor/gopkg.in/gomail.v2/CONTRIBUTING.md
new file mode 100644
index 000000000..d5601c257
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/CONTRIBUTING.md
@@ -0,0 +1,20 @@
+Thank you for contributing to Gomail! Here are a few guidelines:
+
+## Bugs
+
+If you think you found a bug, create an issue and supply the minimum amount
+of code triggering the bug so it can be reproduced.
+
+
+## Fixing a bug
+
+If you want to fix a bug, you can send a pull request. It should contains a
+new test or update an existing one to cover that bug.
+
+
+## New feature proposal
+
+If you think Gomail lacks a feature, you can open an issue or send a pull
+request. I want to keep Gomail code and API as simple as possible so please
+describe your needs so we can discuss whether this feature should be added to
+Gomail or not.
diff --git a/vendor/gopkg.in/gomail.v2/LICENSE b/vendor/gopkg.in/gomail.v2/LICENSE
new file mode 100644
index 000000000..5f5c12af7
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Alexandre Cesaro
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/gopkg.in/gomail.v2/README.md b/vendor/gopkg.in/gomail.v2/README.md
new file mode 100644
index 000000000..18cb88130
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/README.md
@@ -0,0 +1,97 @@
+# Gomail
+[![Build Status](https://travis-ci.org/go-gomail/gomail.svg?branch=v2)](https://travis-ci.org/go-gomail/gomail) [![Code Coverage](http://gocover.io/_badge/gopkg.in/gomail.v2)](http://gocover.io/gopkg.in/gomail.v2) [![Documentation](https://godoc.org/gopkg.in/gomail.v2?status.svg)](https://godoc.org/gopkg.in/gomail.v2)
+
+## Introduction
+
+Gomail is a simple and efficient package to send emails. It is well tested and
+documented.
+
+It is versioned using [gopkg.in](https://gopkg.in) so I promise
+they will never be backward incompatible changes within each version.
+
+It requires Go 1.2 or newer. With Go 1.5, no external dependencies are used.
+
+
+## Features
+
+Gomail supports:
+- Attachments
+- Embedded images
+- HTML and text templates
+- Automatic encoding of special characters
+- SSL and TLS
+- Sending multiple emails with the same SMTP connection
+- Any method to send emails: SMTP, postfix (not included but easily doable), etc
+
+
+## Documentation
+
+https://godoc.org/gopkg.in/gomail.v2
+
+
+## Download
+
+ go get gopkg.in/gomail.v2
+
+
+## Examples
+
+See the [examples in the documentation](https://godoc.org/gopkg.in/gomail.v2#example-package).
+
+
+## FAQ
+
+### x509: certificate signed by unknown authority
+
+If you get this error it means the certificate used by the SMTP server is not
+considered valid by the client running Gomail. As a quick workaround you can
+bypass the verification of the server's certificate chain and host name by using
+`SetTLSConfig`:
+
+ d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
+ d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
+
+Note, however, that this is insecure and should not be used in production.
+
+
+## Contribute
+
+Contributions are more than welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for
+more info.
+
+
+## Change log
+
+See [CHANGELOG.md](CHANGELOG.md).
+
+
+## License
+
+[MIT](LICENSE)
+
+
+## Contact
+
+You can ask questions on the [Gomail
+thread](https://groups.google.com/d/topic/golang-nuts/jMxZHzvvEVg/discussion)
+in the Go mailing-list.
+
+
+## Support
+
+If you want to support the development of Gomail, I gladly accept donations.
+
+I will give 100% of the money I receive to
+[Enfants, Espoir Du Monde](http://www.eedm.fr/).
+EEDM is a French NGO which helps children in Bangladesh, Cameroun, Haiti, India
+and Madagascar.
+
+All its members are volunteers so its operating costs are only
+1.9%. So your money will directly helps children of these countries.
+
+As an added bonus, your donations will also tip me by lowering my taxes :smile:
+
+I will send an email with the receipt of the donation to EEDM annually to all
+donors.
+
+[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PYQKC7VFVXCFG)
diff --git a/vendor/gopkg.in/gomail.v2/auth.go b/vendor/gopkg.in/gomail.v2/auth.go
new file mode 100644
index 000000000..4bcdd0620
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/auth.go
@@ -0,0 +1,67 @@
+package gomail
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "net/smtp"
+)
+
+// plainAuth is an smtp.Auth that implements the PLAIN authentication mechanism.
+// It fallbacks to the LOGIN mechanism if it is the only mechanism advertised
+// by the server.
+type plainAuth struct {
+ username string
+ password string
+ host string
+ login bool
+}
+
+func (a *plainAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
+ if server.Name != a.host {
+ return "", nil, errors.New("gomail: wrong host name")
+ }
+
+ var plain, login bool
+ for _, a := range server.Auth {
+ switch a {
+ case "PLAIN":
+ plain = true
+ case "LOGIN":
+ login = true
+ }
+ }
+
+ if !server.TLS && !plain && !login {
+ return "", nil, errors.New("gomail: unencrypted connection")
+ }
+
+ if !plain && login {
+ a.login = true
+ return "LOGIN", nil, nil
+ }
+
+ return "PLAIN", []byte("\x00" + a.username + "\x00" + a.password), nil
+}
+
+func (a *plainAuth) Next(fromServer []byte, more bool) ([]byte, error) {
+ if !a.login {
+ if more {
+ return nil, errors.New("gomail: unexpected server challenge")
+ }
+ return nil, nil
+ }
+
+ if !more {
+ return nil, nil
+ }
+
+ switch {
+ case bytes.Equal(fromServer, []byte("Username:")):
+ return []byte(a.username), nil
+ case bytes.Equal(fromServer, []byte("Password:")):
+ return []byte(a.password), nil
+ default:
+ return nil, fmt.Errorf("gomail: unexpected server challenge: %s", fromServer)
+ }
+}
diff --git a/vendor/gopkg.in/gomail.v2/auth_test.go b/vendor/gopkg.in/gomail.v2/auth_test.go
new file mode 100644
index 000000000..20b477214
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/auth_test.go
@@ -0,0 +1,156 @@
+package gomail
+
+import (
+ "net/smtp"
+ "testing"
+)
+
+const (
+ testUser = "user"
+ testPwd = "pwd"
+ testHost = "smtp.example.com"
+)
+
+var testAuth = &plainAuth{
+ username: testUser,
+ password: testPwd,
+ host: testHost,
+}
+
+type plainAuthTest struct {
+ auths []string
+ challenges []string
+ tls bool
+ wantProto string
+ wantData []string
+ wantError bool
+}
+
+func TestNoAdvertisement(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{},
+ challenges: []string{"Username:", "Password:"},
+ tls: false,
+ wantProto: "PLAIN",
+ wantError: true,
+ })
+}
+
+func TestNoAdvertisementTLS(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{},
+ challenges: []string{"Username:", "Password:"},
+ tls: true,
+ wantProto: "PLAIN",
+ wantData: []string{"\x00" + testUser + "\x00" + testPwd},
+ })
+}
+
+func TestPlain(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"PLAIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: false,
+ wantProto: "PLAIN",
+ wantData: []string{"\x00" + testUser + "\x00" + testPwd},
+ })
+}
+
+func TestPlainTLS(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"PLAIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: true,
+ wantProto: "PLAIN",
+ wantData: []string{"\x00" + testUser + "\x00" + testPwd},
+ })
+}
+
+func TestPlainAndLogin(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"PLAIN", "LOGIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: false,
+ wantProto: "PLAIN",
+ wantData: []string{"\x00" + testUser + "\x00" + testPwd},
+ })
+}
+
+func TestPlainAndLoginTLS(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"PLAIN", "LOGIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: true,
+ wantProto: "PLAIN",
+ wantData: []string{"\x00" + testUser + "\x00" + testPwd},
+ })
+}
+
+func TestLogin(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"LOGIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: false,
+ wantProto: "LOGIN",
+ wantData: []string{"", testUser, testPwd},
+ })
+}
+
+func TestLoginTLS(t *testing.T) {
+ testPlainAuth(t, &plainAuthTest{
+ auths: []string{"LOGIN"},
+ challenges: []string{"Username:", "Password:"},
+ tls: true,
+ wantProto: "LOGIN",
+ wantData: []string{"", testUser, testPwd},
+ })
+}
+
+func testPlainAuth(t *testing.T, test *plainAuthTest) {
+ auth := &plainAuth{
+ username: testUser,
+ password: testPwd,
+ host: testHost,
+ }
+ server := &smtp.ServerInfo{
+ Name: testHost,
+ TLS: test.tls,
+ Auth: test.auths,
+ }
+ proto, toServer, err := auth.Start(server)
+ if err != nil && !test.wantError {
+ t.Fatalf("plainAuth.Start(): %v", err)
+ }
+ if err != nil && test.wantError {
+ return
+ }
+ if proto != test.wantProto {
+ t.Errorf("invalid protocol, got %q, want %q", proto, test.wantProto)
+ }
+
+ i := 0
+ got := string(toServer)
+ if got != test.wantData[i] {
+ t.Errorf("Invalid response, got %q, want %q", got, test.wantData[i])
+ }
+
+ if proto == "PLAIN" {
+ return
+ }
+
+ for _, challenge := range test.challenges {
+ i++
+ if i >= len(test.wantData) {
+ t.Fatalf("unexpected challenge: %q", challenge)
+ }
+
+ toServer, err = auth.Next([]byte(challenge), true)
+ if err != nil {
+ t.Fatalf("plainAuth.Auth(): %v", err)
+ }
+ got = string(toServer)
+ if got != test.wantData[i] {
+ t.Errorf("Invalid response, got %q, want %q", got, test.wantData[i])
+ }
+ }
+}
diff --git a/vendor/gopkg.in/gomail.v2/doc.go b/vendor/gopkg.in/gomail.v2/doc.go
new file mode 100644
index 000000000..a8f5091f5
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/doc.go
@@ -0,0 +1,5 @@
+// Package gomail provides a simple interface to compose emails and to mail them
+// efficiently.
+//
+// More info on Github: https://github.com/go-gomail/gomail
+package gomail
diff --git a/vendor/gopkg.in/gomail.v2/example_test.go b/vendor/gopkg.in/gomail.v2/example_test.go
new file mode 100644
index 000000000..8d9c6c293
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/example_test.go
@@ -0,0 +1,215 @@
+package gomail_test
+
+import (
+ "fmt"
+ "html/template"
+ "io"
+ "log"
+ "time"
+
+ "gopkg.in/gomail.v2"
+)
+
+func Example() {
+ m := gomail.NewMessage()
+ m.SetHeader("From", "alex@example.com")
+ m.SetHeader("To", "bob@example.com", "cora@example.com")
+ m.SetAddressHeader("Cc", "dan@example.com", "Dan")
+ m.SetHeader("Subject", "Hello!")
+ m.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!")
+ m.Attach("/home/Alex/lolcat.jpg")
+
+ d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
+
+ // Send the email to Bob, Cora and Dan.
+ if err := d.DialAndSend(m); err != nil {
+ panic(err)
+ }
+}
+
+// A daemon that listens to a channel and sends all incoming messages.
+func Example_daemon() {
+ ch := make(chan *gomail.Message)
+
+ go func() {
+ d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
+
+ var s gomail.SendCloser
+ var err error
+ open := false
+ for {
+ select {
+ case m, ok := <-ch:
+ if !ok {
+ return
+ }
+ if !open {
+ if s, err = d.Dial(); err != nil {
+ panic(err)
+ }
+ open = true
+ }
+ if err := gomail.Send(s, m); err != nil {
+ log.Print(err)
+ }
+ // Close the connection to the SMTP server if no email was sent in
+ // the last 30 seconds.
+ case <-time.After(30 * time.Second):
+ if open {
+ if err := s.Close(); err != nil {
+ panic(err)
+ }
+ open = false
+ }
+ }
+ }
+ }()
+
+ // Use the channel in your program to send emails.
+
+ // Close the channel to stop the mail daemon.
+ close(ch)
+}
+
+// Efficiently send a customized newsletter to a list of recipients.
+func Example_newsletter() {
+ // The list of recipients.
+ var list []struct {
+ Name string
+ Address string
+ }
+
+ d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
+ s, err := d.Dial()
+ if err != nil {
+ panic(err)
+ }
+
+ m := gomail.NewMessage()
+ for _, r := range list {
+ m.SetHeader("From", "no-reply@example.com")
+ m.SetAddressHeader("To", r.Address, r.Name)
+ m.SetHeader("Subject", "Newsletter #1")
+ m.SetBody("text/html", fmt.Sprintf("Hello %s!", r.Name))
+
+ if err := gomail.Send(s, m); err != nil {
+ log.Printf("Could not send email to %q: %v", r.Address, err)
+ }
+ m.Reset()
+ }
+}
+
+// Send an email using a local SMTP server.
+func Example_noAuth() {
+ m := gomail.NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetHeader("Subject", "Hello!")
+ m.SetBody("text/plain", "Hello!")
+
+ d := gomail.Dialer{Host: "localhost", Port: 587}
+ if err := d.DialAndSend(m); err != nil {
+ panic(err)
+ }
+}
+
+// Send an email using an API or postfix.
+func Example_noSMTP() {
+ m := gomail.NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetHeader("Subject", "Hello!")
+ m.SetBody("text/plain", "Hello!")
+
+ s := gomail.SendFunc(func(from string, to []string, msg io.WriterTo) error {
+ // Implements you email-sending function, for example by calling
+ // an API, or running postfix, etc.
+ fmt.Println("From:", from)
+ fmt.Println("To:", to)
+ return nil
+ })
+
+ if err := gomail.Send(s, m); err != nil {
+ panic(err)
+ }
+ // Output:
+ // From: from@example.com
+ // To: [to@example.com]
+}
+
+var m *gomail.Message
+
+func ExampleSetCopyFunc() {
+ m.Attach("foo.txt", gomail.SetCopyFunc(func(w io.Writer) error {
+ _, err := w.Write([]byte("Content of foo.txt"))
+ return err
+ }))
+}
+
+func ExampleSetHeader() {
+ h := map[string][]string{"Content-ID": {"<foo@bar.mail>"}}
+ m.Attach("foo.jpg", gomail.SetHeader(h))
+}
+
+func ExampleMessage_AddAlternative() {
+ m.SetBody("text/plain", "Hello!")
+ m.AddAlternative("text/html", "<p>Hello!</p>")
+}
+
+func ExampleMessage_AddAlternativeWriter() {
+ t := template.Must(template.New("example").Parse("Hello {{.}}!"))
+ m.AddAlternativeWriter("text/plain", func(w io.Writer) error {
+ return t.Execute(w, "Bob")
+ })
+}
+
+func ExampleMessage_Attach() {
+ m.Attach("/tmp/image.jpg")
+}
+
+func ExampleMessage_Embed() {
+ m.Embed("/tmp/image.jpg")
+ m.SetBody("text/html", `<img src="cid:image.jpg" alt="My image" />`)
+}
+
+func ExampleMessage_FormatAddress() {
+ m.SetHeader("To", m.FormatAddress("bob@example.com", "Bob"), m.FormatAddress("cora@example.com", "Cora"))
+}
+
+func ExampleMessage_FormatDate() {
+ m.SetHeaders(map[string][]string{
+ "X-Date": {m.FormatDate(time.Now())},
+ })
+}
+
+func ExampleMessage_SetAddressHeader() {
+ m.SetAddressHeader("To", "bob@example.com", "Bob")
+}
+
+func ExampleMessage_SetBody() {
+ m.SetBody("text/plain", "Hello!")
+}
+
+func ExampleMessage_SetDateHeader() {
+ m.SetDateHeader("X-Date", time.Now())
+}
+
+func ExampleMessage_SetHeader() {
+ m.SetHeader("Subject", "Hello!")
+}
+
+func ExampleMessage_SetHeaders() {
+ m.SetHeaders(map[string][]string{
+ "From": {m.FormatAddress("alex@example.com", "Alex")},
+ "To": {"bob@example.com", "cora@example.com"},
+ "Subject": {"Hello"},
+ })
+}
+
+func ExampleSetCharset() {
+ m = gomail.NewMessage(gomail.SetCharset("ISO-8859-1"))
+}
+
+func ExampleSetEncoding() {
+ m = gomail.NewMessage(gomail.SetEncoding(gomail.Base64))
+}
diff --git a/vendor/gopkg.in/gomail.v2/message.go b/vendor/gopkg.in/gomail.v2/message.go
new file mode 100644
index 000000000..2f75368bd
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/message.go
@@ -0,0 +1,302 @@
+package gomail
+
+import (
+ "bytes"
+ "io"
+ "os"
+ "path/filepath"
+ "time"
+)
+
+// Message represents an email.
+type Message struct {
+ header header
+ parts []part
+ attachments []*file
+ embedded []*file
+ charset string
+ encoding Encoding
+ hEncoder mimeEncoder
+ buf bytes.Buffer
+}
+
+type header map[string][]string
+
+type part struct {
+ header header
+ copier func(io.Writer) error
+}
+
+// NewMessage creates a new message. It uses UTF-8 and quoted-printable encoding
+// by default.
+func NewMessage(settings ...MessageSetting) *Message {
+ m := &Message{
+ header: make(header),
+ charset: "UTF-8",
+ encoding: QuotedPrintable,
+ }
+
+ m.applySettings(settings)
+
+ if m.encoding == Base64 {
+ m.hEncoder = bEncoding
+ } else {
+ m.hEncoder = qEncoding
+ }
+
+ return m
+}
+
+// Reset resets the message so it can be reused. The message keeps its previous
+// settings so it is in the same state that after a call to NewMessage.
+func (m *Message) Reset() {
+ for k := range m.header {
+ delete(m.header, k)
+ }
+ m.parts = nil
+ m.attachments = nil
+ m.embedded = nil
+}
+
+func (m *Message) applySettings(settings []MessageSetting) {
+ for _, s := range settings {
+ s(m)
+ }
+}
+
+// A MessageSetting can be used as an argument in NewMessage to configure an
+// email.
+type MessageSetting func(m *Message)
+
+// SetCharset is a message setting to set the charset of the email.
+func SetCharset(charset string) MessageSetting {
+ return func(m *Message) {
+ m.charset = charset
+ }
+}
+
+// SetEncoding is a message setting to set the encoding of the email.
+func SetEncoding(enc Encoding) MessageSetting {
+ return func(m *Message) {
+ m.encoding = enc
+ }
+}
+
+// Encoding represents a MIME encoding scheme like quoted-printable or base64.
+type Encoding string
+
+const (
+ // QuotedPrintable represents the quoted-printable encoding as defined in
+ // RFC 2045.
+ QuotedPrintable Encoding = "quoted-printable"
+ // Base64 represents the base64 encoding as defined in RFC 2045.
+ Base64 Encoding = "base64"
+ // Unencoded can be used to avoid encoding the body of an email. The headers
+ // will still be encoded using quoted-printable encoding.
+ Unencoded Encoding = "8bit"
+)
+
+// SetHeader sets a value to the given header field.
+func (m *Message) SetHeader(field string, value ...string) {
+ m.encodeHeader(value)
+ m.header[field] = value
+}
+
+func (m *Message) encodeHeader(values []string) {
+ for i := range values {
+ values[i] = m.encodeString(values[i])
+ }
+}
+
+func (m *Message) encodeString(value string) string {
+ return m.hEncoder.Encode(m.charset, value)
+}
+
+// SetHeaders sets the message headers.
+func (m *Message) SetHeaders(h map[string][]string) {
+ for k, v := range h {
+ m.SetHeader(k, v...)
+ }
+}
+
+// SetAddressHeader sets an address to the given header field.
+func (m *Message) SetAddressHeader(field, address, name string) {
+ m.header[field] = []string{m.FormatAddress(address, name)}
+}
+
+// FormatAddress formats an address and a name as a valid RFC 5322 address.
+func (m *Message) FormatAddress(address, name string) string {
+ enc := m.encodeString(name)
+ if enc == name {
+ m.buf.WriteByte('"')
+ for i := 0; i < len(name); i++ {
+ b := name[i]
+ if b == '\\' || b == '"' {
+ m.buf.WriteByte('\\')
+ }
+ m.buf.WriteByte(b)
+ }
+ m.buf.WriteByte('"')
+ } else if hasSpecials(name) {
+ m.buf.WriteString(bEncoding.Encode(m.charset, name))
+ } else {
+ m.buf.WriteString(enc)
+ }
+ m.buf.WriteString(" <")
+ m.buf.WriteString(address)
+ m.buf.WriteByte('>')
+
+ addr := m.buf.String()
+ m.buf.Reset()
+ return addr
+}
+
+func hasSpecials(text string) bool {
+ for i := 0; i < len(text); i++ {
+ switch c := text[i]; c {
+ case '(', ')', '<', '>', '[', ']', ':', ';', '@', '\\', ',', '.', '"':
+ return true
+ }
+ }
+
+ return false
+}
+
+// SetDateHeader sets a date to the given header field.
+func (m *Message) SetDateHeader(field string, date time.Time) {
+ m.header[field] = []string{m.FormatDate(date)}
+}
+
+// FormatDate formats a date as a valid RFC 5322 date.
+func (m *Message) FormatDate(date time.Time) string {
+ return date.Format(time.RFC1123Z)
+}
+
+// GetHeader gets a header field.
+func (m *Message) GetHeader(field string) []string {
+ return m.header[field]
+}
+
+// SetBody sets the body of the message.
+func (m *Message) SetBody(contentType, body string) {
+ m.parts = []part{
+ {
+ header: m.getPartHeader(contentType),
+ copier: func(w io.Writer) error {
+ _, err := io.WriteString(w, body)
+ return err
+ },
+ },
+ }
+}
+
+// AddAlternative adds an alternative part to the message.
+//
+// It is commonly used to send HTML emails that default to the plain text
+// version for backward compatibility.
+//
+// More info: http://en.wikipedia.org/wiki/MIME#Alternative
+func (m *Message) AddAlternative(contentType, body string) {
+ m.parts = append(m.parts,
+ part{
+ header: m.getPartHeader(contentType),
+ copier: func(w io.Writer) error {
+ _, err := io.WriteString(w, body)
+ return err
+ },
+ },
+ )
+}
+
+// AddAlternativeWriter adds an alternative part to the message. It can be
+// useful with the text/template or html/template packages.
+func (m *Message) AddAlternativeWriter(contentType string, f func(io.Writer) error) {
+ m.parts = []part{
+ {
+ header: m.getPartHeader(contentType),
+ copier: f,
+ },
+ }
+}
+
+func (m *Message) getPartHeader(contentType string) header {
+ return map[string][]string{
+ "Content-Type": {contentType + "; charset=" + m.charset},
+ "Content-Transfer-Encoding": {string(m.encoding)},
+ }
+}
+
+type file struct {
+ Name string
+ Header map[string][]string
+ CopyFunc func(w io.Writer) error
+}
+
+func (f *file) setHeader(field, value string) {
+ f.Header[field] = []string{value}
+}
+
+// A FileSetting can be used as an argument in Message.Attach or Message.Embed.
+type FileSetting func(*file)
+
+// SetHeader is a file setting to set the MIME header of the message part that
+// contains the file content.
+//
+// Mandatory headers are automatically added if they are not set when sending
+// the email.
+func SetHeader(h map[string][]string) FileSetting {
+ return func(f *file) {
+ for k, v := range h {
+ f.Header[k] = v
+ }
+ }
+}
+
+// SetCopyFunc is a file setting to replace the function that runs when the
+// message is sent. It should copy the content of the file to the io.Writer.
+//
+// The default copy function opens the file with the given filename, and copy
+// its content to the io.Writer.
+func SetCopyFunc(f func(io.Writer) error) FileSetting {
+ return func(fi *file) {
+ fi.CopyFunc = f
+ }
+}
+
+func (m *Message) appendFile(list []*file, name string, settings []FileSetting) []*file {
+ f := &file{
+ Name: filepath.Base(name),
+ Header: make(map[string][]string),
+ CopyFunc: func(w io.Writer) error {
+ h, err := os.Open(name)
+ if err != nil {
+ return err
+ }
+ if _, err := io.Copy(w, h); err != nil {
+ h.Close()
+ return err
+ }
+ return h.Close()
+ },
+ }
+
+ for _, s := range settings {
+ s(f)
+ }
+
+ if list == nil {
+ return []*file{f}
+ }
+
+ return append(list, f)
+}
+
+// Attach attaches the files to the email.
+func (m *Message) Attach(filename string, settings ...FileSetting) {
+ m.attachments = m.appendFile(m.attachments, filename, settings)
+}
+
+// Embed embeds the images to the email.
+func (m *Message) Embed(filename string, settings ...FileSetting) {
+ m.embedded = m.appendFile(m.embedded, filename, settings)
+}
diff --git a/vendor/gopkg.in/gomail.v2/message_test.go b/vendor/gopkg.in/gomail.v2/message_test.go
new file mode 100644
index 000000000..fdd9ff9bd
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/message_test.go
@@ -0,0 +1,630 @@
+package gomail
+
+import (
+ "bytes"
+ "encoding/base64"
+ "io"
+ "io/ioutil"
+ "path/filepath"
+ "regexp"
+ "strconv"
+ "strings"
+ "testing"
+ "time"
+)
+
+func init() {
+ now = func() time.Time {
+ return time.Date(2014, 06, 25, 17, 46, 0, 0, time.UTC)
+ }
+}
+
+type message struct {
+ from string
+ to []string
+ content string
+}
+
+func TestMessage(t *testing.T) {
+ m := NewMessage()
+ m.SetAddressHeader("From", "from@example.com", "Señor From")
+ m.SetHeader("To", m.FormatAddress("to@example.com", "Señor To"), "tobis@example.com")
+ m.SetAddressHeader("Cc", "cc@example.com", "A, B")
+ m.SetAddressHeader("X-To", "ccbis@example.com", "à, b")
+ m.SetDateHeader("X-Date", now())
+ m.SetHeader("X-Date-2", m.FormatDate(now()))
+ m.SetHeader("Subject", "¡Hola, señor!")
+ m.SetHeaders(map[string][]string{
+ "X-Headers": {"Test", "Café"},
+ })
+ m.SetBody("text/plain", "¡Hola, señor!")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{
+ "to@example.com",
+ "tobis@example.com",
+ "cc@example.com",
+ },
+ content: "From: =?UTF-8?q?Se=C3=B1or_From?= <from@example.com>\r\n" +
+ "To: =?UTF-8?q?Se=C3=B1or_To?= <to@example.com>, tobis@example.com\r\n" +
+ "Cc: \"A, B\" <cc@example.com>\r\n" +
+ "X-To: =?UTF-8?b?w6AsIGI=?= <ccbis@example.com>\r\n" +
+ "X-Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
+ "X-Date-2: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
+ "X-Headers: Test, =?UTF-8?q?Caf=C3=A9?=\r\n" +
+ "Subject: =?UTF-8?q?=C2=A1Hola,_se=C3=B1or!?=\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "=C2=A1Hola, se=C3=B1or!",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestBodyWriter(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.AddAlternativeWriter("text/plain", func(w io.Writer) error {
+ _, err := w.Write([]byte("Test message"))
+ return err
+ })
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test message",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestCustomMessage(t *testing.T) {
+ m := NewMessage(SetCharset("ISO-8859-1"), SetEncoding(Base64))
+ m.SetHeaders(map[string][]string{
+ "From": {"from@example.com"},
+ "To": {"to@example.com"},
+ "Subject": {"Café"},
+ })
+ m.SetBody("text/html", "¡Hola, señor!")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Subject: =?ISO-8859-1?b?Q2Fmw6k=?=\r\n" +
+ "Content-Type: text/html; charset=ISO-8859-1\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ "wqFIb2xhLCBzZcOxb3Ih",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestUnencodedMessage(t *testing.T) {
+ m := NewMessage(SetEncoding(Unencoded))
+ m.SetHeaders(map[string][]string{
+ "From": {"from@example.com"},
+ "To": {"to@example.com"},
+ "Subject": {"Café"},
+ })
+ m.SetBody("text/html", "¡Hola, señor!")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Subject: =?UTF-8?q?Caf=C3=A9?=\r\n" +
+ "Content-Type: text/html; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: 8bit\r\n" +
+ "\r\n" +
+ "¡Hola, señor!",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestRecipients(t *testing.T) {
+ m := NewMessage()
+ m.SetHeaders(map[string][]string{
+ "From": {"from@example.com"},
+ "To": {"to@example.com"},
+ "Cc": {"cc@example.com"},
+ "Bcc": {"bcc1@example.com", "bcc2@example.com"},
+ "Subject": {"Hello!"},
+ })
+ m.SetBody("text/plain", "Test message")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com", "cc@example.com", "bcc1@example.com", "bcc2@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Cc: cc@example.com\r\n" +
+ "Subject: Hello!\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test message",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestAlternative(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", "¡Hola, señor!")
+ m.AddAlternative("text/html", "¡<b>Hola</b>, <i>señor</i>!</h1>")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/alternative; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "=C2=A1Hola, se=C3=B1or!\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: text/html; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "=C2=A1<b>Hola</b>, <i>se=C3=B1or</i>!</h1>\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 1, want)
+}
+
+func TestAttachmentOnly(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.Attach(mockCopyFile("/tmp/test.pdf"))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: application/pdf; name=\"test.pdf\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.pdf\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.pdf")),
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestAttachment(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", "Test")
+ m.Attach(mockCopyFile("/tmp/test.pdf"))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/mixed; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/pdf; name=\"test.pdf\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.pdf\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.pdf")) + "\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 1, want)
+}
+
+func TestAttachmentsOnly(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.Attach(mockCopyFile("/tmp/test.pdf"))
+ m.Attach(mockCopyFile("/tmp/test.zip"))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/mixed; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/pdf; name=\"test.pdf\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.pdf\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.pdf")) + "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/zip; name=\"test.zip\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.zip\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.zip")) + "\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 1, want)
+}
+
+func TestAttachments(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", "Test")
+ m.Attach(mockCopyFile("/tmp/test.pdf"))
+ m.Attach(mockCopyFile("/tmp/test.zip"))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/mixed; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/pdf; name=\"test.pdf\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.pdf\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.pdf")) + "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/zip; name=\"test.zip\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.zip\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.zip")) + "\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 1, want)
+}
+
+func TestEmbedded(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.Embed(mockCopyFileWithHeader(m, "image1.jpg", map[string][]string{"Content-ID": {"<test-content-id>"}}))
+ m.Embed(mockCopyFile("image2.jpg"))
+ m.SetBody("text/plain", "Test")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/related; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: image/jpeg; name=\"image1.jpg\"\r\n" +
+ "Content-Disposition: inline; filename=\"image1.jpg\"\r\n" +
+ "Content-ID: <test-content-id>\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of image1.jpg")) + "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: image/jpeg; name=\"image2.jpg\"\r\n" +
+ "Content-Disposition: inline; filename=\"image2.jpg\"\r\n" +
+ "Content-ID: <image2.jpg>\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of image2.jpg")) + "\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 1, want)
+}
+
+func TestFullMessage(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", "¡Hola, señor!")
+ m.AddAlternative("text/html", "¡<b>Hola</b>, <i>señor</i>!</h1>")
+ m.Attach(mockCopyFile("test.pdf"))
+ m.Embed(mockCopyFile("image.jpg"))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: multipart/mixed; boundary=_BOUNDARY_1_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: multipart/related; boundary=_BOUNDARY_2_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_2_\r\n" +
+ "Content-Type: multipart/alternative; boundary=_BOUNDARY_3_\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_3_\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "=C2=A1Hola, se=C3=B1or!\r\n" +
+ "--_BOUNDARY_3_\r\n" +
+ "Content-Type: text/html; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "=C2=A1<b>Hola</b>, <i>se=C3=B1or</i>!</h1>\r\n" +
+ "--_BOUNDARY_3_--\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_2_\r\n" +
+ "Content-Type: image/jpeg; name=\"image.jpg\"\r\n" +
+ "Content-Disposition: inline; filename=\"image.jpg\"\r\n" +
+ "Content-ID: <image.jpg>\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of image.jpg")) + "\r\n" +
+ "--_BOUNDARY_2_--\r\n" +
+ "\r\n" +
+ "--_BOUNDARY_1_\r\n" +
+ "Content-Type: application/pdf; name=\"test.pdf\"\r\n" +
+ "Content-Disposition: attachment; filename=\"test.pdf\"\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ base64.StdEncoding.EncodeToString([]byte("Content of test.pdf")) + "\r\n" +
+ "--_BOUNDARY_1_--\r\n",
+ }
+
+ testMessage(t, m, 3, want)
+
+ want = &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ "Test reset",
+ }
+ m.Reset()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", "Test reset")
+ testMessage(t, m, 0, want)
+}
+
+func TestQpLineLength(t *testing.T) {
+ m := NewMessage()
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain",
+ strings.Repeat("0", 76)+"\r\n"+
+ strings.Repeat("0", 75)+"à\r\n"+
+ strings.Repeat("0", 74)+"à\r\n"+
+ strings.Repeat("0", 73)+"à\r\n"+
+ strings.Repeat("0", 72)+"à\r\n"+
+ strings.Repeat("0", 75)+"\r\n"+
+ strings.Repeat("0", 76)+"\n")
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ strings.Repeat("0", 75) + "=\r\n0\r\n" +
+ strings.Repeat("0", 75) + "=\r\n=C3=A0\r\n" +
+ strings.Repeat("0", 74) + "=\r\n=C3=A0\r\n" +
+ strings.Repeat("0", 73) + "=\r\n=C3=A0\r\n" +
+ strings.Repeat("0", 72) + "=C3=\r\n=A0\r\n" +
+ strings.Repeat("0", 75) + "\r\n" +
+ strings.Repeat("0", 75) + "=\r\n0\r\n",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func TestBase64LineLength(t *testing.T) {
+ m := NewMessage(SetCharset("UTF-8"), SetEncoding(Base64))
+ m.SetHeader("From", "from@example.com")
+ m.SetHeader("To", "to@example.com")
+ m.SetBody("text/plain", strings.Repeat("0", 58))
+
+ want := &message{
+ from: "from@example.com",
+ to: []string{"to@example.com"},
+ content: "From: from@example.com\r\n" +
+ "To: to@example.com\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: base64\r\n" +
+ "\r\n" +
+ strings.Repeat("MDAw", 19) + "\r\nMA==",
+ }
+
+ testMessage(t, m, 0, want)
+}
+
+func testMessage(t *testing.T, m *Message, bCount int, want *message) {
+ err := Send(stubSendMail(t, bCount, want), m)
+ if err != nil {
+ t.Error(err)
+ }
+}
+
+func stubSendMail(t *testing.T, bCount int, want *message) SendFunc {
+ return func(from string, to []string, m io.WriterTo) error {
+ if from != want.from {
+ t.Fatalf("Invalid from, got %q, want %q", from, want.from)
+ }
+
+ if len(to) != len(want.to) {
+ t.Fatalf("Invalid recipient count, \ngot %d: %q\nwant %d: %q",
+ len(to), to,
+ len(want.to), want.to,
+ )
+ }
+ for i := range want.to {
+ if to[i] != want.to[i] {
+ t.Fatalf("Invalid recipient, got %q, want %q",
+ to[i], want.to[i],
+ )
+ }
+ }
+
+ buf := new(bytes.Buffer)
+ _, err := m.WriteTo(buf)
+ if err != nil {
+ t.Error(err)
+ }
+ got := buf.String()
+ wantMsg := string("Mime-Version: 1.0\r\n" +
+ "Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
+ want.content)
+ if bCount > 0 {
+ boundaries := getBoundaries(t, bCount, got)
+ for i, b := range boundaries {
+ wantMsg = strings.Replace(wantMsg, "_BOUNDARY_"+strconv.Itoa(i+1)+"_", b, -1)
+ }
+ }
+
+ compareBodies(t, got, wantMsg)
+
+ return nil
+ }
+}
+
+func compareBodies(t *testing.T, got, want string) {
+ // We cannot do a simple comparison since the ordering of headers' fields
+ // is random.
+ gotLines := strings.Split(got, "\r\n")
+ wantLines := strings.Split(want, "\r\n")
+
+ // We only test for too many lines, missing lines are tested after
+ if len(gotLines) > len(wantLines) {
+ t.Fatalf("Message has too many lines, \ngot %d:\n%s\nwant %d:\n%s", len(gotLines), got, len(wantLines), want)
+ }
+
+ isInHeader := true
+ headerStart := 0
+ for i, line := range wantLines {
+ if line == gotLines[i] {
+ if line == "" {
+ isInHeader = false
+ } else if !isInHeader && len(line) > 2 && line[:2] == "--" {
+ isInHeader = true
+ headerStart = i + 1
+ }
+ continue
+ }
+
+ if !isInHeader {
+ missingLine(t, line, got, want)
+ }
+
+ isMissing := true
+ for j := headerStart; j < len(gotLines); j++ {
+ if gotLines[j] == "" {
+ break
+ }
+ if gotLines[j] == line {
+ isMissing = false
+ break
+ }
+ }
+ if isMissing {
+ missingLine(t, line, got, want)
+ }
+ }
+}
+
+func missingLine(t *testing.T, line, got, want string) {
+ t.Fatalf("Missing line %q\ngot:\n%s\nwant:\n%s", line, got, want)
+}
+
+func getBoundaries(t *testing.T, count int, m string) []string {
+ if matches := boundaryRegExp.FindAllStringSubmatch(m, count); matches != nil {
+ boundaries := make([]string, count)
+ for i, match := range matches {
+ boundaries[i] = match[1]
+ }
+ return boundaries
+ }
+
+ t.Fatal("Boundary not found in body")
+ return []string{""}
+}
+
+var boundaryRegExp = regexp.MustCompile("boundary=(\\w+)")
+
+func mockCopyFile(name string) (string, FileSetting) {
+ return name, SetCopyFunc(func(w io.Writer) error {
+ _, err := w.Write([]byte("Content of " + filepath.Base(name)))
+ return err
+ })
+}
+
+func mockCopyFileWithHeader(m *Message, name string, h map[string][]string) (string, FileSetting, FileSetting) {
+ name, f := mockCopyFile(name)
+ return name, f, SetHeader(h)
+}
+
+func BenchmarkFull(b *testing.B) {
+ discardFunc := SendFunc(func(from string, to []string, m io.WriterTo) error {
+ _, err := m.WriteTo(ioutil.Discard)
+ return err
+ })
+
+ m := NewMessage()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ m.SetAddressHeader("From", "from@example.com", "Señor From")
+ m.SetHeaders(map[string][]string{
+ "To": {"to@example.com"},
+ "Cc": {"cc@example.com"},
+ "Bcc": {"bcc1@example.com", "bcc2@example.com"},
+ "Subject": {"¡Hola, señor!"},
+ })
+ m.SetBody("text/plain", "¡Hola, señor!")
+ m.AddAlternative("text/html", "<p>¡Hola, señor!</p>")
+ m.Attach(mockCopyFile("benchmark.txt"))
+ m.Embed(mockCopyFile("benchmark.jpg"))
+
+ if err := Send(discardFunc, m); err != nil {
+ panic(err)
+ }
+ m.Reset()
+ }
+}
diff --git a/vendor/gopkg.in/gomail.v2/mime.go b/vendor/gopkg.in/gomail.v2/mime.go
new file mode 100644
index 000000000..51cba724b
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/mime.go
@@ -0,0 +1,19 @@
+// +build go1.5
+
+package gomail
+
+import (
+ "mime"
+ "mime/quotedprintable"
+)
+
+var newQPWriter = quotedprintable.NewWriter
+
+type mimeEncoder struct {
+ mime.WordEncoder
+}
+
+var (
+ bEncoding = mimeEncoder{mime.BEncoding}
+ qEncoding = mimeEncoder{mime.QEncoding}
+)
diff --git a/vendor/gopkg.in/gomail.v2/mime_go14.go b/vendor/gopkg.in/gomail.v2/mime_go14.go
new file mode 100644
index 000000000..246e2e5e5
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/mime_go14.go
@@ -0,0 +1,16 @@
+// +build !go1.5
+
+package gomail
+
+import "gopkg.in/alexcesaro/quotedprintable.v3"
+
+var newQPWriter = quotedprintable.NewWriter
+
+type mimeEncoder struct {
+ quotedprintable.WordEncoder
+}
+
+var (
+ bEncoding = mimeEncoder{quotedprintable.BEncoding}
+ qEncoding = mimeEncoder{quotedprintable.QEncoding}
+)
diff --git a/vendor/gopkg.in/gomail.v2/send.go b/vendor/gopkg.in/gomail.v2/send.go
new file mode 100644
index 000000000..3e6726509
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/send.go
@@ -0,0 +1,117 @@
+package gomail
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "net/mail"
+)
+
+// Sender is the interface that wraps the Send method.
+//
+// Send sends an email to the given addresses.
+type Sender interface {
+ Send(from string, to []string, msg io.WriterTo) error
+}
+
+// SendCloser is the interface that groups the Send and Close methods.
+type SendCloser interface {
+ Sender
+ Close() error
+}
+
+// A SendFunc is a function that sends emails to the given adresses.
+//
+// The SendFunc type is an adapter to allow the use of ordinary functions as
+// email senders. If f is a function with the appropriate signature, SendFunc(f)
+// is a Sender object that calls f.
+type SendFunc func(from string, to []string, msg io.WriterTo) error
+
+// Send calls f(from, to, msg).
+func (f SendFunc) Send(from string, to []string, msg io.WriterTo) error {
+ return f(from, to, msg)
+}
+
+// Send sends emails using the given Sender.
+func Send(s Sender, msg ...*Message) error {
+ for i, m := range msg {
+ if err := send(s, m); err != nil {
+ return fmt.Errorf("gomail: could not send email %d: %v", i+1, err)
+ }
+ }
+
+ return nil
+}
+
+func send(s Sender, m *Message) error {
+ from, err := m.getFrom()
+ if err != nil {
+ return err
+ }
+
+ to, err := m.getRecipients()
+ if err != nil {
+ return err
+ }
+
+ if err := s.Send(from, to, m); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (m *Message) getFrom() (string, error) {
+ from := m.header["Sender"]
+ if len(from) == 0 {
+ from = m.header["From"]
+ if len(from) == 0 {
+ return "", errors.New(`gomail: invalid message, "From" field is absent`)
+ }
+ }
+
+ return parseAddress(from[0])
+}
+
+func (m *Message) getRecipients() ([]string, error) {
+ n := 0
+ for _, field := range []string{"To", "Cc", "Bcc"} {
+ if addresses, ok := m.header[field]; ok {
+ n += len(addresses)
+ }
+ }
+ list := make([]string, 0, n)
+
+ for _, field := range []string{"To", "Cc", "Bcc"} {
+ if addresses, ok := m.header[field]; ok {
+ for _, a := range addresses {
+ addr, err := parseAddress(a)
+ if err != nil {
+ return nil, err
+ }
+ list = addAddress(list, addr)
+ }
+ }
+ }
+
+ return list, nil
+}
+
+func addAddress(list []string, addr string) []string {
+ for _, a := range list {
+ if addr == a {
+ return list
+ }
+ }
+
+ return append(list, addr)
+}
+
+func parseAddress(field string) (string, error) {
+ a, err := mail.ParseAddress(field)
+ if a == nil {
+ return "", err
+ }
+
+ return a.Address, err
+}
diff --git a/vendor/gopkg.in/gomail.v2/send_test.go b/vendor/gopkg.in/gomail.v2/send_test.go
new file mode 100644
index 000000000..ba59cd3dc
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/send_test.go
@@ -0,0 +1,80 @@
+package gomail
+
+import (
+ "bytes"
+ "io"
+ "reflect"
+ "testing"
+)
+
+const (
+ testTo1 = "to1@example.com"
+ testTo2 = "to2@example.com"
+ testFrom = "from@example.com"
+ testBody = "Test message"
+ testMsg = "To: " + testTo1 + ", " + testTo2 + "\r\n" +
+ "From: " + testFrom + "\r\n" +
+ "Mime-Version: 1.0\r\n" +
+ "Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
+ "Content-Type: text/plain; charset=UTF-8\r\n" +
+ "Content-Transfer-Encoding: quoted-printable\r\n" +
+ "\r\n" +
+ testBody
+)
+
+type mockSender SendFunc
+
+func (s mockSender) Send(from string, to []string, msg io.WriterTo) error {
+ return s(from, to, msg)
+}
+
+type mockSendCloser struct {
+ mockSender
+ close func() error
+}
+
+func (s *mockSendCloser) Close() error {
+ return s.close()
+}
+
+func TestSend(t *testing.T) {
+ s := &mockSendCloser{
+ mockSender: stubSend(t, testFrom, []string{testTo1, testTo2}, testMsg),
+ close: func() error {
+ t.Error("Close() should not be called in Send()")
+ return nil
+ },
+ }
+ if err := Send(s, getTestMessage()); err != nil {
+ t.Errorf("Send(): %v", err)
+ }
+}
+
+func getTestMessage() *Message {
+ m := NewMessage()
+ m.SetHeader("From", testFrom)
+ m.SetHeader("To", testTo1, testTo2)
+ m.SetBody("text/plain", testBody)
+
+ return m
+}
+
+func stubSend(t *testing.T, wantFrom string, wantTo []string, wantBody string) mockSender {
+ return func(from string, to []string, msg io.WriterTo) error {
+ if from != wantFrom {
+ t.Errorf("invalid from, got %q, want %q", from, wantFrom)
+ }
+ if !reflect.DeepEqual(to, wantTo) {
+ t.Errorf("invalid to, got %v, want %v", to, wantTo)
+ }
+
+ buf := new(bytes.Buffer)
+ _, err := msg.WriteTo(buf)
+ if err != nil {
+ t.Fatal(err)
+ }
+ compareBodies(t, buf.String(), wantBody)
+
+ return nil
+ }
+}
diff --git a/vendor/gopkg.in/gomail.v2/smtp.go b/vendor/gopkg.in/gomail.v2/smtp.go
new file mode 100644
index 000000000..cf773a102
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/smtp.go
@@ -0,0 +1,175 @@
+package gomail
+
+import (
+ "crypto/tls"
+ "fmt"
+ "io"
+ "net"
+ "net/smtp"
+)
+
+// A Dialer is a dialer to an SMTP server.
+type Dialer struct {
+ // Host represents the host of the SMTP server.
+ Host string
+ // Port represents the port of the SMTP server.
+ Port int
+ // Auth represents the authentication mechanism used to authenticate to the
+ // SMTP server.
+ Auth smtp.Auth
+ // SSL defines whether an SSL connection is used. It should be false in
+ // most cases since the authentication mechanism should use the STARTTLS
+ // extension instead.
+ SSL bool
+ // TSLConfig represents the TLS configuration used for the TLS (when the
+ // STARTTLS extension is used) or SSL connection.
+ TLSConfig *tls.Config
+}
+
+// NewPlainDialer returns a Dialer. The given parameters are used to connect to
+// the SMTP server via a PLAIN authentication mechanism.
+//
+// It fallbacks to the LOGIN mechanism if it is the only mechanism advertised by
+// the server.
+func NewPlainDialer(host string, port int, username, password string) *Dialer {
+ return &Dialer{
+ Host: host,
+ Port: port,
+ Auth: &plainAuth{
+ username: username,
+ password: password,
+ host: host,
+ },
+ SSL: port == 465,
+ }
+}
+
+// Dial dials and authenticates to an SMTP server. The returned SendCloser
+// should be closed when done using it.
+func (d *Dialer) Dial() (SendCloser, error) {
+ c, err := d.dial()
+ if err != nil {
+ return nil, err
+ }
+
+ if d.Auth != nil {
+ if ok, _ := c.Extension("AUTH"); ok {
+ if err = c.Auth(d.Auth); err != nil {
+ c.Close()
+ return nil, err
+ }
+ }
+ }
+
+ return &smtpSender{c}, nil
+}
+
+func (d *Dialer) dial() (smtpClient, error) {
+ if d.SSL {
+ return d.sslDial()
+ }
+ return d.starttlsDial()
+}
+
+func (d *Dialer) starttlsDial() (smtpClient, error) {
+ c, err := smtpDial(addr(d.Host, d.Port))
+ if err != nil {
+ return nil, err
+ }
+
+ if ok, _ := c.Extension("STARTTLS"); ok {
+ if err := c.StartTLS(d.tlsConfig()); err != nil {
+ c.Close()
+ return nil, err
+ }
+ }
+
+ return c, nil
+}
+
+func (d *Dialer) sslDial() (smtpClient, error) {
+ conn, err := tlsDial("tcp", addr(d.Host, d.Port), d.tlsConfig())
+ if err != nil {
+ return nil, err
+ }
+
+ return newClient(conn, d.Host)
+}
+
+func (d *Dialer) tlsConfig() *tls.Config {
+ if d.TLSConfig == nil {
+ return &tls.Config{ServerName: d.Host}
+ }
+
+ return d.TLSConfig
+}
+
+func addr(host string, port int) string {
+ return fmt.Sprintf("%s:%d", host, port)
+}
+
+// DialAndSend opens a connection to the SMTP server, sends the given emails and
+// closes the connection.
+func (d *Dialer) DialAndSend(m ...*Message) error {
+ s, err := d.Dial()
+ if err != nil {
+ return err
+ }
+ defer s.Close()
+
+ return Send(s, m...)
+}
+
+type smtpSender struct {
+ smtpClient
+}
+
+func (c *smtpSender) Send(from string, to []string, msg io.WriterTo) error {
+ if err := c.Mail(from); err != nil {
+ return err
+ }
+
+ for _, addr := range to {
+ if err := c.Rcpt(addr); err != nil {
+ return err
+ }
+ }
+
+ w, err := c.Data()
+ if err != nil {
+ return err
+ }
+
+ if _, err = msg.WriteTo(w); err != nil {
+ w.Close()
+ return err
+ }
+
+ return w.Close()
+}
+
+func (c *smtpSender) Close() error {
+ return c.Quit()
+}
+
+// Stubbed out for tests.
+var (
+ smtpDial = func(addr string) (smtpClient, error) {
+ return smtp.Dial(addr)
+ }
+ tlsDial = tls.Dial
+ newClient = func(conn net.Conn, host string) (smtpClient, error) {
+ return smtp.NewClient(conn, host)
+ }
+)
+
+type smtpClient interface {
+ Extension(string) (bool, string)
+ StartTLS(*tls.Config) error
+ Auth(smtp.Auth) error
+ Mail(string) error
+ Rcpt(string) error
+ Data() (io.WriteCloser, error)
+ Quit() error
+ Close() error
+}
diff --git a/vendor/gopkg.in/gomail.v2/smtp_test.go b/vendor/gopkg.in/gomail.v2/smtp_test.go
new file mode 100644
index 000000000..c8503489b
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/smtp_test.go
@@ -0,0 +1,254 @@
+package gomail
+
+import (
+ "bytes"
+ "crypto/tls"
+ "io"
+ "net"
+ "net/smtp"
+ "reflect"
+ "testing"
+)
+
+const (
+ testPort = 587
+ testSSLPort = 465
+)
+
+var (
+ testTLSConn = &tls.Conn{}
+ testConfig = &tls.Config{InsecureSkipVerify: true}
+)
+
+func TestDialer(t *testing.T) {
+ d := NewPlainDialer(testHost, testPort, "user", "pwd")
+ testSendMail(t, d, []string{
+ "Extension STARTTLS",
+ "StartTLS",
+ "Extension AUTH",
+ "Auth",
+ "Mail " + testFrom,
+ "Rcpt " + testTo1,
+ "Rcpt " + testTo2,
+ "Data",
+ "Write message",
+ "Close writer",
+ "Quit",
+ "Close",
+ })
+}
+
+func TestDialerSSL(t *testing.T) {
+ d := NewPlainDialer(testHost, testSSLPort, "user", "pwd")
+ testSendMail(t, d, []string{
+ "Extension AUTH",
+ "Auth",
+ "Mail " + testFrom,
+ "Rcpt " + testTo1,
+ "Rcpt " + testTo2,
+ "Data",
+ "Write message",
+ "Close writer",
+ "Quit",
+ "Close",
+ })
+}
+
+func TestDialerConfig(t *testing.T) {
+ d := NewPlainDialer(testHost, testPort, "user", "pwd")
+ d.TLSConfig = testConfig
+ testSendMail(t, d, []string{
+ "Extension STARTTLS",
+ "StartTLS",
+ "Extension AUTH",
+ "Auth",
+ "Mail " + testFrom,
+ "Rcpt " + testTo1,
+ "Rcpt " + testTo2,
+ "Data",
+ "Write message",
+ "Close writer",
+ "Quit",
+ "Close",
+ })
+}
+
+func TestDialerSSLConfig(t *testing.T) {
+ d := NewPlainDialer(testHost, testSSLPort, "user", "pwd")
+ d.TLSConfig = testConfig
+ testSendMail(t, d, []string{
+ "Extension AUTH",
+ "Auth",
+ "Mail " + testFrom,
+ "Rcpt " + testTo1,
+ "Rcpt " + testTo2,
+ "Data",
+ "Write message",
+ "Close writer",
+ "Quit",
+ "Close",
+ })
+}
+
+func TestDialerNoAuth(t *testing.T) {
+ d := &Dialer{
+ Host: testHost,
+ Port: testPort,
+ }
+ testSendMail(t, d, []string{
+ "Extension STARTTLS",
+ "StartTLS",
+ "Mail " + testFrom,
+ "Rcpt " + testTo1,
+ "Rcpt " + testTo2,
+ "Data",
+ "Write message",
+ "Close writer",
+ "Quit",
+ "Close",
+ })
+}
+
+type mockClient struct {
+ t *testing.T
+ i int
+ want []string
+ addr string
+ auth smtp.Auth
+ config *tls.Config
+}
+
+func (c *mockClient) Extension(ext string) (bool, string) {
+ c.do("Extension " + ext)
+ return true, ""
+}
+
+func (c *mockClient) StartTLS(config *tls.Config) error {
+ assertConfig(c.t, config, c.config)
+ c.do("StartTLS")
+ return nil
+}
+
+func (c *mockClient) Auth(a smtp.Auth) error {
+ assertAuth(c.t, a, c.auth)
+ c.do("Auth")
+ return nil
+}
+
+func (c *mockClient) Mail(from string) error {
+ c.do("Mail " + from)
+ return nil
+}
+
+func (c *mockClient) Rcpt(to string) error {
+ c.do("Rcpt " + to)
+ return nil
+}
+
+func (c *mockClient) Data() (io.WriteCloser, error) {
+ c.do("Data")
+ return &mockWriter{c: c, want: testMsg}, nil
+}
+
+func (c *mockClient) Quit() error {
+ c.do("Quit")
+ return nil
+}
+
+func (c *mockClient) Close() error {
+ c.do("Close")
+ return nil
+}
+
+func (c *mockClient) do(cmd string) {
+ if c.i >= len(c.want) {
+ c.t.Fatalf("Invalid command %q", cmd)
+ }
+
+ if cmd != c.want[c.i] {
+ c.t.Fatalf("Invalid command, got %q, want %q", cmd, c.want[c.i])
+ }
+ c.i++
+}
+
+type mockWriter struct {
+ want string
+ c *mockClient
+ buf bytes.Buffer
+}
+
+func (w *mockWriter) Write(p []byte) (int, error) {
+ if w.buf.Len() == 0 {
+ w.c.do("Write message")
+ }
+ w.buf.Write(p)
+ return len(p), nil
+}
+
+func (w *mockWriter) Close() error {
+ compareBodies(w.c.t, w.buf.String(), w.want)
+ w.c.do("Close writer")
+ return nil
+}
+
+func testSendMail(t *testing.T, d *Dialer, want []string) {
+ testClient := &mockClient{
+ t: t,
+ want: want,
+ addr: addr(d.Host, d.Port),
+ auth: testAuth,
+ config: d.TLSConfig,
+ }
+
+ smtpDial = func(addr string) (smtpClient, error) {
+ assertAddr(t, addr, testClient.addr)
+ return testClient, nil
+ }
+
+ tlsDial = func(network, addr string, config *tls.Config) (*tls.Conn, error) {
+ if network != "tcp" {
+ t.Errorf("Invalid network, got %q, want tcp", network)
+ }
+ assertAddr(t, addr, testClient.addr)
+ assertConfig(t, config, testClient.config)
+ return testTLSConn, nil
+ }
+
+ newClient = func(conn net.Conn, host string) (smtpClient, error) {
+ if conn != testTLSConn {
+ t.Error("Invalid TLS connection used")
+ }
+ if host != testHost {
+ t.Errorf("Invalid host, got %q, want %q", host, testHost)
+ }
+ return testClient, nil
+ }
+
+ if err := d.DialAndSend(getTestMessage()); err != nil {
+ t.Error(err)
+ }
+}
+
+func assertAuth(t *testing.T, got, want smtp.Auth) {
+ if !reflect.DeepEqual(got, want) {
+ t.Errorf("Invalid auth, got %#v, want %#v", got, want)
+ }
+}
+
+func assertAddr(t *testing.T, got, want string) {
+ if got != want {
+ t.Errorf("Invalid addr, got %q, want %q", got, want)
+ }
+}
+
+func assertConfig(t *testing.T, got, want *tls.Config) {
+ if want == nil {
+ want = &tls.Config{ServerName: testHost}
+ }
+ if got.ServerName != want.ServerName {
+ t.Errorf("Invalid field ServerName in config, got %q, want %q", got.ServerName, want.ServerName)
+ }
+ if got.InsecureSkipVerify != want.InsecureSkipVerify {
+ t.Errorf("Invalid field InsecureSkipVerify in config, got %v, want %v", got.InsecureSkipVerify, want.InsecureSkipVerify)
+ }
+}
diff --git a/vendor/gopkg.in/gomail.v2/writeto.go b/vendor/gopkg.in/gomail.v2/writeto.go
new file mode 100644
index 000000000..57a1dd7f1
--- /dev/null
+++ b/vendor/gopkg.in/gomail.v2/writeto.go
@@ -0,0 +1,242 @@
+package gomail
+
+import (
+ "encoding/base64"
+ "errors"
+ "io"
+ "mime"
+ "mime/multipart"
+ "path/filepath"
+ "time"
+)
+
+// WriteTo implements io.WriterTo. It dumps the whole message into w.
+func (m *Message) WriteTo(w io.Writer) (int64, error) {
+ mw := &messageWriter{w: w}
+ mw.writeMessage(m)
+ return mw.n, mw.err
+}
+
+func (w *messageWriter) writeMessage(m *Message) {
+ if _, ok := m.header["Mime-Version"]; !ok {
+ w.writeString("Mime-Version: 1.0\r\n")
+ }
+ if _, ok := m.header["Date"]; !ok {
+ w.writeHeader("Date", m.FormatDate(now()))
+ }
+ w.writeHeaders(m.header)
+
+ if m.hasMixedPart() {
+ w.openMultipart("mixed")
+ }
+
+ if m.hasRelatedPart() {
+ w.openMultipart("related")
+ }
+
+ if m.hasAlternativePart() {
+ w.openMultipart("alternative")
+ }
+ for _, part := range m.parts {
+ w.writeHeaders(part.header)
+ w.writeBody(part.copier, m.encoding)
+ }
+ if m.hasAlternativePart() {
+ w.closeMultipart()
+ }
+
+ w.addFiles(m.embedded, false)
+ if m.hasRelatedPart() {
+ w.closeMultipart()
+ }
+
+ w.addFiles(m.attachments, true)
+ if m.hasMixedPart() {
+ w.closeMultipart()
+ }
+}
+
+func (m *Message) hasMixedPart() bool {
+ return (len(m.parts) > 0 && len(m.attachments) > 0) || len(m.attachments) > 1
+}
+
+func (m *Message) hasRelatedPart() bool {
+ return (len(m.parts) > 0 && len(m.embedded) > 0) || len(m.embedded) > 1
+}
+
+func (m *Message) hasAlternativePart() bool {
+ return len(m.parts) > 1
+}
+
+type messageWriter struct {
+ w io.Writer
+ n int64
+ writers [3]*multipart.Writer
+ partWriter io.Writer
+ depth uint8
+ err error
+}
+
+func (w *messageWriter) openMultipart(mimeType string) {
+ mw := multipart.NewWriter(w)
+ contentType := "multipart/" + mimeType + "; boundary=" + mw.Boundary()
+ w.writers[w.depth] = mw
+
+ if w.depth == 0 {
+ w.writeHeader("Content-Type", contentType)
+ w.writeString("\r\n")
+ } else {
+ w.createPart(map[string][]string{
+ "Content-Type": {contentType},
+ })
+ }
+ w.depth++
+}
+
+func (w *messageWriter) createPart(h map[string][]string) {
+ w.partWriter, w.err = w.writers[w.depth-1].CreatePart(h)
+}
+
+func (w *messageWriter) closeMultipart() {
+ if w.depth > 0 {
+ w.writers[w.depth-1].Close()
+ w.depth--
+ }
+}
+
+func (w *messageWriter) addFiles(files []*file, isAttachment bool) {
+ for _, f := range files {
+ if _, ok := f.Header["Content-Type"]; !ok {
+ mediaType := mime.TypeByExtension(filepath.Ext(f.Name))
+ if mediaType == "" {
+ mediaType = "application/octet-stream"
+ }
+ f.setHeader("Content-Type", mediaType+`; name="`+f.Name+`"`)
+ }
+
+ if _, ok := f.Header["Content-Transfer-Encoding"]; !ok {
+ f.setHeader("Content-Transfer-Encoding", string(Base64))
+ }
+
+ if _, ok := f.Header["Content-Disposition"]; !ok {
+ var disp string
+ if isAttachment {
+ disp = "attachment"
+ } else {
+ disp = "inline"
+ }
+ f.setHeader("Content-Disposition", disp+`; filename="`+f.Name+`"`)
+ }
+
+ if !isAttachment {
+ if _, ok := f.Header["Content-ID"]; !ok {
+ f.setHeader("Content-ID", "<"+f.Name+">")
+ }
+ }
+ w.writeHeaders(f.Header)
+ w.writeBody(f.CopyFunc, Base64)
+ }
+}
+
+func (w *messageWriter) Write(p []byte) (int, error) {
+ if w.err != nil {
+ return 0, errors.New("gomail: cannot write as writer is in error")
+ }
+
+ var n int
+ n, w.err = w.w.Write(p)
+ w.n += int64(n)
+ return n, w.err
+}
+
+func (w *messageWriter) writeString(s string) {
+ n, _ := io.WriteString(w.w, s)
+ w.n += int64(n)
+}
+
+func (w *messageWriter) writeStrings(a []string, sep string) {
+ if len(a) > 0 {
+ w.writeString(a[0])
+ if len(a) == 1 {
+ return
+ }
+ }
+ for _, s := range a[1:] {
+ w.writeString(sep)
+ w.writeString(s)
+ }
+}
+
+func (w *messageWriter) writeHeader(k string, v ...string) {
+ w.writeString(k)
+ w.writeString(": ")
+ w.writeStrings(v, ", ")
+ w.writeString("\r\n")
+}
+
+func (w *messageWriter) writeHeaders(h map[string][]string) {
+ if w.depth == 0 {
+ for k, v := range h {
+ if k != "Bcc" {
+ w.writeHeader(k, v...)
+ }
+ }
+ } else {
+ w.createPart(h)
+ }
+}
+
+func (w *messageWriter) writeBody(f func(io.Writer) error, enc Encoding) {
+ var subWriter io.Writer
+ if w.depth == 0 {
+ w.writeString("\r\n")
+ subWriter = w.w
+ } else {
+ subWriter = w.partWriter
+ }
+
+ if enc == Base64 {
+ wc := base64.NewEncoder(base64.StdEncoding, newBase64LineWriter(subWriter))
+ w.err = f(wc)
+ wc.Close()
+ } else if enc == Unencoded {
+ w.err = f(subWriter)
+ } else {
+ wc := newQPWriter(subWriter)
+ w.err = f(wc)
+ wc.Close()
+ }
+}
+
+// As required by RFC 2045, 6.7. (page 21) for quoted-printable, and
+// RFC 2045, 6.8. (page 25) for base64.
+const maxLineLen = 76
+
+// base64LineWriter limits text encoded in base64 to 76 characters per line
+type base64LineWriter struct {
+ w io.Writer
+ lineLen int
+}
+
+func newBase64LineWriter(w io.Writer) *base64LineWriter {
+ return &base64LineWriter{w: w}
+}
+
+func (w *base64LineWriter) Write(p []byte) (int, error) {
+ n := 0
+ for len(p)+w.lineLen > maxLineLen {
+ w.w.Write(p[:maxLineLen-w.lineLen])
+ w.w.Write([]byte("\r\n"))
+ p = p[maxLineLen-w.lineLen:]
+ n += maxLineLen - w.lineLen
+ w.lineLen = 0
+ }
+
+ w.w.Write(p)
+ w.lineLen += len(p)
+
+ return n + len(p), nil
+}
+
+// Stubbed out for testing.
+var now = time.Now
diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go
index 25808000f..2c9d5111f 100644
--- a/vendor/gopkg.in/yaml.v2/scannerc.go
+++ b/vendor/gopkg.in/yaml.v2/scannerc.go
@@ -9,7 +9,7 @@ import (
// ************
//
// The following notes assume that you are familiar with the YAML specification
-// (http://yaml.org/spec/cvs/current.html). We mostly follow it, although in
+// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in
// some cases we are less restrictive that it requires.
//
// The process of transforming a YAML stream into a sequence of events is
diff --git a/webapp/.eslintrc.json b/webapp/.eslintrc.json
index 183df2017..bb4721c22 100644
--- a/webapp/.eslintrc.json
+++ b/webapp/.eslintrc.json
@@ -37,6 +37,7 @@
"block-scoped-var": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
"camelcase": [2, {"properties": "never"}],
+ "capitalized-comments": 0,
"class-methods-use-this": 1,
"comma-dangle": [2, "never"],
"comma-spacing": [2, {"before": false, "after": true}],
@@ -76,9 +77,11 @@
"newline-per-chained-call": 0,
"no-alert": 2,
"no-array-constructor": 2,
+ "no-await-in-loop": 2,
"no-caller": 2,
"no-case-declarations": 2,
"no-class-assign": 2,
+ "no-compare-neg-zero": 2,
"no-cond-assign": [2, "except-parens"],
"no-confusing-arrow": 2,
"no-console": 2,
@@ -120,6 +123,7 @@
"no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2], "enforceConst": true, "detectObjects": true } ],
"no-mixed-operators": [2, {"allowSamePrecedence": false}],
"no-mixed-spaces-and-tabs": 2,
+ "no-multi-assign": 2,
"no-multi-spaces": [2, { "exceptions": { "Property": false } }],
"no-multi-str": 0,
"no-multiple-empty-lines": [2, {"max": 1}],
@@ -181,11 +185,14 @@
"object-shorthand": [2, "always"],
"one-var": [2, "never"],
"one-var-declaration-per-line": 0,
+ "operator-assignment": [2, "always"],
"operator-linebreak": [2, "after"],
"padded-blocks": [2, "never"],
"prefer-arrow-callback": 2,
"prefer-const": 2,
+ "prefer-destructuring": 0,
"prefer-numeric-literals": 2,
+ "prefer-promise-reject-errors": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
"prefer-template": 0,
@@ -194,6 +201,7 @@
"radix": 2,
"react/display-name": [2, { "ignoreTranspilerName": false }],
"react/forbid-component-props": 0,
+ "react/forbid-elements": [2, { "forbid": ["embed"] }],
"react/jsx-boolean-value": [2, "always"],
"react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [2, "never"],
@@ -217,6 +225,7 @@
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/jsx-wrap-multilines": 2,
+ "react/no-array-index-key": 1,
"react/no-children-prop": 2,
"react/no-danger": 0,
"react/no-danger-with-children": 2,
@@ -236,11 +245,13 @@
"react/prefer-es6-class": 2,
"react/prefer-stateless-function": 0,
"react/prop-types": 2,
+ "react/require-default-props": 0,
"react/require-optimization": 1,
"react/require-render-return": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 0,
"react/style-prop-object": 2,
+ "require-await": 2,
"require-yield": 2,
"rest-spread-spacing": [2, "never"],
"semi": [2, "always"],
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index e3563d79c..acbc943cf 100644
--- a/webapp/actions/channel_actions.jsx
+++ b/webapp/actions/channel_actions.jsx
@@ -313,6 +313,7 @@ export function joinChannel(channel, success, error) {
channel.id,
() => {
ChannelStore.removeMoreChannel(channel.id);
+ ChannelStore.storeChannel(channel);
if (success) {
success();
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx
index cbcddfc7c..0c837621f 100644
--- a/webapp/actions/post_actions.jsx
+++ b/webapp/actions/post_actions.jsx
@@ -68,6 +68,14 @@ export function handleNewPost(post, msg) {
});
}
+export function pinPost(channelId, postId) {
+ AsyncClient.pinPost(channelId, postId);
+}
+
+export function unpinPost(channelId, postId) {
+ AsyncClient.unpinPost(channelId, postId);
+}
+
export function flagPost(postId) {
trackEvent('api', 'api_posts_flagged');
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
@@ -96,7 +104,8 @@ export function getFlaggedPosts() {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH,
results: data,
- is_flagged_posts: true
+ is_flagged_posts: true,
+ is_pinned_posts: false
});
loadProfilesForPosts(data.posts);
@@ -107,6 +116,31 @@ export function getFlaggedPosts() {
);
}
+export function getPinnedPosts(channelId) {
+ Client.getPinnedPosts(channelId,
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_SEARCH_TERM,
+ term: null,
+ do_search: false,
+ is_mention_search: false
+ });
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_SEARCH,
+ results: data,
+ is_flagged_posts: false,
+ is_pinned_posts: true
+ });
+
+ loadProfilesForPosts(data.posts);
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getPinnedPosts');
+ }
+ );
+}
+
export function loadPosts(channelId = ChannelStore.getCurrentId(), isPost = false) {
const postList = PostStore.getAllPosts(channelId);
const latestPostTime = PostStore.getLatestPostFromPageTime(channelId);
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx
index eaffd9ff4..a95049f93 100644
--- a/webapp/client/client.jsx
+++ b/webapp/client/client.jsx
@@ -1802,6 +1802,15 @@ export default class Client {
this.trackEvent('api', 'api_posts_get_flagged', {team_id: this.getTeamId()});
}
+ getPinnedPosts(channelId, success, error) {
+ request.
+ get(`${this.getChannelNeededRoute(channelId)}/pinned`).
+ set(this.defaultHeaders).
+ type('application/json').
+ accept('application/json').
+ end(this.handleResponse.bind(this, 'getPinnedPosts', success, error));
+ }
+
getFileInfosForPost(channelId, postId, success, error) {
request.
get(`${this.getChannelNeededRoute(channelId)}/posts/${postId}/get_file_infos`).
@@ -2187,6 +2196,24 @@ export default class Client {
});
}
+ pinPost(channelId, postId, success, error) {
+ request.
+ post(`${this.getChannelNeededRoute(channelId)}/posts/${postId}/pin`).
+ set(this.defaultHeaders).
+ accept('application/json').
+ send().
+ end(this.handleResponse.bind(this, 'pinPost', success, error));
+ }
+
+ unpinPost(channelId, postId, success, error) {
+ request.
+ post(`${this.getChannelNeededRoute(channelId)}/posts/${postId}/unpin`).
+ set(this.defaultHeaders).
+ accept('application/json').
+ send().
+ end(this.handleResponse.bind(this, 'unpinPost', success, error));
+ }
+
saveReaction(channelId, reaction, success, error) {
request.
post(`${this.getChannelNeededRoute(channelId)}/posts/${reaction.post_id}/reactions/save`).
diff --git a/webapp/components/admin_console/password_settings.jsx b/webapp/components/admin_console/password_settings.jsx
index 3707977b8..43ec40904 100644
--- a/webapp/components/admin_console/password_settings.jsx
+++ b/webapp/components/admin_console/password_settings.jsx
@@ -39,16 +39,16 @@ export default class PasswordSettings extends AdminSettings {
if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.PasswordRequirements === 'true') {
let sampleErrorMsgId = 'user.settings.security.passwordError';
if (props.config.PasswordSettings.Lowercase) {
- sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
+ sampleErrorMsgId += 'Lowercase';
}
if (props.config.PasswordSettings.Uppercase) {
- sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
+ sampleErrorMsgId += 'Uppercase';
}
if (props.config.PasswordSettings.Number) {
- sampleErrorMsgId = sampleErrorMsgId + 'Number';
+ sampleErrorMsgId += 'Number';
}
if (props.config.PasswordSettings.Symbol) {
- sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
+ sampleErrorMsgId += 'Symbol';
}
this.sampleErrorMsg = (
<FormattedMessage
@@ -101,16 +101,16 @@ export default class PasswordSettings extends AdminSettings {
}
let sampleErrorMsgId = 'user.settings.security.passwordError';
if (this.refs.lowercase.checked) {
- sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
+ sampleErrorMsgId += 'Lowercase';
}
if (this.refs.uppercase.checked) {
- sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
+ sampleErrorMsgId += 'Uppercase';
}
if (this.refs.number.checked) {
- sampleErrorMsgId = sampleErrorMsgId + 'Number';
+ sampleErrorMsgId += 'Number';
}
if (this.refs.symbol.checked) {
- sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
+ sampleErrorMsgId += 'Symbol';
}
return (
<FormattedMessage
diff --git a/webapp/components/admin_console/reset_password_modal.jsx b/webapp/components/admin_console/reset_password_modal.jsx
index 757f85517..1b9e5b37a 100644
--- a/webapp/components/admin_console/reset_password_modal.jsx
+++ b/webapp/components/admin_console/reset_password_modal.jsx
@@ -61,7 +61,7 @@ class ResetPasswordModal extends React.Component {
if (this.state.serverError) {
urlClass += ' has-error';
- serverError = <div className='form-group has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
+ serverError = <div className='has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
}
let title;
diff --git a/webapp/components/audio_video_preview.jsx b/webapp/components/audio_video_preview.jsx
index 4956900a9..9a55e4835 100644
--- a/webapp/components/audio_video_preview.jsx
+++ b/webapp/components/audio_video_preview.jsx
@@ -94,7 +94,6 @@ export default class AudioVideoPreview extends React.Component {
<video
key={this.props.fileInfo.id}
ref='video'
- style={{maxHeight: this.props.maxHeight}}
data-setup='{}'
controls='controls'
width={width}
@@ -111,6 +110,5 @@ export default class AudioVideoPreview extends React.Component {
AudioVideoPreview.propTypes = {
fileInfo: React.PropTypes.object.isRequired,
- fileUrl: React.PropTypes.string.isRequired,
- maxHeight: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]).isRequired
+ fileUrl: React.PropTypes.string.isRequired
};
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 01e1e98cf..120846b8d 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -30,7 +30,7 @@ import * as Utils from 'utils/utils.jsx';
import * as ChannelUtils from 'utils/channel_utils.jsx';
import {getSiteURL} from 'utils/url.jsx';
import * as TextFormatting from 'utils/text_formatting.jsx';
-import {getFlaggedPosts} from 'actions/post_actions.jsx';
+import {getFlaggedPosts, getPinnedPosts} from 'actions/post_actions.jsx';
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
@@ -53,6 +53,7 @@ export default class ChannelHeader extends React.Component {
this.hideRenameChannelModal = this.hideRenameChannelModal.bind(this);
this.handleShortcut = this.handleShortcut.bind(this);
this.getFlagged = this.getFlagged.bind(this);
+ this.getPinnedPosts = this.getPinnedPosts.bind(this);
this.initWebrtc = this.initWebrtc.bind(this);
this.onBusy = this.onBusy.bind(this);
this.openDirectMessageModal = this.openDirectMessageModal.bind(this);
@@ -158,6 +159,15 @@ export default class ChannelHeader extends React.Component {
}
}
+ getPinnedPosts(e) {
+ e.preventDefault();
+ if (SearchStore.isPinnedPosts) {
+ GlobalActions.toggleSideBarAction(false);
+ } else {
+ getPinnedPosts(this.props.channelId);
+ }
+ }
+
getFlagged(e) {
e.preventDefault();
if (SearchStore.isFlaggedPosts) {
@@ -211,6 +221,7 @@ export default class ChannelHeader extends React.Component {
render() {
const flagIcon = Constants.FLAG_ICON_SVG;
+ const pinIcon = Constants.PIN_ICON;
if (!this.validState()) {
// Use an empty div to make sure the header's height stays constant
@@ -230,7 +241,10 @@ export default class ChannelHeader extends React.Component {
);
const flaggedTooltip = (
- <Tooltip id='flaggedTooltip'>
+ <Tooltip
+ id='flaggedTooltip'
+ className='text-nowrap'
+ >
<FormattedMessage
id='channel_header.flagged'
defaultMessage='Flagged Posts'
@@ -665,19 +679,27 @@ export default class ChannelHeader extends React.Component {
headerText = channel.header;
}
- const toggleFavoriteTooltip = (
- <Tooltip id='favoriteTooltip'>
- {this.state.isFavorite ?
+ let toggleFavoriteTooltip;
+ if (this.state.isFavorite) {
+ toggleFavoriteTooltip = (
+ <Tooltip id='favoriteTooltip'>
<FormattedMessage
id='channelHeader.removeFromFavorites'
defaultMessage='Remove from Favorites'
- /> :
- <FormattedMessage
- id='channelHeader.addToFavorites'
- defaultMessage='Add to Favorites'
- />}
- </Tooltip>
- );
+ />
+ </Tooltip>
+ );
+ } else {
+ toggleFavoriteTooltip = (
+ <Tooltip id='favoriteTooltip'>
+ <FormattedMessage
+ id='channelHeader.addToFavorites'
+ defaultMessage='Add to Favorites'
+ />
+ </Tooltip>
+ );
+ }
+
const toggleFavorite = (
<OverlayTrigger
delayShow={Constants.OVERLAY_TIME_DELAY}
@@ -762,8 +784,20 @@ export default class ChannelHeader extends React.Component {
</OverlayTrigger>
</div>
</th>
- <th className='header-list__members'>
+ <th className='header-list__right'>
{popoverListMembers}
+ <a
+ href='#'
+ type='button'
+ id='pinned-posts-button'
+ className='pinned-posts-button'
+ onClick={this.getPinnedPosts}
+ >
+ <span
+ dangerouslySetInnerHTML={{__html: pinIcon}}
+ aria-hidden='true'
+ />
+ </a>
</th>
<th className='search-bar__container'>
<NavbarSearchBox
diff --git a/webapp/components/create_team/components/display_name.jsx b/webapp/components/create_team/components/display_name.jsx
index aeb8afbb9..865c0e6db 100644
--- a/webapp/components/create_team/components/display_name.jsx
+++ b/webapp/components/create_team/components/display_name.jsx
@@ -10,7 +10,6 @@ import logoImage from 'images/logo.png';
import React from 'react';
import ReactDOM from 'react-dom';
-import {Link} from 'react-router/es6';
import {FormattedMessage} from 'react-intl';
export default class TeamSignupDisplayNamePage extends React.Component {
@@ -118,14 +117,6 @@ export default class TeamSignupDisplayNamePage extends React.Component {
defaultMessage='Next'
/><i className='fa fa-chevron-right'/>
</button>
- <div className='margin--extra'>
- <Link to='/select_team'>
- <FormattedMessage
- id='create_team.display_name.back'
- defaultMessage='Back to previous step'
- />
- </Link>
- </div>
</form>
</div>
);
diff --git a/webapp/components/integrations/components/confirm_integration.jsx b/webapp/components/integrations/components/confirm_integration.jsx
index 6d778f241..b4f299d1c 100644
--- a/webapp/components/integrations/components/confirm_integration.jsx
+++ b/webapp/components/integrations/components/confirm_integration.jsx
@@ -5,7 +5,7 @@ import React from 'react';
import BackstageHeader from 'components/backstage/components/backstage_header.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
-import {Link} from 'react-router/es6';
+import {Link, browserHistory} from 'react-router/es6';
import UserStore from 'stores/user_store.jsx';
import IntegrationStore from 'stores/integration_store.jsx';
@@ -25,6 +25,7 @@ export default class ConfirmIntegration extends React.Component {
super(props);
this.handleIntegrationChange = this.handleIntegrationChange.bind(this);
+ this.handleKeyPress = this.handleKeyPress.bind(this);
const userId = UserStore.getCurrentId();
@@ -38,10 +39,12 @@ export default class ConfirmIntegration extends React.Component {
componentDidMount() {
IntegrationStore.addChangeListener(this.handleIntegrationChange);
+ window.addEventListener('keypress', this.handleKeyPress);
}
componentWillUnmount() {
IntegrationStore.removeChangeListener(this.handleIntegrationChange);
+ window.removeEventListener('keypress', this.handleKeyPress);
}
handleIntegrationChange() {
@@ -53,6 +56,12 @@ export default class ConfirmIntegration extends React.Component {
});
}
+ handleKeyPress(e) {
+ if (e.key === 'Enter') {
+ browserHistory.push('/' + this.props.team.name + '/integrations/' + this.state.type);
+ }
+ }
+
render() {
let headerText = null;
let helpText = null;
diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx
index 38c594cf7..01da0199f 100644
--- a/webapp/components/login/login_controller.jsx
+++ b/webapp/components/login/login_controller.jsx
@@ -413,6 +413,7 @@ export default class LoginController extends React.Component {
</div>
<div className='form-group'>
<button
+ id='loginButton'
type='submit'
className='btn btn-primary'
>
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index c945a0b9c..28d8fae05 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -19,12 +19,15 @@ import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
+import SearchStore from 'stores/search_store.jsx';
import ChannelSwitchModal from './channel_switch_modal.jsx';
import * as Utils from 'utils/utils.jsx';
import * as ChannelUtils from 'utils/channel_utils.jsx';
import * as ChannelActions from 'actions/channel_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
+import {getPinnedPosts} from 'actions/post_actions.jsx';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
@@ -62,6 +65,7 @@ export default class Navbar extends React.Component {
this.hideChannelSwitchModal = this.hideChannelSwitchModal.bind(this);
this.openDirectMessageModal = this.openDirectMessageModal.bind(this);
+ this.getPinnedPosts = this.getPinnedPosts.bind(this);
const state = this.getStateFromStores();
state.showEditChannelPurposeModal = false;
@@ -216,6 +220,15 @@ export default class Navbar extends React.Component {
});
}
+ getPinnedPosts(e) {
+ e.preventDefault();
+ if (SearchStore.isPinnedPosts) {
+ GlobalActions.toggleSideBarAction(false);
+ } else {
+ getPinnedPosts(this.state.channel.id);
+ }
+ }
+
toggleFavorite = (e) => {
e.preventDefault();
@@ -244,6 +257,7 @@ export default class Navbar extends React.Component {
}
let viewInfoOption;
+ let viewPinnedPostsOption;
let addMembersOption;
let manageMembersOption;
let setChannelHeaderOption;
@@ -335,6 +349,21 @@ export default class Navbar extends React.Component {
</li>
);
+ viewPinnedPostsOption = (
+ <li role='presentation'>
+ <a
+ role='menuitem'
+ href='#'
+ onClick={this.getPinnedPosts}
+ >
+ <FormattedMessage
+ id='navbar.viewPinnedPosts'
+ defaultMessage='View Pinned Posts'
+ />
+ </a>
+ </li>
+ );
+
if (!ChannelStore.isDefault(channel)) {
addMembersOption = (
<li role='presentation'>
@@ -525,10 +554,10 @@ export default class Navbar extends React.Component {
id='channelHeader.removeFromFavorites'
defaultMessage='Remove from Favorites'
/> :
- <FormattedMessage
- id='channelHeader.addToFavorites'
- defaultMessage='Add to Favorites'
- />}
+ <FormattedMessage
+ id='channelHeader.addToFavorites'
+ defaultMessage='Add to Favorites'
+ />}
</a>
</li>
);
@@ -561,6 +590,7 @@ export default class Navbar extends React.Component {
role='menu'
>
{viewInfoOption}
+ {viewPinnedPostsOption}
{notificationPreferenceOption}
{addMembersOption}
{manageMembersOption}
diff --git a/webapp/components/needs_team.jsx b/webapp/components/needs_team.jsx
index 5cb714ebc..11e75bfb7 100644
--- a/webapp/components/needs_team.jsx
+++ b/webapp/components/needs_team.jsx
@@ -12,6 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
+import PostStore from 'stores/post_store.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import {startPeriodicStatusUpdates, stopPeriodicStatusUpdates} from 'actions/status_actions.jsx';
import {startPeriodicSync, stopPeriodicSync} from 'actions/websocket_actions.jsx';
@@ -177,12 +178,25 @@ export default class NeedsTeam extends React.Component {
</div>
);
}
+
+ let channel = ChannelStore.getByName(this.props.params.channel);
+ if (channel == null) {
+ // the permalink view is not really tied to a particular channel but still needs it
+ const postId = PostStore.getFocusedPostId();
+ const post = PostStore.getEarliestPostFromPage(postId);
+
+ // the post take some time before being available on page load
+ if (post != null) {
+ channel = ChannelStore.get(post.channel_id);
+ }
+ }
+
return (
<div className='channel-view'>
<ErrorBar/>
<WebrtcNotification/>
<div className='container-fluid'>
- <SidebarRight/>
+ <SidebarRight channel={channel}/>
<SidebarRightMenu teamType={this.state.team.type}/>
<WebrtcSidebar/>
{content}
diff --git a/webapp/components/new_channel_modal.jsx b/webapp/components/new_channel_modal.jsx
index 2f9533b0e..f16b4596f 100644
--- a/webapp/components/new_channel_modal.jsx
+++ b/webapp/components/new_channel_modal.jsx
@@ -77,7 +77,7 @@ export default class NewChannelModal extends React.Component {
e.preventDefault();
const displayName = ReactDOM.findDOMNode(this.refs.display_name).value.trim();
- if (displayName.length < 1) {
+ if (displayName.length < Constants.MIN_CHANNELNAME_LENGTH) {
this.setState({displayNameError: true});
return;
}
@@ -104,7 +104,7 @@ export default class NewChannelModal extends React.Component {
<p className='input__help error'>
<FormattedMessage
id='channel_modal.displayNameError'
- defaultMessage='This field is required'
+ defaultMessage='Channel name must be 2 or more characters'
/>
{this.state.displayNameError}
</p>
@@ -232,7 +232,7 @@ export default class NewChannelModal extends React.Component {
ref='display_name'
className='form-control'
placeholder={Utils.localizeMessage('channel_modal.nameEx', 'E.g.: "Bugs", "Marketing", "客户支持"')}
- maxLength='22'
+ maxLength={Constants.MAX_CHANNELNAME_LENGTH}
value={this.props.channelData.displayName}
autoFocus={true}
tabIndex='1'
diff --git a/webapp/components/popover_list_members.jsx b/webapp/components/popover_list_members.jsx
index bd2f744c7..1518b1ebf 100644
--- a/webapp/components/popover_list_members.jsx
+++ b/webapp/components/popover_list_members.jsx
@@ -233,7 +233,7 @@ export default class PopoverListMembers extends React.Component {
}
return (
- <div>
+ <div className='member-popover__container'>
<div
id='member_popover'
className='member-popover__trigger'
@@ -243,13 +243,11 @@ export default class PopoverListMembers extends React.Component {
AsyncClient.getProfilesInChannel(this.props.channel.id, 0);
}}
>
- <div>
- {countText}
- <span
- className='fa fa-user'
- aria-hidden='true'
- />
- </div>
+ {countText}
+ <span
+ className='fa fa-user'
+ aria-hidden='true'
+ />
</div>
<Overlay
rootClose={true}
diff --git a/webapp/components/post_view/components/date_separator.jsx b/webapp/components/post_view/components/date_separator.jsx
new file mode 100644
index 000000000..18dc0c7ff
--- /dev/null
+++ b/webapp/components/post_view/components/date_separator.jsx
@@ -0,0 +1,27 @@
+import React from 'react';
+import {FormattedDate} from 'react-intl';
+
+export default class DateSeparator extends React.Component {
+ render() {
+ return (
+ <div
+ className='date-separator'
+ >
+ <hr className='separator__hr'/>
+ <div className='separator__text'>
+ <FormattedDate
+ value={this.props.date}
+ weekday='short'
+ month='short'
+ day='2-digit'
+ year='numeric'
+ />
+ </div>
+ </div>
+ );
+ }
+}
+
+DateSeparator.propTypes = {
+ date: React.PropTypes.instanceOf(Date)
+};
diff --git a/webapp/components/post_view/components/post_attachment.jsx b/webapp/components/post_view/components/post_attachment.jsx
index 57335b94a..1b2cddcd6 100644
--- a/webapp/components/post_view/components/post_attachment.jsx
+++ b/webapp/components/post_view/components/post_attachment.jsx
@@ -184,6 +184,7 @@ class PostAttachment extends React.Component {
author.push(
<img
className='attachment__author-icon'
+ crossOrigin='anonymous'
src={data.author_icon}
key={'attachment__author-icon'}
height='14'
@@ -257,6 +258,7 @@ class PostAttachment extends React.Component {
image = (
<img
className='attachment__image'
+ crossOrigin='anonymous'
src={data.image_url}
/>
);
@@ -269,6 +271,7 @@ class PostAttachment extends React.Component {
className='attachment__thumb-container'
>
<img
+ crossOrigin='anonymous'
src={data.thumb_url}
/>
</div>
diff --git a/webapp/components/post_view/components/post_attachment_opengraph.jsx b/webapp/components/post_view/components/post_attachment_opengraph.jsx
index 12437e672..13171202a 100644
--- a/webapp/components/post_view/components/post_attachment_opengraph.jsx
+++ b/webapp/components/post_view/components/post_attachment_opengraph.jsx
@@ -32,7 +32,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
this.onImageLoad = this.onImageLoad.bind(this);
this.onImageError = this.onImageError.bind(this);
this.truncateText = this.truncateText.bind(this);
- this.setImageWidth = this.setImageWidth.bind(this);
}
IMAGE_LOADED = {
@@ -75,20 +74,16 @@ export default class PostAttachmentOpenGraph extends React.Component {
componentDidMount() {
OpenGraphStore.addUrlDataChangeListener(this.onOpenGraphMetadataChange);
- this.setImageWidth();
- window.addEventListener('resize', this.setImageWidth);
}
componentDidUpdate() {
if (this.props.childComponentDidUpdateFunction) {
this.props.childComponentDidUpdateFunction();
}
- this.setImageWidth();
}
componentWillUnmount() {
OpenGraphStore.removeUrlDataChangeListener(this.onOpenGraphMetadataChange);
- window.removeEventListener('resize', this.setImageWidth);
}
onOpenGraphMetadataChange(url) {
@@ -163,9 +158,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
return (
<div
className='attachment__image__container--openraph'
- style={{
- width: (this.imageDimentions.height * this.imageRatio) + this.smallImageContainerLeftPadding
- }} // Initially set the width accordinly to max image heigh, ie 80px. Later on it would be modified according to actul height of image.
ref={(div) => {
this.smallImageContainer = div;
}}
@@ -201,6 +193,7 @@ export default class PostAttachmentOpenGraph extends React.Component {
element = this.wrapInSmallImageContainer(
<img
className={'attachment__image attachment__image--openraph'}
+ crossOrigin='anonymous'
src={imageUrl}
ref={(img) => {
this.smallImageElement = img;
@@ -215,20 +208,6 @@ export default class PostAttachmentOpenGraph extends React.Component {
return element;
}
- setImageWidth() {
- if (
- this.state.imageLoaded === this.IMAGE_LOADED.YES &&
- this.smallImageContainer &&
- this.smallImageElement
- ) {
- this.smallImageContainer.style.width = (
- (this.smallImageElement.offsetHeight * this.imageRatio) +
- this.smallImageContainerLeftPadding +
- 'px'
- );
- }
- }
-
truncateText(text, maxLength = this.textMaxLenght, ellipsis = this.textEllipsis) {
if (text.length > maxLength) {
return text.substring(0, maxLength - ellipsis.length) + ellipsis;
diff --git a/webapp/components/post_view/components/post_image.jsx b/webapp/components/post_view/components/post_image.jsx
index 9a761bfca..6fe954e99 100644
--- a/webapp/components/post_view/components/post_image.jsx
+++ b/webapp/components/post_view/components/post_image.jsx
@@ -67,6 +67,7 @@ export default class PostImageEmbed extends React.Component {
return (
<img
className='img-div placeholder'
+ crossOrigin='anonymous'
height='500px'
/>
);
@@ -75,6 +76,7 @@ export default class PostImageEmbed extends React.Component {
return (
<img
className='img-div'
+ crossOrigin='anonymous'
src={this.props.link}
/>
);
diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx
index 331fdeb00..5318ec272 100644
--- a/webapp/components/post_view/components/post_info.jsx
+++ b/webapp/components/post_view/components/post_info.jsx
@@ -26,6 +26,8 @@ export default class PostInfo extends React.Component {
this.removePost = this.removePost.bind(this);
this.flagPost = this.flagPost.bind(this);
this.unflagPost = this.unflagPost.bind(this);
+ this.pinPost = this.pinPost.bind(this);
+ this.unpinPost = this.unpinPost.bind(this);
this.canEdit = false;
this.canDelete = false;
@@ -148,6 +150,42 @@ export default class PostInfo extends React.Component {
);
}
+ if (this.props.post.is_pinned) {
+ dropdownContents.push(
+ <li
+ key='unpinLink'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.unpinPost}
+ >
+ <FormattedMessage
+ id='post_info.unpin'
+ defaultMessage='Un-pin from channel'
+ />
+ </a>
+ </li>
+ );
+ } else {
+ dropdownContents.push(
+ <li
+ key='pinLink'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.pinPost}
+ >
+ <FormattedMessage
+ id='post_info.pin'
+ defaultMessage='Pin to channel'
+ />
+ </a>
+ </li>
+ );
+ }
+
if (this.canDelete) {
dropdownContents.push(
<li
@@ -250,6 +288,16 @@ export default class PostInfo extends React.Component {
);
}
+ pinPost(e) {
+ e.preventDefault();
+ PostActions.pinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
+ unpinPost(e) {
+ e.preventDefault();
+ PostActions.unpinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
flagPost(e) {
e.preventDefault();
PostActions.flagPost(this.props.post.id);
@@ -374,6 +422,18 @@ export default class PostInfo extends React.Component {
);
}
+ let pinnedBadge;
+ if (post.is_pinned) {
+ pinnedBadge = (
+ <span className='post__pinned-badge'>
+ <FormattedMessage
+ id='post_info.pinned'
+ defaultMessage='Pinned'
+ />
+ </span>
+ );
+ }
+
return (
<ul className='post__header--info'>
<li className='col'>
@@ -384,6 +444,7 @@ export default class PostInfo extends React.Component {
useMilitaryTime={this.props.useMilitaryTime}
postId={post.id}
/>
+ {pinnedBadge}
{flagTrigger}
</li>
{options}
diff --git a/webapp/components/post_view/components/post_time.jsx b/webapp/components/post_view/components/post_time.jsx
index 25d533e0a..77f3f3266 100644
--- a/webapp/components/post_view/components/post_time.jsx
+++ b/webapp/components/post_view/components/post_time.jsx
@@ -40,12 +40,15 @@ export default class PostTime extends React.Component {
}
renderTimeTag() {
+ const date = getDateForUnixTicks(this.props.eventTime);
+
return (
<time
className='post__time'
- dateTime={getDateForUnixTicks(this.props.eventTime).toISOString()}
+ dateTime={date.toISOString()}
+ title={date}
>
- {getDateForUnixTicks(this.props.eventTime).toLocaleString('en', {hour: '2-digit', minute: '2-digit', hour12: !this.props.useMilitaryTime})}
+ {date.toLocaleString('en', {hour: '2-digit', minute: '2-digit', hour12: !this.props.useMilitaryTime})}
</time>
);
}
diff --git a/webapp/components/profile_picture.jsx b/webapp/components/profile_picture.jsx
index 7a5f892db..737a4400b 100644
--- a/webapp/components/profile_picture.jsx
+++ b/webapp/components/profile_picture.jsx
@@ -69,6 +69,7 @@ export default class ProfilePicture extends React.Component {
width={this.props.width}
height={this.props.width}
src={this.props.src}
+ crossOrigin='anonymous'
/>
<StatusIcon status={this.props.status}/>
</span>
@@ -82,6 +83,7 @@ export default class ProfilePicture extends React.Component {
width={this.props.width}
height={this.props.width}
src={this.props.src}
+ crossOrigin='anonymous'
/>
<StatusIcon status={this.props.status}/>
</span>
diff --git a/webapp/components/profile_popover.jsx b/webapp/components/profile_popover.jsx
index c7d45474f..e21716cb3 100644
--- a/webapp/components/profile_popover.jsx
+++ b/webapp/components/profile_popover.jsx
@@ -182,6 +182,7 @@ export default class ProfilePopover extends React.Component {
height='128'
width='128'
key='user-popover-image'
+ crossOrigin='anonymous'
/>
);
diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx
index cb527d850..52e4d9851 100644
--- a/webapp/components/rhs_comment.jsx
+++ b/webapp/components/rhs_comment.jsx
@@ -10,7 +10,7 @@ import ReactionListContainer from 'components/post_view/components/reaction_list
import RhsDropdown from 'components/rhs_dropdown.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
-import {flagPost, unflagPost} from 'actions/post_actions.jsx';
+import {flagPost, unflagPost, pinPost, unpinPost} from 'actions/post_actions.jsx';
import TeamStore from 'stores/team_store.jsx';
@@ -36,6 +36,8 @@ export default class RhsComment extends React.Component {
this.removePost = this.removePost.bind(this);
this.flagPost = this.flagPost.bind(this);
this.unflagPost = this.unflagPost.bind(this);
+ this.pinPost = this.pinPost.bind(this);
+ this.unpinPost = this.unpinPost.bind(this);
this.canEdit = false;
this.canDelete = false;
@@ -128,6 +130,16 @@ export default class RhsComment extends React.Component {
unflagPost(this.props.post.id);
}
+ pinPost(e) {
+ e.preventDefault();
+ pinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
+ unpinPost(e) {
+ e.preventDefault();
+ unpinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
createDropdown() {
const post = this.props.post;
@@ -195,6 +207,42 @@ export default class RhsComment extends React.Component {
</li>
);
+ if (post.is_pinned) {
+ dropdownContents.push(
+ <li
+ key='rhs-comment-unpin'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.unpinPost}
+ >
+ <FormattedMessage
+ id='rhs_root.unpin'
+ defaultMessage='Un-pin from channel'
+ />
+ </a>
+ </li>
+ );
+ } else {
+ dropdownContents.push(
+ <li
+ key='rhs-comment-pin'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.pinPost}
+ >
+ <FormattedMessage
+ id='rhs_root.pin'
+ defaultMessage='Pin to channel'
+ />
+ </a>
+ </li>
+ );
+ }
+
if (this.canDelete) {
dropdownContents.push(
<li
@@ -503,10 +551,19 @@ export default class RhsComment extends React.Component {
);
}
+ let pinnedBadge;
+ if (post.is_pinned) {
+ pinnedBadge = (
+ <span className='post__pinned-badge'>
+ <FormattedMessage
+ id='post_info.pinned'
+ defaultMessage='Pinned'
+ />
+ </span>
+ );
+ }
+
const timeOptions = {
- day: 'numeric',
- month: 'short',
- year: 'numeric',
hour: '2-digit',
minute: '2-digit',
hour12: !this.props.useMilitaryTime
@@ -524,6 +581,7 @@ export default class RhsComment extends React.Component {
{botIndicator}
<li className='col'>
{this.renderTimeTag(post, timeOptions)}
+ {pinnedBadge}
{flagTrigger}
</li>
{options}
diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx
index 0c1037501..83d930bca 100644
--- a/webapp/components/rhs_root_post.jsx
+++ b/webapp/components/rhs_root_post.jsx
@@ -14,7 +14,7 @@ import UserStore from 'stores/user_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
-import {flagPost, unflagPost} from 'actions/post_actions.jsx';
+import {flagPost, unflagPost, pinPost, unpinPost} from 'actions/post_actions.jsx';
import * as Utils from 'utils/utils.jsx';
import * as PostUtils from 'utils/post_utils.jsx';
@@ -35,6 +35,8 @@ export default class RhsRootPost extends React.Component {
this.handlePermalink = this.handlePermalink.bind(this);
this.flagPost = this.flagPost.bind(this);
this.unflagPost = this.unflagPost.bind(this);
+ this.pinPost = this.pinPost.bind(this);
+ this.unpinPost = this.unpinPost.bind(this);
this.canEdit = false;
this.canDelete = false;
@@ -143,6 +145,16 @@ export default class RhsRootPost extends React.Component {
);
}
+ pinPost(e) {
+ e.preventDefault();
+ pinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
+ unpinPost(e) {
+ e.preventDefault();
+ unpinPost(this.props.post.channel_id, this.props.post.id);
+ }
+
render() {
const post = this.props.post;
const user = this.props.user;
@@ -240,6 +252,42 @@ export default class RhsRootPost extends React.Component {
</li>
);
+ if (post.is_pinned) {
+ dropdownContents.push(
+ <li
+ key='rhs-root-unpin'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.unpinPost}
+ >
+ <FormattedMessage
+ id='rhs_root.unpin'
+ defaultMessage='Un-pin from channel'
+ />
+ </a>
+ </li>
+ );
+ } else {
+ dropdownContents.push(
+ <li
+ key='rhs-root-pin'
+ role='presentation'
+ >
+ <a
+ href='#'
+ onClick={this.pinPost}
+ >
+ <FormattedMessage
+ id='rhs_root.pin'
+ defaultMessage='Pin to channel'
+ />
+ </a>
+ </li>
+ );
+ }
+
if (this.canDelete) {
dropdownContents.push(
<li
@@ -450,10 +498,19 @@ export default class RhsRootPost extends React.Component {
flagFunc = this.flagPost;
}
+ let pinnedBadge;
+ if (post.is_pinned) {
+ pinnedBadge = (
+ <span className='post__pinned-badge'>
+ <FormattedMessage
+ id='post_info.pinned'
+ defaultMessage='Pinned'
+ />
+ </span>
+ );
+ }
+
const timeOptions = {
- day: 'numeric',
- month: 'short',
- year: 'numeric',
hour: '2-digit',
minute: '2-digit',
hour12: !this.props.useMilitaryTime
@@ -470,6 +527,7 @@ export default class RhsRootPost extends React.Component {
{botIndicator}
<li className='col'>
{this.renderTimeTag(post, timeOptions)}
+ {pinnedBadge}
<OverlayTrigger
key={'rootpostflagtooltipkey' + flagVisible}
delayShow={Constants.OVERLAY_TIME_DELAY}
diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx
index 3c0b2e114..2c1d03901 100644
--- a/webapp/components/rhs_thread.jsx
+++ b/webapp/components/rhs_thread.jsx
@@ -8,6 +8,7 @@ import RootPost from './rhs_root_post.jsx';
import Comment from './rhs_comment.jsx';
import FileUploadOverlay from './file_upload_overlay.jsx';
import FloatingTimestamp from './post_view/components/floating_timestamp.jsx';
+import DateSeparator from './post_view/components/date_separator.jsx';
import PostStore from 'stores/post_store.jsx';
import UserStore from 'stores/user_store.jsx';
@@ -325,6 +326,7 @@ export default class RhsThread extends React.Component {
const postsArray = this.state.postsArray;
const selected = this.state.selected;
const profiles = this.state.profiles || {};
+ let previousPostDay = Utils.getDateForUnixTicks(selected.create_at);
if (postsArray == null || selected == null) {
return (
@@ -355,6 +357,55 @@ export default class RhsThread extends React.Component {
rootStatus = this.state.statuses[selected.user_id] || 'offline';
}
+ const commentsLists = [];
+ for (let i = 0; i < postsArray.length; i++) {
+ const comPost = postsArray[i];
+ let p;
+ if (UserStore.getCurrentId() === comPost.user_id) {
+ p = UserStore.getCurrentUser();
+ } else {
+ p = profiles[comPost.user_id];
+ }
+
+ let isFlagged = false;
+ if (this.state.flaggedPosts) {
+ isFlagged = this.state.flaggedPosts.get(comPost.id) === 'true';
+ }
+
+ let status = 'offline';
+ if (this.state.statuses && p && p.id) {
+ status = this.state.statuses[p.id] || 'offline';
+ }
+
+ const keyPrefix = comPost.id ? comPost.id : comPost.pending_post_id;
+
+ const currentPostDay = Utils.getDateForUnixTicks(comPost.create_at);
+
+ if (currentPostDay.toDateString() !== previousPostDay.toDateString()) {
+ previousPostDay = currentPostDay;
+ commentsLists.push(
+ <DateSeparator
+ date={currentPostDay}
+ />);
+ }
+
+ commentsLists.push(
+ <div key={keyPrefix + 'commentKey'}>
+ <Comment
+ ref={comPost.id}
+ post={comPost}
+ user={p}
+ currentUser={this.props.currentUser}
+ compactDisplay={this.state.compactDisplay}
+ useMilitaryTime={this.props.useMilitaryTime}
+ isFlagged={isFlagged}
+ status={status}
+ isBusy={this.state.isBusy}
+ />
+ </div>
+ );
+ }
+
return (
<div className='post-right__container'>
<FileUploadOverlay overlayType='right'/>
@@ -384,6 +435,9 @@ export default class RhsThread extends React.Component {
onScroll={this.handleScroll}
>
<div className='post-right__scroll'>
+ <DateSeparator
+ date={previousPostDay}
+ />
<RootPost
ref={selected.id}
post={selected}
@@ -401,41 +455,7 @@ export default class RhsThread extends React.Component {
ref='rhspostlist'
className='post-right-comments-container'
>
- {postsArray.map((comPost) => {
- let p;
- if (UserStore.getCurrentId() === comPost.user_id) {
- p = UserStore.getCurrentUser();
- } else {
- p = profiles[comPost.user_id];
- }
-
- let isFlagged = false;
- if (this.state.flaggedPosts) {
- isFlagged = this.state.flaggedPosts.get(comPost.id) === 'true';
- }
-
- let status = 'offline';
- if (this.state.statuses && p && p.id) {
- status = this.state.statuses[p.id] || 'offline';
- }
-
- const keyPrefix = comPost.id ? comPost.id : comPost.pending_post_id;
-
- return (
- <Comment
- ref={comPost.id}
- key={keyPrefix + 'commentKey'}
- post={comPost}
- user={p}
- currentUser={this.props.currentUser}
- compactDisplay={this.state.compactDisplay}
- useMilitaryTime={this.props.useMilitaryTime}
- isFlagged={isFlagged}
- status={status}
- isBusy={this.state.isBusy}
- />
- );
- })}
+ {commentsLists}
</div>
<div className='post-create__container'>
<CreateComment
diff --git a/webapp/components/search_bar.jsx b/webapp/components/search_bar.jsx
index 1c9f607e6..b88e67a11 100644
--- a/webapp/components/search_bar.jsx
+++ b/webapp/components/search_bar.jsx
@@ -216,7 +216,10 @@ export default class SearchBar extends React.Component {
);
const flaggedTooltip = (
- <Tooltip id='flaggedTooltip'>
+ <Tooltip
+ id='flaggedTooltip'
+ className='text-nowrap'
+ >
<FormattedMessage
id='channel_header.flagged'
defaultMessage='Flagged Posts'
diff --git a/webapp/components/search_results.jsx b/webapp/components/search_results.jsx
index 4c0105738..ceafd766c 100644
--- a/webapp/components/search_results.jsx
+++ b/webapp/components/search_results.jsx
@@ -213,6 +213,31 @@ export default class SearchResults extends React.Component {
</ul>
</div>
);
+ } else if (this.props.isPinnedPosts && noResults) {
+ ctls = (
+ <div className='sidebar--right__subheader'>
+ <ul>
+ <li>
+ <FormattedHTMLMessage
+ id='search_results.usagePin1'
+ defaultMessage='There are no pinned messages yet.'
+ />
+ </li>
+ <li>
+ <FormattedHTMLMessage
+ id='search_results.usagePin2'
+ defaultMessage={'You can pin a message by clicking the "Pin to channel" option from the message\'s menu.'}
+ />
+ </li>
+ <li>
+ <FormattedHTMLMessage
+ id='search_results.usagePin3'
+ defaultMessage='Pinned messages are accessible by all channel members and are a way to mark messages for future reference.'
+ />
+ </li>
+ </ul>
+ </div>
+ );
} else if (!searchTerm && noResults) {
ctls = (
<div className='sidebar--right__subheader'>
@@ -289,6 +314,8 @@ export default class SearchResults extends React.Component {
toggleSize={this.props.toggleSize}
shrink={this.props.shrink}
isFlaggedPosts={this.props.isFlaggedPosts}
+ isPinnedPosts={this.props.isPinnedPosts}
+ channelDisplayName={this.props.channelDisplayName}
/>
<div
id='search-items-container'
@@ -307,5 +334,7 @@ SearchResults.propTypes = {
useMilitaryTime: React.PropTypes.bool.isRequired,
toggleSize: React.PropTypes.func,
shrink: React.PropTypes.func,
- isFlaggedPosts: React.PropTypes.bool
+ isFlaggedPosts: React.PropTypes.bool,
+ isPinnedPosts: React.PropTypes.bool,
+ channelDisplayName: React.PropTypes.string.isRequired
};
diff --git a/webapp/components/search_results_header.jsx b/webapp/components/search_results_header.jsx
index 1f2818e98..288d883ee 100644
--- a/webapp/components/search_results_header.jsx
+++ b/webapp/components/search_results_header.jsx
@@ -79,6 +79,16 @@ export default class SearchResultsHeader extends React.Component {
defaultMessage='Flagged Posts'
/>
);
+ } else if (this.props.isPinnedPosts) {
+ title = (
+ <FormattedMessage
+ id='search_header.title4'
+ defaultMessage='Pinned posts in {channelDisplayName}'
+ values={{
+ channelDisplayName: this.props.channelDisplayName
+ }}
+ />
+ );
}
return (
@@ -131,5 +141,7 @@ SearchResultsHeader.propTypes = {
isMentionSearch: React.PropTypes.bool,
toggleSize: React.PropTypes.func,
shrink: React.PropTypes.func,
- isFlaggedPosts: React.PropTypes.bool
+ isFlaggedPosts: React.PropTypes.bool,
+ isPinnedPosts: React.PropTypes.bool,
+ channelDisplayName: React.PropTypes.string.isRequired
};
diff --git a/webapp/components/search_results_item.jsx b/webapp/components/search_results_item.jsx
index b3de3492c..1c7309f51 100644
--- a/webapp/components/search_results_item.jsx
+++ b/webapp/components/search_results_item.jsx
@@ -289,6 +289,18 @@ export default class SearchResultsItem extends React.Component {
);
}
+ let pinnedBadge;
+ if (post.is_pinned) {
+ pinnedBadge = (
+ <span className='post__pinned-badge'>
+ <FormattedMessage
+ id='post_info.pinned'
+ defaultMessage='Pinned'
+ />
+ </span>
+ );
+ }
+
return (
<div className='search-item__container'>
<div className='date-separator'>
@@ -322,6 +334,7 @@ export default class SearchResultsItem extends React.Component {
{botIndicator}
<li className='col'>
{this.renderTimeTag(post)}
+ {pinnedBadge}
{flagContent}
</li>
{rhsControls}
diff --git a/webapp/components/searchable_user_list.jsx b/webapp/components/searchable_user_list.jsx
index d25c8a506..ab3f9ee9b 100644
--- a/webapp/components/searchable_user_list.jsx
+++ b/webapp/components/searchable_user_list.jsx
@@ -19,6 +19,7 @@ export default class SearchableUserList extends React.Component {
this.nextPage = this.nextPage.bind(this);
this.previousPage = this.previousPage.bind(this);
this.doSearch = this.doSearch.bind(this);
+ this.focusSearchBar = this.focusSearchBar.bind(this);
this.nextTimeoutId = 0;
@@ -30,15 +31,14 @@ export default class SearchableUserList extends React.Component {
}
componentDidMount() {
- if (this.props.focusOnMount) {
- this.refs.filter.focus();
- }
+ this.focusSearchBar();
}
componentDidUpdate(prevProps, prevState) {
if (this.state.page !== prevState.page) {
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
}
+ this.focusSearchBar();
}
componentWillUnmount() {
@@ -57,6 +57,12 @@ export default class SearchableUserList extends React.Component {
this.setState({page: this.state.page - 1});
}
+ focusSearchBar() {
+ if (this.props.focusOnMount) {
+ this.refs.filter.focus();
+ }
+ }
+
doSearch() {
const term = this.refs.filter.value;
this.props.search(term);
diff --git a/webapp/components/setting_item_max.jsx b/webapp/components/setting_item_max.jsx
index 5b6a5d53a..9f3c4f0cf 100644
--- a/webapp/components/setting_item_max.jsx
+++ b/webapp/components/setting_item_max.jsx
@@ -31,12 +31,30 @@ export default class SettingItemMax extends React.Component {
render() {
var clientError = null;
if (this.props.client_error) {
- clientError = (<div className='form-group'><label className='col-sm-12 has-error'>{this.props.client_error}</label></div>);
+ clientError = (
+ <div className='form-group'>
+ <label
+ id='clientError'
+ className='col-sm-12 has-error'
+ >
+ {this.props.client_error}
+ </label>
+ </div>
+ );
}
var serverError = null;
if (this.props.server_error) {
- serverError = (<div className='form-group'><label className='col-sm-12 has-error'>{this.props.server_error}</label></div>);
+ serverError = (
+ <div className='form-group'>
+ <label
+ id='serverError'
+ className='col-sm-12 has-error'
+ >
+ {this.props.server_error}
+ </label>
+ </div>
+ );
}
var extraInfo = null;
@@ -48,6 +66,7 @@ export default class SettingItemMax extends React.Component {
if (this.props.submit) {
submit = (
<input
+ id='saveSetting'
type='submit'
className='btn btn-sm btn-primary'
href='#'
@@ -88,6 +107,7 @@ export default class SettingItemMax extends React.Component {
{clientError}
{submit}
<a
+ id={this.props.title + 'Cancel'}
className='btn btn-sm'
href='#'
onClick={this.props.updateSection}
diff --git a/webapp/components/setting_item_min.jsx b/webapp/components/setting_item_min.jsx
index 96d8bf459..4f756c46e 100644
--- a/webapp/components/setting_item_min.jsx
+++ b/webapp/components/setting_item_min.jsx
@@ -12,6 +12,7 @@ export default class SettingItemMin extends React.Component {
editButton = (
<li className='col-xs-12 col-sm-3 section-edit'>
<a
+ id={this.props.title}
className='theme'
href='#'
onClick={this.props.updateSection}
@@ -33,7 +34,12 @@ export default class SettingItemMin extends React.Component {
>
<li className='col-xs-12 col-sm-9 section-title'>{this.props.title}</li>
{editButton}
- <li className='col-xs-12 section-describe'>{this.props.describe}</li>
+ <li
+ id={this.props.title + 'Desc'}
+ className='col-xs-12 section-describe'
+ >
+ {this.props.describe}
+ </li>
</ul>
);
}
diff --git a/webapp/components/setting_picture.jsx b/webapp/components/setting_picture.jsx
index b74ee8eb7..45ac4096d 100644
--- a/webapp/components/setting_picture.jsx
+++ b/webapp/components/setting_picture.jsx
@@ -1,8 +1,6 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import $ from 'jquery';
-import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl';
import loadingGif from 'images/load.gif';
@@ -14,17 +12,35 @@ export default class SettingPicture extends React.Component {
super(props);
this.setPicture = this.setPicture.bind(this);
+ this.confirmImage = this.confirmImage.bind(this);
}
setPicture(file) {
if (file) {
var reader = new FileReader();
- var img = ReactDOM.findDOMNode(this.refs.image);
- reader.onload = function load(e) {
- $(img).attr('src', e.target.result);
- };
+ reader.onload = (e) => {
+ const canvas = this.refs.profileImageCanvas;
+ const context = canvas.getContext('2d');
+ const imageObj = new Image();
+ imageObj.onload = () => {
+ if (imageObj.width > imageObj.height) {
+ const side = imageObj.height;
+ const rem = imageObj.width - side;
+ const startX = parseInt(rem / 2, 10);
+ context.drawImage(imageObj, startX, 0, side, side,
+ 0, 0, canvas.width, canvas.height);
+ } else {
+ const side = imageObj.width;
+ const rem = imageObj.height - side;
+ const startY = parseInt(rem / 2, 10);
+ context.drawImage(imageObj, 0, startY, side, side,
+ 0, 0, canvas.width, canvas.height);
+ }
+ };
+ imageObj.src = e.target.result;
+ };
reader.readAsDataURL(file);
}
}
@@ -48,10 +64,11 @@ export default class SettingPicture extends React.Component {
var img = null;
if (this.props.picture) {
img = (
- <img
- ref='image'
- className='profile-img rounded'
- src=''
+ <canvas
+ ref='profileImageCanvas'
+ className='profile-img'
+ width='256px'
+ height='256px'
/>
);
} else {
@@ -83,7 +100,7 @@ export default class SettingPicture extends React.Component {
confirmButton = (
<a
className={confirmButtonClass}
- onClick={this.props.submit}
+ onClick={this.confirmImage}
>
<FormattedMessage
id='setting_picture.save'
@@ -147,6 +164,16 @@ export default class SettingPicture extends React.Component {
</ul>
);
}
+
+ confirmImage(e) {
+ e.persist();
+ this.refs.profileImageCanvas.toBlob((blob) => {
+ blob.lastModifiedDate = new Date();
+ blob.name = 'image.jpg';
+ this.props.imageCropChange(blob);
+ this.props.submit(e);
+ }, 'image/jpeg', 0.95);
+ }
}
SettingPicture.propTypes = {
@@ -158,5 +185,6 @@ SettingPicture.propTypes = {
submitActive: React.PropTypes.bool,
submit: React.PropTypes.func,
title: React.PropTypes.string,
- pictureChange: React.PropTypes.func
+ pictureChange: React.PropTypes.func,
+ imageCropChange: React.PropTypes.func
};
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 08d80d363..b9356c5a1 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -636,13 +636,15 @@ export default class Sidebar extends React.Component {
this.lastUnreadChannel = null;
// create elements for all 4 types of channels
- const favoriteItems = this.state.favoriteChannels.map((channel, index, arr) => {
- if (channel.type === Constants.DM_CHANNEL) {
- return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
- }
+ const favoriteItems = this.state.favoriteChannels.
+ sort(Utils.sortTeamsByDisplayName).
+ map((channel, index, arr) => {
+ if (channel.type === Constants.DM_CHANNEL) {
+ return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
+ }
- return this.createChannelElement(channel);
- });
+ return this.createChannelElement(channel);
+ });
const publicChannelItems = this.state.publicChannels.map(this.createChannelElement);
diff --git a/webapp/components/sidebar_header_dropdown.jsx b/webapp/components/sidebar_header_dropdown.jsx
index 484ca3298..34c228ac2 100644
--- a/webapp/components/sidebar_header_dropdown.jsx
+++ b/webapp/components/sidebar_header_dropdown.jsx
@@ -467,6 +467,7 @@ export default class SidebarHeaderDropdown extends React.Component {
<Dropdown.Menu>
<li>
<a
+ id='accountSettings'
href='#'
onClick={this.toggleAccountSettingsModal}
>
@@ -480,6 +481,7 @@ export default class SidebarHeaderDropdown extends React.Component {
{teamLink}
<li>
<a
+ id='logout'
href='#'
onClick={() => GlobalActions.emitUserLoggedOutEvent()}
>
diff --git a/webapp/components/sidebar_right.jsx b/webapp/components/sidebar_right.jsx
index fb120337a..42b7381f4 100644
--- a/webapp/components/sidebar_right.jsx
+++ b/webapp/components/sidebar_right.jsx
@@ -11,13 +11,13 @@ import UserStore from 'stores/user_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import WebrtcStore from 'stores/webrtc_store.jsx';
-import {getFlaggedPosts} from 'actions/post_actions.jsx';
+import {getFlaggedPosts, getPinnedPosts} from 'actions/post_actions.jsx';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
-import React from 'react';
+import React, {PropTypes} from 'react';
export default class SidebarRight extends React.Component {
constructor(props) {
@@ -27,6 +27,7 @@ export default class SidebarRight extends React.Component {
this.onPreferenceChange = this.onPreferenceChange.bind(this);
this.onSelectedChange = this.onSelectedChange.bind(this);
+ this.onPostPinnedChange = this.onPostPinnedChange.bind(this);
this.onSearchChange = this.onSearchChange.bind(this);
this.onUserChange = this.onUserChange.bind(this);
this.onShowSearch = this.onShowSearch.bind(this);
@@ -39,6 +40,7 @@ export default class SidebarRight extends React.Component {
searchVisible: SearchStore.getSearchResults() !== null,
isMentionSearch: SearchStore.getIsMentionSearch(),
isFlaggedPosts: SearchStore.getIsFlaggedPosts(),
+ isPinnedPosts: SearchStore.getIsPinnedPosts(),
postRightVisible: Boolean(PostStore.getSelectedPost()),
expanded: false,
fromSearch: false,
@@ -50,6 +52,7 @@ export default class SidebarRight extends React.Component {
componentDidMount() {
SearchStore.addSearchChangeListener(this.onSearchChange);
PostStore.addSelectedPostChangeListener(this.onSelectedChange);
+ PostStore.addPostPinnedChangeListener(this.onPostPinnedChange);
SearchStore.addShowSearchListener(this.onShowSearch);
UserStore.addChangeListener(this.onUserChange);
PreferenceStore.addChangeListener(this.onPreferenceChange);
@@ -59,6 +62,7 @@ export default class SidebarRight extends React.Component {
componentWillUnmount() {
SearchStore.removeSearchChangeListener(this.onSearchChange);
PostStore.removeSelectedPostChangeListener(this.onSelectedChange);
+ PostStore.removePostPinnedChangeListener(this.onPostPinnedChange);
SearchStore.removeShowSearchListener(this.onShowSearch);
UserStore.removeChangeListener(this.onUserChange);
PreferenceStore.removeChangeListener(this.onPreferenceChange);
@@ -137,6 +141,12 @@ export default class SidebarRight extends React.Component {
});
}
+ onPostPinnedChange() {
+ if (this.props.channel && this.state.isPinnedPosts) {
+ getPinnedPosts(this.props.channel.id);
+ }
+ }
+
onShrink() {
this.setState({
expanded: false
@@ -147,7 +157,8 @@ export default class SidebarRight extends React.Component {
this.setState({
searchVisible: SearchStore.getSearchResults() !== null,
isMentionSearch: SearchStore.getIsMentionSearch(),
- isFlaggedPosts: SearchStore.getIsFlaggedPosts()
+ isFlaggedPosts: SearchStore.getIsFlaggedPosts(),
+ isPinnedPosts: SearchStore.getIsPinnedPosts()
});
}
@@ -182,9 +193,11 @@ export default class SidebarRight extends React.Component {
<SearchResults
isMentionSearch={this.state.isMentionSearch}
isFlaggedPosts={this.state.isFlaggedPosts}
+ isPinnedPosts={this.state.isPinnedPosts}
useMilitaryTime={this.state.useMilitaryTime}
toggleSize={this.toggleSize}
shrink={this.onShrink}
+ channelDisplayName={this.props.channel ? this.props.channel.display_name : ''}
/>
);
} else if (this.state.postRightVisible) {
@@ -222,3 +235,7 @@ export default class SidebarRight extends React.Component {
);
}
}
+
+SidebarRight.propTypes = {
+ channel: PropTypes.object
+};
diff --git a/webapp/components/team_general_tab.jsx b/webapp/components/team_general_tab.jsx
index 0100cad64..bc6c70e7f 100644
--- a/webapp/components/team_general_tab.jsx
+++ b/webapp/components/team_general_tab.jsx
@@ -106,14 +106,11 @@ class GeneralTab extends React.Component {
let valid = true;
const name = this.state.name.trim();
- if (!name) {
+ if (name) {
+ state.clientError = '';
+ } else {
state.clientError = Utils.localizeMessage('general_tab.required', 'This field is required');
valid = false;
- } else if (name === this.props.team.display_name) {
- state.clientError = Utils.localizeMessage('general_tab.chooseName', 'Please choose a new name for your team');
- valid = false;
- } else {
- state.clientError = '';
}
this.setState(state);
diff --git a/webapp/components/user_settings/desktop_notification_settings.jsx b/webapp/components/user_settings/desktop_notification_settings.jsx
index 3a330b623..be403ebb6 100644
--- a/webapp/components/user_settings/desktop_notification_settings.jsx
+++ b/webapp/components/user_settings/desktop_notification_settings.jsx
@@ -74,6 +74,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundOn'
type='radio'
name='notificationSounds'
checked={soundRadio[0]}
@@ -89,6 +90,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundOff'
type='radio'
name='notificationSounds'
checked={soundRadio[1]}
@@ -136,6 +138,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundDuration3'
type='radio'
name='desktopDuration'
checked={durationRadio[0]}
@@ -154,6 +157,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundDuration5'
type='radio'
name='desktopDuration'
checked={durationRadio[1]}
@@ -172,6 +176,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundDuration10'
type='radio'
name='desktopDuration'
checked={durationRadio[2]}
@@ -189,6 +194,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='soundDurationUnlimited'
type='radio'
name='desktopDuration'
checked={durationRadio[3]}
@@ -225,6 +231,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='desktopNotificationAllActivity'
type='radio'
name='desktopNotificationLevel'
checked={activityRadio[0]}
@@ -240,6 +247,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='desktopNotificationMentions'
type='radio'
name='desktopNotificationLevel'
checked={activityRadio[1]}
@@ -255,6 +263,7 @@ export default class DesktopNotificationSettings extends React.Component {
<div className='radio'>
<label>
<input
+ id='desktopNotificationNever'
type='radio'
name='desktopNotificationLevel'
checked={activityRadio[2]}
diff --git a/webapp/components/user_settings/email_notification_setting.jsx b/webapp/components/user_settings/email_notification_setting.jsx
index 457512507..1e6c5d7f5 100644
--- a/webapp/components/user_settings/email_notification_setting.jsx
+++ b/webapp/components/user_settings/email_notification_setting.jsx
@@ -113,6 +113,7 @@ export default class EmailNotificationSetting extends React.Component {
<div className='radio'>
<label>
<input
+ id='emailNotificationMinutes'
type='radio'
name='emailNotifications'
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_FIFTEEN_MINUTES}
@@ -128,6 +129,7 @@ export default class EmailNotificationSetting extends React.Component {
<div className='radio'>
<label>
<input
+ id='emailNotificationHour'
type='radio'
name='emailNotifications'
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_HOUR}
@@ -164,6 +166,7 @@ export default class EmailNotificationSetting extends React.Component {
<div className='radio'>
<label>
<input
+ id='emailNotificationImmediately'
type='radio'
name='emailNotifications'
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_IMMEDIATE}
@@ -179,6 +182,7 @@ export default class EmailNotificationSetting extends React.Component {
<div className='radio'>
<label>
<input
+ id='emailNotificationNever'
type='radio'
name='emailNotifications'
checked={!this.props.enableEmail}
diff --git a/webapp/components/user_settings/user_settings_general.jsx b/webapp/components/user_settings/user_settings_general.jsx
index f9c624aa0..d558958f0 100644
--- a/webapp/components/user_settings/user_settings_general.jsx
+++ b/webapp/components/user_settings/user_settings_general.jsx
@@ -101,6 +101,7 @@ class UserSettingsGeneralTab extends React.Component {
this.updatePicture = this.updatePicture.bind(this);
this.updateSection = this.updateSection.bind(this);
this.updatePosition = this.updatePosition.bind(this);
+ this.updatedCroppedPicture = this.updatedCroppedPicture.bind(this);
this.state = this.setupInitialState(props);
}
@@ -311,6 +312,17 @@ class UserSettingsGeneralTab extends React.Component {
this.setState({confirmEmail: e.target.value});
}
+ updatedCroppedPicture(file) {
+ if (file) {
+ this.setState({picture: file});
+
+ this.submitActive = true;
+ this.setState({clientError: null});
+ } else {
+ this.setState({picture: null});
+ }
+ }
+
updatePicture(e) {
if (e.target.files && e.target.files[0]) {
this.setState({picture: e.target.files[0]});
@@ -410,6 +422,7 @@ class UserSettingsGeneralTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='primaryEmail'
className='form-control'
type='email'
onChange={this.updateEmail}
@@ -431,6 +444,7 @@ class UserSettingsGeneralTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='confirmEmail'
className='form-control'
type='email'
onChange={this.updateConfirmEmail}
@@ -684,6 +698,7 @@ class UserSettingsGeneralTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='firstName'
className='form-control'
type='text'
onChange={this.updateFirstName}
@@ -706,6 +721,7 @@ class UserSettingsGeneralTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='lastName'
className='form-control'
type='text'
onChange={this.updateLastName}
@@ -832,6 +848,7 @@ class UserSettingsGeneralTab extends React.Component {
<label className='col-sm-5 control-label'>{nicknameLabel}</label>
<div className='col-sm-7'>
<input
+ id='nickname'
className='form-control'
type='text'
onChange={this.updateNickname}
@@ -916,6 +933,7 @@ class UserSettingsGeneralTab extends React.Component {
<label className='col-sm-5 control-label'>{usernameLabel}</label>
<div className='col-sm-7'>
<input
+ id='username'
maxLength={Constants.MAX_USERNAME_LENGTH}
className='form-control'
type='text'
@@ -1006,6 +1024,7 @@ class UserSettingsGeneralTab extends React.Component {
<label className='col-sm-5 control-label'>{positionLabel}</label>
<div className='col-sm-7'>
<input
+ id='position'
className='form-control'
type='text'
onChange={this.updatePosition}
@@ -1086,6 +1105,7 @@ class UserSettingsGeneralTab extends React.Component {
pictureChange={this.updatePicture}
submitActive={this.submitActive}
loadingPicture={this.state.loadingPicture}
+ imageCropChange={this.updatedCroppedPicture}
/>
);
} else {
@@ -1123,6 +1143,7 @@ class UserSettingsGeneralTab extends React.Component {
<div>
<div className='modal-header'>
<button
+ id='closeUserSettings'
type='button'
className='close'
data-dismiss='modal'
diff --git a/webapp/components/user_settings/user_settings_notifications.jsx b/webapp/components/user_settings/user_settings_notifications.jsx
index 7c82488f6..ebd43e5af 100644
--- a/webapp/components/user_settings/user_settings_notifications.jsx
+++ b/webapp/components/user_settings/user_settings_notifications.jsx
@@ -64,6 +64,9 @@ function getNotificationsStateFromStores() {
} else {
usernameKey = true;
keys.splice(keys.indexOf(user.username), 1);
+ if (keys.indexOf(`@${user.username}`) !== -1) {
+ keys.splice(keys.indexOf(`@${user.username}`), 1);
+ }
}
customKeys = keys.join(',');
@@ -281,6 +284,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationOnline'
type='radio'
name='pushNotificationStatus'
checked={pushStatusRadio[0]}
@@ -296,6 +300,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationAway'
type='radio'
name='pushNotificationStatus'
checked={pushStatusRadio[1]}
@@ -311,6 +316,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationOffline'
type='radio'
name='pushNotificationStatus'
checked={pushStatusRadio[2]}
@@ -347,6 +353,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationAllActivity'
type='radio'
name='pushNotificationLevel'
checked={pushActivityRadio[0]}
@@ -362,6 +369,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationMentions'
type='radio'
name='pushNotificationLevel'
checked={pushActivityRadio[1]}
@@ -377,6 +385,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='pushNotificationNever'
type='radio'
name='pushNotificationLevel'
checked={pushActivityRadio[2]}
@@ -520,6 +529,7 @@ export default class NotificationsTab extends React.Component {
<div className='checkbox'>
<label>
<input
+ id='notificationTriggerFirst'
type='checkbox'
checked={this.state.firstNameKey}
onChange={handleUpdateFirstNameKey}
@@ -545,6 +555,7 @@ export default class NotificationsTab extends React.Component {
<div className='checkbox'>
<label>
<input
+ id='notificationTriggerUsername'
type='checkbox'
checked={this.state.usernameKey}
onChange={handleUpdateUsernameKey}
@@ -569,6 +580,7 @@ export default class NotificationsTab extends React.Component {
<div className='checkbox'>
<label>
<input
+ id='notificationTriggerShouts'
type='checkbox'
checked={this.state.channelKey}
onChange={handleUpdateChannelKey}
@@ -587,6 +599,7 @@ export default class NotificationsTab extends React.Component {
<div className='checkbox'>
<label>
<input
+ id='notificationTriggerCustom'
ref='customcheck'
type='checkbox'
checked={this.state.customKeysChecked}
@@ -599,6 +612,7 @@ export default class NotificationsTab extends React.Component {
</label>
</div>
<input
+ id='notificationTriggerCustomText'
ref='custommentions'
className='form-control mentions-input'
type='text'
@@ -697,6 +711,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='notificationCommentsAny'
type='radio'
name='commentsNotificationLevel'
checked={commentsActive[0]}
@@ -712,6 +727,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='notificationCommentsRoot'
type='radio'
name='commentsNotificationLevel'
checked={commentsActive[1]}
@@ -727,6 +743,7 @@ export default class NotificationsTab extends React.Component {
<div className='radio'>
<label>
<input
+ id='notificationCommentsNever'
type='radio'
name='commentsNotificationLevel'
checked={commentsActive[2]}
@@ -804,6 +821,7 @@ export default class NotificationsTab extends React.Component {
<div>
<div className='modal-header'>
<button
+ id='closeButton'
type='button'
className='close'
data-dismiss='modal'
diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx
index b6ee2d915..9ca7f4b62 100644
--- a/webapp/components/user_settings/user_settings_security.jsx
+++ b/webapp/components/user_settings/user_settings_security.jsx
@@ -331,6 +331,7 @@ export default class SecurityTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='currentPassword'
className='form-control'
type='password'
onChange={this.updateCurrentPassword}
@@ -352,6 +353,7 @@ export default class SecurityTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='newPassword'
className='form-control'
type='password'
onChange={this.updateNewPassword}
@@ -373,6 +375,7 @@ export default class SecurityTab extends React.Component {
</label>
<div className='col-sm-7'>
<input
+ id='confirmPassword'
className='form-control'
type='password'
onChange={this.updateConfirmPassword}
diff --git a/webapp/components/view_image.jsx b/webapp/components/view_image.jsx
index 385138d54..e5c3caa0a 100644
--- a/webapp/components/view_image.jsx
+++ b/webapp/components/view_image.jsx
@@ -185,7 +185,6 @@ export default class ViewImageModal extends React.Component {
<ImagePreview
fileInfo={fileInfo}
fileUrl={fileUrl}
- maxHeight={this.state.imgHeight}
/>
);
} else if (fileType === 'video' || fileType === 'audio') {
@@ -193,7 +192,6 @@ export default class ViewImageModal extends React.Component {
<AudioVideoPreview
fileInfo={fileInfo}
fileUrl={fileUrl}
- maxHeight={this.state.imgHeight}
/>
);
} else if (PDFPreview.supports(fileInfo)) {
@@ -344,7 +342,7 @@ LoadingImagePreview.propTypes = {
loading: React.PropTypes.string
};
-function ImagePreview({fileInfo, fileUrl, maxHeight}) {
+function ImagePreview({fileInfo, fileUrl}) {
let previewUrl;
if (fileInfo.has_preview_image) {
previewUrl = FileStore.getFilePreviewUrl(fileInfo.id);
@@ -359,16 +357,12 @@ function ImagePreview({fileInfo, fileUrl, maxHeight}) {
rel='noopener noreferrer'
download={true}
>
- <img
- style={{maxHeight}}
- src={previewUrl}
- />
+ <img src={previewUrl}/>
</a>
);
}
ImagePreview.propTypes = {
fileInfo: React.PropTypes.object.isRequired,
- fileUrl: React.PropTypes.string.isRequired,
- maxHeight: React.PropTypes.number.isRequired
+ fileUrl: React.PropTypes.string.isRequired
};
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 3ef467937..bc30b53e7 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -1118,7 +1118,7 @@
"channel_modal.channel": "Channel",
"channel_modal.createNew": "Create New ",
"channel_modal.descriptionHelp": "Describe how this {term} should be used.",
- "channel_modal.displayNameError": "This field is required",
+ "channel_modal.displayNameError": "Channel name must be 2 or more characters",
"channel_modal.edit": "Edit",
"channel_modal.group": "Group",
"channel_modal.header": "Header",
@@ -1208,7 +1208,6 @@
"create_post.tutorialTip": "<h4>Sending Messages</h4><p>Type here to write a message and press <strong>ENTER</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>",
"create_post.write": "Write a message...",
"create_team.agreement": "By proceeding to create your account and use {siteName}, you agree to our <a href={TermsOfServiceLink}>Terms of Service</a> and <a href={PrivacyPolicyLink}>Privacy Policy</a>. If you do not agree, you cannot use {siteName}.",
- "create_team.display_name.back": "Back to previous step",
"create_team.display_name.charLength": "Name must be {min} or more characters up to a maximum of {max}. You can add a longer team description later.",
"create_team.display_name.nameHelp": "Name your team in any language. Your team name shows in menus and headings.",
"create_team.display_name.next": "Next",
@@ -1324,7 +1323,6 @@
"flag_post.flag": "Flag for follow up",
"flag_post.unflag": "Unflag",
"general_tab.chooseDescription": "Please choose a new description for your team",
- "general_tab.chooseName": "Please choose a new name for your team",
"general_tab.codeDesc": "Click 'Edit' to regenerate Invite Code.",
"general_tab.codeLongDesc": "The Invite Code is used as part of the URL in the team invitation link created by {getTeamInviteLink} in the main menu. Regenerating creates a new team invitation link and invalidates the previous link.",
"general_tab.codeTitle": "Invite Code",
@@ -1665,6 +1663,7 @@
"navbar.toggle1": "Toggle sidebar",
"navbar.toggle2": "Toggle sidebar",
"navbar.viewInfo": "View Info",
+ "navbar.viewPinnedPosts": "View Pinned Posts",
"navbar_dropdown.about": "About Mattermost",
"navbar_dropdown.accountSettings": "Account Settings",
"navbar_dropdown.console": "System Console",
@@ -1721,6 +1720,9 @@
"post_info.permalink": "Permalink",
"post_info.reply": "Reply",
"post_info.system": "System",
+ "post_info.pin": "Pin to channel",
+ "post_info.unpin": "Un-pin from channel",
+ "post_info.pinned": "Pinned",
"post_message_view.edited": "(edited)",
"posts_view.loadMore": "Load more messages",
"posts_view.newMsg": "New Messages",
@@ -1773,11 +1775,14 @@
"rhs_root.mobile.flag": "Flag",
"rhs_root.mobile.unflag": "Unflag",
"rhs_root.permalink": "Permalink",
+ "rhs_root.pin": "Pin to channel",
+ "rhs_root.unpin": "Un-pin from channel",
"search_bar.search": "Search",
"search_bar.usage": "<h4>Search Options</h4><ul><li><span>Use </span><b>\"quotation marks\"</b><span> to search for phrases</span></li><li><span>Use </span><b>from:</b><span> to find posts from specific users and </span><b>in:</b><span> to find posts in specific channels</span></li></ul>",
"search_header.results": "Search Results",
"search_header.title2": "Recent Mentions",
"search_header.title3": "Flagged Posts",
+ "search_header.title4": "Pinned posts in {channelDisplayName}",
"search_item.direct": "Direct Message (with {username})",
"search_item.jump": "Jump",
"search_results.because": "<ul><li>If you're searching a partial phrase (ex. searching \"rea\", looking for \"reach\" or \"reaction\"), append a * to your search term.</li><li>Two letter searches and common words like \"this\", \"a\" and \"is\" won't appear in search results due to excessive results returned.</li></ul>",
@@ -1787,6 +1792,9 @@
"search_results.usageFlag2": "You can add a flag to messages and comments by clicking the ",
"search_results.usageFlag3": " icon next to the timestamp.",
"search_results.usageFlag4": "Flags are a way to mark messages for follow up. Your flags are personal, and cannot be seen by other users.",
+ "search_results.usagePin1": "There are no pinned messages yet.",
+ "search_results.usagePin2": "You can pin a message by clicking the \"Pin to channel\" option from the message's menu.",
+ "search_results.usagePin3": "Pinned messages are accessible by all channel members and are a way to mark messages for future reference.",
"setting_item_max.cancel": "Cancel",
"setting_item_max.save": "Save",
"setting_item_min.edit": "Edit",
@@ -2238,6 +2246,8 @@
"user.settings.security.switchSaml": "Switch to using SAML SSO",
"user.settings.security.title": "Security Settings",
"user.settings.security.viewHistory": "View Access History",
+ "user.settings.security.active": "Active",
+ "user.settings.security.inactive": "Inactive",
"user_list.notFound": "No users found",
"user_profile.send.dm": "Send Message",
"user_profile.webrtc.call": "Start Video Call",
diff --git a/webapp/package.json b/webapp/package.json
index 216292f34..f0b1b8bb2 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -4,15 +4,15 @@
"version": "0.0.1",
"private": true,
"dependencies": {
- "autolinker": "1.4.0",
+ "autolinker": "1.4.2",
"bootstrap": "3.3.7",
- "bootstrap-colorpicker": "2.3.6",
- "chart.js": "2.4.0",
+ "bootstrap-colorpicker": "2.5.1",
+ "chart.js": "2.5.0",
"compass-mixins": "0.12.10",
"fastclick": "1.0.6",
"flux": "3.1.2",
"font-awesome": "4.7.0",
- "highlight.js": "9.9.0",
+ "highlight.js": "9.10.0",
"inobounce": "0.1.4",
"intl": "1.2.5",
"jasny-bootstrap": "3.1.3",
@@ -20,45 +20,45 @@
"marked": "mattermost/marked#8f5902fff9bad793cd6c66e0c44002c9e79e1317",
"match-at": "0.1.0",
"object-assign": "4.1.1",
- "pdfjs-dist": "1.7.235",
+ "pdfjs-dist": "1.7.363",
"perfect-scrollbar": "0.6.16",
"react": "15.4.2",
"react-addons-pure-render-mixin": "15.4.2",
- "react-bootstrap": "0.30.7",
- "react-custom-scrollbars": "4.0.1",
+ "react-bootstrap": "0.30.8",
+ "react-custom-scrollbars": "4.0.2",
"react-dom": "15.4.2",
"react-intl": "2.2.3",
"react-router": "2.8.1",
- "react-select": "1.0.0-rc.2",
- "superagent": "3.4.1",
- "twemoji": "2.2.3",
- "velocity-animate": "1.4.2",
- "webrtc-adapter": "3.1.0",
+ "react-select": "1.0.0-rc.3",
+ "superagent": "3.5.0",
+ "twemoji": "2.2.5",
+ "velocity-animate": "1.4.3",
+ "webrtc-adapter": "3.2.0",
"xregexp": "3.1.1"
},
"devDependencies": {
- "babel-core": "6.22.1",
- "babel-eslint": "7.1.0",
- "babel-loader": "6.2.10",
- "babel-plugin-transform-runtime": "6.22.0",
- "babel-polyfill": "6.22.0",
- "babel-preset-es2015": "6.22.0",
- "babel-preset-react": "6.22.0",
+ "babel-core": "6.24.0",
+ "babel-eslint": "7.1.1",
+ "babel-loader": "6.4.0",
+ "babel-plugin-transform-runtime": "6.23.0",
+ "babel-polyfill": "6.23.0",
+ "babel-preset-es2015": "6.24.0",
+ "babel-preset-react": "6.23.0",
"babel-preset-stage-0": "6.22.0",
"copy-webpack-plugin": "4.0.1",
- "cross-env": "3.1.4",
- "css-loader": "0.26.1",
- "eslint": "3.10.2",
- "eslint-plugin-react": "6.7.1",
- "exports-loader": "0.6.3",
- "extract-text-webpack-plugin": "1.0.1",
- "file-loader": "0.10.0",
- "html-loader": "0.4.4",
+ "cross-env": "3.2.3",
+ "css-loader": "0.27.3",
+ "eslint": "3.17.1",
+ "eslint-plugin-react": "6.10.0",
+ "exports-loader": "0.6.4",
+ "extract-text-webpack-plugin": "2.1.0",
+ "file-loader": "0.10.1",
+ "html-loader": "0.4.5",
"html-webpack-plugin": "2.28.0",
"image-webpack-loader": "3.2.0",
- "imports-loader": "0.7.0",
+ "imports-loader": "0.7.1",
"jquery-deferred": "0.3.1",
- "jsdom": "9.9.1",
+ "jsdom": "9.12.0",
"jsdom-global": "2.1.1",
"json-loader": "0.5.4",
"mocha": "3.2.0",
@@ -67,9 +67,9 @@
"node-sass": "4.5.0",
"raw-loader": "0.5.1",
"react-addons-test-utils": "15.4.2",
- "sass-loader": "4.1.1",
- "style-loader": "0.13.1",
- "url-loader": "0.5.7",
+ "sass-loader": "6.0.3",
+ "style-loader": "0.13.2",
+ "url-loader": "0.5.8",
"webpack": "2.2.1",
"webpack-node-externals": "1.5.4"
},
diff --git a/webapp/sass/components/_modal.scss b/webapp/sass/components/_modal.scss
index 93bd9fda4..bfc082ad3 100644
--- a/webapp/sass/components/_modal.scss
+++ b/webapp/sass/components/_modal.scss
@@ -345,7 +345,7 @@
}
img {
- max-height: 100%;
+ max-height: calc(100vh - 200px);
max-width: 100%;
}
diff --git a/webapp/sass/components/_popover.scss b/webapp/sass/components/_popover.scss
index 6b1c57725..93b567ad3 100644
--- a/webapp/sass/components/_popover.scss
+++ b/webapp/sass/components/_popover.scss
@@ -209,6 +209,15 @@
.more-modal__row {
min-height: inherit;
}
+
+ .more-modal__details {
+ line-height: 32px;
+ }
+
+ .more-modal__actions {
+ line-height: 31px;
+ margin: 0;
+ }
}
.popover-content {
diff --git a/webapp/sass/components/_tooltip.scss b/webapp/sass/components/_tooltip.scss
index 0049fe1b8..6953dad58 100644
--- a/webapp/sass/components/_tooltip.scss
+++ b/webapp/sass/components/_tooltip.scss
@@ -7,6 +7,12 @@
padding: 3px 10px 4px;
word-break: break-word;
}
+
+ &.text-nowrap {
+ .tooltip-inner {
+ white-space: nowrap;
+ }
+ }
}
#webrtcTooltip {
diff --git a/webapp/sass/layout/_content.scss b/webapp/sass/layout/_content.scss
index 02f063573..b6fe98eb4 100644
--- a/webapp/sass/layout/_content.scss
+++ b/webapp/sass/layout/_content.scss
@@ -9,10 +9,20 @@
.search-btns {
display: none;
}
- .header-list__members {
+ .header-list__right {
+ // the negative margin-right is used
+ // to prevent the icons in the header from
+ // moving to the left when the RHS is open
+ //
+ // the below z-index is used to ensure the icons
+ // stays on the top and don't get hidden by the
+ // search's input block
+ position: relative;
+ z-index: 6;
+
margin-right: -18px;
- float: right;
padding-right: 0px !important;
+ float: right;
}
}
@@ -23,10 +33,20 @@
.search-btns {
display: none;
}
- .header-list__members {
+ .header-list__right {
+ // the negative margin-right is used
+ // to prevent the icons in the header from
+ // moving to the left when the RHS is open
+ //
+ // the below z-index is used to ensure the icons
+ // stays on the top and don't get hidden by the
+ // search's input block
+ position: relative;
+ z-index: 6;
+
margin-right: -18px;
- float: right;
padding-right: 0px !important;
+ float: right
}
}
}
diff --git a/webapp/sass/layout/_forms.scss b/webapp/sass/layout/_forms.scss
index 7552290d8..64c74b0a5 100644
--- a/webapp/sass/layout/_forms.scss
+++ b/webapp/sass/layout/_forms.scss
@@ -62,7 +62,6 @@
.has-error {
.help-block,
- .control-label,
.radio,
.checkbox,
.radio-inline,
@@ -70,6 +69,10 @@
color: $red;
}
+ .control-label {
+ color: inherit;
+ }
+
&.radio,
&.checkbox,
&.radio-inline,
diff --git a/webapp/sass/layout/_headers.scss b/webapp/sass/layout/_headers.scss
index 8ee6e8fdc..f8211d433 100644
--- a/webapp/sass/layout/_headers.scss
+++ b/webapp/sass/layout/_headers.scss
@@ -7,26 +7,43 @@
line-height: 56px;
width: 100%;
- .member-popover__trigger {
+ .member-popover__trigger,
+ .pinned-posts-button {
cursor: pointer;
- min-width: 60px;
- padding-right: 10px;
- text-align: right;
+ display: inline-block;
+ margin-left: 7px;
+ min-width: 30px;
+ text-align: center;
white-space: nowrap;
.fa {
font-size: 16px;
+ }
+ }
+
+ .member-popover__container,
+ .member-popover__trigger {
+ display: inline;
+ }
+
+ .member-popover__trigger {
+ .fa {
margin-left: 4px;
}
}
+ .pinned-posts-button svg {
+ position: relative;
+ top: 2px;
+ }
+
&.alt {
margin: 0;
th {
font-weight: normal !important;
- &.header-list__members {
+ &.header-list__right {
padding-right: 4px;
}
}
@@ -48,7 +65,7 @@
}
&:last-child {
- padding-right: 8px;
+ padding-right: 6px;
width: 8.9%;
}
}
diff --git a/webapp/sass/layout/_post-right.scss b/webapp/sass/layout/_post-right.scss
index 455ed7fff..9a0f658a2 100644
--- a/webapp/sass/layout/_post-right.scss
+++ b/webapp/sass/layout/_post-right.scss
@@ -53,6 +53,12 @@
border: none;
}
+ .date-separator {
+ hr {
+ border-top: 1px solid #eee;
+ }
+ }
+
.post-create__container {
width: 100%;
@@ -147,7 +153,8 @@
@include flex(1 1 auto);
overflow: auto;
position: relative;
-
+ padding-top: 10px;
+
.file-preview__container {
margin-top: 5px;
}
diff --git a/webapp/sass/layout/_post.scss b/webapp/sass/layout/_post.scss
index 5ecd50468..1e1dd4b08 100644
--- a/webapp/sass/layout/_post.scss
+++ b/webapp/sass/layout/_post.scss
@@ -359,6 +359,9 @@
}
.post-create__container {
+ label {
+ font-weight: normal;
+ }
.custom-textarea {
overflow: hidden;
}
@@ -763,6 +766,7 @@
line-height: 1.6em;
margin: 0;
white-space: pre-wrap;
+ word-break: break-word;
}
.post__header--info {
@@ -800,7 +804,7 @@
.flag-icon__container {
left: 36px;
- margin-left: 5px;
+ margin-left: 7px;
position: absolute;
top: 8px;
}
@@ -1357,15 +1361,25 @@
}
}
-.bot-indicator {
+.bot-indicator,
+.post__pinned-badge {
border-radius: 2px;
font-family: inherit;
font-size: 10px;
font-weight: 600;
- margin: 2px 10px 0 -4px;
padding: 1px 4px;
}
+.bot-indicator {
+ margin: 2px 10px 0 -4px;
+}
+
+.post__pinned-badge {
+ margin-left: 7px;
+ position: relative;
+ top: -1px;
+}
+
.permalink-text {
overflow: hidden;
}
diff --git a/webapp/sass/layout/_webhooks.scss b/webapp/sass/layout/_webhooks.scss
index f3a8c6fd3..c36edb8a2 100644
--- a/webapp/sass/layout/_webhooks.scss
+++ b/webapp/sass/layout/_webhooks.scss
@@ -41,6 +41,7 @@
&.attachment--opengraph {
max-width: 800px;
}
+
.attachment__content {
border-radius: 4px;
border-style: solid;
@@ -71,16 +72,18 @@
&.attachment__container--danger {
border-left-color: #e40303;
}
+
&.attachment__container--opengraph {
display: table;
- table-layout: fixed;
- width: 100%;
margin: 0;
padding-bottom: 13px;
+ width: 100%;
+
div {
margin: 0;
}
}
+
.sitename {
color: #A3A3A3;
}
@@ -89,8 +92,8 @@
.attachment__body__wrap {
&.attachment__body__wrap--opengraph {
display: table-cell;
- width: 100%;
vertical-align: top;
+ width: 100%;
}
}
@@ -104,6 +107,7 @@
&.attachment__body--no_thumb {
width: 100%;
}
+
&.attachment__body--opengraph {
float: none;
padding-right: 0;
@@ -142,6 +146,7 @@
margin-top: 10px;
max-height: 200px;
max-width: 400px;
+ width: 100%;
&.loading {
height: 150px;
@@ -164,16 +169,17 @@
&.has-link {
color: #2f81b7;
- text-overflow: ellipsis;
overflow: hidden;
+ text-overflow: ellipsis;
white-space: nowrap;
}
&.attachment__title--opengraph {
height: auto;
word-wrap: break-word;
+
&.is-url {
- word-break: break-all
+ word-break: break-all;
}
}
}
diff --git a/webapp/sass/responsive/_desktop.scss b/webapp/sass/responsive/_desktop.scss
index 891431f20..f671104e1 100644
--- a/webapp/sass/responsive/_desktop.scss
+++ b/webapp/sass/responsive/_desktop.scss
@@ -76,6 +76,23 @@
}
}
}
+
+ &.move--left {
+ .post {
+ &.post--root,
+ &.other--root {
+ .post__header {
+ padding-right: 70px;
+ }
+ }
+
+ &.post--comment {
+ .post__header {
+ padding-right: 70px;
+ }
+ }
+ }
+ }
}
}
diff --git a/webapp/sass/responsive/_mobile.scss b/webapp/sass/responsive/_mobile.scss
index 891b0ed48..4fbec082a 100644
--- a/webapp/sass/responsive/_mobile.scss
+++ b/webapp/sass/responsive/_mobile.scss
@@ -1,6 +1,10 @@
@charset 'UTF-8';
@media screen and (max-width: 768px) {
+ .table-responsive {
+ border: none;
+ }
+
.multi-select__container {
.btn {
display: block;
@@ -253,6 +257,7 @@
}
}
}
+
blockquote {
margin-top: 0;
}
@@ -274,6 +279,7 @@
.post__header {
margin-bottom: 0;
+ padding-right: 70px;
.col__reply {
top: -3px;
@@ -1342,7 +1348,7 @@
a {
border-bottom: 1px solid;
- line-height: 50px;
+ line-height: 45px;
position: relative;
text-align: center;
}
diff --git a/webapp/sass/responsive/_tablet.scss b/webapp/sass/responsive/_tablet.scss
index 06a725a31..3bafc38d4 100644
--- a/webapp/sass/responsive/_tablet.scss
+++ b/webapp/sass/responsive/_tablet.scss
@@ -127,6 +127,15 @@
top: auto;
}
}
+
+ &.move--left,
+ &.webrtc--show,
+ &.move--right {
+ .header-list__right {
+ // hide it behind the RHS
+ z-index: -1;
+ }
+ }
}
.post {
.attachment {
@@ -182,6 +191,14 @@
}
}
}
+
+ .sidebar--right__title {
+ display: inline-block;
+ max-width: 300px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
}
.inner-wrap {
@@ -213,6 +230,11 @@
}
}
+ .post__pinned-badge {
+ margin-left: 0;
+ margin-right: 5px;
+ }
+
&:not(.post--thread) {
padding: 5px .5em 0 77px;
@@ -359,9 +381,16 @@
}
.post__header {
+ float: left;
+ padding-top: 3px;
+
.col__reply {
top: -21px;
}
+
+ .post__pinned-badge {
+ margin-right: 5px;
+ }
}
&:not(.post--compact) {
@@ -381,6 +410,12 @@
}
}
}
+
+ &.post--comment:not(.post--compact) {
+ .post__pinned-badge {
+ margin-left: 10px;
+ }
+ }
}
}
}
diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx
index 6e312f67a..6f81619c2 100644
--- a/webapp/stores/post_store.jsx
+++ b/webapp/stores/post_store.jsx
@@ -16,6 +16,7 @@ const FOCUSED_POST_CHANGE = 'focused_post_change';
const EDIT_POST_EVENT = 'edit_post';
const POSTS_VIEW_JUMP_EVENT = 'post_list_jump';
const SELECTED_POST_CHANGE_EVENT = 'selected_post_change';
+const POST_PINNED_CHANGE_EVENT = 'post_pinned_change';
class PostStoreClass extends EventEmitter {
constructor() {
@@ -259,22 +260,42 @@ class PostStoreClass extends EventEmitter {
this.postsInfo[id].postList = combinedPosts;
}
+ focusedPostListHasPost(id) {
+ const focusedPostId = this.getFocusedPostId();
+ if (focusedPostId == null) {
+ return false;
+ }
+
+ const focusedPostList = makePostListNonNull(this.getAllPosts(focusedPostId));
+ return focusedPostList.posts.hasOwnProperty(id);
+ }
+
storePost(post, isNewPost = false) {
- const postList = makePostListNonNull(this.getAllPosts(post.channel_id));
+ const ids = [
+ post.channel_id
+ ];
- if (post.pending_post_id !== '') {
- this.removePendingPost(post.channel_id, post.pending_post_id);
+ // update the post in the permalink view if it's there
+ if (!isNewPost && this.focusedPostListHasPost(post.id)) {
+ ids.push(this.getFocusedPostId());
}
- post.pending_post_id = '';
+ ids.forEach((id) => {
+ const postList = makePostListNonNull(this.getAllPosts(id));
+ if (post.pending_post_id !== '') {
+ this.removePendingPost(post.channel_id, post.pending_post_id);
+ }
- postList.posts[post.id] = post;
- if (isNewPost && postList.order.indexOf(post.id) === -1) {
- postList.order.unshift(post.id);
- }
+ post.pending_post_id = '';
+
+ postList.posts[post.id] = post;
+ if (isNewPost && postList.order.indexOf(post.id) === -1) {
+ postList.order.unshift(post.id);
+ }
- this.makePostsInfo(post.channel_id);
- this.postsInfo[post.channel_id].postList = postList;
+ this.makePostsInfo(post.channel_id);
+ this.postsInfo[id].postList = postList;
+ });
}
storeFocusedPost(postId, channelId, postList) {
@@ -500,6 +521,18 @@ class PostStoreClass extends EventEmitter {
this.removeListener(SELECTED_POST_CHANGE_EVENT, callback);
}
+ emitPostPinnedChange() {
+ this.emit(POST_PINNED_CHANGE_EVENT);
+ }
+
+ addPostPinnedChangeListener(callback) {
+ this.on(POST_PINNED_CHANGE_EVENT, callback);
+ }
+
+ removePostPinnedChangeListener(callback) {
+ this.removeListener(POST_PINNED_CHANGE_EVENT, callback);
+ }
+
getCurrentUsersLatestPost(channelId, rootId) {
const userId = UserStore.getCurrentId();
@@ -686,6 +719,10 @@ PostStore.dispatchToken = AppDispatcher.register((payload) => {
PostStore.storeSelectedPostId(action.postId);
PostStore.emitSelectedPostChange(action.from_search, action.from_flagged_posts);
break;
+ case ActionTypes.RECEIVED_POST_PINNED:
+ case ActionTypes.RECEIVED_POST_UNPINNED:
+ PostStore.emitPostPinnedChange();
+ break;
default:
}
});
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx
index 46a086ddb..49f8b3c2f 100644
--- a/webapp/stores/search_store.jsx
+++ b/webapp/stores/search_store.jsx
@@ -19,6 +19,7 @@ class SearchStoreClass extends EventEmitter {
this.searchResults = null;
this.isMentionSearch = false;
this.isFlaggedPosts = false;
+ this.isPinnedPosts = false;
this.isVisible = false;
this.searchTerm = '';
}
@@ -83,6 +84,10 @@ class SearchStoreClass extends EventEmitter {
return this.isFlaggedPosts;
}
+ getIsPinnedPosts() {
+ return this.isPinnedPosts;
+ }
+
storeSearchTerm(term) {
this.searchTerm = term;
}
@@ -91,10 +96,11 @@ class SearchStoreClass extends EventEmitter {
return this.searchTerm;
}
- storeSearchResults(results, isMentionSearch, isFlaggedPosts) {
+ storeSearchResults(results, isMentionSearch, isFlaggedPosts, isPinnedPosts) {
this.searchResults = results;
this.isMentionSearch = isMentionSearch;
this.isFlaggedPosts = isFlaggedPosts;
+ this.isPinnedPosts = isPinnedPosts;
}
deletePost(post) {
@@ -120,7 +126,7 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
switch (action.type) {
case ActionTypes.RECEIVED_SEARCH:
- SearchStore.storeSearchResults(action.results, action.is_mention_search, action.is_flagged_posts);
+ SearchStore.storeSearchResults(action.results, action.is_mention_search, action.is_flagged_posts, action.is_pinned_posts);
SearchStore.emitSearchChange();
break;
case ActionTypes.RECEIVED_SEARCH_TERM:
diff --git a/webapp/tests/formatting_imgs.test.jsx b/webapp/tests/formatting_imgs.test.jsx
new file mode 100644
index 000000000..fac9a755f
--- /dev/null
+++ b/webapp/tests/formatting_imgs.test.jsx
@@ -0,0 +1,55 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import assert from 'assert';
+
+import * as Markdown from 'utils/markdown.jsx';
+
+describe('Markdown.Imgs', function() {
+ this.timeout(10000);
+
+ it('Inline mage', function(done) {
+ assert.equal(
+ Markdown.format('![Mattermost](/images/icon.png)').trim(),
+ '<p><img src="/images/icon.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
+ );
+
+ done();
+ });
+
+ it('Image with hover text', function(done) {
+ assert.equal(
+ Markdown.format('![Mattermost](/images/icon.png "Mattermost Icon")').trim(),
+ '<p><img src="/images/icon.png" alt="Mattermost" title="Mattermost Icon" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
+ );
+
+ done();
+ });
+
+ it('Image with link', function(done) {
+ assert.equal(
+ Markdown.format('[![Mattermost](../../images/icon-76x76.png)](https://github.com/mattermost/platform)').trim(),
+ '<p><a class="theme markdown__link" href="https://github.com/mattermost/platform" rel="noreferrer" target="_blank"><img src="../../images/icon-76x76.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></a></p>'
+ );
+
+ done();
+ });
+
+ it('Image with width and height', function(done) {
+ assert.equal(
+ Markdown.format('![Mattermost](../../images/icon-76x76.png =50x76 "Mattermost Icon")').trim(),
+ '<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" height="76" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
+ );
+
+ done();
+ });
+
+ it('Image with width', function(done) {
+ assert.equal(
+ Markdown.format('![Mattermost](../../images/icon-76x76.png =50 "Mattermost Icon")').trim(),
+ '<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
+ );
+
+ done();
+ });
+});
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index 9ba853238..1fc19b5f2 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -137,7 +137,7 @@ export function getMyChannelMembers() {
(err) => {
callTracker.getMyChannelMembers = 0;
dispatchError(err, 'getMyChannelMembers');
- reject();
+ reject(new Error('Unable to getMyChannelMembers'));
}
);
});
@@ -166,7 +166,7 @@ export function getMyChannelMembersForTeam(teamId) {
(err) => {
callTracker[`getMyChannelMembers${teamId}`] = 0;
dispatchError(err, 'getMyChannelMembersForTeam');
- reject();
+ reject(new Error('Unable to getMyChannelMembersForTeam'));
}
);
});
@@ -308,7 +308,7 @@ export function getChannelMember(channelId, userId) {
(err) => {
callTracker[`getChannelMember${channelId}${userId}`] = 0;
dispatchError(err, 'getChannelMember');
- reject();
+ reject(new Error('Unable to getChannelMeber'));
}
);
});
@@ -1612,6 +1612,40 @@ export function deleteEmoji(id) {
);
}
+export function pinPost(channelId, reaction) {
+ Client.pinPost(
+ channelId,
+ reaction,
+ () => {
+ // the "post_edited" websocket event take cares of updating the posts
+ // the action below is mostly dispatched for the RHS to update
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_POST_PINNED
+ });
+ },
+ (err) => {
+ dispatchError(err, 'pinPost');
+ }
+ );
+}
+
+export function unpinPost(channelId, reaction) {
+ Client.unpinPost(
+ channelId,
+ reaction,
+ () => {
+ // the "post_edited" websocket event take cares of updating the posts
+ // the action below is mostly dispatched for the RHS to update
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_POST_UNPINNED
+ });
+ },
+ (err) => {
+ dispatchError(err, 'unpinPost');
+ }
+ );
+}
+
export function saveReaction(channelId, reaction) {
Client.saveReaction(
channelId,
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 541fb48ec..d8fc169a3 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -90,6 +90,8 @@ export const ActionTypes = keyMirror({
RECEIVED_POST_SELECTED: null,
RECEIVED_MENTION_DATA: null,
RECEIVED_ADD_MENTION: null,
+ RECEIVED_POST_PINNED: null,
+ RECEIVED_POST_UNPINNED: null,
RECEIVED_PROFILES: null,
RECEIVED_PROFILES_IN_TEAM: null,
@@ -419,6 +421,7 @@ export const Constants = {
REPLY_ICON: "<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'viewBox='-158 242 18 18' style='enable-background:new -158 242 18 18;' xml:space='preserve'> <path d='M-142.2,252.6c-2-3-4.8-4.7-8.3-4.8v-3.3c0-0.2-0.1-0.3-0.2-0.3s-0.3,0-0.4,0.1l-6.9,6.2c-0.1,0.1-0.1,0.2-0.1,0.3 c0,0.1,0,0.2,0.1,0.3l6.9,6.4c0.1,0.1,0.3,0.1,0.4,0.1c0.1-0.1,0.2-0.2,0.2-0.4v-3.8c4.2,0,7.4,0.4,9.6,4.4c0.1,0.1,0.2,0.2,0.3,0.2 c0,0,0.1,0,0.1,0c0.2-0.1,0.3-0.3,0.2-0.4C-140.2,257.3-140.6,255-142.2,252.6z M-150.8,252.5c-0.2,0-0.4,0.2-0.4,0.4v3.3l-6-5.5 l6-5.3v2.8c0,0.2,0.2,0.4,0.4,0.4c3.3,0,6,1.5,8,4.5c0.5,0.8,0.9,1.6,1.2,2.3C-144,252.8-147.1,252.5-150.8,252.5z'/> </svg>",
SCROLL_BOTTOM_ICON: "<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'viewBox='-239 239 21 23' style='enable-background:new -239 239 21 23;' xml:space='preserve'> <path d='M-239,241.4l2.4-2.4l8.1,8.2l8.1-8.2l2.4,2.4l-10.5,10.6L-239,241.4z M-228.5,257.2l8.1-8.2l2.4,2.4l-10.5,10.6l-10.5-10.6 l2.4-2.4L-228.5,257.2z'/> </svg>",
VIDEO_ICON: "<svg width='55%'height='100%'viewBox='0 0 13 8'> <g transform='matrix(1,0,0,1,-507,-146)'> <g transform='matrix(0.0133892,0,0,0.014499,500.635,142.838)'> <path d='M1158,547.286L1158,644.276C1158,684.245 1125.55,716.694 1085.58,716.694L579.341,716.694C539.372,716.694 506.922,684.245 506.922,644.276L506.922,306.322C506.922,266.353 539.371,233.904 579.341,233.903L1085.58,233.903C1125.55,233.904 1158,266.353 1158,306.322L1158,402.939L1359.75,253.14C1365.83,248.362 1373.43,245.973 1382.56,245.973C1386.61,245.973 1390.83,246.602 1395.22,247.859C1408.4,252.134 1414.99,259.552 1414.99,270.113L1414.99,680.485C1414.99,691.046 1408.4,698.464 1395.22,702.739C1390.83,703.996 1386.61,704.624 1382.56,704.624C1373.43,704.624 1365.83,702.236 1359.75,697.458L1158,547.286Z'/> </g> </g> </svg>",
+ PIN_ICON: "<svg width='16px' height='16px' viewBox='0 0 25 25' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' clip-rule='evenodd' stroke-linejoin='round' stroke-miterlimit='1.414'><path d='M24.78 9.236L15.863.316l-1.487 4.46-4.46 4.46L8.43 7.75 3.972 9.235l4.458 4.458L.776 24.388l10.627-7.72 4.46 4.46 1.485-4.46-1.486-1.485 4.46-4.46 4.46-1.487z' fill-rule='nonzero'/></svg>",
THEMES: {
default: {
type: 'Organization',
@@ -865,6 +868,8 @@ export const Constants = {
DEFAULT_MAX_NOTIFICATIONS_PER_CHANNEL: 1000,
MAX_TEAMNAME_LENGTH: 15,
MAX_TEAMDESCRIPTION_LENGTH: 50,
+ MIN_CHANNELNAME_LENGTH: 2,
+ MAX_CHANNELNAME_LENGTH: 22,
MIN_USERNAME_LENGTH: 3,
MAX_USERNAME_LENGTH: 22,
MAX_NICKNAME_LENGTH: 22,
diff --git a/webapp/utils/markdown.jsx b/webapp/utils/markdown.jsx
index c84df0fa5..fa9c985c7 100644
--- a/webapp/utils/markdown.jsx
+++ b/webapp/utils/markdown.jsx
@@ -152,6 +152,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
out += ' height="' + dimensions[1] + '"';
}
out += ' onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"';
+ out += ' crossorigin="anonymous"';
out += this.options.xhtml ? '/>' : '>';
return out;
}
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index c860987af..b3370e88c 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -32,7 +32,7 @@ export function isMac() {
}
export function cmdOrCtrlPressed(e) {
- return (isMac() && e.metaKey) || (!isMac() && e.ctrlKey);
+ return (isMac() && e.metaKey) || (!isMac() && e.ctrlKey && !e.altKey);
}
export function isInRole(roles, inRole) {
@@ -179,7 +179,7 @@ export function displayTime(ticks, utc) {
ampm = ' PM';
}
- hours = hours % 12;
+ hours %= 12;
if (!hours) {
hours = '12';
}
@@ -591,6 +591,7 @@ export function applyTheme(theme) {
changeCss('.app__body .markdown__table tbody tr:nth-child(2n)', 'background:' + changeOpacity(theme.centerChannelColor, 0.07));
changeCss('.app__body .channel-header__info>div.dropdown .header-dropdown__icon', 'color:' + changeOpacity(theme.centerChannelColor, 0.8));
changeCss('.app__body .channel-header #member_popover', 'color:' + changeOpacity(theme.centerChannelColor, 0.8));
+ changeCss('.app__body .channel-header #pinned-posts-button', 'fill:' + changeOpacity(theme.centerChannelColor, 0.8));
changeCss('.app__body .custom-textarea, .app__body .custom-textarea:focus, .app__body .file-preview, .app__body .post-image__details, .app__body .sidebar--right .sidebar-right__body, .app__body .markdown__table th, .app__body .markdown__table td, .app__body .suggestion-list__content, .app__body .modal .modal-content, .app__body .modal .settings-modal .settings-table .settings-content .divider-light, .app__body .webhooks__container, .app__body .dropdown-menu, .app__body .modal .modal-header, .app__body .popover', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2));
changeCss('.app__body .popover.bottom>.arrow', 'border-bottom-color:' + changeOpacity(theme.centerChannelColor, 0.25));
changeCss('.app__body .search-help-popover .search-autocomplete__divider span, .app__body .suggestion-list__divider > span', 'color:' + changeOpacity(theme.centerChannelColor, 0.7));
@@ -659,12 +660,12 @@ export function applyTheme(theme) {
}
if (theme.buttonBg) {
- changeCss('.app__body .btn.btn-primary, .app__body .tutorial__circles .circle.active', 'background:' + theme.buttonBg);
+ changeCss('.app__body .btn.btn-primary, .app__body .tutorial__circles .circle.active, .app__body .post__pinned-badge', 'background:' + theme.buttonBg);
changeCss('.app__body .btn.btn-primary:hover, .app__body .btn.btn-primary:active, .app__body .btn.btn-primary:focus', 'background:' + changeColor(theme.buttonBg, -0.25));
}
if (theme.buttonColor) {
- changeCss('.app__body .btn.btn-primary', 'color:' + theme.buttonColor);
+ changeCss('.app__body .btn.btn-primary, .app__body .post__pinned-badge', 'color:' + theme.buttonColor);
}
if (theme.mentionHighlightBg) {
@@ -1216,7 +1217,7 @@ export function isValidPassword(password) {
error = true;
}
- errorId = errorId + 'Lowercase';
+ errorId += 'Lowercase';
}
if (global.window.mm_config.PasswordRequireUppercase === 'true') {
@@ -1224,7 +1225,7 @@ export function isValidPassword(password) {
error = true;
}
- errorId = errorId + 'Uppercase';
+ errorId += 'Uppercase';
}
if (global.window.mm_config.PasswordRequireNumber === 'true') {
@@ -1232,7 +1233,7 @@ export function isValidPassword(password) {
error = true;
}
- errorId = errorId + 'Number';
+ errorId += 'Number';
}
if (global.window.mm_config.PasswordRequireSymbol === 'true') {
@@ -1240,7 +1241,7 @@ export function isValidPassword(password) {
error = true;
}
- errorId = errorId + 'Symbol';
+ errorId += 'Symbol';
}
minimumLength = global.window.mm_config.PasswordMinimumLength;
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index f1742e3ae..32c5a322a 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -65,7 +65,16 @@ var config = {
},
{
test: /\.scss$/,
- loaders: ['style-loader', 'css-loader', 'sass-loader']
+ use: [{
+ loader: 'style-loader'
+ }, {
+ loader: 'css-loader'
+ }, {
+ loader: 'sass-loader',
+ options: {
+ includePaths: ['node_modules/compass-mixins/lib']
+ }
+ }]
},
{
test: /\.css$/,
@@ -92,13 +101,6 @@ var config = {
minimize: !DEV,
debug: false
}),
- new webpack.LoaderOptionsPlugin({
- options: {
- sassLoader: {
- includePaths: ['node_modules/compass-mixins/lib']
- }
- }
- }),
new webpack.optimize.CommonsChunkPlugin({
minChunks: 2,
children: true