├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── go.mod ├── go.sum ├── main.go ├── signaling ├── gae │ ├── .gcloudignore │ ├── app.yaml │ └── main.go └── schema.go └── vendor ├── github.com ├── google │ └── uuid │ │ ├── .travis.yml │ │ ├── CONTRIBUTING.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dce.go │ │ ├── doc.go │ │ ├── hash.go │ │ ├── marshal.go │ │ ├── node.go │ │ ├── node_js.go │ │ ├── node_net.go │ │ ├── sql.go │ │ ├── time.go │ │ ├── util.go │ │ ├── uuid.go │ │ ├── version1.go │ │ └── version4.go ├── pions │ ├── dtls │ │ ├── LICENSE │ │ └── pkg │ │ │ └── dtls │ │ │ ├── alert.go │ │ │ ├── application_data.go │ │ │ ├── change_cipher_spec.go │ │ │ ├── cipher_suite.go │ │ │ ├── cipher_suite_tls_ecdhe_ecdsa_with_aes_128_gcm_sha256.go │ │ │ ├── cipher_suite_tls_ecdhe_ecdsa_with_aes_256_cbc_sha.go │ │ │ ├── cipher_suite_tls_ecdhe_rsa_with_aes_128_gcm_sha256.go │ │ │ ├── cipher_suite_tls_ecdhe_rsa_with_aes_256_cbc_sha.go │ │ │ ├── client_certificate_type.go │ │ │ ├── client_handlers.go │ │ │ ├── compression_method.go │ │ │ ├── config.go │ │ │ ├── conn.go │ │ │ ├── content.go │ │ │ ├── crypto.go │ │ │ ├── crypto_cbc.go │ │ │ ├── crypto_gcm.go │ │ │ ├── curve_type.go │ │ │ ├── errors.go │ │ │ ├── extension.go │ │ │ ├── extension_supported_elliptic_curves.go │ │ │ ├── extension_supported_point_formats.go │ │ │ ├── extension_use_srtp.go │ │ │ ├── fingerprint.go │ │ │ ├── flight.go │ │ │ ├── fragment_buffer.go │ │ │ ├── handshake.go │ │ │ ├── handshake_cache.go │ │ │ ├── handshake_header.go │ │ │ ├── handshake_message_certificate.go │ │ │ ├── handshake_message_certificate_request.go │ │ │ ├── handshake_message_certificate_verify.go │ │ │ ├── handshake_message_client_hello.go │ │ │ ├── handshake_message_client_key_exchange.go │ │ │ ├── handshake_message_finished.go │ │ │ ├── handshake_message_hello_verify_request.go │ │ │ ├── handshake_message_server_hello.go │ │ │ ├── handshake_message_server_hello_done.go │ │ │ ├── handshake_message_server_key_exchange.go │ │ │ ├── handshake_random.go │ │ │ ├── hash_algorithm.go │ │ │ ├── internal │ │ │ └── udp │ │ │ │ └── conn.go │ │ │ ├── listener.go │ │ │ ├── named_curve.go │ │ │ ├── prf.go │ │ │ ├── record_layer.go │ │ │ ├── record_layer_header.go │ │ │ ├── server_handlers.go │ │ │ ├── signature_algorithm.go │ │ │ ├── signature_hash_algorithm.go │ │ │ ├── srtp_protection_profile.go │ │ │ └── util.go │ ├── pkg │ │ ├── LICENSE.md │ │ └── stun │ │ │ ├── attr_channel_number.go │ │ │ ├── attr_data.go │ │ │ ├── attr_error_code.go │ │ │ ├── attr_even_port.go │ │ │ ├── attr_fingerprint.go │ │ │ ├── attr_ice_controlled.go │ │ │ ├── attr_ice_controlling.go │ │ │ ├── attr_lifetime.go │ │ │ ├── attr_message_integrity.go │ │ │ ├── attr_nonce.go │ │ │ ├── attr_priority.go │ │ │ ├── attr_realm.go │ │ │ ├── attr_requested_transport.go │ │ │ ├── attr_reservation_token.go │ │ │ ├── attr_software.go │ │ │ ├── attr_unknown_attributes.go │ │ │ ├── attr_use_candidate.go │ │ │ ├── attr_username.go │ │ │ ├── attr_xor_mapped_address.go │ │ │ ├── attr_xor_peer_address.go │ │ │ ├── attr_xor_relayed_address.go │ │ │ ├── attribute.go │ │ │ ├── channel_data.go │ │ │ ├── client.go │ │ │ ├── encoding.go │ │ │ ├── message.go │ │ │ ├── message_builder.go │ │ │ ├── packet.go │ │ │ ├── transport_addr.go │ │ │ └── xor_address.go │ └── webrtc │ │ ├── .codacy.yaml │ │ ├── .eslintrc.json │ │ ├── .gitignore │ │ ├── .golangci.yml │ │ ├── .travis.yml │ │ ├── CONTRIBUTING.md │ │ ├── DESIGN.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── errors.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── internal │ │ ├── datachannel │ │ │ ├── datachannel.go │ │ │ ├── message.go │ │ │ ├── message_channel_ack.go │ │ │ └── message_channel_open.go │ │ ├── mux │ │ │ ├── endpoint.go │ │ │ ├── mux.go │ │ │ └── muxfunc.go │ │ ├── network │ │ │ ├── manager.go │ │ │ ├── network.go │ │ │ └── srtp.go │ │ ├── sctp │ │ │ ├── association.go │ │ │ ├── chunk.go │ │ │ ├── chunk_abort.go │ │ │ ├── chunk_cookie_ack.go │ │ │ ├── chunk_cookie_echo.go │ │ │ ├── chunk_heartbeat.go │ │ │ ├── chunk_heartbeat_ack.go │ │ │ ├── chunk_init.go │ │ │ ├── chunk_init_ack.go │ │ │ ├── chunk_init_common.go │ │ │ ├── chunk_payload_data.go │ │ │ ├── chunk_selective_ack.go │ │ │ ├── common.go │ │ │ ├── error_cause.go │ │ │ ├── error_cause_header.go │ │ │ ├── error_cause_invalid_mandatory_parameter.go │ │ │ ├── error_cause_protocol_violation.go │ │ │ ├── error_cause_unrecognized_chunk_type.go │ │ │ ├── packet.go │ │ │ ├── param.go │ │ │ ├── param_chunk_list.go │ │ │ ├── param_forward_tsn_supported.go │ │ │ ├── param_header.go │ │ │ ├── param_heartbeat_info.go │ │ │ ├── param_random.go │ │ │ ├── param_requested_hmac_algorithm.go │ │ │ ├── param_state_cookie.go │ │ │ ├── param_supported_extensions.go │ │ │ ├── payload_queue.go │ │ │ ├── reassembly_queue.go │ │ │ ├── sctp.go │ │ │ └── stream.go │ │ ├── sdp │ │ │ ├── common_description.go │ │ │ ├── ice.go │ │ │ ├── jsep.go │ │ │ ├── marshal.go │ │ │ ├── media_description.go │ │ │ ├── session_description.go │ │ │ ├── time_description.go │ │ │ ├── unmarshal.go │ │ │ └── util.go │ │ ├── srtp │ │ │ ├── context.go │ │ │ ├── srtcp.go │ │ │ └── srtp.go │ │ └── util │ │ │ └── util.go │ │ ├── media.go │ │ ├── mediaengine.go │ │ ├── pkg │ │ ├── datachannel │ │ │ └── payload.go │ │ ├── ice │ │ │ ├── agent.go │ │ │ ├── candidate.go │ │ │ ├── candidatepair.go │ │ │ ├── candidaterelatedaddress.go │ │ │ ├── candidatetype.go │ │ │ ├── errors.go │ │ │ ├── ice.go │ │ │ ├── networktype.go │ │ │ ├── transport.go │ │ │ ├── url.go │ │ │ └── util.go │ │ ├── media │ │ │ └── media.go │ │ ├── rtcerr │ │ │ └── errors.go │ │ ├── rtcp │ │ │ ├── errors.go │ │ │ ├── fuzz.go │ │ │ ├── goodbye.go │ │ │ ├── header.go │ │ │ ├── packet.go │ │ │ ├── picture_loss_indication.go │ │ │ ├── rapid_resynchronization_request.go │ │ │ ├── raw_packet.go │ │ │ ├── reader.go │ │ │ ├── receiver_report.go │ │ │ ├── reception_report.go │ │ │ ├── sender_report.go │ │ │ ├── slice_loss_indication.go │ │ │ ├── source_description.go │ │ │ └── transport_layer_nack.go │ │ └── rtp │ │ │ ├── codecs │ │ │ ├── common.go │ │ │ ├── g722_packet.go │ │ │ ├── h264_packet.go │ │ │ ├── opus_packet.go │ │ │ └── vp8_packet.go │ │ │ ├── depacketizer.go │ │ │ ├── packet.go │ │ │ ├── packetizer.go │ │ │ └── sequencer.go │ │ ├── rtcbundlepolicy.go │ │ ├── rtccertificate.go │ │ ├── rtcconfiguration.go │ │ ├── rtcdatachannel.go │ │ ├── rtcdatachannelinit.go │ │ ├── rtcdatachannelstate.go │ │ ├── rtcdtlsfingerprint.go │ │ ├── rtcdtlstransport.go │ │ ├── rtcdtlstransportstate.go │ │ ├── rtcicecandidatetype.go │ │ ├── rtcicecomponent.go │ │ ├── rtciceconnectionstate.go │ │ ├── rtcicecredentialtype.go │ │ ├── rtcicegatheringstate.go │ │ ├── rtciceprotocol.go │ │ ├── rtcicerole.go │ │ ├── rtciceserver.go │ │ ├── rtcicetransport.go │ │ ├── rtcicetransportpolicy.go │ │ ├── rtcoauthcredential.go │ │ ├── rtcofferansweroptions.go │ │ ├── rtcpeerconnection.go │ │ ├── rtcpeerconnectionstate.go │ │ ├── rtcprioritytype.go │ │ ├── rtcrtcpmuxpolicy.go │ │ ├── rtcrtpreceiver.go │ │ ├── rtcrtpsender.go │ │ ├── rtcrtptranceiver.go │ │ ├── rtcrtptransceiverdirection.go │ │ ├── rtcsctptransport.go │ │ ├── rtcsctptransportstate.go │ │ ├── rtcsdptype.go │ │ ├── rtcsessiondescription.go │ │ └── rtcsignalingstate.go └── pkg │ └── errors │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── errors.go │ └── stack.go ├── golang.org └── x │ ├── crypto │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── curve25519 │ │ ├── const_amd64.h │ │ ├── const_amd64.s │ │ ├── cswap_amd64.s │ │ ├── curve25519.go │ │ ├── doc.go │ │ ├── freeze_amd64.s │ │ ├── ladderstep_amd64.s │ │ ├── mont25519_amd64.go │ │ ├── mul_amd64.s │ │ └── square_amd64.s │ └── net │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── bpf │ ├── asm.go │ ├── constants.go │ ├── doc.go │ ├── instructions.go │ ├── setter.go │ ├── vm.go │ └── vm_instructions.go │ ├── internal │ ├── iana │ │ ├── const.go │ │ └── gen.go │ └── socket │ │ ├── cmsghdr.go │ │ ├── cmsghdr_bsd.go │ │ ├── cmsghdr_linux_32bit.go │ │ ├── cmsghdr_linux_64bit.go │ │ ├── cmsghdr_solaris_64bit.go │ │ ├── cmsghdr_stub.go │ │ ├── defs_darwin.go │ │ ├── defs_dragonfly.go │ │ ├── defs_freebsd.go │ │ ├── defs_linux.go │ │ ├── defs_netbsd.go │ │ ├── defs_openbsd.go │ │ ├── defs_solaris.go │ │ ├── empty.s │ │ ├── error_unix.go │ │ ├── error_windows.go │ │ ├── iovec_32bit.go │ │ ├── iovec_64bit.go │ │ ├── iovec_solaris_64bit.go │ │ ├── iovec_stub.go │ │ ├── mmsghdr_stub.go │ │ ├── mmsghdr_unix.go │ │ ├── msghdr_bsd.go │ │ ├── msghdr_bsdvar.go │ │ ├── msghdr_linux.go │ │ ├── msghdr_linux_32bit.go │ │ ├── msghdr_linux_64bit.go │ │ ├── msghdr_openbsd.go │ │ ├── msghdr_solaris_64bit.go │ │ ├── msghdr_stub.go │ │ ├── rawconn.go │ │ ├── rawconn_mmsg.go │ │ ├── rawconn_msg.go │ │ ├── rawconn_nommsg.go │ │ ├── rawconn_nomsg.go │ │ ├── rawconn_stub.go │ │ ├── reflect.go │ │ ├── socket.go │ │ ├── sys.go │ │ ├── sys_bsd.go │ │ ├── sys_bsdvar.go │ │ ├── sys_darwin.go │ │ ├── sys_dragonfly.go │ │ ├── sys_go1_11_darwin.go │ │ ├── sys_go1_12_darwin.go │ │ ├── sys_linux.go │ │ ├── sys_linux_386.go │ │ ├── sys_linux_386.s │ │ ├── sys_linux_amd64.go │ │ ├── sys_linux_arm.go │ │ ├── sys_linux_arm64.go │ │ ├── sys_linux_mips.go │ │ ├── sys_linux_mips64.go │ │ ├── sys_linux_mips64le.go │ │ ├── sys_linux_mipsle.go │ │ ├── sys_linux_ppc64.go │ │ ├── sys_linux_ppc64le.go │ │ ├── sys_linux_s390x.go │ │ ├── sys_linux_s390x.s │ │ ├── sys_netbsd.go │ │ ├── sys_posix.go │ │ ├── sys_solaris.go │ │ ├── sys_solaris_amd64.s │ │ ├── sys_stub.go │ │ ├── sys_unix.go │ │ ├── sys_windows.go │ │ ├── zsys_darwin_386.go │ │ ├── zsys_darwin_amd64.go │ │ ├── zsys_darwin_arm.go │ │ ├── zsys_darwin_arm64.go │ │ ├── zsys_dragonfly_amd64.go │ │ ├── zsys_freebsd_386.go │ │ ├── zsys_freebsd_amd64.go │ │ ├── zsys_freebsd_arm.go │ │ ├── zsys_linux_386.go │ │ ├── zsys_linux_amd64.go │ │ ├── zsys_linux_arm.go │ │ ├── zsys_linux_arm64.go │ │ ├── zsys_linux_mips.go │ │ ├── zsys_linux_mips64.go │ │ ├── zsys_linux_mips64le.go │ │ ├── zsys_linux_mipsle.go │ │ ├── zsys_linux_ppc64.go │ │ ├── zsys_linux_ppc64le.go │ │ ├── zsys_linux_s390x.go │ │ ├── zsys_netbsd_386.go │ │ ├── zsys_netbsd_amd64.go │ │ ├── zsys_netbsd_arm.go │ │ ├── zsys_openbsd_386.go │ │ ├── zsys_openbsd_amd64.go │ │ ├── zsys_openbsd_arm.go │ │ └── zsys_solaris_amd64.go │ └── ipv4 │ ├── batch.go │ ├── control.go │ ├── control_bsd.go │ ├── control_pktinfo.go │ ├── control_stub.go │ ├── control_unix.go │ ├── control_windows.go │ ├── defs_darwin.go │ ├── defs_dragonfly.go │ ├── defs_freebsd.go │ ├── defs_linux.go │ ├── defs_netbsd.go │ ├── defs_openbsd.go │ ├── defs_solaris.go │ ├── dgramopt.go │ ├── doc.go │ ├── endpoint.go │ ├── gen.go │ ├── genericopt.go │ ├── header.go │ ├── helper.go │ ├── iana.go │ ├── icmp.go │ ├── icmp_linux.go │ ├── icmp_stub.go │ ├── packet.go │ ├── packet_go1_8.go │ ├── packet_go1_9.go │ ├── payload.go │ ├── payload_cmsg.go │ ├── payload_cmsg_go1_8.go │ ├── payload_cmsg_go1_9.go │ ├── payload_nocmsg.go │ ├── sockopt.go │ ├── sockopt_posix.go │ ├── sockopt_stub.go │ ├── sys_asmreq.go │ ├── sys_asmreq_stub.go │ ├── sys_asmreqn.go │ ├── sys_asmreqn_stub.go │ ├── sys_bpf.go │ ├── sys_bpf_stub.go │ ├── sys_bsd.go │ ├── sys_darwin.go │ ├── sys_dragonfly.go │ ├── sys_freebsd.go │ ├── sys_linux.go │ ├── sys_solaris.go │ ├── sys_ssmreq.go │ ├── sys_ssmreq_stub.go │ ├── sys_stub.go │ ├── sys_windows.go │ ├── zsys_darwin.go │ ├── zsys_dragonfly.go │ ├── zsys_freebsd_386.go │ ├── zsys_freebsd_amd64.go │ ├── zsys_freebsd_arm.go │ ├── zsys_linux_386.go │ ├── zsys_linux_amd64.go │ ├── zsys_linux_arm.go │ ├── zsys_linux_arm64.go │ ├── zsys_linux_mips.go │ ├── zsys_linux_mips64.go │ ├── zsys_linux_mips64le.go │ ├── zsys_linux_mipsle.go │ ├── zsys_linux_ppc.go │ ├── zsys_linux_ppc64.go │ ├── zsys_linux_ppc64le.go │ ├── zsys_linux_s390x.go │ ├── zsys_netbsd.go │ ├── zsys_openbsd.go │ └── zsys_solaris.go └── modules.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | ssh-p2p 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DST := localhost:22 2 | 3 | .PHONY: deploy test 4 | 5 | deploy: 6 | gcloud app deploy signaling/gae 7 | 8 | build: 9 | go build . 10 | 11 | server: 12 | ./ssh-p2p server -key=6ee87ebb-2938-47f9-8577-e8fd4aa3988c -dial=$(DST) 13 | 14 | client: 15 | ./ssh-p2p client -key=6ee87ebb-2938-47f9-8577-e8fd4aa3988c -listen=localhost:2222 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!NOTE] 2 | > This project will be archived and no longer maintained. You can use this instead. 3 | > 4 | > https://github.com/rtctunnel/rtctunnel 5 | 6 | # ssh-p2p 7 | ssh p2p tunneling server and client 8 | 9 | # connection sequence 10 | 11 | 1. ssh ---dial---> ssh-p2p client 12 | 2. ssh-p2p client <----negotiation----> ssh-p2p server 13 | 3. sshd <--dial--- ssh-p2p server 14 | 15 | # backend protocol 16 | 17 | - RTCDataChannel/WebRTC: https://github.com/pions/webrtc 18 | - signaling server: https://nobo-signaling.appspot.com/ 19 | 20 | src: [signaling/gae](https://github.com/nobonobo/ssh-p2p/signaling/gae) 21 | 22 | thx! https://github.com/pions/webrtc 23 | 24 | # install 25 | 26 | ```sh 27 | $ go get -u github.com/nobonobo/ssh-p2p 28 | ``` 29 | 30 | # usage 31 | 32 | ## server side 33 | 34 | ```sh 35 | $ KEY = $(ssh-p2p newkey) 36 | $ echo $KEY 37 | xxxxxxxx-xxxx-xxxx-xxxxxxxx 38 | $ ssh-p2p server -key=$KEY -dial=127.0.0.1:22 39 | ``` 40 | 41 | share $KEY value to client side 42 | 43 | ## client side 44 | 45 | ```sh 46 | $ KEY=xxxxxxxx-xxxx-xxxx-xxxxxxxx 47 | $ ssh-p2p client -key=$KEY -listen=127.0.0.1:2222 48 | ``` 49 | 50 | ## client side other terminal 51 | 52 | ```sh 53 | $ ssh -p 2222 127.0.0.1 54 | ``` 55 | 56 | **connect to server side sshd !!** 57 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/nobonobo/ssh-p2p 2 | 3 | require ( 4 | github.com/google/go-cmp v0.2.0 // indirect 5 | github.com/google/uuid v1.0.0 6 | github.com/pions/transport v0.1.0 // indirect 7 | github.com/pions/webrtc v1.2.0 8 | gotest.tools v2.2.0+incompatible // indirect 9 | ) 10 | -------------------------------------------------------------------------------- /signaling/gae/.gcloudignore: -------------------------------------------------------------------------------- 1 | # This file specifies files that are *not* uploaded to Google Cloud Platform 2 | # using gcloud. It follows the same syntax as .gitignore, with the addition of 3 | # "#!include" directives (which insert the entries of the given .gitignore-style 4 | # file at that point). 5 | # 6 | # For more information, run: 7 | # $ gcloud topic gcloudignore 8 | # 9 | .gcloudignore 10 | # If you would like to upload your .git directory, .gitignore file or files 11 | # from your .gitignore file, remove the corresponding line 12 | # below: 13 | .git 14 | .gitignore 15 | 16 | # Binaries for programs and plugins 17 | *.exe 18 | *.exe~ 19 | *.dll 20 | *.so 21 | *.dylib 22 | # Test binary, build with `go test -c` 23 | *.test 24 | # Output of the go coverage tool, specifically when used with LiteIDE 25 | *.out -------------------------------------------------------------------------------- /signaling/gae/app.yaml: -------------------------------------------------------------------------------- 1 | runtime: go111 2 | 3 | env_variables: 4 | GOOGLE_CLOUD_PROJECT: nobo-signaling 5 | 6 | handlers: 7 | - url: /.* 8 | script: _go_app 9 | secure: always 10 | 11 | instance_class: B1 12 | basic_scaling: 13 | max_instances: 1 14 | idle_timeout: 1m 15 | -------------------------------------------------------------------------------- /signaling/schema.go: -------------------------------------------------------------------------------- 1 | package signaling 2 | 3 | // URI default signaling server 4 | const URI = "https://nobo-signaling.appspot.com" 5 | 6 | // ConnectInfo SDP by offer or answer 7 | type ConnectInfo struct { 8 | Source string `json:"source"` 9 | SDP string `json:"sdp"` 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - tip 7 | 8 | script: 9 | - go test -v ./... 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | bmatsuo 3 | shawnps 4 | theory 5 | jboverfelt 6 | dsymonds 7 | cd1 8 | wallclockbuilder 9 | dansouza 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/README.md: -------------------------------------------------------------------------------- 1 | # uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) 2 | The uuid package generates and inspects UUIDs based on 3 | [RFC 4122](http://tools.ietf.org/html/rfc4122) 4 | and DCE 1.1: Authentication and Security Services. 5 | 6 | This package is based on the github.com/pborman/uuid package (previously named 7 | code.google.com/p/go-uuid). It differs from these earlier packages in that 8 | a UUID is a 16 byte array rather than a byte slice. One loss due to this 9 | change is the ability to represent an invalid UUID (vs a NIL UUID). 10 | 11 | ###### Install 12 | `go get github.com/google/uuid` 13 | 14 | ###### Documentation 15 | [![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) 16 | 17 | Full `go doc` style documentation for the package can be viewed online without 18 | installing this package by using the GoDoc site here: 19 | http://godoc.org/github.com/google/uuid 20 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package uuid generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security 8 | // Services. 9 | // 10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to 11 | // maps or compared directly. 12 | package uuid 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/marshal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "fmt" 8 | 9 | // MarshalText implements encoding.TextMarshaler. 10 | func (uuid UUID) MarshalText() ([]byte, error) { 11 | var js [36]byte 12 | encodeHex(js[:], uuid) 13 | return js[:], nil 14 | } 15 | 16 | // UnmarshalText implements encoding.TextUnmarshaler. 17 | func (uuid *UUID) UnmarshalText(data []byte) error { 18 | id, err := ParseBytes(data) 19 | if err == nil { 20 | *uuid = id 21 | } 22 | return err 23 | } 24 | 25 | // MarshalBinary implements encoding.BinaryMarshaler. 26 | func (uuid UUID) MarshalBinary() ([]byte, error) { 27 | return uuid[:], nil 28 | } 29 | 30 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 31 | func (uuid *UUID) UnmarshalBinary(data []byte) error { 32 | if len(data) != 16 { 33 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) 34 | } 35 | copy(uuid[:], data) 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_js.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build js 6 | 7 | package uuid 8 | 9 | // getHardwareInterface returns nil values for the JS version of the code. 10 | // This remvoves the "net" dependency, because it is not used in the browser. 11 | // Using the "net" library inflates the size of the transpiled JS code by 673k bytes. 12 | func getHardwareInterface(name string) (string, []byte) { return "", nil } 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_net.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !js 6 | 7 | package uuid 8 | 9 | import "net" 10 | 11 | var interfaces []net.Interface // cached list of interfaces 12 | 13 | // getHardwareInterface returns the name and hardware address of interface name. 14 | // If name is "" then the name and hardware address of one of the system's 15 | // interfaces is returned. If no interfaces are found (name does not exist or 16 | // there are no interfaces) then "", nil is returned. 17 | // 18 | // Only addresses of at least 6 bytes are returned. 19 | func getHardwareInterface(name string) (string, []byte) { 20 | if interfaces == nil { 21 | var err error 22 | interfaces, err = net.Interfaces() 23 | if err != nil { 24 | return "", nil 25 | } 26 | } 27 | for _, ifs := range interfaces { 28 | if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { 29 | return ifs.Name, ifs.HardwareAddr 30 | } 31 | } 32 | return "", nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns nil and an error. 17 | // 18 | // In most cases, New should be used. 19 | func NewUUID() (UUID, error) { 20 | nodeMu.Lock() 21 | if nodeID == zeroID { 22 | setNodeInterface("") 23 | } 24 | nodeMu.Unlock() 25 | 26 | var uuid UUID 27 | now, seq, err := GetTime() 28 | if err != nil { 29 | return uuid, err 30 | } 31 | 32 | timeLow := uint32(now & 0xffffffff) 33 | timeMid := uint16((now >> 32) & 0xffff) 34 | timeHi := uint16((now >> 48) & 0x0fff) 35 | timeHi |= 0x1000 // Version 1 36 | 37 | binary.BigEndian.PutUint32(uuid[0:], timeLow) 38 | binary.BigEndian.PutUint16(uuid[4:], timeMid) 39 | binary.BigEndian.PutUint16(uuid[6:], timeHi) 40 | binary.BigEndian.PutUint16(uuid[8:], seq) 41 | copy(uuid[10:], nodeID[:]) 42 | 43 | return uuid, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "io" 8 | 9 | // New creates a new random UUID or panics. New is equivalent to 10 | // the expression 11 | // 12 | // uuid.Must(uuid.NewRandom()) 13 | func New() UUID { 14 | return Must(NewRandom()) 15 | } 16 | 17 | // NewRandom returns a Random (Version 4) UUID. 18 | // 19 | // The strength of the UUIDs is based on the strength of the crypto/rand 20 | // package. 21 | // 22 | // A note about uniqueness derived from the UUID Wikipedia entry: 23 | // 24 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being 25 | // hit by a meteorite is estimated to be one chance in 17 billion, that 26 | // means the probability is about 0.00000000006 (6 × 10−11), 27 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a 28 | // year and having one duplicate. 29 | func NewRandom() (UUID, error) { 30 | var uuid UUID 31 | _, err := io.ReadFull(rander, uuid[:]) 32 | if err != nil { 33 | return Nil, err 34 | } 35 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 36 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 37 | return uuid, nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/application_data.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // Application data messages are carried by the record layer and are 4 | // fragmented, compressed, and encrypted based on the current connection 5 | // state. The messages are treated as transparent data to the record 6 | // layer. 7 | // https://tools.ietf.org/html/rfc5246#section-10 8 | type applicationData struct { 9 | data []byte 10 | } 11 | 12 | func (a applicationData) contentType() contentType { 13 | return contentTypeApplicationData 14 | } 15 | 16 | func (a *applicationData) Marshal() ([]byte, error) { 17 | return append([]byte{}, a.data...), nil 18 | } 19 | 20 | func (a *applicationData) Unmarshal(data []byte) error { 21 | a.data = append([]byte{}, data...) 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/change_cipher_spec.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // The change cipher spec protocol exists to signal transitions in 4 | // ciphering strategies. The protocol consists of a single message, 5 | // which is encrypted and compressed under the current (not the pending) 6 | // connection state. The message consists of a single byte of value 1. 7 | // https://tools.ietf.org/html/rfc5246#section-7.1 8 | type changeCipherSpec struct { 9 | } 10 | 11 | func (c changeCipherSpec) contentType() contentType { 12 | return contentTypeChangeCipherSpec 13 | } 14 | 15 | func (c *changeCipherSpec) Marshal() ([]byte, error) { 16 | return []byte{0x01}, nil 17 | } 18 | 19 | func (c *changeCipherSpec) Unmarshal(data []byte) error { 20 | if len(data) == 1 && data[0] == 0x01 { 21 | return nil 22 | } 23 | 24 | return errInvalidCipherSpec 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/cipher_suite_tls_ecdhe_rsa_with_aes_128_gcm_sha256.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type cipherSuiteTLSEcdheRsaWithAes128GcmSha256 struct { 4 | cipherSuiteTLSEcdheEcdsaWithAes128GcmSha256 5 | } 6 | 7 | func (c cipherSuiteTLSEcdheRsaWithAes128GcmSha256) certificateType() clientCertificateType { 8 | return clientCertificateTypeRSASign 9 | } 10 | 11 | func (c cipherSuiteTLSEcdheRsaWithAes128GcmSha256) ID() cipherSuiteID { 12 | return 0xc02f 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/cipher_suite_tls_ecdhe_rsa_with_aes_256_cbc_sha.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type cipherSuiteTLSEcdheRsaWithAes256CbcSha struct { 4 | cipherSuiteTLSEcdheEcdsaWithAes256CbcSha 5 | } 6 | 7 | func (c cipherSuiteTLSEcdheRsaWithAes256CbcSha) certificateType() clientCertificateType { 8 | return clientCertificateTypeRSASign 9 | } 10 | 11 | func (c cipherSuiteTLSEcdheRsaWithAes256CbcSha) ID() cipherSuiteID { 12 | return 0x0035 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/client_certificate_type.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-10 4 | type clientCertificateType byte 5 | 6 | const ( 7 | clientCertificateTypeRSASign clientCertificateType = 1 8 | clientCertificateTypeECDSASign clientCertificateType = 64 9 | ) 10 | 11 | var clientCertificateTypes = map[clientCertificateType]bool{ 12 | clientCertificateTypeRSASign: true, 13 | clientCertificateTypeECDSASign: true, 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/compression_method.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type compressionMethodID byte 4 | 5 | const ( 6 | compressionMethodNull compressionMethodID = 0 7 | ) 8 | 9 | type compressionMethod struct { 10 | id compressionMethodID 11 | } 12 | 13 | var compressionMethods = map[compressionMethodID]*compressionMethod{ 14 | compressionMethodNull: {id: compressionMethodNull}, 15 | } 16 | 17 | var defaultCompressionMethods = []*compressionMethod{ 18 | compressionMethods[compressionMethodNull], 19 | } 20 | 21 | func decodeCompressionMethods(buf []byte) ([]*compressionMethod, error) { 22 | if len(buf) < 1 { 23 | return nil, errDTLSPacketInvalidLength 24 | } 25 | compressionMethodsCount := int(buf[0]) 26 | c := []*compressionMethod{} 27 | for i := 0; i < compressionMethodsCount; i++ { 28 | id := compressionMethodID(buf[i+1]) 29 | if compressionMethod, ok := compressionMethods[id]; ok { 30 | c = append(c, compressionMethod) 31 | } 32 | } 33 | return c, nil 34 | } 35 | 36 | func encodeCompressionMethods(c []*compressionMethod) []byte { 37 | out := []byte{byte(len(c))} 38 | for i := len(c); i > 0; i-- { 39 | out = append(out, byte(c[i-1].id)) 40 | } 41 | return out 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/config.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "crypto" 5 | "crypto/x509" 6 | ) 7 | 8 | // Config is used to configure a DTLS client or server. 9 | // After a Config is passed to a DTLS function it must not be modified. 10 | type Config struct { 11 | Certificate *x509.Certificate 12 | PrivateKey crypto.PrivateKey 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/content.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // https://tools.ietf.org/html/rfc4346#section-6.2.1 4 | type contentType uint8 5 | 6 | const ( 7 | contentTypeChangeCipherSpec contentType = 20 8 | contentTypeAlert contentType = 21 9 | contentTypeHandshake contentType = 22 10 | contentTypeApplicationData contentType = 23 11 | ) 12 | 13 | type content interface { 14 | contentType() contentType 15 | Marshal() ([]byte, error) 16 | Unmarshal(data []byte) error 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/curve_type.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-10 4 | type ellipticCurveType byte 5 | 6 | const ( 7 | ellipticCurveTypeNamedCurve ellipticCurveType = 0x03 8 | ) 9 | 10 | var ellipticCurveTypes = map[ellipticCurveType]bool{ 11 | ellipticCurveTypeNamedCurve: true, 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/fingerprint.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "crypto/x509" 5 | "errors" 6 | "fmt" 7 | ) 8 | 9 | // Fingerprint creates a fingerprint for a certificate using the specified hash algorithm 10 | func Fingerprint(cert *x509.Certificate, algo HashAlgorithm) (string, error) { 11 | digest := []byte(fmt.Sprintf("%x", algo.digest(cert.Raw))) 12 | 13 | digestlen := len(digest) 14 | if digestlen == 0 { 15 | return "", nil 16 | } 17 | if digestlen%2 != 0 { 18 | return "", errors.New("invalid fingerprint length") 19 | } 20 | res := make([]byte, digestlen>>1+digestlen-1) 21 | 22 | pos := 0 23 | for i, c := range digest { 24 | res[pos] = c 25 | pos++ 26 | if (i)%2 != 0 && i < digestlen-1 { 27 | res[pos] = byte(':') 28 | pos++ 29 | } 30 | } 31 | 32 | return string(res), nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_header.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "encoding/binary" 5 | ) 6 | 7 | // msg_len for Handshake messages assumes an extra 12 bytes for 8 | // sequence, fragment and version information 9 | const handshakeHeaderLength = 12 10 | 11 | type handshakeHeader struct { 12 | handshakeType handshakeType 13 | length uint32 // uint24 in spec 14 | messageSequence uint16 15 | fragmentOffset uint32 // uint24 in spec 16 | fragmentLength uint32 // uint24 in spec 17 | } 18 | 19 | func (h *handshakeHeader) Marshal() ([]byte, error) { 20 | out := make([]byte, handshakeMessageHeaderLength) 21 | 22 | out[0] = byte(h.handshakeType) 23 | putBigEndianUint24(out[1:], h.length) 24 | binary.BigEndian.PutUint16(out[4:], h.messageSequence) 25 | putBigEndianUint24(out[6:], h.fragmentOffset) 26 | putBigEndianUint24(out[9:], h.fragmentLength) 27 | return out, nil 28 | } 29 | 30 | func (h *handshakeHeader) Unmarshal(data []byte) error { 31 | if len(data) < handshakeHeaderLength { 32 | return errBufferTooSmall 33 | } 34 | 35 | h.handshakeType = handshakeType(data[0]) 36 | h.length = bigEndianUint24(data[1:]) 37 | h.messageSequence = binary.BigEndian.Uint16(data[4:]) 38 | h.fragmentOffset = bigEndianUint24(data[6:]) 39 | h.fragmentLength = bigEndianUint24(data[9:]) 40 | return nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_message_certificate.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "crypto/x509" 5 | ) 6 | 7 | type handshakeMessageCertificate struct { 8 | certificate *x509.Certificate 9 | } 10 | 11 | func (h handshakeMessageCertificate) handshakeType() handshakeType { 12 | return handshakeTypeCertificate 13 | } 14 | 15 | func (h *handshakeMessageCertificate) Marshal() ([]byte, error) { 16 | if h.certificate == nil { 17 | return nil, errCertificateUnset 18 | } 19 | 20 | out := make([]byte, 6) 21 | putBigEndianUint24(out, uint32(len(h.certificate.Raw))+3) 22 | putBigEndianUint24(out[3:], uint32(len(h.certificate.Raw))) 23 | 24 | return append(out, h.certificate.Raw...), nil 25 | } 26 | 27 | func (h *handshakeMessageCertificate) Unmarshal(data []byte) error { 28 | if len(data) < 6 { 29 | return errBufferTooSmall 30 | } 31 | 32 | certificateBodyLen := int(bigEndianUint24(data)) 33 | certificateLen := int(bigEndianUint24(data[3:])) 34 | if certificateBodyLen+3 != len(data) { 35 | return errLengthMismatch 36 | } else if certificateLen+6 != len(data) { 37 | return errLengthMismatch 38 | } 39 | 40 | cert, err := x509.ParseCertificate(data[6:]) 41 | if err != nil { 42 | return err 43 | } 44 | h.certificate = cert 45 | 46 | return nil 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_message_client_key_exchange.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type handshakeMessageClientKeyExchange struct { 4 | publicKey []byte 5 | } 6 | 7 | func (h handshakeMessageClientKeyExchange) handshakeType() handshakeType { 8 | return handshakeTypeClientKeyExchange 9 | } 10 | 11 | func (h *handshakeMessageClientKeyExchange) Marshal() ([]byte, error) { 12 | return append([]byte{byte(len(h.publicKey))}, h.publicKey...), nil 13 | } 14 | 15 | func (h *handshakeMessageClientKeyExchange) Unmarshal(data []byte) error { 16 | publicKeyLength := int(data[0]) 17 | if len(data) <= publicKeyLength { 18 | return errBufferTooSmall 19 | } 20 | h.publicKey = append([]byte{}, data[1:]...) 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_message_finished.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type handshakeMessageFinished struct { 4 | verifyData []byte 5 | } 6 | 7 | func (h handshakeMessageFinished) handshakeType() handshakeType { 8 | return handshakeTypeFinished 9 | } 10 | 11 | func (h *handshakeMessageFinished) Marshal() ([]byte, error) { 12 | return append([]byte{}, h.verifyData...), nil 13 | } 14 | 15 | func (h *handshakeMessageFinished) Unmarshal(data []byte) error { 16 | h.verifyData = append([]byte{}, data...) 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_message_server_hello_done.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type handshakeMessageServerHelloDone struct { 4 | } 5 | 6 | func (h handshakeMessageServerHelloDone) handshakeType() handshakeType { 7 | return handshakeTypeServerHelloDone 8 | } 9 | 10 | func (h *handshakeMessageServerHelloDone) Marshal() ([]byte, error) { 11 | return []byte{}, nil 12 | } 13 | 14 | func (h *handshakeMessageServerHelloDone) Unmarshal(data []byte) error { 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/handshake_random.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "crypto/rand" 5 | "encoding/binary" 6 | "time" 7 | ) 8 | 9 | const randomBytesLength = 28 10 | const handshakeRandomLength = randomBytesLength + 4 11 | 12 | // https://tools.ietf.org/html/rfc4346#section-7.4.1.2 13 | type handshakeRandom struct { 14 | gmtUnixTime time.Time 15 | randomBytes [randomBytesLength]byte 16 | } 17 | 18 | func (h *handshakeRandom) Marshal() ([]byte, error) { 19 | out := make([]byte, handshakeRandomLength) 20 | 21 | binary.BigEndian.PutUint32(out[0:], uint32(h.gmtUnixTime.Unix())) 22 | copy(out[4:], h.randomBytes[:]) 23 | 24 | return out, nil 25 | } 26 | 27 | func (h *handshakeRandom) Unmarshal(data []byte) error { 28 | if len(data) != handshakeRandomLength { 29 | return errBufferTooSmall 30 | } 31 | h.gmtUnixTime = time.Unix(int64(binary.BigEndian.Uint32(data[0:])), 0) 32 | copy(h.randomBytes[:], data[4:]) 33 | 34 | return nil 35 | } 36 | 37 | // populate fills the handshakeRandom with random values 38 | // may be called multiple times 39 | func (h *handshakeRandom) populate() error { 40 | h.gmtUnixTime = time.Now() 41 | 42 | tmp := make([]byte, randomBytesLength) 43 | _, err := rand.Read(tmp) 44 | copy(h.randomBytes[:], tmp) 45 | 46 | return err 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/listener.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "errors" 5 | "net" 6 | 7 | "github.com/pions/dtls/pkg/dtls/internal/udp" 8 | ) 9 | 10 | // Listen creates a DTLS listener 11 | func Listen(network string, laddr *net.UDPAddr, config *Config) (*Listener, error) { 12 | if config == nil { 13 | return nil, errors.New("No config provided") 14 | } 15 | parent, err := udp.Listen(network, laddr) 16 | if err != nil { 17 | return nil, err 18 | } 19 | return &Listener{ 20 | config: config, 21 | parent: parent, 22 | }, nil 23 | } 24 | 25 | // Listener represents a DTLS listener 26 | type Listener struct { 27 | config *Config 28 | parent *udp.Listener 29 | } 30 | 31 | // Accept waits for and returns the next connection to the listener. 32 | // You have to either close or read on all connection that are created. 33 | func (l *Listener) Accept() (net.Conn, error) { 34 | c, err := l.parent.Accept() 35 | if err != nil { 36 | return nil, err 37 | } 38 | return Server(c, l.config) 39 | } 40 | 41 | // Close closes the listener. 42 | // Any blocked Accept operations will be unblocked and return errors. 43 | // Already Accepted connections are not closed. 44 | func (l *Listener) Close() error { 45 | return l.parent.Close() 46 | } 47 | 48 | // Addr returns the listener's network address. 49 | func (l *Listener) Addr() net.Addr { 50 | return l.parent.Addr() 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/named_curve.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | import ( 4 | "crypto/elliptic" 5 | "crypto/rand" 6 | 7 | "golang.org/x/crypto/curve25519" 8 | ) 9 | 10 | // https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8 11 | type namedCurve uint16 12 | 13 | type namedCurveKeypair struct { 14 | curve namedCurve 15 | publicKey []byte 16 | privateKey []byte 17 | } 18 | 19 | const ( 20 | namedCurveP256 namedCurve = 0x0017 21 | namedCurveX25519 namedCurve = 0x001d 22 | ) 23 | 24 | var namedCurves = map[namedCurve]bool{ 25 | namedCurveX25519: true, 26 | namedCurveP256: true, 27 | } 28 | 29 | func generateKeypair(c namedCurve) (*namedCurveKeypair, error) { 30 | switch c { 31 | case namedCurveX25519: 32 | tmp := make([]byte, 32) 33 | if _, err := rand.Read(tmp); err != nil { 34 | return nil, err 35 | } 36 | 37 | var public, private [32]byte 38 | copy(private[:], tmp) 39 | 40 | curve25519.ScalarBaseMult(&public, &private) 41 | return &namedCurveKeypair{namedCurveX25519, public[:], private[:]}, nil 42 | case namedCurveP256: 43 | privateKey, x, y, err := elliptic.GenerateKey(elliptic.P256(), rand.Reader) 44 | if err != nil { 45 | return nil, err 46 | } 47 | 48 | return &namedCurveKeypair{namedCurveP256, elliptic.Marshal(elliptic.P256(), x, y), privateKey}, nil 49 | } 50 | return nil, errInvalidNamedCurve 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/signature_algorithm.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-16 4 | type signatureAlgorithm uint16 5 | 6 | const ( 7 | signatureAlgorithmRSA signatureAlgorithm = 1 8 | signatureAlgorithmECDSA signatureAlgorithm = 3 9 | ) 10 | 11 | var signatureAlgorithms = map[signatureAlgorithm]bool{ 12 | signatureAlgorithmRSA: true, 13 | signatureAlgorithmECDSA: true, 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/signature_hash_algorithm.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type signatureHashAlgorithm struct { 4 | hash HashAlgorithm 5 | signature signatureAlgorithm 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/pions/dtls/pkg/dtls/srtp_protection_profile.go: -------------------------------------------------------------------------------- 1 | package dtls 2 | 3 | type srtpProtectionProfile uint16 4 | 5 | const ( 6 | SRTP_AES128_CM_HMAC_SHA1_80 srtpProtectionProfile = 0x0001 // nolint 7 | ) 8 | 9 | var srtpProtectionProfiles = map[srtpProtectionProfile]bool{ 10 | SRTP_AES128_CM_HMAC_SHA1_80: true, 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2018 Pion LLC 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_channel_number.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // A ChannelNumber is a 4-byte header that identifies a Channel. Each channel 8 | // number in use is bound to a specific peer and thus serves as a 9 | // shorthand for the peer's host transport address. 10 | // https://tools.ietf.org/html/rfc5766#section-2.5 11 | type ChannelNumber struct { 12 | ChannelNumber uint16 13 | } 14 | 15 | // Pack a ChannelNumber attribute, adding it to the passed message 16 | func (x *ChannelNumber) Pack(message *Message) error { 17 | v := make([]byte, 2) 18 | enc.PutUint16(v, x.ChannelNumber) 19 | message.AddAttribute(AttrChannelNumber, v) 20 | return nil 21 | } 22 | 23 | // Unpack a ChannelNumber, deserializing the rawAttribute and populating the struct 24 | func (x *ChannelNumber) Unpack(message *Message, rawAttribute *RawAttribute) error { 25 | v := rawAttribute.Value 26 | 27 | if len(v) != 4 { 28 | return errors.Errorf("invalid channel number length %d != %d (expected)", len(v), 2) 29 | } 30 | 31 | x.ChannelNumber = enc.Uint16(v[:2]) 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_data.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | // A Data represents the attribute is present in all Send and Data indications. The 4 | // value portion of this attribute is variable length and consists of 5 | // the application data (that is, the data that would immediately follow 6 | // the UDP header if the data was been sent directly between the client 7 | // and the peer). If the length of this attribute is not a multiple of 8 | // 4, then padding must be added after this attribute. 9 | type Data struct { 10 | Data []byte 11 | } 12 | 13 | // Pack a Data attribute, adding it to the passed message 14 | func (d *Data) Pack(message *Message) error { 15 | message.AddAttribute(AttrData, d.Data) 16 | return nil 17 | } 18 | 19 | // Unpack a Data, deserializing the rawAttribute and populating the struct 20 | func (d *Data) Unpack(message *Message, rawAttribute *RawAttribute) error { 21 | d.Data = rawAttribute.Value 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_even_port.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // A EvenPort attribute allows the client to request that the port in the 8 | // relayed transport address be even, and (optionally) that the server 9 | // reserve the next-higher port number. The value portion of this 10 | // attribute is 1 byte long. 11 | type EvenPort struct { 12 | ReserveAdditional bool 13 | } 14 | 15 | // Pack a EvenNumber attribute, adding it to the passed message 16 | func (e *EvenPort) Pack(message *Message) error { 17 | return errors.Errorf("*EvenPort.Pack has not been implemented") 18 | } 19 | 20 | // Unpack a EvenPort, deserializing the rawAttribute and populating the struct 21 | func (e *EvenPort) Unpack(message *Message, rawAttribute *RawAttribute) error { 22 | e.ReserveAdditional = rawAttribute.Value[0] != 0 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_ice_controlled.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // IceControlled struct representated tiebreak 8 | type IceControlled struct { 9 | TieBreaker uint64 10 | } 11 | 12 | // Pack with TieBreak 13 | func (i *IceControlled) Pack(message *Message) error { 14 | v := make([]byte, 8) 15 | enc.PutUint64(v, i.TieBreaker) 16 | message.AddAttribute(AttrIceControlled, v) 17 | return nil 18 | } 19 | 20 | // Unpack with TieBreak 21 | func (i *IceControlled) Unpack(message *Message, rawAttribute *RawAttribute) error { 22 | v := rawAttribute.Value 23 | 24 | if len(v) != 8 { 25 | return errors.Errorf("invalid TieBreaker length %d != %d (expected)", len(v), 8) 26 | } 27 | 28 | i.TieBreaker = enc.Uint64(v) 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_ice_controlling.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // IceControlling struct representated tiebreak 8 | type IceControlling struct { 9 | TieBreaker uint64 10 | } 11 | 12 | // Pack with TieBreak 13 | func (i *IceControlling) Pack(message *Message) error { 14 | v := make([]byte, 8) 15 | enc.PutUint64(v, i.TieBreaker) 16 | message.AddAttribute(AttrIceControlling, v) 17 | return nil 18 | } 19 | 20 | // Unpack with TieBreak 21 | func (i *IceControlling) Unpack(message *Message, rawAttribute *RawAttribute) error { 22 | v := rawAttribute.Value 23 | 24 | if len(v) != 8 { 25 | return errors.Errorf("invalid TieBreaker length %d != %d (expected)", len(v), 8) 26 | } 27 | 28 | i.TieBreaker = enc.Uint64(v) 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_lifetime.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // Lifetime represented duration 8 | type Lifetime struct { 9 | Duration uint32 10 | } 11 | 12 | //Pack with Lifetime duration 13 | func (x *Lifetime) Pack(message *Message) error { 14 | v := make([]byte, 4) 15 | enc.PutUint32(v, x.Duration) 16 | message.AddAttribute(AttrLifetime, v) 17 | return nil 18 | } 19 | 20 | //Unpack with lifetime 21 | func (x *Lifetime) Unpack(message *Message, rawAttribute *RawAttribute) error { 22 | v := rawAttribute.Value 23 | 24 | if len(v) != 4 { 25 | return errors.Errorf("invalid lifetime length %d != %d (expected)", len(v), 4) 26 | } 27 | 28 | x.Duration = enc.Uint32(v) 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_nonce.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import "github.com/pkg/errors" 4 | 5 | // https://tools.ietf.org/html/rfc5389#section-15.8 6 | // The NONCE attribute may be present in requests and responses. It 7 | // contains a sequence of qdtext or quoted-pair, which are defined in 8 | // RFC 3261 [RFC3261]. Note that this means that the NONCE attribute 9 | // will not contain actual quote characters. See RFC 2617 [RFC2617], 10 | // Section 4.3, for guidance on selection of nonce values in a server. 11 | // 12 | // It MUST be less than 128 characters (which can be as long as 763 13 | // bytes). 14 | 15 | // Nonce struct represented by NONCE attribute rfc5389#section-15.8 16 | type Nonce struct { 17 | Nonce string 18 | } 19 | 20 | const ( 21 | nonceMaxLength = 763 22 | ) 23 | 24 | //Pack with checking nonce max length 25 | func (n *Nonce) Pack(message *Message) error { 26 | if len([]byte(n.Nonce)) > nonceMaxLength { 27 | return errors.Errorf("invalid nonce length %d", len([]byte(n.Nonce))) 28 | } 29 | message.AddAttribute(AttrNonce, []byte(n.Nonce)) 30 | return nil 31 | } 32 | 33 | //Unpack nonce 34 | func (n *Nonce) Unpack(message *Message, rawAttribute *RawAttribute) error { 35 | n.Nonce = string(rawAttribute.Value) 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_priority.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // Priority is a STUN Priority message 8 | type Priority struct { 9 | Priority uint32 10 | } 11 | 12 | // Pack a STUN Priority message 13 | func (p *Priority) Pack(message *Message) error { 14 | v := make([]byte, 4) 15 | enc.PutUint32(v, p.Priority) 16 | message.AddAttribute(AttrPriority, v) 17 | return nil 18 | } 19 | 20 | // Unpack a STUN Priority message 21 | func (p *Priority) Unpack(message *Message, rawAttribute *RawAttribute) error { 22 | v := rawAttribute.Value 23 | 24 | if len(v) != 4 { 25 | return errors.Errorf("invalid priority length %d != %d (expected)", len(v), 4) 26 | } 27 | 28 | p.Priority = enc.Uint32(v) 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_reservation_token.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import "github.com/pkg/errors" 4 | 5 | // https://tools.ietf.org/html/rfc5766#section-14.9 6 | // The RESERVATION-TOKEN attribute contains a token that uniquely 7 | // identifies a relayed transport address being held in reserve by the 8 | // server. The server includes this attribute in a success response to 9 | // tell the client about the token, and the client includes this 10 | // attribute in a subsequent Allocate request to request the server use 11 | // that relayed transport address for the allocation. 12 | // 13 | // The attribute value is 8 bytes and contains the token value. 14 | 15 | // ReservationToken struct representated RESERVATION-TOKEN attribute rfc5766#section-14.9 16 | type ReservationToken struct { 17 | ReservationToken string 18 | } 19 | 20 | const ( 21 | reservationTokenMaxLength = 8 22 | ) 23 | 24 | // Pack with checking reservationTokenMaxLength 25 | func (r *ReservationToken) Pack(message *Message) error { 26 | if len([]byte(r.ReservationToken)) > reservationTokenMaxLength { 27 | return errors.Errorf("invalid ReservationToken length %d", len([]byte(r.ReservationToken))) 28 | } 29 | message.AddAttribute(AttrReservationToken, []byte(r.ReservationToken)) 30 | return nil 31 | } 32 | 33 | // Unpack ReservationToken 34 | func (r *ReservationToken) Unpack(message *Message, rawAttribute *RawAttribute) error { 35 | r.ReservationToken = string(rawAttribute.Value) 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_software.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import "github.com/pkg/errors" 4 | 5 | // https://tools.ietf.org/html/rfc5389#section-15.10 6 | // The SOFTWARE attribute contains a textual description of the software 7 | // being used by the agent sending the message 8 | 9 | // Software struct has SOFTWARE field that rfc5389#section-15.10 10 | type Software struct { 11 | Software string 12 | } 13 | 14 | const ( 15 | softwareMaxLength = 763 16 | ) 17 | 18 | // Pack with checking softwareMaxLength 19 | func (s *Software) Pack(message *Message) error { 20 | if len([]byte(s.Software)) > softwareMaxLength { 21 | return errors.Errorf("invalid software length %d", len([]byte(s.Software))) 22 | } 23 | message.AddAttribute(AttrSoftware, []byte(s.Software)) 24 | return nil 25 | } 26 | 27 | // Unpack Software field 28 | func (s *Software) Unpack(message *Message, rawAttribute *RawAttribute) error { 29 | s.Software = string(rawAttribute.Value) 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_use_candidate.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | // https://tools.ietf.org/html/draft-ietf-ice-rfc5245bis-20#section-16.1 4 | 5 | // UseCandidate has no field struct 6 | type UseCandidate struct { 7 | } 8 | 9 | // Pack with use-candidate attribute 10 | func (u *UseCandidate) Pack(message *Message) error { 11 | message.AddAttribute(AttrUseCandidate, []byte{}) 12 | return nil 13 | } 14 | 15 | // Unpack use-candidate attribute 16 | func (u *UseCandidate) Unpack(message *Message, rawAttribute *RawAttribute) error { 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_username.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import "github.com/pkg/errors" 4 | 5 | // https://tools.ietf.org/html/rfc5389#section-15.3 6 | // The USERNAME attribute is used for message integrity. It identifies 7 | // the username and password combination used in the message-integrity 8 | // check. 9 | // 10 | // The value of USERNAME is a variable-length value. It MUST contain a 11 | // UTF-8 [RFC3629] encoded sequence of less than 513 bytes, and MUST 12 | // have been processed using SASLprep [RFC4013]. 13 | 14 | // Username struct 15 | type Username struct { 16 | Username string 17 | } 18 | 19 | const ( 20 | usernameMaxLength = 513 21 | ) 22 | 23 | // Pack messsage using USERNAME attribute 24 | func (u *Username) Pack(message *Message) error { 25 | if len([]byte(u.Username)) > usernameMaxLength { 26 | return errors.Errorf("invalid username length %d", len([]byte(u.Username))) 27 | } 28 | message.AddAttribute(AttrUsername, []byte(u.Username)) 29 | return nil 30 | } 31 | 32 | // Unpack message as USERNAME 33 | func (u *Username) Unpack(message *Message, rawAttribute *RawAttribute) error { 34 | u.Username = string(rawAttribute.Value) 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_xor_mapped_address.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | // 0 1 2 3 4 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 5 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6 | // |x x x x x x x x| Family | X-Port | 7 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 8 | // | X-Address (Variable) 9 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 10 | 11 | //XorMappedAddress https://tools.ietf.org/html/rfc5389#section-15.2 12 | type XorMappedAddress struct { 13 | XorAddress 14 | } 15 | 16 | // Pack writes an XorMappedAddress into a message 17 | func (x *XorMappedAddress) Pack(message *Message) error { 18 | v, err := x.packInner(message) 19 | if err != nil { 20 | return err 21 | } 22 | message.AddAttribute(AttrXORMappedAddress, v) 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_xor_peer_address.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | // The XOR-PEER-ADDRESS specifies the address and port of the peer as 4 | // seen from the TURN server. (For example, the peer's server-reflexive 5 | // transport address if the peer is behind a NAT.) It is encoded in the 6 | // same way as XOR-MAPPED-ADDRESS [RFC5389]. 7 | 8 | //XorPeerAddress include XorAddress which encoded in the same way as XOR-MAPPED-ADDRESS [RFC5389] 9 | type XorPeerAddress struct { 10 | XorAddress 11 | } 12 | 13 | //Pack using XOR-PEER-ADDRESS 14 | func (x *XorPeerAddress) Pack(message *Message) error { 15 | v, err := x.packInner(message) 16 | if err != nil { 17 | return err 18 | } 19 | message.AddAttribute(AttrXORPeerAddress, v) 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/attr_xor_relayed_address.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | // https://tools.ietf.org/html/rfc5766#section-14.5 4 | // The XOR-RELAYED-ADDRESS is present in Allocate responses. It 5 | // specifies the address and port that the server allocated to the 6 | // client. It is encoded in the same way as XOR-MAPPED-ADDRESS 7 | // [RFC5389] 8 | 9 | //XorRelayedAddress include XorAddress which encoded in the same way as XOR-MAPPED-ADDRESS [RFC5389] 10 | type XorRelayedAddress struct { 11 | XorAddress 12 | } 13 | 14 | //Pack using XOR-RELAYED-ADDRESS 15 | func (x *XorRelayedAddress) Pack(message *Message) error { 16 | v, err := x.packInner(message) 17 | if err != nil { 18 | return err 19 | } 20 | message.AddAttribute(AttrXORRelayedAddress, v) 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/channel_data.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | //ChannelData is struct including ChannelNumber and Data 8 | type ChannelData struct { 9 | ChannelNumber uint16 10 | Length uint16 11 | Data []byte 12 | } 13 | 14 | //NewChannelData return ChannelData from packet 15 | func NewChannelData(packet []byte) (*ChannelData, error) { 16 | cn, err := getChannelNumber(packet) 17 | if err != nil { 18 | return nil, err 19 | } 20 | 21 | return &ChannelData{ 22 | ChannelNumber: cn, 23 | Length: getChannelLength(packet), 24 | Data: packet[4:], 25 | }, nil 26 | } 27 | 28 | // 0b01: ChannelData message (since the channel number is the first 29 | // field in the ChannelData message and channel numbers fall in the 30 | // range 0x4000 - 0x7FFF). 31 | func getChannelNumber(header []byte) (uint16, error) { 32 | cn := enc.Uint16(header) 33 | if cn < 0x4000 || cn > 0x7FFF { 34 | return 0, errors.Errorf("ChannelNumber is out of range: %d", cn) 35 | } 36 | return cn, nil 37 | } 38 | 39 | func getChannelLength(header []byte) uint16 { 40 | return enc.Uint16(header[2:]) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/encoding.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import "encoding/binary" 4 | 5 | // STUN expects all messages to be BigEndian encoded 6 | 7 | var ( 8 | enc = binary.BigEndian 9 | ) 10 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/message_builder.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // Build return messsage which is built from class, method, transactionID, and pack message using attribute 8 | func Build(class MessageClass, method Method, transactionID []byte, attrs ...Attribute) (*Message, error) { 9 | 10 | m := &Message{ 11 | Class: class, 12 | Method: method, 13 | TransactionID: transactionID, 14 | } 15 | 16 | m.Raw = make([]byte, messageHeaderLength) 17 | 18 | setMessageType(m.Raw[messageHeaderStart:2], class, method) 19 | 20 | copy(m.Raw[transactionIDStart:], m.TransactionID) 21 | 22 | for _, v := range attrs { 23 | err := v.Pack(m) 24 | if err != nil { 25 | return nil, errors.Wrap(err, "failed packing attribute") 26 | } 27 | } 28 | 29 | return m, nil 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/pions/pkg/stun/packet.go: -------------------------------------------------------------------------------- 1 | package stun 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // PacketType is whether STUN or ChannelData 8 | type PacketType int 9 | 10 | // PacketTypes 11 | const ( 12 | PacketTypeSTUN PacketType = iota 13 | PacketTypeChannelData PacketType = iota 14 | ) 15 | 16 | // GetPacketType returns PacketType(whether STUN or ChannelData) 17 | func GetPacketType(packet []byte) (PacketType, error) { 18 | if len(packet) < 2 { 19 | return 0, errors.Errorf("Packet is too short to determine type: %d", len(packet)) 20 | } 21 | 22 | if verifyStunHeaderMostSignificant2Bits(packet) { 23 | return PacketTypeSTUN, nil 24 | } else if _, err := getChannelNumber(packet); err == nil { 25 | return PacketTypeChannelData, nil 26 | } 27 | 28 | return 0, errors.Errorf("%08b %08b", packet[0], packet[1]) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/.codacy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - examples/examples.json -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["standard"] 3 | } 4 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/.gitignore: -------------------------------------------------------------------------------- 1 | ### JetBrains IDE ### 2 | ##################### 3 | .idea/ 4 | 5 | ### Emacs Temporary Files ### 6 | ############################# 7 | *~ 8 | 9 | ### Folders ### 10 | ############### 11 | bin/ 12 | vendor/ 13 | 14 | ### Files ### 15 | ############# 16 | *.ivf 17 | tags -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/.golangci.yml: -------------------------------------------------------------------------------- 1 | linters-settings: 2 | govet: 3 | check-shadowing: true 4 | misspell: 5 | locale: US 6 | 7 | linters: 8 | enable-all: true 9 | disable: 10 | - maligned 11 | - lll 12 | - dupl 13 | 14 | issues: 15 | exclude-use-default: false 16 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.x" # use the latest Go release 5 | 6 | notifications: 7 | email: false 8 | slack: 9 | secure: IYjXoe03KykZ3v4GgUwGzfWRepO5DnJdxB87lSQ2IMsF6PBFSc3CaOX3GUclHIlzTdchR+PHj1jtEZZVSkgfp9amZBCcqbJTBOPG1YA6hxOvTpgeWIttMH0cmMxSCuCa4RfkuRH2+UXbjREMJ3ENau2CTMKReyW4Jddh9dREZohVmYuqN6uuBqCndYpt3Lm1Hv+T+vqxwTDdE/q0hwGMiwgvQm7N3K397e1q1mg+o4tMGwqyUIPnEPjaSKcEuOBa8Rqyl96nn+HGZK0zvNqUOxlzeRMM0VBcxe2s+zY/SuLj4OwNl1zEmIfY6Qj70t2cmT3xJvJprB4pCwR7q78b4lfpNu6rqCJPIZG/qDFT+XSuhDCmLlCO/+Uhtu11pgjV8UMNLTKJth+7hurH7oLNb7jYk9VYsiKhs41LICyDjJNzS5yPatF5xj0HOujb6Uh/pfI+9a+IpPSeXv1gBo8H3oWa6TfRhuTUS3Jc48p/jriZmgWgbKa1HKTaY9ENvAdZFfxJdrRg3Y4SKnjZcAPw7ijRIx1oaM3rHYbOTm/dj4ggho7EgTO3k8toQ5PKohrbBG5RERqHJvC47SXDt0fEjeGnAfN7Xtj0Pq8YyaFIj7CmCCGoI//2sWkK3AmjnwIuW0hUMsL3GsED+p0lsu6FX9wysJwy2Z2mTfIX/CXmB6w= 10 | 11 | before_install: 12 | - sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 13 | 14 | before_script: 15 | - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.10.2 16 | - go get github.com/mattn/goveralls 17 | 18 | script: 19 | - bash .github/build-examples.sh 20 | - rm -rf examples 21 | # Remove examples, no test coverage for them 22 | - golangci-lint run 23 | - goveralls -v -race -covermode=atomic -service=travis-ci 24 | - bash .github/assert-contributors.sh 25 | - bash .github/lint-disallowed-functions-in-library.sh 26 | - bash .github/lint-commit-message.sh 27 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 |

2 | Contributing 3 |

4 | 5 | Moved to the **[contributing wiki](https://github.com/pions/webrtc/wiki/Contributing)**. 6 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/pions/webrtc 2 | 3 | require ( 4 | github.com/davecgh/go-spew v1.1.1 // indirect 5 | github.com/pions/dtls v1.0.2 6 | github.com/pions/pkg v0.0.0-20181115215726-b60cd756f712 7 | github.com/pkg/errors v0.8.0 8 | github.com/pmezard/go-difflib v1.0.0 // indirect 9 | github.com/stretchr/testify v1.2.2 10 | golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 // indirect 11 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3 // indirect 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/pions/dtls v1.0.2 h1:VOIp3whGooFWS4X0RBOXaykNORYr05yjs8mlNYqRc+4= 4 | github.com/pions/dtls v1.0.2/go.mod h1:T22vu8VCOxNmIrbe3nnM1UdIo3m1Bx5CJNkHyehahLg= 5 | github.com/pions/pkg v0.0.0-20181115215726-b60cd756f712 h1:ciXO7F7PusyAzW/EZJt01bETgfTxP/BIGoWQ15pBP54= 6 | github.com/pions/pkg v0.0.0-20181115215726-b60cd756f712/go.mod h1:r9wKZs+Xxv2acLspex4CHQiIhFjGK1zGP+nUm/8klXA= 7 | github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= 8 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 9 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 10 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 11 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 12 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 13 | golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= 14 | golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 15 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= 16 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 17 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/datachannel/message_channel_ack.go: -------------------------------------------------------------------------------- 1 | package datachannel 2 | 3 | // ChannelAck is used to ACK a DataChannel open 4 | type ChannelAck struct{} 5 | 6 | const ( 7 | channelOpenAckLength = 4 8 | ) 9 | 10 | // Marshal returns raw bytes for the given message 11 | func (c *ChannelAck) Marshal() ([]byte, error) { 12 | raw := make([]byte, channelOpenAckLength) 13 | raw[0] = uint8(DataChannelAck) 14 | 15 | return raw, nil 16 | } 17 | 18 | // Unmarshal populates the struct with the given raw data 19 | func (c *ChannelAck) Unmarshal(raw []byte) error { 20 | // Message type already checked in Parse and there is no further data 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/chunk_cookie_ack.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | /* 8 | chunkCookieAck represents an SCTP Chunk of type chunkCookieAck 9 | 10 | 0 1 2 3 11 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 12 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 13 | | Type = 11 |Chunk Flags | Length = 4 | 14 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 15 | */ 16 | type chunkCookieAck struct { 17 | chunkHeader 18 | } 19 | 20 | func (c *chunkCookieAck) unmarshal(raw []byte) error { 21 | if err := c.chunkHeader.unmarshal(raw); err != nil { 22 | return err 23 | } 24 | 25 | if c.typ != COOKIEACK { 26 | return errors.Errorf("ChunkType is not of type COOKIEACK, actually is %s", c.typ.String()) 27 | } 28 | 29 | return nil 30 | } 31 | 32 | func (c *chunkCookieAck) marshal() ([]byte, error) { 33 | c.chunkHeader.typ = COOKIEACK 34 | return c.chunkHeader.marshal() 35 | } 36 | 37 | func (c *chunkCookieAck) check() (abort bool, err error) { 38 | return false, nil 39 | } 40 | 41 | // String makes chunkCookieAck printable 42 | func (c *chunkCookieAck) String() string { 43 | return c.chunkHeader.String() 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/chunk_cookie_echo.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | /* 8 | CookieEcho represents an SCTP Chunk of type CookieEcho 9 | 10 | 0 1 2 3 11 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 12 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 13 | | Type = 10 |Chunk Flags | Length | 14 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 15 | | Cookie | 16 | | | 17 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 18 | 19 | */ 20 | type chunkCookieEcho struct { 21 | chunkHeader 22 | cookie []byte 23 | } 24 | 25 | func (c *chunkCookieEcho) unmarshal(raw []byte) error { 26 | if err := c.chunkHeader.unmarshal(raw); err != nil { 27 | return err 28 | } 29 | 30 | if c.typ != COOKIEECHO { 31 | return errors.Errorf("ChunkType is not of type COOKIEECHO, actually is %s", c.typ.String()) 32 | } 33 | c.cookie = c.raw 34 | 35 | return nil 36 | } 37 | 38 | func (c *chunkCookieEcho) marshal() ([]byte, error) { 39 | c.chunkHeader.typ = COOKIEECHO 40 | c.chunkHeader.raw = c.cookie 41 | return c.chunkHeader.marshal() 42 | } 43 | 44 | func (c *chunkCookieEcho) check() (abort bool, err error) { 45 | return false, nil 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/common.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | const ( 4 | paddingMultiple = 4 5 | ) 6 | 7 | func getPadding(len int) int { 8 | return (paddingMultiple - (len % paddingMultiple)) % paddingMultiple 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/error_cause_header.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | import ( 4 | "encoding/binary" 5 | 6 | "github.com/pkg/errors" 7 | ) 8 | 9 | // errorCauseHeader represents the shared header that is shared by all error causes 10 | type errorCauseHeader struct { 11 | code errorCauseCode 12 | len uint16 13 | raw []byte 14 | } 15 | 16 | const ( 17 | errorCauseHeaderLength = 4 18 | ) 19 | 20 | func (e *errorCauseHeader) marshal() ([]byte, error) { 21 | return nil, errors.Errorf("Unimplemented") 22 | } 23 | 24 | func (e *errorCauseHeader) unmarshal(raw []byte) error { 25 | e.code = errorCauseCode(binary.BigEndian.Uint16(raw[0:])) 26 | e.len = binary.BigEndian.Uint16(raw[2:]) 27 | valueLength := e.len - errorCauseHeaderLength 28 | e.raw = raw[errorCauseHeaderLength : errorCauseHeaderLength+valueLength] 29 | return nil 30 | } 31 | 32 | func (e *errorCauseHeader) length() uint16 { 33 | return e.len 34 | } 35 | 36 | func (e *errorCauseHeader) errorCauseCode() errorCauseCode { 37 | return e.code 38 | } 39 | 40 | // String makes errorCauseHeader printable 41 | func (e errorCauseHeader) String() string { 42 | return e.code.String() 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/error_cause_invalid_mandatory_parameter.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | // errorCauseInvalidMandatoryParameter represents an SCTP error cause 4 | type errorCauseInvalidMandatoryParameter struct { 5 | errorCauseHeader 6 | } 7 | 8 | func (e *errorCauseInvalidMandatoryParameter) marshal() ([]byte, error) { 9 | return e.errorCauseHeader.marshal() 10 | } 11 | 12 | func (e *errorCauseInvalidMandatoryParameter) unmarshal(raw []byte) error { 13 | return e.errorCauseHeader.unmarshal(raw) 14 | } 15 | 16 | // String makes errorCauseInvalidMandatoryParameter printable 17 | func (e *errorCauseInvalidMandatoryParameter) String() string { 18 | return e.errorCauseHeader.String() 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/error_cause_unrecognized_chunk_type.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | // errorCauseUnrecognizedChunkType represents an SCTP error cause 4 | type errorCauseUnrecognizedChunkType struct { 5 | errorCauseHeader 6 | } 7 | 8 | func (e *errorCauseUnrecognizedChunkType) marshal() ([]byte, error) { 9 | return e.errorCauseHeader.marshal() 10 | } 11 | 12 | func (e *errorCauseUnrecognizedChunkType) unmarshal(raw []byte) error { 13 | return e.errorCauseHeader.unmarshal(raw) 14 | } 15 | 16 | // String makes errorCauseUnrecognizedChunkType printable 17 | func (e *errorCauseUnrecognizedChunkType) String() string { 18 | return e.errorCauseHeader.String() 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_chunk_list.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | type paramChunkList struct { 4 | paramHeader 5 | chunkTypes []chunkType 6 | } 7 | 8 | func (c *paramChunkList) marshal() ([]byte, error) { 9 | c.typ = chunkList 10 | c.raw = make([]byte, len(c.chunkTypes)) 11 | for i, t := range c.chunkTypes { 12 | c.raw[i] = byte(t) 13 | } 14 | 15 | return c.paramHeader.marshal() 16 | } 17 | 18 | func (c *paramChunkList) unmarshal(raw []byte) (param, error) { 19 | c.paramHeader.unmarshal(raw) 20 | for _, t := range c.raw { 21 | c.chunkTypes = append(c.chunkTypes, chunkType(t)) 22 | } 23 | 24 | return c, nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_forward_tsn_supported.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | type paramForwardTSNSupported struct { 4 | paramHeader 5 | } 6 | 7 | func (f *paramForwardTSNSupported) marshal() ([]byte, error) { 8 | f.typ = forwardTSNSupp 9 | f.raw = []byte{} 10 | return f.paramHeader.marshal() 11 | } 12 | 13 | func (f *paramForwardTSNSupported) unmarshal(raw []byte) (param, error) { 14 | f.paramHeader.unmarshal(raw) 15 | return f, nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_header.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | import ( 4 | "encoding/binary" 5 | "fmt" 6 | ) 7 | 8 | type paramHeader struct { 9 | typ paramType 10 | len int 11 | raw []byte 12 | } 13 | 14 | const ( 15 | paramHeaderLength = 4 16 | ) 17 | 18 | func (p *paramHeader) marshal() ([]byte, error) { 19 | paramLengthPlusHeader := paramHeaderLength + len(p.raw) 20 | 21 | rawParam := make([]byte, paramLengthPlusHeader) 22 | binary.BigEndian.PutUint16(rawParam[0:], uint16(p.typ)) 23 | binary.BigEndian.PutUint16(rawParam[2:], uint16(paramLengthPlusHeader)) 24 | copy(rawParam[paramHeaderLength:], p.raw) 25 | 26 | return rawParam, nil 27 | } 28 | 29 | func (p *paramHeader) unmarshal(raw []byte) { 30 | paramLengthPlusHeader := binary.BigEndian.Uint16(raw[2:]) 31 | paramLength := paramLengthPlusHeader - initOptionalVarHeaderLength 32 | 33 | p.typ = paramType(binary.BigEndian.Uint16(raw[0:])) 34 | p.raw = raw[paramHeaderLength : paramHeaderLength+paramLength] 35 | p.len = int(paramLengthPlusHeader) 36 | } 37 | 38 | func (p *paramHeader) length() int { 39 | return p.len 40 | } 41 | 42 | // String makes paramHeader printable 43 | func (p paramHeader) String() string { 44 | return fmt.Sprintf("%s (%d): %s", p.typ, p.len, p.raw) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_heartbeat_info.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | type paramHeartbeatInfo struct { 4 | paramHeader 5 | heartbeatInformation []byte 6 | } 7 | 8 | func (h *paramHeartbeatInfo) marshal() ([]byte, error) { 9 | h.typ = heartbeatInfo 10 | h.raw = h.heartbeatInformation 11 | return h.paramHeader.marshal() 12 | } 13 | 14 | func (h *paramHeartbeatInfo) unmarshal(raw []byte) (param, error) { 15 | h.paramHeader.unmarshal(raw) 16 | h.heartbeatInformation = h.raw 17 | return h, nil 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_random.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | type paramRandom struct { 4 | paramHeader 5 | randomData []byte 6 | } 7 | 8 | func (r *paramRandom) marshal() ([]byte, error) { 9 | r.typ = random 10 | r.raw = r.randomData 11 | return r.paramHeader.marshal() 12 | } 13 | 14 | func (r *paramRandom) unmarshal(raw []byte) (param, error) { 15 | r.paramHeader.unmarshal(raw) 16 | r.randomData = r.raw 17 | return r, nil 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_state_cookie.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | import ( 4 | "encoding/binary" 5 | "fmt" 6 | "math/rand" 7 | "time" 8 | ) 9 | 10 | type paramStateCookie struct { 11 | paramHeader 12 | cookie []byte 13 | } 14 | 15 | func newRandomStateCookie() *paramStateCookie { 16 | rs := rand.NewSource(time.Now().UnixNano()) 17 | r := rand.New(rs) 18 | randCookie := make([]byte, 32) 19 | i := 0 20 | for i < 4 { 21 | binary.BigEndian.PutUint64(randCookie[i*4:], r.Uint64()) 22 | i++ 23 | } 24 | 25 | s := ¶mStateCookie{ 26 | cookie: randCookie, 27 | } 28 | 29 | return s 30 | } 31 | 32 | func (s *paramStateCookie) marshal() ([]byte, error) { 33 | s.typ = stateCookie 34 | s.raw = s.cookie 35 | return s.paramHeader.marshal() 36 | } 37 | 38 | func (s *paramStateCookie) unmarshal(raw []byte) (param, error) { 39 | s.paramHeader.unmarshal(raw) 40 | s.cookie = s.raw 41 | return s, nil 42 | } 43 | 44 | // String makes paramStateCookie printable 45 | func (s *paramStateCookie) String() string { 46 | return fmt.Sprintf("%s: %s", s.paramHeader, s.cookie) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/param_supported_extensions.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | 3 | type paramSupportedExtensions struct { 4 | paramHeader 5 | ChunkTypes []chunkType 6 | } 7 | 8 | func (s *paramSupportedExtensions) marshal() ([]byte, error) { 9 | s.typ = supportedExt 10 | s.raw = make([]byte, len(s.ChunkTypes)) 11 | for i, c := range s.ChunkTypes { 12 | s.raw[i] = byte(c) 13 | } 14 | 15 | return s.paramHeader.marshal() 16 | } 17 | 18 | func (s *paramSupportedExtensions) unmarshal(raw []byte) (param, error) { 19 | s.paramHeader.unmarshal(raw) 20 | 21 | for _, t := range s.raw { 22 | s.ChunkTypes = append(s.ChunkTypes, chunkType(t)) 23 | } 24 | 25 | return s, nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/sctp/sctp.go: -------------------------------------------------------------------------------- 1 | package sctp 2 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/internal/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | ) 7 | 8 | // RandSeq generates a random alpha numeric sequence of the requested length 9 | func RandSeq(n int) string { 10 | r := rand.New(rand.NewSource(time.Now().UnixNano())) 11 | letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") 12 | b := make([]rune, n) 13 | for i := range b { 14 | b[i] = letters[r.Intn(len(letters))] 15 | } 16 | return string(b) 17 | } 18 | 19 | // GetPadding Returns the padding required to make the length a multiple of 4 20 | func GetPadding(len int) int { 21 | if len%4 == 0 { 22 | return 0 23 | } 24 | return 4 - (len % 4) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/media.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | import ( 4 | "github.com/pions/webrtc/pkg/media" 5 | "github.com/pions/webrtc/pkg/rtcp" 6 | "github.com/pions/webrtc/pkg/rtp" 7 | ) 8 | 9 | // RTCTrack represents a track that is communicated 10 | type RTCTrack struct { 11 | ID string 12 | PayloadType uint8 13 | Kind RTCRtpCodecType 14 | Label string 15 | Ssrc uint32 16 | Codec *RTCRtpCodec 17 | Packets <-chan *rtp.Packet 18 | RTCPPackets <-chan rtcp.Packet 19 | Samples chan<- media.RTCSample 20 | RawRTP chan<- *rtp.Packet 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/datachannel/payload.go: -------------------------------------------------------------------------------- 1 | package datachannel 2 | 3 | import "fmt" 4 | 5 | // PayloadType are the different types of data that can be 6 | // represented in a DataChannel message 7 | type PayloadType int 8 | 9 | // PayloadType enums 10 | const ( 11 | PayloadTypeString = iota + 1 12 | PayloadTypeBinary 13 | ) 14 | 15 | func (p PayloadType) String() string { 16 | switch p { 17 | case PayloadTypeString: 18 | return "Payload Type String" 19 | case PayloadTypeBinary: 20 | return "Payload Type Binary" 21 | default: 22 | return fmt.Sprintf("Invalid PayloadType (%d)", p) 23 | } 24 | } 25 | 26 | // Payload is the body of a DataChannel message 27 | type Payload interface { 28 | PayloadType() PayloadType 29 | } 30 | 31 | // PayloadString is a string DataChannel message 32 | type PayloadString struct { 33 | Data []byte 34 | } 35 | 36 | //PayloadType returns the type of payload 37 | func (p PayloadString) PayloadType() PayloadType { 38 | return PayloadTypeString 39 | } 40 | 41 | // PayloadBinary is a binary DataChannel message 42 | type PayloadBinary struct { 43 | Data []byte 44 | } 45 | 46 | //PayloadType returns the type of payload 47 | func (p PayloadBinary) PayloadType() PayloadType { 48 | return PayloadTypeBinary 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/ice/candidatepair.go: -------------------------------------------------------------------------------- 1 | package ice 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/pions/pkg/stun" 7 | ) 8 | 9 | func newCandidatePair(local, remote *Candidate) *candidatePair { 10 | return &candidatePair{ 11 | remote: remote, 12 | local: local, 13 | } 14 | } 15 | 16 | // candidatePair represents a combination of a local and remote candidate 17 | type candidatePair struct { 18 | remote *Candidate 19 | local *Candidate 20 | } 21 | 22 | func (p *candidatePair) Write(b []byte) (int, error) { 23 | return p.local.writeTo(b, p.remote) 24 | } 25 | 26 | // keepaliveCandidate sends a STUN Binding Indication to the remote candidate 27 | func (a *Agent) keepaliveCandidate(local, remote *Candidate) { 28 | msg, err := stun.Build(stun.ClassIndication, stun.MethodBinding, stun.GenerateTransactionId(), 29 | &stun.Username{Username: a.remoteUfrag + ":" + a.localUfrag}, 30 | &stun.MessageIntegrity{ 31 | Key: []byte(a.remotePwd), 32 | }, 33 | &stun.Fingerprint{}, 34 | ) 35 | 36 | if err != nil { 37 | fmt.Println(err) 38 | return 39 | } 40 | 41 | a.sendSTUN(msg, local, remote) 42 | } 43 | 44 | func (a *Agent) sendSTUN(msg *stun.Message, local, remote *Candidate) { 45 | _, err := local.writeTo(msg.Pack(), remote) 46 | if err != nil { 47 | // TODO: Determine if we should always drop the err 48 | // E.g.: maybe handle for known valid pairs or to 49 | // discard pairs faster. 50 | _ = err 51 | // fmt.Printf("failed to send STUN message: %v", err) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/ice/candidaterelatedaddress.go: -------------------------------------------------------------------------------- 1 | package ice 2 | 3 | import "fmt" 4 | 5 | // CandidateRelatedAddress convey transport addresses related to the 6 | // candidate, useful for diagnostics and other purposes. 7 | type CandidateRelatedAddress struct { 8 | Address string 9 | Port int 10 | } 11 | 12 | // String makes CandidateRelatedAddress printable 13 | func (c *CandidateRelatedAddress) String() string { 14 | if c == nil { 15 | return "" 16 | } 17 | 18 | return fmt.Sprintf(" related %s:%d", c.Address, c.Port) 19 | } 20 | 21 | // Equal allows comparing two CandidateRelatedAddresses. 22 | // The CandidateRelatedAddress are allowed to be nil. 23 | func (c *CandidateRelatedAddress) Equal(other *CandidateRelatedAddress) bool { 24 | if c == nil && other == nil { 25 | return true 26 | } 27 | return c != nil && other != nil && 28 | c.Address == other.Address && 29 | c.Port == other.Port 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/ice/candidatetype.go: -------------------------------------------------------------------------------- 1 | package ice 2 | 3 | // CandidateType represents the type of candidate 4 | type CandidateType byte 5 | 6 | // CandidateType enum 7 | const ( 8 | CandidateTypeHost CandidateType = iota + 1 9 | CandidateTypeServerReflexive 10 | // CandidateTypePeerReflexive // TODO 11 | // CandidateTypeRelay // TODO 12 | ) 13 | 14 | // String makes CandidateType printable 15 | func (c CandidateType) String() string { 16 | switch c { 17 | case CandidateTypeHost: 18 | return "host" 19 | case CandidateTypeServerReflexive: 20 | return "srflx" 21 | // case CandidateTypePeerReflexive: 22 | // return "prflx" 23 | // case CandidateTypeRelay: 24 | // return "relay" 25 | } 26 | return "Unknown candidate type" 27 | } 28 | 29 | // Preference returns the preference weight of a CandidateType 30 | func (c CandidateType) Preference() uint16 { 31 | switch c { 32 | case CandidateTypeHost: 33 | return 126 34 | case CandidateTypeServerReflexive: 35 | return 100 36 | } 37 | return 0 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/ice/errors.go: -------------------------------------------------------------------------------- 1 | package ice 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | var ( 8 | // ErrUnknownType indicates an error with Unknown info. 9 | ErrUnknownType = errors.New("Unknown") 10 | 11 | // ErrSchemeType indicates the scheme type could not be parsed. 12 | ErrSchemeType = errors.New("unknown scheme type") 13 | 14 | // ErrSTUNQuery indicates query arguments are provided in a STUN URL. 15 | ErrSTUNQuery = errors.New("queries not supported in stun address") 16 | 17 | // ErrInvalidQuery indicates an malformed query is provided. 18 | ErrInvalidQuery = errors.New("invalid query") 19 | 20 | // ErrHost indicates malformed hostname is provided. 21 | ErrHost = errors.New("invalid hostname") 22 | 23 | // ErrPort indicates malformed port is provided. 24 | ErrPort = errors.New("invalid port") 25 | 26 | // ErrProtoType indicates an unsupported transport type was provided. 27 | ErrProtoType = errors.New("invalid transport protocol type") 28 | 29 | // ErrClosed indicates the agent is closed 30 | ErrClosed = errors.New("the agent is closed") 31 | ) 32 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/ice/util.go: -------------------------------------------------------------------------------- 1 | package ice 2 | 3 | import ( 4 | "net" 5 | "sync/atomic" 6 | ) 7 | 8 | func localInterfaces() (ips []net.IP) { 9 | ifaces, err := net.Interfaces() 10 | if err != nil { 11 | return ips 12 | } 13 | 14 | for _, iface := range ifaces { 15 | if iface.Flags&net.FlagUp == 0 { 16 | continue // interface down 17 | } 18 | if iface.Flags&net.FlagLoopback != 0 { 19 | continue // loopback interface 20 | } 21 | addrs, err := iface.Addrs() 22 | if err != nil { 23 | return ips 24 | } 25 | for _, addr := range addrs { 26 | var ip net.IP 27 | switch v := addr.(type) { 28 | case *net.IPNet: 29 | ip = v.IP 30 | case *net.IPAddr: 31 | ip = v.IP 32 | } 33 | if ip == nil || ip.IsLoopback() { 34 | continue 35 | } 36 | ips = append(ips, ip) 37 | } 38 | } 39 | return ips 40 | } 41 | 42 | type atomicError struct{ v atomic.Value } 43 | 44 | func (a *atomicError) Store(err error) { 45 | a.v.Store(struct{ error }{err}) 46 | } 47 | func (a *atomicError) Load() error { 48 | err, _ := a.v.Load().(struct{ error }) 49 | return err.error 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/media/media.go: -------------------------------------------------------------------------------- 1 | package media 2 | 3 | // RTCSample contains media, and the amount of samples in it 4 | type RTCSample struct { 5 | Data []byte 6 | Samples uint32 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtcp/errors.go: -------------------------------------------------------------------------------- 1 | package rtcp 2 | 3 | import "errors" 4 | 5 | var ( 6 | errInvalidTotalLost = errors.New("rtcp: invalid total lost count") 7 | errInvalidHeader = errors.New("rtcp: invalid header") 8 | errTooManyReports = errors.New("rtcp: too many reports") 9 | errTooManyChunks = errors.New("rtcp: too many chunks") 10 | errTooManySources = errors.New("rtcp: too many sources") 11 | errPacketTooShort = errors.New("rtcp: packet too short") 12 | errWrongType = errors.New("rtcp: wrong packet type") 13 | errSDESTextTooLong = errors.New("rtcp: sdes must be < 255 octets long") 14 | errSDESMissingType = errors.New("rtcp: sdes item missing type") 15 | errReasonTooLong = errors.New("rtcp: reason must be < 255 octets long") 16 | errBadVersion = errors.New("rtcp: invalid packet version") 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtcp/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package rtcp 4 | 5 | import ( 6 | "bytes" 7 | "io" 8 | ) 9 | 10 | // Fuzz implements a randomized fuzz test of the rtcp 11 | // parser using go-fuzz. 12 | // 13 | // To run the fuzzer, first download go-fuzz: 14 | // `go get github.com/dvyukov/go-fuzz/...` 15 | // 16 | // Then build the testing package: 17 | // `go-fuzz-build github.com/pions/webrtc` 18 | // 19 | // And run the fuzzer on the corpus: 20 | // ``` 21 | // mkdir workdir 22 | // 23 | // # optionally add a starter corpus of valid rtcp packets. 24 | // # the corpus should be as compact and diverse as possible. 25 | // cp -r ~/my-rtcp-packets workdir/corpus 26 | // 27 | // go-fuzz -bin=ase-fuzz.zip -workdir=workdir 28 | // ```` 29 | func Fuzz(data []byte) int { 30 | r := NewReader(bytes.NewReader(data)) 31 | for { 32 | _, data, err := r.ReadPacket() 33 | if err == io.EOF { 34 | break 35 | } 36 | if err != nil { 37 | return 0 38 | } 39 | 40 | packet, _, err := Unmarshal(data) 41 | if err != nil { 42 | return 0 43 | } 44 | 45 | if _, err := packet.Marshal(); err != nil { 46 | return 0 47 | } 48 | } 49 | 50 | return 1 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtcp/raw_packet.go: -------------------------------------------------------------------------------- 1 | package rtcp 2 | 3 | // RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when 4 | // a packet with an unknown type is encountered. 5 | type RawPacket []byte 6 | 7 | // Marshal encodes the packet in binary. 8 | func (r RawPacket) Marshal() ([]byte, error) { 9 | return r, nil 10 | } 11 | 12 | // Unmarshal decodes the packet from binary. 13 | func (r *RawPacket) Unmarshal(b []byte) error { 14 | if len(b) < (headerLength) { 15 | return errPacketTooShort 16 | } 17 | *r = b 18 | 19 | var h Header 20 | if err := h.Unmarshal(b); err != nil { 21 | return err 22 | } 23 | 24 | return nil 25 | } 26 | 27 | // Header returns the Header associated with this packet. 28 | func (r RawPacket) Header() Header { 29 | var h Header 30 | if err := h.Unmarshal(r); err != nil { 31 | return Header{} 32 | } 33 | return h 34 | } 35 | 36 | // DestinationSSRC returns an array of SSRC values that this packet refers to. 37 | func (r *RawPacket) DestinationSSRC() []uint32 { 38 | return []uint32{} 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtcp/reader.go: -------------------------------------------------------------------------------- 1 | package rtcp 2 | 3 | import "io" 4 | 5 | // A Reader reads packets from an RTCP combined packet. 6 | type Reader struct { 7 | r io.Reader 8 | } 9 | 10 | // NewReader creates a new Reader reading from r. 11 | func NewReader(r io.Reader) *Reader { 12 | return &Reader{r} 13 | } 14 | 15 | // ReadPacket reads one packet from r. 16 | // 17 | // It returns the parsed packet Header and a byte slice containing the encoded 18 | // packet data (including the header). How the packet data is parsed depends on 19 | // the Type field contained in the Header. 20 | func (r *Reader) ReadPacket() (header Header, data []byte, err error) { 21 | // First grab the header 22 | headerBuf := make([]byte, headerLength) 23 | if _, err := io.ReadFull(r.r, headerBuf); err != nil { 24 | return header, data, err 25 | } 26 | if err := header.Unmarshal(headerBuf); err != nil { 27 | return header, data, err 28 | } 29 | 30 | packetLen := (header.Length + 1) * 4 31 | 32 | // Then grab the rest 33 | bodyBuf := make([]byte, packetLen-headerLength) 34 | if _, err := io.ReadFull(r.r, bodyBuf); err != nil { 35 | return header, data, err 36 | } 37 | 38 | data = append(headerBuf, bodyBuf...) 39 | 40 | return header, data, nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtp/codecs/common.go: -------------------------------------------------------------------------------- 1 | package codecs 2 | 3 | func min(a, b int) int { 4 | if a < b { 5 | return a 6 | } 7 | return b 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtp/codecs/g722_packet.go: -------------------------------------------------------------------------------- 1 | package codecs 2 | 3 | // G722Payloader payloads G722 packets 4 | type G722Payloader struct{} 5 | 6 | // Payload fragments an G722 packet across one or more byte arrays 7 | func (p *G722Payloader) Payload(mtu int, payload []byte) [][]byte { 8 | var out [][]byte 9 | for len(payload) > mtu { 10 | o := make([]byte, mtu) 11 | copy(o, payload[:mtu]) 12 | payload = payload[mtu:] 13 | out = append(out, o) 14 | } 15 | o := make([]byte, len(payload)) 16 | copy(o, payload) 17 | return append(out, o) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtp/codecs/opus_packet.go: -------------------------------------------------------------------------------- 1 | package codecs 2 | 3 | import "github.com/pions/webrtc/pkg/rtp" 4 | 5 | // OpusPayloader payloads Opus packets 6 | type OpusPayloader struct{} 7 | 8 | // Payload fragments an Opus packet across one or more byte arrays 9 | func (p *OpusPayloader) Payload(mtu int, payload []byte) [][]byte { 10 | out := make([]byte, len(payload)) 11 | copy(out, payload) 12 | return [][]byte{out} 13 | } 14 | 15 | // OpusPacket represents the VP8 header that is stored in the payload of an RTP Packet 16 | type OpusPacket struct { 17 | Payload []byte 18 | } 19 | 20 | // Unmarshal parses the passed byte slice and stores the result in the OpusPacket this method is called upon 21 | func (p *OpusPacket) Unmarshal(packet *rtp.Packet) ([]byte, error) { 22 | p.Payload = packet.Payload 23 | return p.Payload, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/pkg/rtp/depacketizer.go: -------------------------------------------------------------------------------- 1 | package rtp 2 | 3 | // Depacketizer depacketizes a RTP payload, removing any RTP specific data from the payload 4 | type Depacketizer interface { 5 | Unmarshal(packet *Packet) ([]byte, error) 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcdtlsfingerprint.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCDtlsFingerprint specifies the hash function algorithm and certificate 4 | // fingerprint as described in https://tools.ietf.org/html/rfc4572. 5 | type RTCDtlsFingerprint struct { 6 | // Algorithm specifies one of the the hash function algorithms defined in 7 | // the 'Hash function Textual Names' registry. 8 | Algorithm string 9 | 10 | // Value specifies the value of the certificate fingerprint in lowercase 11 | // hex string as expressed utilizing the syntax of 'fingerprint' in 12 | // https://tools.ietf.org/html/rfc4572#section-5. 13 | Value string 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcdtlstransport.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCDtlsTransport allows an application access to information about the DTLS 4 | // transport over which RTP and RTCP packets are sent and received by 5 | // RTCRtpSender and RTCRtpReceiver, as well other data such as SCTP packets sent 6 | // and received by data channels. 7 | type RTCDtlsTransport struct { 8 | // Transport RTCIceTransport 9 | // State RTCDtlsTransportState 10 | 11 | // OnStateChange func() 12 | // OnError func() 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcicecomponent.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceComponent describes if the ice transport is used for RTP 4 | // (or RTCP multiplexing). 5 | type RTCIceComponent int 6 | 7 | const ( 8 | // RTCIceComponentRtp indicates that the ICE Transport is used for RTP (or 9 | // RTCP multiplexing), as defined in 10 | // https://tools.ietf.org/html/rfc5245#section-4.1.1.1. Protocols 11 | // multiplexed with RTP (e.g. data channel) share its component ID. This 12 | // represents the component-id value 1 when encoded in candidate-attribute. 13 | RTCIceComponentRtp RTCIceComponent = iota + 1 14 | 15 | // RTCIceComponentRtcp indicates that the ICE Transport is used for RTCP as 16 | // defined by https://tools.ietf.org/html/rfc5245#section-4.1.1.1. This 17 | // represents the component-id value 2 when encoded in candidate-attribute. 18 | RTCIceComponentRtcp 19 | ) 20 | 21 | // This is done this way because of a linter. 22 | const ( 23 | rtcIceComponentRtpStr = "rtp" 24 | rtcIceComponentRtcpStr = "rtcp" 25 | ) 26 | 27 | func newRTCIceComponent(raw string) RTCIceComponent { 28 | switch raw { 29 | case rtcIceComponentRtpStr: 30 | return RTCIceComponentRtp 31 | case rtcIceComponentRtcpStr: 32 | return RTCIceComponentRtcp 33 | default: 34 | return RTCIceComponent(Unknown) 35 | } 36 | } 37 | 38 | func (t RTCIceComponent) String() string { 39 | switch t { 40 | case RTCIceComponentRtp: 41 | return rtcIceComponentRtpStr 42 | case RTCIceComponentRtcp: 43 | return rtcIceComponentRtcpStr 44 | default: 45 | return ErrUnknownType.Error() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcicecredentialtype.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceCredentialType indicates the type of credentials used to connect to 4 | // an ICE server. 5 | type RTCIceCredentialType int 6 | 7 | const ( 8 | // RTCIceCredentialTypePassword describes username and pasword based 9 | // credentials as described in https://tools.ietf.org/html/rfc5389. 10 | RTCIceCredentialTypePassword RTCIceCredentialType = iota + 1 11 | 12 | // RTCIceCredentialTypeOauth describes token based credential as described 13 | // in https://tools.ietf.org/html/rfc7635. 14 | RTCIceCredentialTypeOauth 15 | ) 16 | 17 | // This is done this way because of a linter. 18 | const ( 19 | rtcIceCredentialTypePasswordStr = "password" 20 | rtcIceCredentialTypeOauthStr = "oauth" 21 | ) 22 | 23 | func newRTCIceCredentialType(raw string) RTCIceCredentialType { 24 | switch raw { 25 | case rtcIceCredentialTypePasswordStr: 26 | return RTCIceCredentialTypePassword 27 | case rtcIceCredentialTypeOauthStr: 28 | return RTCIceCredentialTypeOauth 29 | default: 30 | return RTCIceCredentialType(Unknown) 31 | } 32 | } 33 | 34 | func (t RTCIceCredentialType) String() string { 35 | switch t { 36 | case RTCIceCredentialTypePassword: 37 | return rtcIceCredentialTypePasswordStr 38 | case RTCIceCredentialTypeOauth: 39 | return rtcIceCredentialTypeOauthStr 40 | default: 41 | return ErrUnknownType.Error() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtciceprotocol.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceProtocol indicates the transport protocol type that is used in the 4 | // ice.URL structure. 5 | type RTCIceProtocol int 6 | 7 | const ( 8 | // RTCIceProtocolUDP indicates the URL uses a UDP transport. 9 | RTCIceProtocolUDP RTCIceProtocol = iota + 1 10 | 11 | // RTCIceProtocolTCP indicates the URL uses a TCP transport. 12 | RTCIceProtocolTCP 13 | ) 14 | 15 | // This is done this way because of a linter. 16 | const ( 17 | rtcIceProtocolUDPStr = "udp" 18 | rtcIceProtocolTCPStr = "tcp" 19 | ) 20 | 21 | func newRTCIceProtocol(raw string) RTCIceProtocol { 22 | switch raw { 23 | case rtcIceProtocolUDPStr: 24 | return RTCIceProtocolUDP 25 | case rtcIceProtocolTCPStr: 26 | return RTCIceProtocolTCP 27 | default: 28 | return RTCIceProtocol(Unknown) 29 | } 30 | } 31 | 32 | func (t RTCIceProtocol) String() string { 33 | switch t { 34 | case RTCIceProtocolUDP: 35 | return rtcIceProtocolUDPStr 36 | case RTCIceProtocolTCP: 37 | return rtcIceProtocolTCPStr 38 | default: 39 | return ErrUnknownType.Error() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcicerole.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceRole describes the role ice.Agent is playing in selecting the 4 | // preferred the candidate pair. 5 | type RTCIceRole int 6 | 7 | const ( 8 | // RTCIceRoleControlling indicates that the ICE agent that is responsible 9 | // for selecting the final choice of candidate pairs and signaling them 10 | // through STUN and an updated offer, if needed. In any session, one agent 11 | // is always controlling. The other is the controlled agent. 12 | RTCIceRoleControlling RTCIceRole = iota + 1 13 | 14 | // RTCIceRoleControlled indicates that an ICE agent that waits for the 15 | // controlling agent to select the final choice of candidate pairs. 16 | RTCIceRoleControlled 17 | ) 18 | 19 | // This is done this way because of a linter. 20 | const ( 21 | rtcIceRoleControllingStr = "controlling" 22 | rtcIceRoleControlledStr = "controlled" 23 | ) 24 | 25 | func newRTCIceRole(raw string) RTCIceRole { 26 | switch raw { 27 | case rtcIceRoleControllingStr: 28 | return RTCIceRoleControlling 29 | case rtcIceRoleControlledStr: 30 | return RTCIceRoleControlled 31 | default: 32 | return RTCIceRole(Unknown) 33 | } 34 | } 35 | 36 | func (t RTCIceRole) String() string { 37 | switch t { 38 | case RTCIceRoleControlling: 39 | return rtcIceRoleControllingStr 40 | case RTCIceRoleControlled: 41 | return rtcIceRoleControlledStr 42 | default: 43 | return ErrUnknownType.Error() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcicetransport.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceTransport allows an application access to information about the ICE 4 | // transport over which packets are sent and received. 5 | type RTCIceTransport struct { 6 | // Role RTCIceRole 7 | // Component RTCIceComponent 8 | // State RTCIceTransportState 9 | // gatheringState RTCIceGathererState 10 | } 11 | 12 | // func (t *RTCIceTransport) GetLocalCandidates() []RTCIceCandidate { 13 | // 14 | // } 15 | // 16 | // func (t *RTCIceTransport) GetRemoteCandidates() []RTCIceCandidate { 17 | // 18 | // } 19 | // 20 | // func (t *RTCIceTransport) GetSelectedCandidatePair() RTCIceCandidatePair { 21 | // 22 | // } 23 | // 24 | // func (t *RTCIceTransport) GetLocalParameters() RTCIceParameters { 25 | // 26 | // } 27 | // 28 | // func (t *RTCIceTransport) GetRemoteParameters() RTCIceParameters { 29 | // 30 | // } 31 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcicetransportpolicy.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCIceTransportPolicy defines the ICE candidate policy surface the 4 | // permitted candidates. Only these candidates are used for connectivity checks. 5 | type RTCIceTransportPolicy int 6 | 7 | const ( 8 | // RTCIceTransportPolicyRelay indicates only media relay candidates such 9 | // as candidates passing through a TURN server are used. 10 | RTCIceTransportPolicyRelay RTCIceTransportPolicy = iota + 1 11 | 12 | // RTCIceTransportPolicyAll indicates any type of candidate is used. 13 | RTCIceTransportPolicyAll 14 | ) 15 | 16 | // This is done this way because of a linter. 17 | const ( 18 | rtcIceTransportPolicyRelayStr = "relay" 19 | rtcIceTransportPolicyAllStr = "all" 20 | ) 21 | 22 | func newRTCIceTransportPolicy(raw string) RTCIceTransportPolicy { 23 | switch raw { 24 | case rtcIceTransportPolicyRelayStr: 25 | return RTCIceTransportPolicyRelay 26 | case rtcIceTransportPolicyAllStr: 27 | return RTCIceTransportPolicyAll 28 | default: 29 | return RTCIceTransportPolicy(Unknown) 30 | } 31 | } 32 | 33 | func (t RTCIceTransportPolicy) String() string { 34 | switch t { 35 | case RTCIceTransportPolicyRelay: 36 | return rtcIceTransportPolicyRelayStr 37 | case RTCIceTransportPolicyAll: 38 | return rtcIceTransportPolicyAllStr 39 | default: 40 | return ErrUnknownType.Error() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcoauthcredential.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCOAuthCredential represents OAuth credential information which is used by 4 | // the STUN/TURN client to connect to an ICE server as defined in 5 | // https://tools.ietf.org/html/rfc7635. Note that the kid parameter is not 6 | // located in RTCOAuthCredential, but in RTCIceServer's username member. 7 | type RTCOAuthCredential struct { 8 | // MacKey is a base64-url encoded format. It is used in STUN message 9 | // integrity hash calculation. 10 | MacKey string 11 | 12 | // AccessToken is a base64-encoded format. This is an encrypted 13 | // self-contained token that is opaque to the application. 14 | AccessToken string 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcofferansweroptions.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCOfferAnswerOptions is a base structure which describes the options that 4 | // can be used to control the offer/answer creation process. 5 | type RTCOfferAnswerOptions struct { 6 | // VoiceActivityDetection allows the application to provide information 7 | // about whether it wishes voice detection feature to be enabled or disabled. 8 | VoiceActivityDetection bool 9 | } 10 | 11 | // RTCAnswerOptions structure describes the options used to control the answer 12 | // creation process. 13 | type RTCAnswerOptions struct { 14 | RTCOfferAnswerOptions 15 | } 16 | 17 | // RTCOfferOptions structure describes the options used to control the offer 18 | // creation process 19 | type RTCOfferOptions struct { 20 | RTCOfferAnswerOptions 21 | 22 | // IceRestart forces the underlying ice gathering process to be restarted. 23 | // When this value is true, the generated description will have ICE 24 | // credentials that are different from the current credentials 25 | IceRestart bool 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcrtcpmuxpolicy.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCRtcpMuxPolicy affects what ICE candidates are gathered to support 4 | // non-multiplexed RTCP. 5 | type RTCRtcpMuxPolicy int 6 | 7 | const ( 8 | // RTCRtcpMuxPolicyNegotiate indicates to gather ICE candidates for both 9 | // RTP and RTCP candidates. If the remote-endpoint is capable of 10 | // multiplexing RTCP, multiplex RTCP on the RTP candidates. If it is not, 11 | // use both the RTP and RTCP candidates separately. 12 | RTCRtcpMuxPolicyNegotiate RTCRtcpMuxPolicy = iota + 1 13 | 14 | // RTCRtcpMuxPolicyRequire indicates to gather ICE candidates only for 15 | // RTP and multiplex RTCP on the RTP candidates. If the remote endpoint is 16 | // not capable of rtcp-mux, session negotiation will fail. 17 | RTCRtcpMuxPolicyRequire 18 | ) 19 | 20 | // This is done this way because of a linter. 21 | const ( 22 | rtcRtcpMuxPolicyNegotiateStr = "negotiate" 23 | rtcRtcpMuxPolicyRequireStr = "require" 24 | ) 25 | 26 | func newRTCRtcpMuxPolicy(raw string) RTCRtcpMuxPolicy { 27 | switch raw { 28 | case rtcRtcpMuxPolicyNegotiateStr: 29 | return RTCRtcpMuxPolicyNegotiate 30 | case rtcRtcpMuxPolicyRequireStr: 31 | return RTCRtcpMuxPolicyRequire 32 | default: 33 | return RTCRtcpMuxPolicy(Unknown) 34 | } 35 | } 36 | 37 | func (t RTCRtcpMuxPolicy) String() string { 38 | switch t { 39 | case RTCRtcpMuxPolicyNegotiate: 40 | return rtcRtcpMuxPolicyNegotiateStr 41 | case RTCRtcpMuxPolicyRequire: 42 | return rtcRtcpMuxPolicyRequireStr 43 | default: 44 | return ErrUnknownType.Error() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcrtpreceiver.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCRtpReceiver allows an application to inspect the receipt of a RTCTrack 4 | type RTCRtpReceiver struct { 5 | Track *RTCTrack 6 | // receiverTrack *RTCTrack 7 | // receiverTransport 8 | // receiverRtcpTransport 9 | } 10 | 11 | // TODO: receiving side 12 | // func newRTCRtpReceiver(kind, id string) { 13 | // 14 | // } 15 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcrtpsender.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | // RTCRtpSender allows an application to control how a given RTCTrack is encoded and transmitted to a remote peer 4 | type RTCRtpSender struct { 5 | Track *RTCTrack 6 | // senderTrack *RTCTrack 7 | // senderTransport 8 | // senderRtcpTransport 9 | } 10 | 11 | func newRTCRtpSender(track *RTCTrack) *RTCRtpSender { 12 | s := &RTCRtpSender{ 13 | Track: track, 14 | } 15 | return s 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcrtptranceiver.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // RTCRtpTransceiver represents a combination of an RTCRtpSender and an RTCRtpReceiver that share a common mid. 8 | type RTCRtpTransceiver struct { 9 | Mid string 10 | Sender *RTCRtpSender 11 | Receiver *RTCRtpReceiver 12 | Direction RTCRtpTransceiverDirection 13 | // currentDirection RTCRtpTransceiverDirection 14 | // firedDirection RTCRtpTransceiverDirection 15 | // receptive bool 16 | stopped bool 17 | } 18 | 19 | func (t *RTCRtpTransceiver) setSendingTrack(track *RTCTrack) error { 20 | t.Sender.Track = track 21 | 22 | switch t.Direction { 23 | case RTCRtpTransceiverDirectionRecvonly: 24 | t.Direction = RTCRtpTransceiverDirectionSendrecv 25 | case RTCRtpTransceiverDirectionInactive: 26 | t.Direction = RTCRtpTransceiverDirectionSendonly 27 | default: 28 | return errors.Errorf("Invalid state change in RTCRtpTransceiver.setSending") 29 | } 30 | return nil 31 | } 32 | 33 | // Stop irreversibly stops the RTCRtpTransceiver 34 | func (t *RTCRtpTransceiver) Stop() error { 35 | return errors.Errorf("TODO") 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/pions/webrtc/rtcsessiondescription.go: -------------------------------------------------------------------------------- 1 | package webrtc 2 | 3 | import ( 4 | "github.com/pions/webrtc/internal/sdp" 5 | ) 6 | 7 | // RTCSessionDescription is used to expose local and remote session descriptions. 8 | type RTCSessionDescription struct { 9 | Type RTCSdpType `json:"type"` 10 | Sdp string `json:"sdp"` 11 | 12 | // This will never be initialized by callers, internal use only 13 | parsed *sdp.SessionDescription 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.2 7 | - 1.7.1 8 | - tip 9 | 10 | script: 11 | - go test -v ./... 12 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/const_amd64.h: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html 7 | 8 | #define REDMASK51 0x0007FFFFFFFFFFFF 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/const_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | // These constants cannot be encoded in non-MOVQ immediates. 11 | // We access them directly from memory instead. 12 | 13 | DATA ·_121666_213(SB)/8, $996687872 14 | GLOBL ·_121666_213(SB), 8, $8 15 | 16 | DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA 17 | GLOBL ·_2P0(SB), 8, $8 18 | 19 | DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE 20 | GLOBL ·_2P1234(SB), 8, $8 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/cswap_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,!gccgo,!appengine 6 | 7 | // func cswap(inout *[4][5]uint64, v uint64) 8 | TEXT ·cswap(SB),7,$0 9 | MOVQ inout+0(FP),DI 10 | MOVQ v+8(FP),SI 11 | 12 | SUBQ $1, SI 13 | NOTQ SI 14 | MOVQ SI, X15 15 | PSHUFD $0x44, X15, X15 16 | 17 | MOVOU 0(DI), X0 18 | MOVOU 16(DI), X2 19 | MOVOU 32(DI), X4 20 | MOVOU 48(DI), X6 21 | MOVOU 64(DI), X8 22 | MOVOU 80(DI), X1 23 | MOVOU 96(DI), X3 24 | MOVOU 112(DI), X5 25 | MOVOU 128(DI), X7 26 | MOVOU 144(DI), X9 27 | 28 | MOVO X1, X10 29 | MOVO X3, X11 30 | MOVO X5, X12 31 | MOVO X7, X13 32 | MOVO X9, X14 33 | 34 | PXOR X0, X10 35 | PXOR X2, X11 36 | PXOR X4, X12 37 | PXOR X6, X13 38 | PXOR X8, X14 39 | PAND X15, X10 40 | PAND X15, X11 41 | PAND X15, X12 42 | PAND X15, X13 43 | PAND X15, X14 44 | PXOR X10, X0 45 | PXOR X10, X1 46 | PXOR X11, X2 47 | PXOR X11, X3 48 | PXOR X12, X4 49 | PXOR X12, X5 50 | PXOR X13, X6 51 | PXOR X13, X7 52 | PXOR X14, X8 53 | PXOR X14, X9 54 | 55 | MOVOU X0, 0(DI) 56 | MOVOU X2, 16(DI) 57 | MOVOU X4, 32(DI) 58 | MOVOU X6, 48(DI) 59 | MOVOU X8, 64(DI) 60 | MOVOU X1, 80(DI) 61 | MOVOU X3, 96(DI) 62 | MOVOU X5, 112(DI) 63 | MOVOU X7, 128(DI) 64 | MOVOU X9, 144(DI) 65 | RET 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package curve25519 provides an implementation of scalar multiplication on 6 | // the elliptic curve known as curve25519. See https://cr.yp.to/ecdh.html 7 | package curve25519 // import "golang.org/x/crypto/curve25519" 8 | 9 | // basePoint is the x coordinate of the generator of the curve. 10 | var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 11 | 12 | // ScalarMult sets dst to the product in*base where dst and base are the x 13 | // coordinates of group points and all values are in little-endian form. 14 | func ScalarMult(dst, in, base *[32]byte) { 15 | scalarMult(dst, in, base) 16 | } 17 | 18 | // ScalarBaseMult sets dst to the product in*base where dst and base are the x 19 | // coordinates of group points, base is the standard generator and all values 20 | // are in little-endian form. 21 | func ScalarBaseMult(dst, in *[32]byte) { 22 | ScalarMult(dst, in, &basePoint) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | import "fmt" 8 | 9 | // Assemble converts insts into raw instructions suitable for loading 10 | // into a BPF virtual machine. 11 | // 12 | // Currently, no optimization is attempted, the assembled program flow 13 | // is exactly as provided. 14 | func Assemble(insts []Instruction) ([]RawInstruction, error) { 15 | ret := make([]RawInstruction, len(insts)) 16 | var err error 17 | for i, inst := range insts { 18 | ret[i], err = inst.Assemble() 19 | if err != nil { 20 | return nil, fmt.Errorf("assembling instruction %d: %s", i+1, err) 21 | } 22 | } 23 | return ret, nil 24 | } 25 | 26 | // Disassemble attempts to parse raw back into 27 | // Instructions. Unrecognized RawInstructions are assumed to be an 28 | // extension not implemented by this package, and are passed through 29 | // unchanged to the output. The allDecoded value reports whether insts 30 | // contains no RawInstructions. 31 | func Disassemble(raw []RawInstruction) (insts []Instruction, allDecoded bool) { 32 | insts = make([]Instruction, len(raw)) 33 | allDecoded = true 34 | for i, r := range raw { 35 | insts[i] = r.Disassemble() 36 | if _, ok := insts[i].(RawInstruction); ok { 37 | allDecoded = false 38 | } 39 | } 40 | return insts, allDecoded 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/setter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | // A Setter is a type which can attach a compiled BPF filter to itself. 8 | type Setter interface { 9 | SetBPF(filter []RawInstruction) error 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) len() int { return int(h.Len) } 10 | func (h *cmsghdr) lvl() int { return int(h.Level) } 11 | func (h *cmsghdr) typ() int { return int(h.Type) } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) set(l, lvl, typ int) { 10 | h.Len = uint32(l) 11 | h.Level = int32(lvl) 12 | h.Type = int32(typ) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint64(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type cmsghdr struct{} 10 | 11 | const sizeofCmsghdr = 0 12 | 13 | func (h *cmsghdr) len() int { return 0 } 14 | func (h *cmsghdr) lvl() int { return 0 } 15 | func (h *cmsghdr) typ() int { return 0 } 16 | 17 | func (h *cmsghdr) set(l, lvl, typ int) {} 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | #include 15 | 16 | #define _GNU_SOURCE 17 | #include 18 | */ 19 | import "C" 20 | 21 | const ( 22 | sysAF_UNSPEC = C.AF_UNSPEC 23 | sysAF_INET = C.AF_INET 24 | sysAF_INET6 = C.AF_INET6 25 | 26 | sysSOCK_RAW = C.SOCK_RAW 27 | ) 28 | 29 | type iovec C.struct_iovec 30 | 31 | type msghdr C.struct_msghdr 32 | 33 | type mmsghdr C.struct_mmsghdr 34 | 35 | type cmsghdr C.struct_cmsghdr 36 | 37 | type sockaddrInet C.struct_sockaddr_in 38 | 39 | type sockaddrInet6 C.struct_sockaddr_in6 40 | 41 | const ( 42 | sizeofIovec = C.sizeof_struct_iovec 43 | sizeofMsghdr = C.sizeof_struct_msghdr 44 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 45 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 46 | 47 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 48 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 49 | ) 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type mmsghdr C.struct_mmsghdr 32 | 33 | type cmsghdr C.struct_cmsghdr 34 | 35 | type sockaddrInet C.struct_sockaddr_in 36 | 37 | type sockaddrInet6 C.struct_sockaddr_in6 38 | 39 | const ( 40 | sizeofIovec = C.sizeof_struct_iovec 41 | sizeofMsghdr = C.sizeof_struct_msghdr 42 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 43 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 44 | 45 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 46 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 47 | ) 48 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/empty.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | // This exists solely so we can linkname in symbols from syscall. 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/error_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | import "syscall" 10 | 11 | var ( 12 | errEAGAIN error = syscall.EAGAIN 13 | errEINVAL error = syscall.EINVAL 14 | errENOENT error = syscall.ENOENT 15 | ) 16 | 17 | // errnoErr returns common boxed Errno values, to prevent allocations 18 | // at runtime. 19 | func errnoErr(errno syscall.Errno) error { 20 | switch errno { 21 | case 0: 22 | return nil 23 | case syscall.EAGAIN: 24 | return errEAGAIN 25 | case syscall.EINVAL: 26 | return errEINVAL 27 | case syscall.ENOENT: 28 | return errENOENT 29 | } 30 | return errno 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/error_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "syscall" 8 | 9 | var ( 10 | errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING 11 | errEINVAL error = syscall.EINVAL 12 | ) 13 | 14 | // errnoErr returns common boxed Errno values, to prevent allocations 15 | // at runtime. 16 | func errnoErr(errno syscall.Errno) error { 17 | switch errno { 18 | case 0: 19 | return nil 20 | case syscall.ERROR_IO_PENDING: 21 | return errERROR_IO_PENDING 22 | case syscall.EINVAL: 23 | return errEINVAL 24 | } 25 | return errno 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 18 | v.Len = uint32(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 18 | v.Len = uint64(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*int8)(unsafe.Pointer(&b[0])) 18 | v.Len = uint64(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type iovec struct{} 10 | 11 | func (v *iovec) set(b []byte) {} 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux,!netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdr struct{} 12 | 13 | type mmsghdrs []mmsghdr 14 | 15 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 16 | return nil 17 | } 18 | 19 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdrs []mmsghdr 12 | 13 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 14 | for i := range hs { 15 | vs := make([]iovec, len(ms[i].Buffers)) 16 | var sa []byte 17 | if parseFn != nil { 18 | sa = make([]byte, sizeofSockaddrInet6) 19 | } 20 | if marshalFn != nil { 21 | sa = marshalFn(ms[i].Addr) 22 | } 23 | hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) 24 | } 25 | return nil 26 | } 27 | 28 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 29 | for i := range hs { 30 | ms[i].N = int(hs[i].Len) 31 | ms[i].NN = hs[i].Hdr.controllen() 32 | ms[i].Flags = hs[i].Hdr.flags() 33 | if parseFn != nil { 34 | var err error 35 | ms[i].Addr, err = parseFn(hs[i].Hdr.name(), hint) 36 | if err != nil { 37 | return err 38 | } 39 | } 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import "unsafe" 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 12 | for i := range vs { 13 | vs[i].set(bs[i]) 14 | } 15 | h.setIov(vs) 16 | if len(oob) > 0 { 17 | h.Control = (*byte)(unsafe.Pointer(&oob[0])) 18 | h.Controllen = uint32(len(oob)) 19 | } 20 | if sa != nil { 21 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 22 | h.Namelen = uint32(len(sa)) 23 | } 24 | } 25 | 26 | func (h *msghdr) name() []byte { 27 | if h.Name != nil && h.Namelen > 0 { 28 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 29 | } 30 | return nil 31 | } 32 | 33 | func (h *msghdr) controllen() int { 34 | return int(h.Controllen) 35 | } 36 | 37 | func (h *msghdr) flags() int { 38 | return int(h.Flags) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd 6 | 7 | package socket 8 | 9 | func (h *msghdr) setIov(vs []iovec) { 10 | l := len(vs) 11 | if l == 0 { 12 | return 13 | } 14 | h.Iov = &vs[0] 15 | h.Iovlen = int32(l) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "unsafe" 8 | 9 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 10 | for i := range vs { 11 | vs[i].set(bs[i]) 12 | } 13 | h.setIov(vs) 14 | if len(oob) > 0 { 15 | h.setControl(oob) 16 | } 17 | if sa != nil { 18 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 19 | h.Namelen = uint32(len(sa)) 20 | } 21 | } 22 | 23 | func (h *msghdr) name() []byte { 24 | if h.Name != nil && h.Namelen > 0 { 25 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 26 | } 27 | return nil 28 | } 29 | 30 | func (h *msghdr) controllen() int { 31 | return int(h.Controllen) 32 | } 33 | 34 | func (h *msghdr) flags() int { 35 | return int(h.Flags) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | l := len(vs) 14 | if l == 0 { 15 | return 16 | } 17 | h.Iov = &vs[0] 18 | h.Iovlen = uint32(l) 19 | } 20 | 21 | func (h *msghdr) setControl(b []byte) { 22 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 23 | h.Controllen = uint32(len(b)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | l := len(vs) 14 | if l == 0 { 15 | return 16 | } 17 | h.Iov = &vs[0] 18 | h.Iovlen = uint64(l) 19 | } 20 | 21 | func (h *msghdr) setControl(b []byte) { 22 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 23 | h.Controllen = uint64(len(b)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func (h *msghdr) setIov(vs []iovec) { 8 | l := len(vs) 9 | if l == 0 { 10 | return 11 | } 12 | h.Iov = &vs[0] 13 | h.Iovlen = uint32(l) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 13 | for i := range vs { 14 | vs[i].set(bs[i]) 15 | } 16 | if len(vs) > 0 { 17 | h.Iov = &vs[0] 18 | h.Iovlen = int32(len(vs)) 19 | } 20 | if len(oob) > 0 { 21 | h.Accrights = (*int8)(unsafe.Pointer(&oob[0])) 22 | h.Accrightslen = int32(len(oob)) 23 | } 24 | if sa != nil { 25 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 26 | h.Namelen = uint32(len(sa)) 27 | } 28 | } 29 | 30 | func (h *msghdr) controllen() int { 31 | return int(h.Accrightslen) 32 | } 33 | 34 | func (h *msghdr) flags() int { 35 | return int(NativeEndian.Uint32(h.Pad_cgo_2[:])) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type msghdr struct{} 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {} 12 | func (h *msghdr) name() []byte { return nil } 13 | func (h *msghdr) controllen() int { return 0 } 14 | func (h *msghdr) flags() int { return 0 } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | // +build !linux 7 | 8 | package socket 9 | 10 | import "errors" 11 | 12 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 13 | return 0, errors.New("not implemented") 14 | } 15 | 16 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 17 | return 0, errors.New("not implemented") 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 7 | 8 | package socket 9 | 10 | import "errors" 11 | 12 | func (c *Conn) recvMsg(m *Message, flags int) error { 13 | return errors.New("not implemented") 14 | } 15 | 16 | func (c *Conn) sendMsg(m *Message, flags int) error { 17 | return errors.New("not implemented") 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package socket 8 | 9 | import "errors" 10 | 11 | func (c *Conn) recvMsg(m *Message, flags int) error { 12 | return errors.New("not implemented") 13 | } 14 | 15 | func (c *Conn) sendMsg(m *Message, flags int) error { 16 | return errors.New("not implemented") 17 | } 18 | 19 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 20 | return 0, errors.New("not implemented") 21 | } 22 | 23 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 24 | return 0, errors.New("not implemented") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "encoding/binary" 9 | "unsafe" 10 | ) 11 | 12 | var ( 13 | // NativeEndian is the machine native endian implementation of 14 | // ByteOrder. 15 | NativeEndian binary.ByteOrder 16 | 17 | kernelAlign int 18 | ) 19 | 20 | func init() { 21 | i := uint32(1) 22 | b := (*[4]byte)(unsafe.Pointer(&i)) 23 | if b[0] == 1 { 24 | NativeEndian = binary.LittleEndian 25 | } else { 26 | NativeEndian = binary.BigEndian 27 | } 28 | kernelAlign = probeProtocolStack() 29 | } 30 | 31 | func roundup(l int) int { 32 | return (l + kernelAlign - 1) & ^(kernelAlign - 1) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd openbsd 6 | 7 | package socket 8 | 9 | import "errors" 10 | 11 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 12 | return 0, errors.New("not implemented") 13 | } 14 | 15 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 16 | return 0, errors.New("not implemented") 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | func probeProtocolStack() int { 15 | if runtime.GOOS == "openbsd" && runtime.GOARCH == "arm" { 16 | return 8 17 | } 18 | var p uintptr 19 | return int(unsafe.Sizeof(p)) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.12 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 15 | l := uint32(len(b)) 16 | _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 17 | return int(l), errnoErr(errno) 18 | } 19 | 20 | func setsockopt(s uintptr, level, name int, b []byte) error { 21 | _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 22 | return errnoErr(errno) 23 | } 24 | 25 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 26 | n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 27 | return int(n), errnoErr(errno) 28 | } 29 | 30 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 31 | n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 32 | return int(n), errnoErr(errno) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!s390x,!386 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func probeProtocolStack() int { 15 | var p uintptr 16 | return int(unsafe.Sizeof(p)) 17 | } 18 | 19 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 20 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 21 | return int(n), errnoErr(errno) 22 | } 23 | 24 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 25 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 26 | return int(n), errnoErr(errno) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-36 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x12b 9 | sysSENDMMSG = 0x133 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x16d 9 | sysSENDMMSG = 0x176 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0xf3 9 | sysSENDMMSG = 0x10d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-72 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-72 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | const ( 13 | sysRECVMMSG = 0x1db 14 | sysSENDMMSG = 0x1dc 15 | ) 16 | 17 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 18 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 19 | return int(n), errnoErr(errno) 20 | } 21 | 22 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 23 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 24 | return int(n), errnoErr(errno) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 8 | JMP syscall·sysvicall6(SB) 9 | 10 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 11 | JMP syscall·rawSysvicall6(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd linux,!s390x,!386 netbsd openbsd 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 15 | l := uint32(len(b)) 16 | _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 17 | return int(l), errnoErr(errno) 18 | } 19 | 20 | func setsockopt(s uintptr, level, name int, b []byte) error { 21 | _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 22 | return errnoErr(errno) 23 | } 24 | 25 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 26 | n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 27 | return int(n), errnoErr(errno) 28 | } 29 | 30 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 31 | n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 32 | return int(n), errnoErr(errno) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Len uint8 42 | Family uint8 43 | Port uint16 44 | Addr [4]byte /* in_addr */ 45 | Zero [8]int8 46 | } 47 | 48 | type sockaddrInet6 struct { 49 | Len uint8 50 | Family uint8 51 | Port uint16 52 | Flowinfo uint32 53 | Addr [16]byte /* in6_addr */ 54 | Scope_id uint32 55 | } 56 | 57 | const ( 58 | sizeofIovec = 0x8 59 | sizeofMsghdr = 0x1c 60 | sizeofMmsghdr = 0x20 61 | sizeofCmsghdr = 0xc 62 | 63 | sizeofSockaddrInet = 0x10 64 | sizeofSockaddrInet6 = 0x1c 65 | ) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint32 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Addr [4]byte /* in_addr */ 48 | Zero [8]int8 49 | } 50 | 51 | type sockaddrInet6 struct { 52 | Len uint8 53 | Family uint8 54 | Port uint16 55 | Flowinfo uint32 56 | Addr [16]byte /* in6_addr */ 57 | Scope_id uint32 58 | } 59 | 60 | const ( 61 | sizeofIovec = 0x10 62 | sizeofMsghdr = 0x30 63 | sizeofMmsghdr = 0x40 64 | sizeofCmsghdr = 0xc 65 | 66 | sizeofSockaddrInet = 0x10 67 | sizeofSockaddrInet6 = 0x1c 68 | ) 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Len uint8 42 | Family uint8 43 | Port uint16 44 | Addr [4]byte /* in_addr */ 45 | Zero [8]int8 46 | } 47 | 48 | type sockaddrInet6 struct { 49 | Len uint8 50 | Family uint8 51 | Port uint16 52 | Flowinfo uint32 53 | Addr [16]byte /* in6_addr */ 54 | Scope_id uint32 55 | } 56 | 57 | const ( 58 | sizeofIovec = 0x8 59 | sizeofMsghdr = 0x1c 60 | sizeofMmsghdr = 0x20 61 | sizeofCmsghdr = 0xc 62 | 63 | sizeofSockaddrInet = 0x10 64 | sizeofSockaddrInet6 = 0x1c 65 | ) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_solaris.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1a 10 | 11 | sysSOCK_RAW = 0x4 12 | ) 13 | 14 | type iovec struct { 15 | Base *int8 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Accrights *int8 27 | Accrightslen int32 28 | Pad_cgo_2 [4]byte 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Family uint16 39 | Port uint16 40 | Addr [4]byte /* in_addr */ 41 | Zero [8]int8 42 | } 43 | 44 | type sockaddrInet6 struct { 45 | Family uint16 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | X__sin6_src_id uint32 51 | } 52 | 53 | const ( 54 | sizeofIovec = 0x10 55 | sizeofMsghdr = 0x30 56 | sizeofCmsghdr = 0xc 57 | 58 | sizeofSockaddrInet = 0x10 59 | sizeofSockaddrInet6 = 0x20 60 | ) 61 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | "golang.org/x/net/internal/socket" 16 | ) 17 | 18 | func marshalDst(b []byte, cm *ControlMessage) []byte { 19 | m := socket.ControlMessage(b) 20 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len) 21 | return m.Next(net.IPv4len) 22 | } 23 | 24 | func parseDst(cm *ControlMessage, b []byte) { 25 | if len(cm.Dst) < net.IPv4len { 26 | cm.Dst = make(net.IP, net.IPv4len) 27 | } 28 | copy(cm.Dst, b[:net.IPv4len]) 29 | } 30 | 31 | func marshalInterface(b []byte, cm *ControlMessage) []byte { 32 | m := socket.ControlMessage(b) 33 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink) 34 | return m.Next(syscall.SizeofSockaddrDatalink) 35 | } 36 | 37 | func parseInterface(cm *ControlMessage, b []byte) { 38 | sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0])) 39 | cm.IfIndex = int(sadl.Index) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_pktinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/iana" 14 | "golang.org/x/net/internal/socket" 15 | ) 16 | 17 | func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { 18 | m := socket.ControlMessage(b) 19 | m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) 20 | if cm != nil { 21 | pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) 22 | if ip := cm.Src.To4(); ip != nil { 23 | copy(pi.Spec_dst[:], ip) 24 | } 25 | if cm.IfIndex > 0 { 26 | pi.setIfindex(cm.IfIndex) 27 | } 28 | } 29 | return m.Next(sizeofInetPktinfo) 30 | } 31 | 32 | func parsePacketInfo(cm *ControlMessage, b []byte) { 33 | pi := (*inetPktinfo)(unsafe.Pointer(&b[0])) 34 | cm.IfIndex = int(pi.Ifindex) 35 | if len(cm.Dst) < net.IPv4len { 36 | cm.Dst = make(net.IP, net.IPv4len) 37 | } 38 | copy(cm.Dst, pi.Addr[:]) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errOpNoSupport 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "syscall" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 14 | // TODO(mikio): implement this 15 | return syscall.EWINDOWS 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF 32 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 33 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 34 | 35 | sizeofIPMreq = C.sizeof_struct_ip_mreq 36 | ) 37 | 38 | type ipMreq C.struct_ip_mreq 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/genericopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | // TOS returns the type-of-service field value for outgoing packets. 8 | func (c *genericOpt) TOS() (int, error) { 9 | if !c.ok() { 10 | return 0, errInvalidConn 11 | } 12 | so, ok := sockOpts[ssoTOS] 13 | if !ok { 14 | return 0, errOpNoSupport 15 | } 16 | return so.GetInt(c.Conn) 17 | } 18 | 19 | // SetTOS sets the type-of-service field value for future outgoing 20 | // packets. 21 | func (c *genericOpt) SetTOS(tos int) error { 22 | if !c.ok() { 23 | return errInvalidConn 24 | } 25 | so, ok := sockOpts[ssoTOS] 26 | if !ok { 27 | return errOpNoSupport 28 | } 29 | return so.SetInt(c.Conn, tos) 30 | } 31 | 32 | // TTL returns the time-to-live field value for outgoing packets. 33 | func (c *genericOpt) TTL() (int, error) { 34 | if !c.ok() { 35 | return 0, errInvalidConn 36 | } 37 | so, ok := sockOpts[ssoTTL] 38 | if !ok { 39 | return 0, errOpNoSupport 40 | } 41 | return so.GetInt(c.Conn) 42 | } 43 | 44 | // SetTTL sets the time-to-live field value for future outgoing 45 | // packets. 46 | func (c *genericOpt) SetTTL(ttl int) error { 47 | if !c.ok() { 48 | return errInvalidConn 49 | } 50 | so, ok := sockOpts[ssoTTL] 51 | if !ok { 52 | return errOpNoSupport 53 | } 54 | return so.SetInt(c.Conn, ttl) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/icmp_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | func (f *icmpFilter) accept(typ ICMPType) { 8 | f.Data &^= 1 << (uint32(typ) & 31) 9 | } 10 | 11 | func (f *icmpFilter) block(typ ICMPType) { 12 | f.Data |= 1 << (uint32(typ) & 31) 13 | } 14 | 15 | func (f *icmpFilter) setAll(block bool) { 16 | if block { 17 | f.Data = 1<<32 - 1 18 | } else { 19 | f.Data = 0 20 | } 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return f.Data&(1<<(uint32(typ)&31)) != 0 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/icmp_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | const sizeofICMPFilter = 0x0 10 | 11 | type icmpFilter struct { 12 | } 13 | 14 | func (f *icmpFilter) accept(typ ICMPType) { 15 | } 16 | 17 | func (f *icmpFilter) block(typ ICMPType) { 18 | } 19 | 20 | func (f *icmpFilter) setAll(block bool) { 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/packet_go1_8.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | func (c *packetHandler) readFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) { 12 | c.rawOpt.RLock() 13 | oob := NewControlMessage(c.rawOpt.cflags) 14 | c.rawOpt.RUnlock() 15 | n, nn, _, src, err := c.ReadMsgIP(b, oob) 16 | if err != nil { 17 | return nil, nil, nil, err 18 | } 19 | var hs []byte 20 | if hs, p, err = slicePacket(b[:n]); err != nil { 21 | return nil, nil, nil, err 22 | } 23 | if h, err = ParseHeader(hs); err != nil { 24 | return nil, nil, nil, err 25 | } 26 | if nn > 0 { 27 | cm = new(ControlMessage) 28 | if err := cm.Parse(oob[:nn]); err != nil { 29 | return nil, nil, nil, err 30 | } 31 | } 32 | if src != nil && cm != nil { 33 | cm.Src = src.IP 34 | } 35 | return 36 | } 37 | 38 | func (c *packetHandler) writeTo(h *Header, p []byte, cm *ControlMessage) error { 39 | oob := cm.Marshal() 40 | wh, err := h.Marshal() 41 | if err != nil { 42 | return err 43 | } 44 | dst := new(net.IPAddr) 45 | if cm != nil { 46 | if ip := cm.Dst.To4(); ip != nil { 47 | dst.IP = ip 48 | } 49 | } 50 | if dst.IP == nil { 51 | dst.IP = h.Dst 52 | } 53 | wh = append(wh, p...) 54 | _, _, err = c.WriteMsgIP(wh, oob, dst) 55 | return err 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "net" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | // BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo 14 | // methods of PacketConn is not implemented. 15 | 16 | // A payloadHandler represents the IPv4 datagram payload handler. 17 | type payloadHandler struct { 18 | net.PacketConn 19 | *socket.Conn 20 | rawOpt 21 | } 22 | 23 | func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload_cmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | // ReadFrom reads a payload of the received IPv4 datagram, from the 12 | // endpoint c, copying the payload into b. It returns the number of 13 | // bytes copied into b, the control message cm and the source address 14 | // src of the received datagram. 15 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 16 | if !c.ok() { 17 | return 0, nil, nil, errInvalidConn 18 | } 19 | return c.readFrom(b) 20 | } 21 | 22 | // WriteTo writes a payload of the IPv4 datagram, to the destination 23 | // address dst through the endpoint c, copying the payload from b. It 24 | // returns the number of bytes written. The control message cm allows 25 | // the datagram path and the outgoing interface to be specified. 26 | // Currently only Darwin and Linux support this. The cm may be nil if 27 | // control of the outgoing datagram is not required. 28 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 29 | if !c.ok() { 30 | return 0, errInvalidConn 31 | } 32 | return c.writeTo(b, cm, dst) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload_nocmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | // ReadFrom reads a payload of the received IPv4 datagram, from the 12 | // endpoint c, copying the payload into b. It returns the number of 13 | // bytes copied into b, the control message cm and the source address 14 | // src of the received datagram. 15 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 16 | if !c.ok() { 17 | return 0, nil, nil, errInvalidConn 18 | } 19 | if n, src, err = c.PacketConn.ReadFrom(b); err != nil { 20 | return 0, nil, nil, err 21 | } 22 | return 23 | } 24 | 25 | // WriteTo writes a payload of the IPv4 datagram, to the destination 26 | // address dst through the endpoint c, copying the payload from b. It 27 | // returns the number of bytes written. The control message cm allows 28 | // the datagram path and the outgoing interface to be specified. 29 | // Currently only Darwin and Linux support this. The cm may be nil if 30 | // control of the outgoing datagram is not required. 31 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 32 | if !c.ok() { 33 | return 0, errInvalidConn 34 | } 35 | if dst == nil { 36 | return 0, errMissingAddress 37 | } 38 | return c.PacketConn.WriteTo(b, dst) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { 17 | return nil, errOpNoSupport 18 | } 19 | 20 | func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { 21 | return errOpNoSupport 22 | } 23 | 24 | func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { 25 | return nil, errOpNoSupport 26 | } 27 | 28 | func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { 29 | return errOpNoSupport 30 | } 31 | 32 | func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | return errOpNoSupport 34 | } 35 | 36 | func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 37 | return errOpNoSupport 38 | } 39 | 40 | func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { 41 | return errOpNoSupport 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) { 20 | return nil, errOpNoSupport 21 | } 22 | 23 | func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error { 24 | return errOpNoSupport 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreqn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 17 | b := make([]byte, so.Len) 18 | if _, err := so.Get(c, b); err != nil { 19 | return nil, err 20 | } 21 | mreqn := (*ipMreqn)(unsafe.Pointer(&b[0])) 22 | if mreqn.Ifindex == 0 { 23 | return nil, nil 24 | } 25 | ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex)) 26 | if err != nil { 27 | return nil, err 28 | } 29 | return ifi, nil 30 | } 31 | 32 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | var mreqn ipMreqn 34 | if ifi != nil { 35 | mreqn.Ifindex = int32(ifi.Index) 36 | } 37 | if grp != nil { 38 | mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} 39 | } 40 | b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn] 41 | return so.Set(c, b) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 16 | return nil, errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 20 | return errOpNoSupport 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_bpf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 17 | prog := sockFProg{ 18 | Len: uint16(len(f)), 19 | Filter: (*sockFilter)(unsafe.Pointer(&f[0])), 20 | } 21 | b := (*[sizeofSockFprog]byte)(unsafe.Pointer(&prog))[:sizeofSockFprog] 22 | return so.Set(c, b) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errOpNoSupport 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_ssmreq.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | var freebsd32o64 bool 17 | 18 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 19 | var gr groupReq 20 | if ifi != nil { 21 | gr.Interface = uint32(ifi.Index) 22 | } 23 | gr.setGroup(grp) 24 | var b []byte 25 | if freebsd32o64 { 26 | var d [sizeofGroupReq + 4]byte 27 | s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) 28 | copy(d[:4], s[:4]) 29 | copy(d[8:], s[4:]) 30 | b = d[:] 31 | } else { 32 | b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] 33 | } 34 | return so.Set(c, b) 35 | } 36 | 37 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 38 | var gsr groupSourceReq 39 | if ifi != nil { 40 | gsr.Interface = uint32(ifi.Index) 41 | } 42 | gsr.setSourceGroup(grp, src) 43 | var b []byte 44 | if freebsd32o64 { 45 | var d [sizeofGroupSourceReq + 4]byte 46 | s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) 47 | copy(d[:4], s[:4]) 48 | copy(d[8:], s[4:]) 49 | b = d[:] 50 | } else { 51 | b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] 52 | } 53 | return so.Set(c, b) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux,!solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 20 | return errOpNoSupport 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x41 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_MULTICAST_VIF = 0xe 22 | sysIP_ADD_MEMBERSHIP = 0xc 23 | sysIP_DROP_MEMBERSHIP = 0xd 24 | 25 | sizeofIPMreq = 0x8 26 | ) 27 | 28 | type ipMreq struct { 29 | Multiaddr [4]byte /* in_addr */ 30 | Interface [4]byte /* in_addr */ 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x17 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x1e 16 | sysIP_RECVTTL = 0x1f 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/google/uuid v1.0.0 2 | github.com/google/uuid 3 | # github.com/pions/dtls v1.0.2 4 | github.com/pions/dtls/pkg/dtls 5 | github.com/pions/dtls/pkg/dtls/internal/udp 6 | # github.com/pions/pkg v0.0.0-20181115215726-b60cd756f712 7 | github.com/pions/pkg/stun 8 | # github.com/pions/webrtc v1.2.0 9 | github.com/pions/webrtc 10 | github.com/pions/webrtc/pkg/datachannel 11 | github.com/pions/webrtc/pkg/ice 12 | github.com/pions/webrtc/internal/datachannel 13 | github.com/pions/webrtc/internal/network 14 | github.com/pions/webrtc/internal/sdp 15 | github.com/pions/webrtc/pkg/media 16 | github.com/pions/webrtc/pkg/rtcerr 17 | github.com/pions/webrtc/pkg/rtcp 18 | github.com/pions/webrtc/pkg/rtp 19 | github.com/pions/webrtc/pkg/rtp/codecs 20 | github.com/pions/webrtc/internal/util 21 | github.com/pions/webrtc/internal/sctp 22 | github.com/pions/webrtc/internal/mux 23 | github.com/pions/webrtc/internal/srtp 24 | # github.com/pkg/errors v0.8.0 25 | github.com/pkg/errors 26 | # golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 27 | golang.org/x/crypto/curve25519 28 | # golang.org/x/net v0.0.0-20181220203305-927f97764cc3 29 | golang.org/x/net/ipv4 30 | golang.org/x/net/bpf 31 | golang.org/x/net/internal/iana 32 | golang.org/x/net/internal/socket 33 | --------------------------------------------------------------------------------