Code Monkey home page Code Monkey logo

cobalt-rs's Introduction

cobalt Build Status Build status Crates.io License Coverage Status

A rust based networking library providing virtual connections over UDP with an included message layer supporting both unreliable messaging and reliable messages with optional in-order delivery.

Usage

Add this to your Cargo.toml:

[dependencies]
cobalt = "0.22.0"

and this to your crate root:

extern crate cobalt;

For usage examples please refer to the documentation of the libraries server and client abstractions.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

cobalt-rs's People

Contributors

bonsaiden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cobalt-rs's Issues

Better control over instant queue needed.

In current cobalt, instant messages are put in a queue and guaranteed to be given to the OS at some point, even when being rate limited due to a congested state.

This is probably a good default behavior, but for example in multiplayer game networking, it is not unusual to have types of messages where newer ones completely supersede older ones and keeping obsolete messages around to send them later is actually harmful.

One way to better support this use case would be to add another MessageKind which acts like Instant, except that all messages of this kind are cleared from the message queue after each call to Connection::send_packet.

Another, somewhat lower level, way would be to allow the application to attach some kind of application defined type id (maybe just an u8 or u32) to each (Instant) message and have a method to remove all messages of a certain type from the message queue.

Or you could have a new MessageQueueFilter type parameter on Connection, which also defines some kind of meta data to be attached to each message and has a filter method to decide whether to drop a message from the queue. This is of course a major change and might not be the best idea. This would however allow applications to, for example, drop messages if they aren't sent out within a certain time frame.

Occassional PacketLost spam

I'm not sure what's causing this, sometimes when I start up my project, it will spam PacketLost after connecting even though no packets are going out anyways.

Relicense under dual MIT/Apache-2.0

Why?

The MIT license requires reproducing countless copies of the same copyright
header with different names in the copyright field, for every MIT library in
use. The Apache license does not have this drawback, and has protections from
patent trolls and an explicit contribution licensing clause. However, the
Apache license is incompatible with GPLv2. This is why Rust is dual-licensed as
MIT/Apache (the "primary" license being Apache, MIT only for GPLv2 compat), and
doing so would be wise for this project. This also makes this crate suitable
for inclusion in the Rust standard distribution and other project using dual
MIT/Apache.

How?

To do this, get explicit approval from each contributor of copyrightable work
(as not all contributions qualify for copyright) and then add the following to
your README:

## License

Licensed under either of
 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you shall be dual licensed as above, without any
additional terms or conditions.

and in your license headers, use the following boilerplate (based on that used in Rust):

// Copyright (c) 2015 t developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.

And don't forget to update the license metadata in your Cargo.toml!

Contributor checkoff

Encryption via Session Keys

I propose per packet encryption via session keys per packet when connecting to the server for the first time. The session key (a symmetric key) will be generated for both the client and server using a public key (an asymmetric key) using something like the Diffie–Hellman key exchange protocol.

After the session key is established per connection; we use the session key to encrypt outgoing client traffic and decrypt it at the server, and vice-versa because the client and server now share a secret key.

There are already a few crypto libraries for Rust such as Ring, and bindings to OpenSSL that could be used.

Of course, this is just an idea, and there might be a better way to go about encrypting network traffic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.