Offical document said that erc can be used with socks lib, but I have tested these steps, it never works:
(require 'socks)
(setq
socks-server '("my proxy" "172.17.1.2" 1080 5)
socks-override-functions nil)
(setq erc-server-connect-function #'erc-open-socks-tls-stream)
And I also did some search and tried some other solutions, I got the same result.
Conclusion: it seems that erc can not be used with proxy, so I have to give up it.