mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-01 09:35:33 +00:00
set DEFAULT_PORT cost as global
This commit is contained in:
parent
ffda3d27e3
commit
b9be89ca0f
3 changed files with 8 additions and 3 deletions
|
|
@ -17,7 +17,6 @@ use gio::{
|
||||||
};
|
};
|
||||||
use glib::{Bytes, Priority, Uri};
|
use glib::{Bytes, Priority, Uri};
|
||||||
|
|
||||||
pub const DEFAULT_PORT: u16 = 1965;
|
|
||||||
pub const DEFAULT_TIMEOUT: u32 = 10;
|
pub const DEFAULT_TIMEOUT: u32 = 10;
|
||||||
|
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
|
|
@ -51,7 +50,7 @@ impl Client {
|
||||||
certificate: Option<TlsCertificate>,
|
certificate: Option<TlsCertificate>,
|
||||||
callback: impl Fn(Result<Response, Error>) + 'static,
|
callback: impl Fn(Result<Response, Error>) + 'static,
|
||||||
) {
|
) {
|
||||||
match crate::gio::network_address::from_uri(&uri, DEFAULT_PORT) {
|
match crate::gio::network_address::from_uri(&uri, crate::DEFAULT_PORT) {
|
||||||
Ok(network_address) => {
|
Ok(network_address) => {
|
||||||
self.socket.connect_async(
|
self.socket.connect_async(
|
||||||
&network_address.clone(),
|
&network_address.clone(),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
|
|
||||||
use crate::client::DEFAULT_PORT;
|
use crate::DEFAULT_PORT;
|
||||||
use gio::NetworkAddress;
|
use gio::NetworkAddress;
|
||||||
use glib::{GString, Uri, UriFlags, UriHideFlags};
|
use glib::{GString, Uri, UriFlags, UriHideFlags};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod gio;
|
pub mod gio;
|
||||||
|
|
||||||
|
// Main API
|
||||||
|
|
||||||
pub use client::Client;
|
pub use client::Client;
|
||||||
|
|
||||||
|
// Global defaults
|
||||||
|
|
||||||
|
pub const DEFAULT_PORT: u16 = 1965;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue