Skip to content

Commit 76b365a

Browse files
committed
Fix URLs in doc
1 parent 2a780ba commit 76b365a

File tree

6 files changed

+32
-43
lines changed

6 files changed

+32
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This repo hosts at [socks5-impl](https://github.com/ssrlive/socks5-impl/tree/mas
2222

2323
## Usage
2424

25-
The entry point of this crate is [`socks5_impl::server::Server`](https://docs.rs/socks5-impl/latest/socks5_impl/server/struct.Server.html).
25+
The entry point of this crate is [`socks5_impl::server::Server`](crate::server::Server).
2626

2727
Check [examples](https://github.com/ssrlive/socks5-impl/tree/master/examples) for usage examples.
2828

src/server/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use tokio::net::TcpStream;
66

77
/// This trait is for defining the socks5 authentication method.
88
///
9-
/// Pre-defined authentication methods can be found in the [`auth`](https://docs.rs/socks5-impl/latest/socks5_impl/server/auth/index.html) module.
9+
/// Pre-defined authentication methods can be found in the [`auth`](crate::server::auth) module.
1010
///
1111
/// You can create your own authentication method by implementing this trait. Since GAT is not stabled yet,
1212
/// [async_trait](https://docs.rs/async-trait/latest/async_trait/index.html) needs to be used.

src/server/connection/associate.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ impl<S: Default> UdpAssociate<S> {
5757

5858
/// Reads the linger duration for this socket by getting the `SO_LINGER` option.
5959
///
60-
/// For more information about this option, see
61-
/// [set_linger](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Connect.html#method.set_linger).
60+
/// For more information about this option, see [`set_linger`](#method.set_linger).
6261
#[inline]
6362
pub fn linger(&self) -> std::io::Result<Option<Duration>> {
6463
self.stream.linger()
@@ -78,8 +77,7 @@ impl<S: Default> UdpAssociate<S> {
7877

7978
/// Gets the value of the `TCP_NODELAY` option on this socket.
8079
///
81-
/// For more information about this option, see
82-
/// [set_nodelay](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Connect.html#method.set_nodelay).
80+
/// For more information about this option, see [`set_nodelay`](#method.set_nodelay).
8381
#[inline]
8482
pub fn nodelay(&self) -> std::io::Result<bool> {
8583
self.stream.nodelay()
@@ -96,8 +94,7 @@ impl<S: Default> UdpAssociate<S> {
9694

9795
/// Gets the value of the `IP_TTL` option for this socket.
9896
///
99-
/// For more information about this option, see
100-
/// [set_ttl](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Connect.html#method.set_ttl).
97+
/// For more information about this option, see [`set_ttl`](#method.set_ttl).
10198
pub fn ttl(&self) -> std::io::Result<u32> {
10299
self.stream.ttl()
103100
}
@@ -191,8 +188,7 @@ impl<S> From<UdpAssociate<S>> for TcpStream {
191188
///
192189
/// This struct can also be revert into a raw tokio UDP socket with [`UdpSocket::from::<AssociatedUdpSocket>()`](#impl-From<AssociatedUdpSocket>).
193190
///
194-
/// [`AssociatedUdpSocket`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/associate/struct.AssociatedUdpSocket.html)
195-
/// can be used as the associated UDP socket.
191+
/// [`AssociatedUdpSocket`] can be used as the associated UDP socket.
196192
#[derive(Debug)]
197193
pub struct AssociatedUdpSocket {
198194
socket: UdpSocket,

src/server/connection/bind.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use tokio::{
1616

1717
/// Socks5 command type `Bind`
1818
///
19-
/// By [`wait_request()`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html#method.wait_request)
20-
/// on an [`Authenticated`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html) from SOCKS5 client,
19+
/// By [`wait_request`](crate::server::connection::Authenticated::wait_request)
20+
/// on an [`Authenticated`](crate::server::connection::Authenticated) from SOCKS5 client,
2121
/// you may get a `Bind<NeedFirstReply>`. After replying the client 2 times
22-
/// using [`reply()`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.reply),
22+
/// using [`reply()`](crate::server::connection::Bind::reply),
2323
/// you will get a `Bind<Ready>`, which can be used as a regular async TCP stream.
2424
///
2525
/// A `Bind<S>` can be converted to a regular tokio [`TcpStream`](https://docs.rs/tokio/latest/tokio/net/struct.TcpStream.html) by using the `From` trait.
@@ -79,8 +79,7 @@ impl Bind<NeedFirstReply> {
7979

8080
/// Reads the linger duration for this socket by getting the `SO_LINGER` option.
8181
///
82-
/// For more information about this option, see
83-
/// [set_linger](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_linger).
82+
/// For more information about this option, see [`set_linger`](crate::server::connection::Bind::set_linger).
8483
#[inline]
8584
pub fn linger(&self) -> std::io::Result<Option<Duration>> {
8685
self.stream.linger()
@@ -100,8 +99,7 @@ impl Bind<NeedFirstReply> {
10099

101100
/// Gets the value of the `TCP_NODELAY` option on this socket.
102101
///
103-
/// For more information about this option, see
104-
/// [set_nodelay](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_nodelay).
102+
/// For more information about this option, see [`set_nodelay`](crate::server::connection::Bind::set_nodelay).
105103
#[inline]
106104
pub fn nodelay(&self) -> std::io::Result<bool> {
107105
self.stream.nodelay()
@@ -118,8 +116,7 @@ impl Bind<NeedFirstReply> {
118116

119117
/// Gets the value of the `IP_TTL` option for this socket.
120118
///
121-
/// For more information about this option, see
122-
/// [set_ttl](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_ttl).
119+
/// For more information about this option, see [`set_ttl`](crate::server::connection::Bind::set_ttl).
123120
pub fn ttl(&self) -> std::io::Result<u32> {
124121
self.stream.ttl()
125122
}
@@ -174,8 +171,7 @@ impl Bind<NeedSecondReply> {
174171

175172
/// Reads the linger duration for this socket by getting the `SO_LINGER` option.
176173
///
177-
/// For more information about this option, see
178-
/// [set_linger](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_linger).
174+
/// For more information about this option, see [`set_linger`](crate::server::connection::Bind::set_linger).
179175
#[inline]
180176
pub fn linger(&self) -> std::io::Result<Option<Duration>> {
181177
self.stream.linger()
@@ -196,7 +192,7 @@ impl Bind<NeedSecondReply> {
196192
/// Gets the value of the `TCP_NODELAY` option on this socket.
197193
///
198194
/// For more information about this option, see
199-
/// [set_nodelay](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_nodelay).
195+
/// [`set_nodelay`](crate::server::connection::Bind::set_nodelay).
200196
#[inline]
201197
pub fn nodelay(&self) -> std::io::Result<bool> {
202198
self.stream.nodelay()
@@ -213,8 +209,7 @@ impl Bind<NeedSecondReply> {
213209

214210
/// Gets the value of the `IP_TTL` option for this socket.
215211
///
216-
/// For more information about this option, see
217-
/// [set_ttl](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Bind.html#method.set_ttl).
212+
/// For more information about this option, see [`set_ttl`](crate::server::connection::Bind::set_ttl).
218213
pub fn ttl(&self) -> std::io::Result<u32> {
219214
self.stream.ttl()
220215
}

src/server/connection/mod.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub mod associate;
1010
pub mod bind;
1111
pub mod connect;
1212

13-
/// An incoming connection. This may not be a valid socks5 connection. You need to call [`handshake()`](#method.handshake)
13+
/// An incoming connection. This may not be a valid socks5 connection. You need to call [`authenticate()`](#method.authenticate)
1414
/// to perform the socks5 handshake. It will be converted to a proper socks5 connection after the handshake succeeds.
1515
pub struct IncomingConnection<O> {
1616
stream: TcpStream,
@@ -43,8 +43,7 @@ impl<O: 'static> IncomingConnection<O> {
4343

4444
/// Reads the linger duration for this socket by getting the `SO_LINGER` option.
4545
///
46-
/// For more information about this option, see
47-
/// [set_linger](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html#method.set_linger).
46+
/// For more information about this option, see [`set_linger`](crate::server::connection::IncomingConnection::set_linger).
4847
#[inline]
4948
pub fn linger(&self) -> std::io::Result<Option<Duration>> {
5049
self.stream.linger()
@@ -65,7 +64,7 @@ impl<O: 'static> IncomingConnection<O> {
6564
/// Gets the value of the `TCP_NODELAY` option on this socket.
6665
///
6766
/// For more information about this option, see
68-
/// [set_nodelay](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html#method.set_nodelay).
67+
/// [`set_nodelay`](#method.set_nodelay).
6968
#[inline]
7069
pub fn nodelay(&self) -> std::io::Result<bool> {
7170
self.stream.nodelay()
@@ -83,7 +82,7 @@ impl<O: 'static> IncomingConnection<O> {
8382
/// Gets the value of the `IP_TTL` option for this socket.
8483
///
8584
/// For more information about this option, see
86-
/// [set_ttl](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html#method.set_ttl).
85+
/// [`set_ttl`](#method.set_ttl).
8786
pub fn ttl(&self) -> std::io::Result<u32> {
8887
self.stream.ttl()
8988
}
@@ -96,10 +95,10 @@ impl<O: 'static> IncomingConnection<O> {
9695
}
9796

9897
/// Perform a SOCKS5 authentication handshake using the given
99-
/// [`AuthExecutor`](https://docs.rs/socks5-impl/latest/socks5_impl/server/auth/trait.AuthExecutor.html) adapter.
98+
/// [`AuthExecutor`](crate::server::auth::AuthExecutor) adapter.
10099
///
101-
/// If the handshake succeeds, an [`Authenticated`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html)
102-
/// alongs with the output of the [`AuthExecutor`](https://docs.rs/socks5-impl/latest/socks5_impl/server/auth/trait.AuthExecutor.html) adapter is returned.
100+
/// If the handshake succeeds, an [`Authenticated`]
101+
/// alongs with the output of the [`AuthExecutor`](crate::server::auth::AuthExecutor) adapter is returned.
103102
/// Otherwise, the error and the original [`TcpStream`](https://docs.rs/tokio/latest/tokio/net/struct.TcpStream.html) is returned.
104103
///
105104
/// Note that this method will not implicitly close the connection even if the handshake failed.
@@ -144,7 +143,7 @@ impl<O> From<IncomingConnection<O>> for TcpStream {
144143
/// A TCP stream that has been authenticated.
145144
///
146145
/// To get the command from the SOCKS5 client, use
147-
/// [`wait_request`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html#method.wait_request).
146+
/// [`wait_request`](crate::server::connection::Authenticated::wait_request).
148147
///
149148
/// It can also be converted back into a raw [`tokio::TcpStream`](https://docs.rs/tokio/latest/tokio/net/struct.TcpStream.html) with `From` trait.
150149
pub struct Authenticated(TcpStream);
@@ -157,8 +156,7 @@ impl Authenticated {
157156

158157
/// Waits the SOCKS5 client to send a request.
159158
///
160-
/// This method will return a [`Command`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/enum.Command.html)
161-
/// if the client sends a valid command.
159+
/// This method will return a [`Command`] if the client sends a valid command.
162160
///
163161
/// When encountering an error, the stream will be returned alongside the error.
164162
///
@@ -197,7 +195,7 @@ impl Authenticated {
197195
/// Reads the linger duration for this socket by getting the `SO_LINGER` option.
198196
///
199197
/// For more information about this option, see
200-
/// [set_linger](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html#method.set_linger).
198+
/// [`set_linger`](crate::server::connection::Authenticated::set_linger).
201199
#[inline]
202200
pub fn linger(&self) -> std::io::Result<Option<Duration>> {
203201
self.0.linger()
@@ -218,7 +216,7 @@ impl Authenticated {
218216
/// Gets the value of the `TCP_NODELAY` option on this socket.
219217
///
220218
/// For more information about this option, see
221-
/// [set_nodelay](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html#method.set_nodelay).
219+
/// [`set_nodelay`](crate::server::connection::Authenticated::set_nodelay).
222220
#[inline]
223221
pub fn nodelay(&self) -> std::io::Result<bool> {
224222
self.0.nodelay()
@@ -236,7 +234,7 @@ impl Authenticated {
236234
/// Gets the value of the `IP_TTL` option for this socket.
237235
///
238236
/// For more information about this option, see
239-
/// [set_ttl](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.Authenticated.html#method.set_ttl).
237+
/// [`set_ttl`](crate::server::connection::Authenticated::set_ttl).
240238
pub fn ttl(&self) -> std::io::Result<u32> {
241239
self.0.ttl()
242240
}

src/server/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub use crate::{
2222
/// The server can be constructed on a given socket address, or be created on an existing TcpListener.
2323
///
2424
/// The authentication method can be configured with the
25-
/// [`AuthExecutor`](https://docs.rs/socks5-impl/latest/socks5_impl/server/auth/trait.AuthExecutor.html) trait.
25+
/// [`AuthExecutor`] trait.
2626
pub struct Server<O> {
2727
listener: TcpListener,
2828
auth: AuthAdaptor<O>,
@@ -49,21 +49,21 @@ impl<O: 'static> Server<O> {
4949
Ok(Self::new(listener, auth))
5050
}
5151

52-
/// Accept an [`IncomingConnection`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html).
52+
/// Accept an [`IncomingConnection`].
5353
/// The connection may not be a valid socks5 connection. You need to call
54-
/// [`IncomingConnection::handshake()`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html#method.handshake)
54+
/// [`IncomingConnection::authenticate`](crate::server::connection::IncomingConnection::authenticate)
5555
/// to hand-shake it into a proper socks5 connection.
5656
#[inline]
5757
pub async fn accept(&self) -> std::io::Result<(IncomingConnection<O>, SocketAddr)> {
5858
let (stream, addr) = self.listener.accept().await?;
5959
Ok((IncomingConnection::new(stream, self.auth.clone()), addr))
6060
}
6161

62-
/// Polls to accept an [`IncomingConnection<O>`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html).
62+
/// Polls to accept an [`IncomingConnection<O>`](crate::server::connection::IncomingConnection).
6363
///
6464
/// The connection is only a freshly created TCP connection and may not be a valid SOCKS5 connection.
6565
/// You should call
66-
/// [`IncomingConnection::authenticate()`](https://docs.rs/socks5-impl/latest/socks5_impl/server/connection/struct.IncomingConnection.html#method.authenticate)
66+
/// [`IncomingConnection::authenticate`](crate::server::connection::IncomingConnection::authenticate)
6767
/// to perform a SOCKS5 authentication handshake.
6868
///
6969
/// If there is no connection to accept, Poll::Pending is returned and the current task will be notified by a waker.

0 commit comments

Comments
 (0)